From dcd3e2a6245110cf7be6489236d85916f6e84d30 Mon Sep 17 00:00:00 2001 From: nakul kachhwaha Date: Thu, 16 Jul 2020 16:31:31 +0530 Subject: [PATCH] qcacld-3.0: Add weightage to valid non-pcl channels In scenarios where p2p is going to be the first connection, while performing group negotiation, pass up the allowed non-pcl channels with valid weight so that supplicant can include these channels as well during negotiation. Passing interface mode to policy_mgr_get_valid_chan_weights and populating the channel list based on policy_mgr_is_concurrency_allowed api for the given mode and assign WEIGHT_OF_NON_PCL_CHANNELS for all allowed channels. Change-Id: I8ff08163e6490642f9c2ebd9ca08f1275a2bb1b8 CRs-Fixed: 2734756 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 4 +++- .../policy_mgr/src/wlan_policy_mgr_pcl.c | 21 ++++++++++++------- .../dispatcher/src/wlan_cm_tgt_if_tx_api.c | 3 ++- core/hdd/src/wlan_hdd_cfg80211.c | 3 ++- core/wma/src/wma_main.c | 3 ++- 5 files changed, 23 insertions(+), 11 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 9c3ada4be1f1..e73af4b011bd 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 @@ -2099,6 +2099,7 @@ QDF_STATUS policy_mgr_get_pcl_for_existing_conn( * @psoc: PSOC object information * @weight: Pointer to the structure containing pcl, saved channel list and * weighed channel list + * @mode: Policy manager connection mode * * Provides the weightage for all valid channels. This compares the PCL list * with the valid channel list. The channels present in the PCL get their @@ -2108,7 +2109,8 @@ QDF_STATUS policy_mgr_get_pcl_for_existing_conn( * Return: QDF_STATUS */ QDF_STATUS policy_mgr_get_valid_chan_weights(struct wlan_objmgr_psoc *psoc, - struct policy_mgr_pcl_chan_weights *weight); + struct policy_mgr_pcl_chan_weights *weight, + enum policy_mgr_con_mode mode); /** * policy_mgr_set_hw_mode_on_channel_switch() - Set hw mode 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 bb868d7e75f8..27a1ddacddf3 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 @@ -2376,7 +2376,8 @@ QDF_STATUS policy_mgr_get_sap_mandatory_channel(struct wlan_objmgr_psoc *psoc, } QDF_STATUS policy_mgr_get_valid_chan_weights(struct wlan_objmgr_psoc *psoc, - struct policy_mgr_pcl_chan_weights *weight) + struct policy_mgr_pcl_chan_weights *weight, + enum policy_mgr_con_mode mode) { uint32_t i, j; struct policy_mgr_conc_connection_info @@ -2393,16 +2394,20 @@ QDF_STATUS policy_mgr_get_valid_chan_weights(struct wlan_objmgr_psoc *psoc, qdf_mem_set(weight->weighed_valid_list, NUM_CHANNELS, WEIGHT_OF_DISALLOWED_CHANNELS); qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); - if (policy_mgr_mode_specific_connection_count( - psoc, PM_STA_MODE, NULL) > 0) { + if ((mode == PM_P2P_GO_MODE || mode == PM_P2P_CLIENT_MODE) || + (mode == PM_STA_MODE && + policy_mgr_mode_specific_connection_count(psoc, PM_STA_MODE, + NULL) > 0)) { /* * Store the STA mode's parameter and temporarily delete it * from the concurrency table. This way the allow concurrency * check can be used as though a new connection is coming up, * allowing to detect the disallowed channels. */ - policy_mgr_store_and_del_conn_info(psoc, PM_STA_MODE, false, - info, &num_cxn_del); + if (mode == PM_STA_MODE) + policy_mgr_store_and_del_conn_info(psoc, mode, + false, info, + &num_cxn_del); /* * There is a small window between releasing the above lock * and acquiring the same in policy_mgr_allow_concurrency, @@ -2410,14 +2415,16 @@ QDF_STATUS policy_mgr_get_valid_chan_weights(struct wlan_objmgr_psoc *psoc, */ for (i = 0; i < weight->saved_num_chan; i++) { if (policy_mgr_is_concurrency_allowed - (psoc, PM_STA_MODE, weight->saved_chan_list[i], + (psoc, mode, weight->saved_chan_list[i], HW_MODE_20_MHZ)) { weight->weighed_valid_list[i] = WEIGHT_OF_NON_PCL_CHANNELS; } } /* Restore the connection info */ - policy_mgr_restore_deleted_conn_info(psoc, info, num_cxn_del); + if (mode == PM_STA_MODE) + policy_mgr_restore_deleted_conn_info(psoc, info, + num_cxn_del); } qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); diff --git a/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_tgt_if_tx_api.c b/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_tgt_if_tx_api.c index 1fb4e50aac3a..b6a7427e95ec 100644 --- a/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_tgt_if_tx_api.c +++ b/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_tgt_if_tx_api.c @@ -85,7 +85,8 @@ wlan_cm_roam_send_set_vdev_pcl(struct wlan_objmgr_psoc *psoc, weights->saved_num_chan = 0; status = policy_mgr_get_valid_chan_weights( - psoc, (struct policy_mgr_pcl_chan_weights *)weights); + psoc, (struct policy_mgr_pcl_chan_weights *)weights, + PM_STA_MODE); qdf_mem_free(freq_list); diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index fe355cea4c58..526ab29a4aba 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -10965,7 +10965,8 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy, chan_weights->saved_num_chan = NUM_CHANNELS; sme_get_valid_channels(chan_weights->saved_chan_list, &chan_weights->saved_num_chan); - policy_mgr_get_valid_chan_weights(hdd_ctx->psoc, chan_weights); + policy_mgr_get_valid_chan_weights(hdd_ctx->psoc, chan_weights, + intf_mode); w_pcl = qdf_mem_malloc(sizeof(struct weighed_pcl) * NUM_CHANNELS); if (!w_pcl) { qdf_mem_free(chan_weights); diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 5bc658298f6a..00364e0079d4 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -9084,7 +9084,8 @@ 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); + (struct policy_mgr_pcl_chan_weights *)&msg->chan_weights, + PM_STA_MODE); for (i = 0; i < msg->chan_weights.saved_num_chan; i++) { msg->chan_weights.weighed_valid_list[i] =