From f826e1aebd4d299a49c05f312a9c84ac201fe2d0 Mon Sep 17 00:00:00 2001 From: Sheenam Monga Date: Mon, 8 Aug 2022 12:55:41 +0530 Subject: [PATCH] qcacmn: Avoid incrementing usable channel count for 0 freq Currently if both filters are added to get usable channels i.e FILTER_CELLULAR_COEX and FILTER_WLAN_CONCURRENCY (3) then all channels for required band are added first and then response is updated based on cellular coex filter and invalid and avoided channel frequencies are removed based on provided mode but for FILTER_WLAN_CONCURRENCY pcl list is added, if frequency is not present in response channel list and count is incremented. As invalid frequencies are already removed from response before concurrency check , so some pcl frequencies will not be present in the list and count may be updated more than valid count. Fix is to add frequencies based on concurrency filter first and then remove invalid frequencies based on celluar coex filter to avoid any invalid increment of channel list count. Change-Id: I72b13c9c1f1bdfe3616d44fe893ce306634b022e CRs-Fixed: 3262059 --- .../umac/regulatory/core/src/reg_services_common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c b/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c index 4678269ed294..7732e35b5ee4 100644 --- a/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c +++ b/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c @@ -3338,7 +3338,7 @@ reg_update_usable_chan_resp(struct wlan_objmgr_pdev *pdev, struct ch_params ch_params = {0}; int index = *count; - for (i = 0; i < len; i++) { + for (i = 0; i < len && index < NUM_CHANNELS; i++) { /* In case usable channels are required for multiple filter * mask, Some frequencies may present in res_msg . To avoid * frequency duplication, only mode mask is updated for @@ -3690,6 +3690,8 @@ reg_get_usable_channel_coex_filter(struct wlan_objmgr_pdev *pdev, chan_list[chan_enum].center_freq && freq_range.end_freq >= chan_list[chan_enum].center_freq) { + reg_debug("avoid freq %d", + chan_list[chan_enum].center_freq); reg_remove_freq(res_msg, chan_enum); } } @@ -3808,16 +3810,15 @@ wlan_reg_get_usable_channel(struct wlan_objmgr_pdev *pdev, } } - if (req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX) - status = - reg_get_usable_channel_coex_filter(pdev, req_msg, res_msg, - chan_list, usable_channels); - if (req_msg.filter_mask & 1 << FILTER_WLAN_CONCURRENCY) status = reg_get_usable_channel_con_filter(pdev, req_msg, res_msg, usable_channels); + if (req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX) + status = + reg_get_usable_channel_coex_filter(pdev, req_msg, res_msg, + chan_list, usable_channels); if (!(req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX) && !(req_msg.filter_mask & 1 << FILTER_WLAN_CONCURRENCY)) status =