Skip to content

Commit 62c57eb

Browse files
benzeajmberg-intel
authored andcommitted
wifi: cfg80211: add a flag for the first part of a scan
When there are no non-6 GHz channels, then the 6 GHz scan is the first part of a split scan. Add a boolean denoting whether the scan is the first part of a scan as it might be useful to drivers for internal bookkeeping. This flag is also set if the scan is not split. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20250609213231.07e5a8a452ec.Ibf18f513e507422078fb31b28947e582a20df87a@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 9844627 commit 62c57eb

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

include/net/cfg80211.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2754,7 +2754,10 @@ struct cfg80211_scan_6ghz_params {
27542754
* are 0 in the mask should be randomised, bits that are 1 should
27552755
* be taken from the @mac_addr
27562756
* @scan_6ghz: relevant for split scan request only,
2757-
* true if this is the second scan request
2757+
* true if this is a 6 GHz scan request
2758+
* @first_part: %true if this is the first part of a split scan request or a
2759+
* scan that was not split. May be %true for a @scan_6ghz scan if no other
2760+
* channels were requested
27582761
* @n_6ghz_params: number of 6 GHz params
27592762
* @scan_6ghz_params: 6 GHz params
27602763
* @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
@@ -2782,6 +2785,7 @@ struct cfg80211_scan_request {
27822785
unsigned long scan_start;
27832786
bool no_cck;
27842787
bool scan_6ghz;
2788+
bool first_part;
27852789
u32 n_6ghz_params;
27862790
struct cfg80211_scan_6ghz_params *scan_6ghz_params;
27872791
s8 tsf_report_link_id;

net/wireless/scan.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,8 @@ static bool cfg80211_find_ssid_match(struct cfg80211_colocated_ap *ap,
838838
return false;
839839
}
840840

841-
static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
841+
static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev,
842+
bool first_part)
842843
{
843844
u8 i;
844845
struct cfg80211_colocated_ap *ap;
@@ -850,6 +851,7 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
850851
size_t size, offs_ssids, offs_6ghz_params, offs_ies;
851852

852853
rdev_req->req.scan_6ghz = true;
854+
rdev_req->req.first_part = first_part;
853855

854856
if (!rdev->wiphy.bands[NL80211_BAND_6GHZ])
855857
return -EOPNOTSUPP;
@@ -1046,7 +1048,7 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
10461048
* If this scan follows a previous scan, save the scan start
10471049
* info from the first part of the scan
10481050
*/
1049-
if (old)
1051+
if (!first_part && !WARN_ON(!old))
10501052
rdev->int_scan_req->info = old->info;
10511053

10521054
err = rdev_scan(rdev, request);
@@ -1070,16 +1072,18 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev)
10701072
struct cfg80211_scan_request_int *rdev_req = rdev->scan_req;
10711073
u32 n_channels = 0, idx, i;
10721074

1073-
if (!(rdev->wiphy.flags & WIPHY_FLAG_SPLIT_SCAN_6GHZ))
1075+
if (!(rdev->wiphy.flags & WIPHY_FLAG_SPLIT_SCAN_6GHZ)) {
1076+
rdev_req->req.first_part = true;
10741077
return rdev_scan(rdev, rdev_req);
1078+
}
10751079

10761080
for (i = 0; i < rdev_req->req.n_channels; i++) {
10771081
if (rdev_req->req.channels[i]->band != NL80211_BAND_6GHZ)
10781082
n_channels++;
10791083
}
10801084

10811085
if (!n_channels)
1082-
return cfg80211_scan_6ghz(rdev);
1086+
return cfg80211_scan_6ghz(rdev, true);
10831087

10841088
request = kzalloc(struct_size(request, req.channels, n_channels),
10851089
GFP_KERNEL);
@@ -1096,6 +1100,7 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev)
10961100
}
10971101

10981102
rdev_req->req.scan_6ghz = false;
1103+
rdev_req->req.first_part = true;
10991104
rdev->int_scan_req = request;
11001105
return rdev_scan(rdev, request);
11011106
}
@@ -1128,7 +1133,7 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
11281133
if (wdev_running(wdev) &&
11291134
(rdev->wiphy.flags & WIPHY_FLAG_SPLIT_SCAN_6GHZ) &&
11301135
!rdev_req->req.scan_6ghz && !request->info.aborted &&
1131-
!cfg80211_scan_6ghz(rdev))
1136+
!cfg80211_scan_6ghz(rdev, false))
11321137
return;
11331138

11341139
/*

0 commit comments

Comments
 (0)