qcacmn: Account for gaps in subchannels list

The radar affected subchannels list that is sent along with RCSA
was not built properly due to unreliable (contained 0s) subchannels
list provided by subchannel marking function.
The implementation used a single iterated loop to traverse through the
subchannel array elements, not counting 0s as possible inputs.

Search through each element of the list to find if the subchannel
is present and break if successful.

Change-Id: I5cd5ce7b6a334247c7d8733ee8433f957480c1dd
CRs-Fixed: 2364640
This commit is contained in:
Vignesh Mohan
2018-12-17 10:55:24 +05:30
کامیت شده توسط nshrivas
والد 30ed5c4456
کامیت 1e3cb514eb

مشاهده پرونده

@@ -577,7 +577,8 @@ static inline void dfs_reset_bangradar(struct wlan_dfs *dfs)
*/ */
static void dfs_prepare_nol_ie_bitmap(struct wlan_dfs *dfs, static void dfs_prepare_nol_ie_bitmap(struct wlan_dfs *dfs,
struct radar_found_info *radar_found, struct radar_found_info *radar_found,
uint8_t *in_sub_channels) uint8_t *in_sub_channels,
uint8_t n_in_sub_channels)
{ {
uint8_t cur_subchans[NUM_CHANNELS_160MHZ]; uint8_t cur_subchans[NUM_CHANNELS_160MHZ];
uint8_t n_cur_subchans; uint8_t n_cur_subchans;
@@ -592,17 +593,16 @@ static void dfs_prepare_nol_ie_bitmap(struct wlan_dfs *dfs,
dfs->dfs_nol_ie_startfreq = dfs->dfs_nol_ie_startfreq =
(uint16_t)utils_dfs_chan_to_freq(cur_subchans[0]); (uint16_t)utils_dfs_chan_to_freq(cur_subchans[0]);
/* To fill the bitmap, only one loop is required /* Search through the array list of radar affected subchannels
* since both the arrays (current channel's subchannel list * to find if the subchannel in our current channel has radar hit.
* and radar affected subchannels list) are sorted. * Break if found to reduce loop count.
* We're doing a sorted search, please change it to O(n^2)
* if the arrays ever become non sorted.
*/ */
for (i = 0, j = 0; i < n_cur_subchans; i++) { for (i = 0; i < n_cur_subchans; i++) {
if (cur_subchans[i] == in_sub_channels[j]) { for (j = 0; j < n_in_sub_channels; j++) {
j++; if (cur_subchans[i] == in_sub_channels[j]) {
dfs->dfs_nol_ie_bitmap |= bits; dfs->dfs_nol_ie_bitmap |= bits;
break;
}
} }
bits <<= 1; bits <<= 1;
} }
@@ -812,7 +812,8 @@ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs,
(dfs->dfs_is_rcsa_ie_sent = false) : (dfs->dfs_is_rcsa_ie_sent = false) :
(dfs->dfs_is_rcsa_ie_sent = true); (dfs->dfs_is_rcsa_ie_sent = true);
if (dfs->dfs_use_nol_subchannel_marking) { if (dfs->dfs_use_nol_subchannel_marking) {
dfs_prepare_nol_ie_bitmap(dfs, radar_found, channels); dfs_prepare_nol_ie_bitmap(dfs, radar_found, channels,
num_channels);
dfs->dfs_is_nol_ie_sent = true; dfs->dfs_is_nol_ie_sent = true;
} }
dfs_mlme_start_rcsa(dfs->dfs_pdev_obj, &wait_for_csa); dfs_mlme_start_rcsa(dfs->dfs_pdev_obj, &wait_for_csa);