From 8104687665aa7f07d7020b0ce4df2a364de7b246 Mon Sep 17 00:00:00 2001 From: abhinav kumar Date: Fri, 25 Mar 2022 11:04:57 +0530 Subject: [PATCH] qcacld-3.0: Allow roaming to configured roaming band only Here upper layer configures roam band via the SETROAMBAND NCHO command. This means DUT should be restricted to roam to the configured band only but as per current PCL filtration logic, DUT is allowed to roam beyond the configured band AP also. Roam Band definition is: 0: auto (all supported bands) 1: 2.4 only 2: 5 only 3: 2.4 + 5 4: 6 only 5: 2.4 + 6 6: 5 + 6 7: 2.4 + 5 + 6 Fix is to update the PCL filtration logic in wma_send_set_pcl_cmd and make sure DUT doesn't roam beyond the configured band AP. Change-Id: Ia2353e8ff982609a4ab5a35715886648f140cd22 CRs-Fixed: 3158456 --- core/wma/src/wma_main.c | 82 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 94c2b7787f..69dafbc8ec 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -9184,33 +9184,99 @@ QDF_STATUS wma_send_set_pcl_cmd(tp_wma_handle wma_handle, } msg->chan_weights.saved_num_chan = wma_handle->saved_chan.num_channels; + status = policy_mgr_get_valid_chan_weights(wma_handle->psoc, (struct policy_mgr_pcl_chan_weights *)&msg->chan_weights, PM_STA_MODE, NULL); + if (QDF_IS_STATUS_ERROR(status)) { + wma_err("Error in creating weighed pcl"); + return status; + } for (i = 0; i < msg->chan_weights.saved_num_chan; i++) { msg->chan_weights.weighed_valid_list[i] = wma_map_pcl_weights( msg->chan_weights.weighed_valid_list[i]); - /* Dont allow roaming on 2G when 5G_ONLY configured */ + + if (msg->band_mask == + (BIT(REG_BAND_2G) | BIT(REG_BAND_5G) | BIT(REG_BAND_6G))) + continue; + + /* + * Dont allow roaming on 5G/6G band if only 2G band configured + * as supported roam band mask + */ + if (((wma_handle->bandcapability == BAND_2G) || + (msg->band_mask == BIT(REG_BAND_2G))) && + !WLAN_REG_IS_24GHZ_CH_FREQ( + msg->chan_weights.saved_chan_list[i])) { + msg->chan_weights.weighed_valid_list[i] = + WEIGHT_OF_DISALLOWED_CHANNELS; + continue; + } + + /* + * Dont allow roaming on 2G/6G band if only 5G band configured + * as supported roam band mask + */ if (((wma_handle->bandcapability == BAND_5G) || (msg->band_mask == BIT(REG_BAND_5G))) && + !WLAN_REG_IS_5GHZ_CH_FREQ( + msg->chan_weights.saved_chan_list[i])) { + msg->chan_weights.weighed_valid_list[i] = + WEIGHT_OF_DISALLOWED_CHANNELS; + continue; + } + + /* + * Dont allow roaming on 2G/5G band if only 6G band configured + * as supported roam band mask + */ + if (msg->band_mask == BIT(REG_BAND_6G) && + !WLAN_REG_IS_6GHZ_CHAN_FREQ( + msg->chan_weights.saved_chan_list[i])) { + msg->chan_weights.weighed_valid_list[i] = + WEIGHT_OF_DISALLOWED_CHANNELS; + continue; + } + + /* + * Dont allow roaming on 6G band if only 2G + 5G band configured + * as supported roam band mask. + */ + if (msg->band_mask == (BIT(REG_BAND_2G) | BIT(REG_BAND_5G)) && + (WLAN_REG_IS_6GHZ_CHAN_FREQ( + msg->chan_weights.saved_chan_list[i]))) { + msg->chan_weights.weighed_valid_list[i] = + WEIGHT_OF_DISALLOWED_CHANNELS; + continue; + } + + /* + * Dont allow roaming on 2G band if only 5G + 6G band configured + * as supported roam band mask. + */ + if (msg->band_mask == (BIT(REG_BAND_5G) | BIT(REG_BAND_6G)) && (WLAN_REG_IS_24GHZ_CH_FREQ( msg->chan_weights.saved_chan_list[i]))) { msg->chan_weights.weighed_valid_list[i] = WEIGHT_OF_DISALLOWED_CHANNELS; + continue; } - if (msg->band_mask == BIT(REG_BAND_2G) && - !WLAN_REG_IS_24GHZ_CH_FREQ( - msg->chan_weights.saved_chan_list[i])) + + /* + * Dont allow roaming on 5G band if only 2G + 6G band configured + * as supported roam band mask. + */ + if (msg->band_mask == (BIT(REG_BAND_2G) | BIT(REG_BAND_6G)) && + (WLAN_REG_IS_5GHZ_CH_FREQ( + msg->chan_weights.saved_chan_list[i]))) { msg->chan_weights.weighed_valid_list[i] = WEIGHT_OF_DISALLOWED_CHANNELS; + continue; + } } - if (!QDF_IS_STATUS_SUCCESS(status)) { - wma_err("Error in creating weighed pcl"); - return status; - } wma_debug("RSO_CFG: Dump PDEV PCL weights for vdev[%d]", msg->vdev_id); policy_mgr_dump_channel_list(msg->chan_weights.saved_num_chan, msg->chan_weights.saved_chan_list,