Skip to content

Commit cbde0b4

Browse files
ilanpeer2jmberg-intel
authored andcommitted
wifi: mac80211: Extend support for scanning while MLO connected
- If the scan request includes a link ID, validate that it is one of the active links. Otherwise, if the scan request doesn't include a valid link ID, select one of the active links. - When reporting the TSF for a BSS entry, use the link ID information from the Rx status or the scan request to set the parent BSSID. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20231113112844.68564692c404.Iae9605cbb7f9d52e00ce98260b3559a34cf18341@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 6285ee3 commit cbde0b4

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

net/mac80211/scan.c

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,32 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
194194
if (scan_sdata && scan_sdata->vif.type == NL80211_IFTYPE_STATION &&
195195
scan_sdata->vif.cfg.assoc &&
196196
ieee80211_have_rx_timestamp(rx_status)) {
197-
bss_meta.parent_tsf =
198-
ieee80211_calculate_rx_timestamp(local, rx_status,
199-
len + FCS_LEN, 24);
200-
ether_addr_copy(bss_meta.parent_bssid,
201-
scan_sdata->vif.bss_conf.bssid);
197+
struct ieee80211_bss_conf *link_conf = NULL;
198+
199+
/* for an MLO connection, set the TSF data only in case we have
200+
* an indication on which of the links the frame was received
201+
*/
202+
if (ieee80211_vif_is_mld(&scan_sdata->vif)) {
203+
if (rx_status->link_valid) {
204+
s8 link_id = rx_status->link_id;
205+
206+
link_conf =
207+
rcu_dereference(scan_sdata->vif.link_conf[link_id]);
208+
}
209+
} else {
210+
link_conf = &scan_sdata->vif.bss_conf;
211+
}
212+
213+
if (link_conf) {
214+
bss_meta.parent_tsf =
215+
ieee80211_calculate_rx_timestamp(local,
216+
rx_status,
217+
len + FCS_LEN,
218+
24);
219+
220+
ether_addr_copy(bss_meta.parent_bssid,
221+
link_conf->bssid);
222+
}
202223
}
203224
rcu_read_unlock();
204225

@@ -666,6 +687,21 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
666687
if (local->scan_req)
667688
return -EBUSY;
668689

690+
/* For an MLO connection, if a link ID was specified, validate that it
691+
* is indeed active. If no link ID was specified, select one of the
692+
* active links.
693+
*/
694+
if (ieee80211_vif_is_mld(&sdata->vif)) {
695+
if (req->tsf_report_link_id >= 0) {
696+
if (!(sdata->vif.active_links &
697+
BIT(req->tsf_report_link_id)))
698+
return -EINVAL;
699+
} else {
700+
req->tsf_report_link_id =
701+
__ffs(sdata->vif.active_links);
702+
}
703+
}
704+
669705
if (!__ieee80211_can_leave_ch(sdata))
670706
return -EBUSY;
671707

@@ -714,6 +750,8 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
714750
local->hw_scan_req->req.duration = req->duration;
715751
local->hw_scan_req->req.duration_mandatory =
716752
req->duration_mandatory;
753+
local->hw_scan_req->req.tsf_report_link_id =
754+
req->tsf_report_link_id;
717755

718756
local->hw_scan_band = 0;
719757
local->hw_scan_req->req.n_6ghz_params = req->n_6ghz_params;

0 commit comments

Comments
 (0)