git: c272abc5c6a7 - main - LinuxKPI: 802.11: adjust the hw_scan channel list
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 15 Feb 2025 23:48:16 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c272abc5c6a72881f1252f069d79990201559d1a commit c272abc5c6a72881f1252f069d79990201559d1a Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2025-02-12 23:26:24 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2025-02-15 23:22:39 +0000 LinuxKPI: 802.11: adjust the hw_scan channel list Until net80211 will grow proper scan offload with the various options needed and will allow switching the scan engine try to improve the situation if we are doing a hw_scan and the device supports SINGLE_SCAN_ON_ALL_BANDS. In that case create the channel list from our device information of supported channels rather than from the net80211 scan list. Filter out currently unsupported bands. While the general "scan EBUSY" problem remains at least in my local testing I am seeing a lot more 2 and 5 GHz band results rather than being stuck on a single band (as was also often the case with iwm for me in the past). Tested by: rene (previous version) MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 61 +++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 9d601050ba69..8c1b9d73ab56 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2020-2024 The FreeBSD Foundation - * Copyright (c) 2020-2024 Bjoern A. Zeeb + * Copyright (c) 2020-2025 Bjoern A. Zeeb * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -3267,7 +3267,6 @@ sw_scan: /* XXX want to adjust ss end time/ maxdwell? */ } else { - struct ieee80211_channel *c; struct ieee80211_scan_request *hw_req; struct linuxkpi_ieee80211_channel *lc, **cpp; struct cfg80211_ssid *ssids; @@ -3284,14 +3283,31 @@ sw_scan: band_mask = 0; nchan = 0; - for (i = ss->ss_next; i < ss->ss_last; i++) { - nchan++; - band = lkpi_net80211_chan_to_nl80211_band( - ss->ss_chans[ss->ss_next + i]); - band_mask |= (1 << band); - } - - if (!ieee80211_hw_check(hw, SINGLE_SCAN_ON_ALL_BANDS)) { + if (ieee80211_hw_check(hw, SINGLE_SCAN_ON_ALL_BANDS)) { +#if 0 /* Avoid net80211 scan lists until it has proper scan offload support. */ + for (i = ss->ss_next; i < ss->ss_last; i++) { + nchan++; + band = lkpi_net80211_chan_to_nl80211_band( + ss->ss_chans[ss->ss_next + i]); + band_mask |= (1 << band); + } +#else + /* Instead we scan for all channels all the time. */ + for (band = 0; band < NUM_NL80211_BANDS; band++) { + switch (band) { + case NL80211_BAND_2GHZ: + case NL80211_BAND_5GHZ: + break; + default: + continue; + } + if (hw->wiphy->bands[band] != NULL) { + nchan += hw->wiphy->bands[band]->n_channels; + band_mask |= (1 << band); + } + } +#endif + } else { IMPROVE("individual band scans not yet supported, only scanning first band"); /* In theory net80211 should drive this. */ /* Probably we need to add local logic for now; @@ -3345,9 +3361,11 @@ sw_scan: *(cpp + i) = (struct linuxkpi_ieee80211_channel *)(lc + i); } +#if 0 /* Avoid net80211 scan lists until it has proper scan offload support. */ for (i = 0; i < nchan; i++) { - c = ss->ss_chans[ss->ss_next + i]; + struct ieee80211_channel *c; + c = ss->ss_chans[ss->ss_next + i]; lc->hw_value = c->ic_ieee; lc->center_freq = c->ic_freq; /* XXX */ /* lc->flags */ @@ -3356,6 +3374,27 @@ sw_scan: /* lc-> ... */ lc++; } +#else + for (band = 0; band < NUM_NL80211_BANDS; band++) { + struct ieee80211_supported_band *supband; + struct linuxkpi_ieee80211_channel *channels; + + /* Band disabled for scanning? */ + if ((band_mask & (1 << band)) == 0) + continue; + + /* Nothing to scan in band? */ + supband = hw->wiphy->bands[band]; + if (supband == NULL || supband->n_channels == 0) + continue; + + channels = supband->channels; + for (i = 0; i < supband->n_channels; i++) { + *lc = channels[i]; + lc++; + } + } +#endif hw_req->req.n_ssids = ssid_count; if (hw_req->req.n_ssids > 0) {