wcn36xx: Enable hardware scan offload for 5Ghz band
authorLoic Poulain <loic.poulain@linaro.org>
Mon, 18 Oct 2021 10:57:58 +0000 (12:57 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 27 Oct 2021 07:41:44 +0000 (10:41 +0300)
Until now, offload scanning for 5Ghz channels was considered broken.
However it was mostly a driver issue, caused by bad reporting of the
beacons/probe-resp bands and frequencies, which has been fixed.

We can now allow offload scan for 5GHz band, this reduces the scanning
time comparing to software driven scanning.

Note that offloaded scan is limited to 48 channels, check for this.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1634554678-7993-2-git-send-email-loic.poulain@linaro.org
drivers/net/wireless/ath/wcn36xx/main.c

index 263af65..2ac8efa 100644 (file)
@@ -659,19 +659,19 @@ static int wcn36xx_hw_scan(struct ieee80211_hw *hw,
                           struct ieee80211_scan_request *hw_req)
 {
        struct wcn36xx *wcn = hw->priv;
-       int i;
 
        if (!get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) {
                /* fallback to mac80211 software scan */
                return 1;
        }
 
-       /* For unknown reason, the hardware offloaded scan only works with
-        * 2.4Ghz channels, fallback to software scan in other cases.
+       /* Firmware scan offload is limited to 48 channels, fallback to
+        * software driven scanning otherwise.
         */
-       for (i = 0; i < hw_req->req.n_channels; i++) {
-               if (hw_req->req.channels[i]->band != NL80211_BAND_2GHZ)
-                       return 1;
+       if (hw_req->req.n_channels > 48) {
+               wcn36xx_warn("Offload scan aborted, n_channels=%u",
+                            hw_req->req.n_channels);
+               return 1;
        }
 
        mutex_lock(&wcn->scan_lock);