From d8ceb1609b7401030fc691c86e08905d8269b47c Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Sat, 19 Dec 2020 00:51:00 +0530 Subject: [PATCH] qcacmn: Copy flags also when the 6g channels are sorted Currently, 6g channels are sorted based on the weightage of each channel. Frequencies are sorted but the flags associated to each channel are not updated properly. So, channels carry invalid flags to firmware and firmware may miss to scan few 6g channels based on these flags and may scan few 6g channels unnecessarily. Copy flags also while sorting frequencies to maintain the flags of each channel as it is. Also, change the type of phymode to enum scan_phy_mode from uint32_t. Change-Id: I0a2330faab1b738f2d7eff3d39ccbfffd51dfde0 CRs-Fixed: 2840029 --- umac/scan/core/src/wlan_scan_manager_6ghz.c | 11 +++++++--- .../dispatcher/inc/wlan_scan_public_structs.h | 22 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/umac/scan/core/src/wlan_scan_manager_6ghz.c b/umac/scan/core/src/wlan_scan_manager_6ghz.c index 4af36bfb2cb4..d3a45823c6c3 100644 --- a/umac/scan/core/src/wlan_scan_manager_6ghz.c +++ b/umac/scan/core/src/wlan_scan_manager_6ghz.c @@ -66,7 +66,7 @@ scm_sort_6ghz_channel_list(struct wlan_objmgr_vdev *vdev, for (i = 0; i < chan_list->num_chan; i++) if (WLAN_REG_IS_6GHZ_CHAN_FREQ(chan_list->chan[i].freq)) - temp_list[j++].freq = chan_list->chan[i].freq; + temp_list[j++] = chan_list->chan[i]; tmp_list_count = j; scm_debug("Total 6ghz channels %d", tmp_list_count); @@ -88,6 +88,8 @@ scm_sort_6ghz_channel_list(struct wlan_objmgr_vdev *vdev, channel->saved_profile_count * SAVED_PROFILE_WEIGHTAGE; rnr_chan_info[j].weight = weight; rnr_chan_info[j].chan_freq = temp_list[i].freq; + rnr_chan_info[j].phymode = temp_list[i].phymode; + rnr_chan_info[j].flags = temp_list[i].flags; j++; /* * Log the info only if weight or bss_beacon_probe_count are @@ -119,8 +121,11 @@ scm_sort_6ghz_channel_list(struct wlan_objmgr_vdev *vdev, /* update the 6g list based on the weightage */ for (i = 0, j = 0; (i < NUM_CHANNELS && j < tmp_list_count); i++) - if (wlan_reg_is_6ghz_chan_freq(chan_list->chan[i].freq)) - chan_list->chan[i].freq = rnr_chan_info[j++].chan_freq; + if (wlan_reg_is_6ghz_chan_freq(chan_list->chan[i].freq)) { + chan_list->chan[i].freq = rnr_chan_info[j].chan_freq; + chan_list->chan[i].flags = rnr_chan_info[j].flags; + chan_list->chan[i].phymode = rnr_chan_info[j++].phymode; + } qdf_mem_free(rnr_chan_info); } diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h index fe32fceda537..2369902dde9a 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h +++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h @@ -692,22 +692,25 @@ struct probe_req_whitelist_attr { }; /** - * Set this flag for a 6g channel to scan it only if an RNR IE is found - * with that channel while scanning 2g/5g bands + * enum scan_flags: scan flags + * @FLAG_SCAN_ONLY_IF_RNR_FOUND: Set this flag for a 6g channel to scan it only + * if an RNR IE is found with that channel while scanning 2g/5g bands. */ -#define FLAG_SCAN_ONLY_IF_RNR_FOUND 0x1 +enum scan_flags { + FLAG_SCAN_ONLY_IF_RNR_FOUND = 0x1, +}; /** * struct chan_info - channel information * @freq: frequency to scan * @phymode: phymode in which @frequency should be scanned - * @flags: Flags to define channel property. Firmware can use this info for - * different operations, e.g.: scan + * @flags: Flags to define channel property as defined @enum scan_flags. + * Firmware can use this info for different operations, e.g.: scan */ struct chan_info { qdf_freq_t freq; - uint32_t phymode; - uint8_t flags; + enum scan_phy_mode phymode; + enum scan_flags flags; }; /** @@ -1384,9 +1387,14 @@ struct channel_list_db { * rnr_chan_weight - RNR channel weightage * @chan_freq: channel frequency * @weight: weightage of the channel + * @phymode: phymode in which @frequency should be scanned + * @flags: Flags to define channel property as defined @enum scan_flags. + * Firmware can use this info for different operations, e.g.: scan */ struct rnr_chan_weight { uint32_t chan_freq; uint32_t weight; + enum scan_phy_mode phymode; + enum scan_flags flags; }; #endif