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 d7575628d2..9d92865cba 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 @@ -2139,6 +2139,28 @@ QDF_STATUS policy_mgr_get_pcl_for_existing_conn( uint8_t *pcl_weight, uint32_t weight_len, bool all_matching_cxn_to_del); +/** + * policy_mgr_get_pcl_for_vdev_id() - Get PCL for 1 vdev + * @psoc: PSOC object information + * @mode: Connection mode of type 'policy_mgr_con_mode' + * @pcl_ch: Pointer to the PCL + * @len: Pointer to the length of the PCL + * @pcl_weight: Pointer to the weights of the PCL + * @weight_len: Max length of the weights list + * @vdev_id: vdev id to get PCL + * + * Get the PCL for a vdev, when vdev need move to another channel, need + * get PCL after remove the vdev from connection list. + * + * Return: None + */ +QDF_STATUS policy_mgr_get_pcl_for_vdev_id(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t *pcl_ch, uint32_t *len, + uint8_t *pcl_weight, + uint32_t weight_len, + uint8_t vdev_id); + /** * policy_mgr_get_valid_chan_weights() - Get the weightage for * all valid channels diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index c107ae2375..986dee6071 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -107,6 +107,46 @@ QDF_STATUS policy_mgr_get_pcl_for_existing_conn( return status; } +QDF_STATUS policy_mgr_get_pcl_for_vdev_id(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, + uint32_t *pcl_ch, uint32_t *len, + uint8_t *pcl_weight, + uint32_t weight_len, + uint8_t vdev_id) +{ + struct policy_mgr_conc_connection_info + info[MAX_NUMBER_OF_CONC_CONNECTIONS] = { {0} }; + uint8_t num_cxn_del = 0; + + QDF_STATUS status = QDF_STATUS_SUCCESS; + struct policy_mgr_psoc_priv_obj *pm_ctx; + + policy_mgr_debug("get pcl for existing conn:%d", mode); + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid Context"); + return QDF_STATUS_E_FAILURE; + } + *len = 0; + qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); + if (policy_mgr_mode_specific_connection_count(psoc, mode, NULL) > 0) { + /* Check, store and temp delete the mode's parameter */ + policy_mgr_store_and_del_conn_info_by_vdev_id(psoc, + vdev_id, + info, + &num_cxn_del); + /* Get the PCL */ + status = policy_mgr_get_pcl(psoc, mode, pcl_ch, len, + pcl_weight, weight_len); + policy_mgr_debug("Get PCL to FW for mode:%d", mode); + /* Restore the connection info */ + policy_mgr_restore_deleted_conn_info(psoc, info, num_cxn_del); + } + qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); + + return status; +} + void policy_mgr_decr_session_set_pcl(struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE mode, uint8_t session_id) diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 647ff0e077..de4abd4551 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -2894,10 +2894,13 @@ wlansap_get_safe_channel_from_pcl_and_acs_range(struct sap_context *sap_ctx) return wlansap_get_safe_channel(sap_ctx); } - status = policy_mgr_get_pcl_for_existing_conn( - mac->psoc, PM_SAP_MODE, pcl_freqs, &pcl_len, - pcl.weight_list, QDF_ARRAY_SIZE(pcl.weight_list), - false); + status = + policy_mgr_get_pcl_for_vdev_id(mac->psoc, PM_SAP_MODE, + pcl_freqs, &pcl_len, + pcl.weight_list, + QDF_ARRAY_SIZE(pcl.weight_list), + sap_ctx->sessionId); + if (QDF_IS_STATUS_ERROR(status)) { sap_err("Get PCL failed"); return INVALID_CHANNEL_ID;