wifi: cfg80211: move regulatory_hint_found_beacon to be earlier
authorBenjamin Berg <benjamin.berg@intel.com>
Fri, 16 Jun 2023 06:53:58 +0000 (09:53 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 19 Jun 2023 10:05:28 +0000 (12:05 +0200)
These calls do not require any locking, so move them in preparation for
the next patches.

A minor change/bugfix is to not hint a beacon for nontransmitted BSSes

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.a5bf3558eae9.I33c7465d983c8bef19deb7a533ee475a16f91774@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/scan.c

index ce2104d..19e7014 100644 (file)
@@ -1971,6 +1971,18 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
                tmp.pub.max_bssid_indicator = non_tx_data->max_bssid_indicator;
        } else {
                ts = jiffies;
                tmp.pub.max_bssid_indicator = non_tx_data->max_bssid_indicator;
        } else {
                ts = jiffies;
+
+               if (channel->band == NL80211_BAND_60GHZ) {
+                       bss_type = capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
+                       if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP ||
+                           bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS)
+                               regulatory_hint_found_beacon(wiphy, channel,
+                                                            gfp);
+               } else {
+                       if (capability & WLAN_CAPABILITY_ESS)
+                               regulatory_hint_found_beacon(wiphy, channel,
+                                                            gfp);
+               }
        }
 
        /*
        }
 
        /*
@@ -2007,16 +2019,6 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
        if (!res)
                return NULL;
 
        if (!res)
                return NULL;
 
-       if (channel->band == NL80211_BAND_60GHZ) {
-               bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
-               if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP ||
-                   bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS)
-                       regulatory_hint_found_beacon(wiphy, channel, gfp);
-       } else {
-               if (res->pub.capability & WLAN_CAPABILITY_ESS)
-                       regulatory_hint_found_beacon(wiphy, channel, gfp);
-       }
-
        if (non_tx_data) {
                /* this is a nontransmitting bss, we need to add it to
                 * transmitting bss' list if it is not there
        if (non_tx_data) {
                /* this is a nontransmitting bss, we need to add it to
                 * transmitting bss' list if it is not there
@@ -2445,6 +2447,16 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy,
                capability = le16_to_cpu(mgmt->u.probe_resp.capab_info);
        }
 
                capability = le16_to_cpu(mgmt->u.probe_resp.capab_info);
        }
 
+       if (channel->band == NL80211_BAND_60GHZ) {
+               bss_type = capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
+               if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP ||
+                   bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS)
+                       regulatory_hint_found_beacon(wiphy, channel, gfp);
+       } else {
+               if (capability & WLAN_CAPABILITY_ESS)
+                       regulatory_hint_found_beacon(wiphy, channel, gfp);
+       }
+
        ies = kzalloc(sizeof(*ies) + ielen, gfp);
        if (!ies)
                return NULL;
        ies = kzalloc(sizeof(*ies) + ielen, gfp);
        if (!ies)
                return NULL;
@@ -2478,16 +2490,6 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy,
        if (!res)
                return NULL;
 
        if (!res)
                return NULL;
 
-       if (channel->band == NL80211_BAND_60GHZ) {
-               bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK;
-               if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP ||
-                   bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS)
-                       regulatory_hint_found_beacon(wiphy, channel, gfp);
-       } else {
-               if (res->pub.capability & WLAN_CAPABILITY_ESS)
-                       regulatory_hint_found_beacon(wiphy, channel, gfp);
-       }
-
        trace_cfg80211_return_bss(&res->pub);
        /* cfg80211_bss_update gives us a referenced result */
        return &res->pub;
        trace_cfg80211_return_bss(&res->pub);
        /* cfg80211_bss_update gives us a referenced result */
        return &res->pub;