From: Arend van Spriel <[email protected]>

Fill the gscan capability information in the wiphy structure if
it is supported by firmware. The values are hardcoded as it can
not be obtained from firmware.

Reviewed-by: Hante Meuleman <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
 .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c    | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 7ffc4ab..374b72c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -207,6 +207,16 @@ static bool check_vif_up(struct brcmf_cfg80211_vif *vif)
                REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), }
 };

+static const struct wiphy_gscan_caps brcmf_gscan_caps = {
+       .max_scan_cache_size = 320,
+       .max_scan_buckets = 8,
+       .max_ap_cache_per_scan = 32,
+       .max_rssi_sample_size = 8,
+       .max_scan_reporting_threshold = 100,
+       .max_hotlist_bssids = 64,
+       .max_significant_wifi_change_aps = 16,
+};
+
 /* Note: brcmf_cipher_suites is an array of int defining which cipher suites
  * are supported. A pointer to this array and the number of entries is passed
  * on to upper layers. AES_CMAC defines whether or not the driver supports MFP.
@@ -6426,7 +6436,12 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct 
brcmf_if *ifp)
        wiphy->max_remain_on_channel_duration = 5000;
        if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO))
                brcmf_wiphy_pno_params(wiphy);
-
+       if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_GSCAN)) {
+               wiphy->gscan = kmemdup(&brcmf_gscan_caps,
+                                      sizeof(brcmf_gscan_caps), GFP_KERNEL);
+               if (!wiphy->gscan)
+                       return -ENOMEM;
+       }
        /* vendor commands/events support */
        wiphy->vendor_commands = brcmf_vendor_cmds;
        wiphy->n_vendor_commands = BRCMF_VNDR_CMDS_LAST - 1;
@@ -6735,6 +6750,7 @@ static void brcmf_free_wiphy(struct wiphy *wiphy)
        if (!wiphy)
                return;

+       kfree(wiphy->gscan);
        if (wiphy->iface_combinations) {
                for (i = 0; i < wiphy->n_iface_combinations; i++)
                        kfree(wiphy->iface_combinations[i].limits);
--
1.9.1

Reply via email to