The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=196cfd0b2eb640a63d007a7e9c3a74e4256255f3

commit 196cfd0b2eb640a63d007a7e9c3a74e4256255f3
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2022-03-24 17:49:59 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2022-03-24 18:00:54 +0000

    LinuxKPI: 802.11: improve hw_scan fallback to sw_scan
    
    Extending what was started in d3ef7fb459ff924911e5276db0c04b13cd8074d9,
    when a driver signals that hw_scan is not possible and expects a sw_scan
    to be preformed we triggered a sw_scan towards the driver but did not
    let net80211 know.
    Cancel the initial scan towards net80211.  If we we defer to sw_scan
    then clear IEEE80211_FEXT_SCAN_OFFLOAD so net80211 will send probe
    requests, and actively start a new scan with net80211.
    This may have to be further refined in the future but seems to work
    for the moment.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c 
b/sys/compat/linuxkpi/common/src/linux_80211.c
index 727c0e276af9..384d068d7920 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -2547,17 +2547,27 @@ sw_scan:
                        free(hw_req, M_LKPI80211);
                        lhw->hw_req = NULL;
 
+                       ieee80211_cancel_scan(vap);
                        /*
                         * XXX-SIGH magic number.
                         * rtw88 has a magic "return 1" if offloading scan is
                         * not possible.  Fall back to sw scan in that case.
                         */
-                       if (error == 1)
+                       if (error == 1) {
+                               vap->iv_flags_ext &= 
~IEEE80211_FEXT_SCAN_OFFLOAD;
+                               ieee80211_start_scan(vap,
+                                   IEEE80211_SCAN_ACTIVE |
+                                   IEEE80211_SCAN_NOPICK |
+                                   IEEE80211_SCAN_ONCE,
+                                   IEEE80211_SCAN_FOREVER,
+                                   ss->ss_mindwell ? ss->ss_mindwell : 
msecs_to_ticks(20),
+                                   ss->ss_maxdwell ? ss->ss_maxdwell : 
msecs_to_ticks(200),
+                                   vap->iv_des_nssid, vap->iv_des_ssid);
                                goto sw_scan;
+                       }
 
                        ic_printf(ic, "ERROR: %s: hw_scan returned %d\n",
                            __func__, error);
-                       ieee80211_cancel_scan(vap);
                }
        }
 }

Reply via email to