From ad7bf16e251e3630c556de868eb187389e01b78c Mon Sep 17 00:00:00 2001 From: Asutosh Mohapatra Date: Thu, 23 Mar 2023 23:26:47 -0700 Subject: [PATCH] qcacld-3.0: Set roam pcl after computing pdev current channel list Currently roam pcl is updated after roam, connection and CSA. Pdev current channel list is updated for many other scenarios, but roam pcl is not modified accordingly. To address this issue, update roam pcl every time after computing pdev current channel list. Change-Id: Ie86d5592255419de8f4040a3206d275ef926cf03 CRs-Fixed: 3481026 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 8 ++-- .../policy_mgr/src/wlan_policy_mgr_core.c | 41 ++++++++----------- core/sme/src/csr/csr_api_roam.c | 35 ++++++++++++++++ 3 files changed, 56 insertions(+), 28 deletions(-) diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 36a80fccef..c33b3b13f1 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -4033,18 +4033,18 @@ void policy_mgr_check_and_stop_opportunistic_timer( struct wlan_objmgr_psoc *psoc, uint8_t id); /** - * policy_mgr_set_weight_of_dfs_passive_channels_to_zero() - set weight of dfs - * and passive channels to 0 + * policy_mgr_set_weight_of_disabled_inactive_channels_to_zero() - set weight + * of disabled and inactive channels to 0 * @psoc: pointer to soc * @pcl: preferred channel freq list * @len: length of preferred channel list * @weight_list: preferred channel weight list * @weight_len: length of weight list - * This function set the weight of dfs and passive channels to 0 + * This function set the weight of disabled and inactive channels to 0 * * Return: None */ -void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( +void policy_mgr_set_weight_of_disabled_inactive_channels_to_zero( struct wlan_objmgr_psoc *psoc, uint32_t *pcl, uint32_t *len, uint8_t *weight_list, uint32_t weight_len); /** diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c index a90cbf293f..7851ce5b9c 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c @@ -2789,25 +2789,23 @@ policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, } /** - * policy_mgr_set_weight_of_dfs_passive_channels_to_zero() - set weight of dfs - * and passive channels to 0 + * policy_mgr_set_weight_of_disabled_inactive_channels_to_zero() - set weight + * of disabled and inactive channels to 0 * @psoc: pointer to soc - * @pcl_channels: preferred channel list + * @pcl_channels: preferred channel freq list * @len: length of preferred channel list * @weight_list: preferred channel weight list * @weight_len: length of weight list - * This function set the weight of dfs and passive channels to 0 + * This function set the weight of disabled and inactive channels to 0 * * Return: None */ -void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( +void policy_mgr_set_weight_of_disabled_inactive_channels_to_zero( struct wlan_objmgr_psoc *psoc, uint32_t *pcl_channels, uint32_t *len, uint8_t *weight_list, uint32_t weight_len) { uint8_t i; uint32_t orig_channel_count = 0; - bool sta_sap_scc_on_dfs_chan; - uint32_t sap_count; enum channel_state channel_state; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -2817,16 +2815,6 @@ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( return; } - sta_sap_scc_on_dfs_chan = - policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc); - sap_count = policy_mgr_mode_specific_connection_count(psoc, - PM_SAP_MODE, NULL); - policy_mgr_debug("sta_sap_scc_on_dfs_chan %u, sap_count %u", - sta_sap_scc_on_dfs_chan, sap_count); - - if (!sta_sap_scc_on_dfs_chan || !sap_count) - return; - if (len) orig_channel_count = QDF_MIN(*len, NUM_CHANNELS); else { @@ -2834,16 +2822,20 @@ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( return; } - policy_mgr_debug("Set weight of DFS/passive channels to 0"); + policy_mgr_debug("Set weight of disabled, inactive channels to 0"); for (i = 0; i < orig_channel_count; i++) { - channel_state = wlan_reg_get_channel_state_for_pwrmode( + if (wlan_reg_is_6ghz_chan_freq(pcl_channels[i]) && + !wlan_reg_is_6ghz_band_set(pm_ctx->pdev)) { + weight_list[i] = 0; + } else { + channel_state = wlan_reg_get_channel_state_for_pwrmode( pm_ctx->pdev, pcl_channels[i], REG_CURRENT_PWR_MODE); - if ((channel_state == CHANNEL_STATE_DISABLE) || - (channel_state == CHANNEL_STATE_INVALID)) - /* Set weight of inactive channels to 0 */ - weight_list[i] = 0; + if (channel_state == CHANNEL_STATE_DISABLE || + channel_state == CHANNEL_STATE_INVALID) + weight_list[i] = 0; + } } return; @@ -3700,8 +3692,9 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, policy_mgr_debug("pcl len %d and weight list sz %d", *len, pcl_sz); - policy_mgr_set_weight_of_dfs_passive_channels_to_zero(psoc, + policy_mgr_set_weight_of_disabled_inactive_channels_to_zero(psoc, pcl_channels, len, pcl_weights, pcl_sz); + end: qdf_mem_free(channel_list); qdf_mem_free(channel_list_24); diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 32bd6224bc..b0840d6d93 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -924,6 +924,40 @@ static void csr_scan_event_handler(struct wlan_objmgr_vdev *vdev, sme_release_global_lock(&mac->sme); } +/** + * csr_update_roam_pcl_per_connected_sta_vdev() - Update roam pcl per connected + * STA + * @psoc: pointer to psoc object + * + * Return: None + */ +static void csr_update_roam_pcl_per_connected_sta_vdev( + struct wlan_objmgr_psoc *psoc) +{ + struct wlan_objmgr_vdev *vdev; + uint32_t vdev_id; + + for (vdev_id = 0; vdev_id < WLAN_UMAC_PSOC_MAX_VDEVS; vdev_id++) { + vdev = + wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, + WLAN_LEGACY_SME_ID); + + if (!vdev) + continue; + + if (vdev->vdev_mlme.vdev_opmode != QDF_STA_MODE) + goto next; + + if (!wlan_cm_is_vdev_connected(vdev)) + goto next; + + policy_mgr_set_pcl_for_existing_combo(psoc, PM_STA_MODE, + vdev_id); +next: + wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID); + } +} + QDF_STATUS csr_update_channel_list(struct mac_context *mac) { tSirUpdateChanList *pChanList; @@ -1140,6 +1174,7 @@ QDF_STATUS csr_update_channel_list(struct mac_context *mac) return QDF_STATUS_E_FAILURE; } + csr_update_roam_pcl_per_connected_sta_vdev(mac->psoc); return QDF_STATUS_SUCCESS; }