wifi: ath12k: change to use dynamic memory for channel list of scan
authorWen Gong <quic_wgong@quicinc.com>
Mon, 17 Jul 2023 03:34:31 +0000 (23:34 -0400)
committerKalle Valo <quic_kvalo@quicinc.com>
Wed, 2 Aug 2023 17:00:59 +0000 (20:00 +0300)
Currently there are about 60 channels for 6 GHz, then the size of
chan_list in struct scan_req_params which is 40 is not enough to
fill all the channel list of 6 GHz.

Use dynamic memory to save the channel list of scan.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230717033431.21983-1-quic_wgong@quicinc.com
drivers/net/wireless/ath/ath12k/mac.c
drivers/net/wireless/ath/ath12k/wmi.h

index 13f477eb4707fd7d998431957cbc5d7c9a3b4f01..4fa565a115e34e3c041aad7abecb13587111d1a9 100644 (file)
@@ -2773,6 +2773,14 @@ static int ath12k_mac_op_hw_scan(struct ieee80211_hw *hw,
 
        if (req->n_channels) {
                arg.num_chan = req->n_channels;
+               arg.chan_list = kcalloc(arg.num_chan, sizeof(*arg.chan_list),
+                                       GFP_KERNEL);
+
+               if (!arg.chan_list) {
+                       ret = -ENOMEM;
+                       goto exit;
+               }
+
                for (i = 0; i < arg.num_chan; i++)
                        arg.chan_list[i] = req->channels[i]->center_freq;
        }
@@ -2791,6 +2799,8 @@ static int ath12k_mac_op_hw_scan(struct ieee80211_hw *hw,
                                                      ATH12K_MAC_SCAN_TIMEOUT_MSECS));
 
 exit:
+       kfree(arg.chan_list);
+
        if (req->ie_len)
                kfree(arg.extraie.ptr);
 
index d89c12bfb009f37013c7198f40a70a04e024a915..9b8ba870490471e973c36d6cc7db19e926f03d9e 100644 (file)
@@ -3034,7 +3034,6 @@ enum scan_dwelltime_adaptive_mode {
 
 #define WLAN_SCAN_MAX_NUM_SSID          10
 #define WLAN_SCAN_MAX_NUM_BSSID         10
-#define WLAN_SCAN_MAX_NUM_CHANNELS      40
 
 struct ath12k_wmi_element_info_arg {
        u32 len;
@@ -3243,7 +3242,7 @@ struct ath12k_wmi_scan_req_arg {
        u32 num_bssid;
        u32 num_ssids;
        u32 n_probes;
-       u32 chan_list[WLAN_SCAN_MAX_NUM_CHANNELS];
+       u32 *chan_list;
        u32 notify_scan_events;
        struct cfg80211_ssid ssid[WLAN_SCAN_MAX_NUM_SSID];
        struct ath12k_wmi_mac_addr_params bssid_list[WLAN_SCAN_MAX_NUM_BSSID];