From adbb5df9b7a9cdc3cc2151c32c19a8001a62aa83 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Tue, 5 Nov 2019 13:19:37 +0800 Subject: [PATCH] qcacld-3.0: Add g_pcl_band_priority - Set 5G/6G Channel order g_pcl_band_priority - Set 5G/6G Channel order This ini is used to set preference between 5G and 6G channels during population of PCL. 0 - Prefer 5G channels, 5G channels will be placed before the 6G channels in PCL. 1 - Prefer 6G channels, 6G channels will be placed before the 5G chennels in PCL. The change will only add 6Ghz channel to PCL for SAP or STA mode. Change-Id: I51b3073d6f4fb01af72ccb0a50d10822ac115bca CRs-Fixed: 2590007 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 21 ++ .../policy_mgr/inc/wlan_policy_mgr_cfg.h | 30 +- .../inc/wlan_policy_mgr_public_struct.h | 12 + .../policy_mgr/src/wlan_policy_mgr_core.c | 273 +++++++++++++----- .../src/wlan_policy_mgr_get_set_utils.c | 11 + .../policy_mgr/src/wlan_policy_mgr_i.h | 2 + .../policy_mgr/src/wlan_policy_mgr_ucfg.c | 1 + 7 files changed, 281 insertions(+), 69 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 abf54efc8467..f781f19f3fed 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 @@ -3155,6 +3155,27 @@ QDF_STATUS policy_mgr_get_hw_mode_from_idx( uint32_t idx, struct policy_mgr_hw_mode_params *hw_mode); +#if defined(CONFIG_BAND_6GHZ) && defined(WLAN_FEATURE_11AX) +/** + * policy_mgr_is_6ghz_conc_mode_supported() - Check connection mode supported + * on 6ghz or not + * @psoc: Pointer to soc + * @mode: new connection mode + * + * Current PORed 6ghz connection is STA, SAP. + * + * Return: true if supports else false. + */ +bool policy_mgr_is_6ghz_conc_mode_supported( + struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode); +#else +static inline bool policy_mgr_is_6ghz_conc_mode_supported( + struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode) +{ + return false; +} +#endif + /** * policy_mgr_update_nan_vdev_mac_info() - Update the NAN vdev id and MAC id in * policy manager diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_cfg.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_cfg.h index 5ace878b05d8..6e3f0ae961f6 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_cfg.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_cfg.h @@ -559,6 +559,33 @@ CFG_INI_UINT("g_mark_sap_indoor_as_disable", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \ CFG_INI_UINT("g_enable_go_force_scc", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \ "Enable/Disable P2P GO force SCC") +/** + * + * g_pcl_band_priority - Set 5G/6G Channel order + * Options. + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to set preference between 5G and 6G channels during + * PCL population. + * 0 - Prefer 5G channels, 5G channels will be placed before the 6G channels + * in PCL. + * 1 - Prefer 6G channels, 6G channels will be placed before the 5G channels + * in PCL. + * + * Supported Feature: STA, SAP + * + * + * Usage: Internal/External + * + * + */ + +#define CFG_PCL_BAND_PRIORITY \ +CFG_INI_UINT("g_pcl_band_priority", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \ + "Set 5G and 6G Channel order") + #define CFG_POLICY_MGR_ALL \ CFG(CFG_MCC_TO_SCC_SWITCH) \ CFG(CFG_CONC_SYS_PREF) \ @@ -579,5 +606,6 @@ CFG_INI_UINT("g_enable_go_force_scc", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \ CFG(CFG_NAN_SAP_SCC_ON_LTE_COEX_CHAN) \ CFG(CFG_MARK_INDOOR_AS_DISABLE_FEATURE)\ CFG(CFG_ALLOW_MCC_GO_DIFF_BI) \ - CFG(CFG_P2P_GO_ENABLE_FORCE_SCC) + CFG(CFG_P2P_GO_ENABLE_FORCE_SCC) \ + CFG(CFG_PCL_BAND_PRIORITY) #endif diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h index 58605359e113..5a31643671dd 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h @@ -179,6 +179,18 @@ enum policy_mgr_pcl_channel_order { POLICY_MGR_PCL_ORDER_5G_THEN_2G, }; +/** + * policy_mgr_pcl_band_priority - Band priority between 5G and 6G channel + * @POLICY_MGR_PCL_BAND_5G_THEN_6G: 5 Ghz channel followed by 6 Ghz channel + * @POLICY_MGR_PCL_BAND_6G_THEN_5G: 6 Ghz channel followed by 5 Ghz channel + * + * Band priority between 5G and 6G + */ +enum policy_mgr_pcl_band_priority { + POLICY_MGR_PCL_BAND_5G_THEN_6G = 0, + POLICY_MGR_PCL_BAND_6G_THEN_5G, +}; + /** * enum policy_mgr_max_rx_ss - Maximum number of receive spatial streams * @POLICY_MGR_RX_NSS_1: Receive Nss = 1 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 b1f2c44c447b..57944ce2c324 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 @@ -1753,6 +1753,8 @@ static QDF_STATUS policy_mgr_get_sbs_channels( /** * policy_mgr_get_connection_channels() - provides the channel(s) * on which current connection(s) is + * @psoc: psoc object + * @mode: conn mode * @ch_freq_list: the channel(s) on which current connection(s) is * @len: Number of channels * @order: no order OR 2.4 Ghz channel followed by 5 Ghz @@ -1771,6 +1773,7 @@ static QDF_STATUS policy_mgr_get_sbs_channels( */ static QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, + enum policy_mgr_con_mode mode, uint32_t *ch_freq_list, uint32_t *len, enum policy_mgr_pcl_channel_order order, bool skip_dfs_channel, @@ -1781,6 +1784,7 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, uint32_t conn_index = 0, num_channels = 0; uint32_t weight1, weight2; struct policy_mgr_psoc_priv_obj *pm_ctx; + bool add_6ghz = true; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -1814,19 +1818,27 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, if (group_id == POLICY_MGR_PCL_GROUP_ID1_ID2) { weight1 = WEIGHT_OF_GROUP1_PCL_CHANNELS; weight2 = WEIGHT_OF_GROUP2_PCL_CHANNELS; - } else { + } else if (group_id == POLICY_MGR_PCL_GROUP_ID2_ID3) { weight1 = WEIGHT_OF_GROUP2_PCL_CHANNELS; weight2 = WEIGHT_OF_GROUP3_PCL_CHANNELS; + } else { + weight1 = WEIGHT_OF_GROUP3_PCL_CHANNELS; + weight2 = WEIGHT_OF_GROUP4_PCL_CHANNELS; } + if (!policy_mgr_is_6ghz_conc_mode_supported(psoc, mode)) + add_6ghz = false; qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); if (POLICY_MGR_PCL_ORDER_NONE == order) { while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { + bool is_6ghz_ch = WLAN_REG_IS_6GHZ_CHAN_FREQ( + pm_conc_connection_list[conn_index].freq); if (skip_dfs_channel && wlan_reg_is_dfs_for_freq( pm_ctx->pdev, pm_conc_connection_list[conn_index].freq)) { conn_index++; - } else if (*index < weight_len) { + } else if ((*index < weight_len) && + (!is_6ghz_ch || add_6ghz)) { ch_freq_list[num_channels++] = pm_conc_connection_list[ conn_index++].freq; @@ -1867,6 +1879,20 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, conn_index++; } } + conn_index = 0; + while (add_6ghz && + PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { + bool is_6ghz_ch = WLAN_REG_IS_6GHZ_CHAN_FREQ( + pm_conc_connection_list[conn_index].freq); + if (is_6ghz_ch && (*index < weight_len)) { + ch_freq_list[num_channels++] = + pm_conc_connection_list[ + conn_index++].freq; + pcl_weight[(*index)++] = weight2; + } else { + conn_index++; + } + } *len = num_channels; } else if (POLICY_MGR_PCL_ORDER_5G_THEN_2G == order) { while (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { @@ -1900,6 +1926,20 @@ QDF_STATUS policy_mgr_get_connection_channels(struct wlan_objmgr_psoc *psoc, conn_index++; } } + conn_index = 0; + while (add_6ghz && + PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) { + bool is_6ghz_ch = WLAN_REG_IS_6GHZ_CHAN_FREQ( + pm_conc_connection_list[conn_index].freq); + if (is_6ghz_ch && (*index < weight_len)) { + ch_freq_list[num_channels++] = + pm_conc_connection_list[ + conn_index++].freq; + pcl_weight[(*index)++] = weight2; + } else { + conn_index++; + } + } *len = num_channels; } else { policy_mgr_err("unknown order %d", order); @@ -1973,6 +2013,77 @@ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( return; } +static void policy_mgr_add_5g_to_pcl( + struct wlan_objmgr_psoc *psoc, + uint32_t *ch_freq_list, + uint32_t *len, + uint8_t *pcl_weight, uint32_t weight_len, + uint32_t *index, enum policy_mgr_pcl_group_id group_id, + const uint32_t *chlist_5g, uint8_t chlist_5g_len, + const uint32_t *chlist_6g, uint8_t chlist_6g_len) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + uint32_t weight1, weight2; + const uint32_t *chlist1; + uint8_t chlist1_len; + const uint32_t *chlist2; + uint8_t chlist2_len; + uint32_t i; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid Context"); + return; + } + + if (group_id == POLICY_MGR_PCL_GROUP_ID1_ID2) { + weight1 = WEIGHT_OF_GROUP1_PCL_CHANNELS; + weight2 = WEIGHT_OF_GROUP2_PCL_CHANNELS; + } else if (group_id == POLICY_MGR_PCL_GROUP_ID2_ID3) { + weight1 = WEIGHT_OF_GROUP2_PCL_CHANNELS; + weight2 = WEIGHT_OF_GROUP3_PCL_CHANNELS; + } else { + weight1 = WEIGHT_OF_GROUP3_PCL_CHANNELS; + weight2 = WEIGHT_OF_GROUP4_PCL_CHANNELS; + } + if (pm_ctx->cfg.pcl_band_priority == POLICY_MGR_PCL_BAND_6G_THEN_5G) { + chlist1 = chlist_6g; + chlist1_len = chlist_6g_len; + chlist2 = chlist_5g; + chlist2_len = chlist_5g_len; + } else { + chlist1 = chlist_5g; + chlist1_len = chlist_5g_len; + chlist2 = chlist_6g; + chlist2_len = chlist_6g_len; + } + if ((chlist1_len + *index) > weight_len) { + policy_mgr_err("no enough weight len %d chlist1_len %d %d", + weight_len, chlist1_len, *index); + return; + } + qdf_mem_copy(ch_freq_list, chlist1, chlist1_len * sizeof(*chlist1)); + for (i = 0; i < chlist1_len; i++) + pcl_weight[(*index)++] = weight1; + + *len += chlist1_len; + + if ((chlist2_len + *index) > weight_len) { + policy_mgr_err("no enough weight len chlist2_len %d %d %d", + weight_len, chlist2_len, *index); + return; + } + qdf_mem_copy(&ch_freq_list[chlist1_len], chlist2, + chlist2_len * sizeof(*chlist2)); + for (i = 0; i < chlist2_len; i++) + pcl_weight[(*index)++] = weight2; + *len += chlist2_len; + + policy_mgr_debug("Add 5g chlist len %d 6g chlist len %d len %d index %d order %d", + chlist_5g_len, chlist_6g_len, *len, *index, + pm_ctx->cfg.pcl_band_priority); +} + /** * policy_mgr_get_channel_list() - provides the channel list * suggestion for new connection @@ -1998,14 +2109,14 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, QDF_STATUS status = QDF_STATUS_E_FAILURE; uint32_t num_channels = 0; uint32_t sbs_num_channels = 0; - uint32_t chan_index_24 = 0, chan_index_5 = 0; + uint32_t chan_index_24 = 0, chan_index_5 = 0, chan_index_6 = 0; bool skip_dfs_channel = false; bool is_etsi13_srd_chan_allowed_in_mas_mode = true; uint32_t i = 0, j = 0; struct policy_mgr_psoc_priv_obj *pm_ctx; bool sta_sap_scc_on_dfs_chan; uint32_t *channel_list, *channel_list_24, *channel_list_5, - *sbs_channel_list; + *sbs_channel_list, *channel_list_6; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -2035,8 +2146,9 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list_24 = qdf_mem_malloc(NUM_CHANNELS * sizeof(uint32_t)); channel_list_5 = qdf_mem_malloc(NUM_CHANNELS * sizeof(uint32_t)); sbs_channel_list = qdf_mem_malloc(NUM_CHANNELS * sizeof(uint32_t)); + channel_list_6 = qdf_mem_malloc(NUM_CHANNELS * sizeof(uint32_t)); if (!channel_list || !channel_list_24 || !channel_list_5 || - !sbs_channel_list) { + !sbs_channel_list || !channel_list_6) { status = QDF_STATUS_E_NOMEM; goto end; } @@ -2087,10 +2199,11 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, channel_list_5[chan_index_5++] = channel_list[i]; } else if (wlan_reg_is_6ghz_chan_freq(channel_list[i])) { /* Add to 5G list untill 6G conc support is enabled */ - channel_list_5[chan_index_5++] = channel_list[i]; + channel_list_6[chan_index_6++] = channel_list[i]; } } - + if (!policy_mgr_is_6ghz_conc_mode_supported(psoc, mode)) + chan_index_6 = 0; num_channels = 0; sbs_num_channels = 0; i = 0; @@ -2140,17 +2253,19 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, status = QDF_STATUS_SUCCESS; break; case PM_5G: - chan_index_5 = QDF_MIN(chan_index_5, weight_len); - qdf_mem_copy(pcl_channels, channel_list_5, - chan_index_5 * sizeof(*pcl_channels)); - *len = chan_index_5; - for (i = 0; i < *len; i++) - pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; + policy_mgr_add_5g_to_pcl( + psoc, pcl_channels, len, + pcl_weights, weight_len, + &i, + POLICY_MGR_PCL_GROUP_ID1_ID2, + channel_list_5, chan_index_5, + channel_list_6, chan_index_6); status = QDF_STATUS_SUCCESS; break; case PM_SCC_CH: case PM_MCC_CH: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); @@ -2161,7 +2276,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, break; case PM_SCC_CH_24G: case PM_MCC_CH_24G: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); @@ -2180,20 +2296,21 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, break; case PM_SCC_CH_5G: case PM_MCC_CH_5G: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID1_ID2); qdf_mem_copy(pcl_channels, channel_list, num_channels * sizeof(*pcl_channels)); *len = num_channels; - chan_index_5 = QDF_MIN((num_channels + chan_index_5), - weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], channel_list_5, - chan_index_5 * sizeof(*pcl_channels)); - *len += chan_index_5; - for (j = 0; j < chan_index_5; i++, j++) - pcl_weights[i] = WEIGHT_OF_GROUP2_PCL_CHANNELS; + policy_mgr_add_5g_to_pcl( + psoc, &pcl_channels[num_channels], len, + pcl_weights, weight_len, + &i, + POLICY_MGR_PCL_GROUP_ID2_ID3, + channel_list_5, chan_index_5, + channel_list_6, chan_index_6); status = QDF_STATUS_SUCCESS; break; case PM_24G_SCC_CH: @@ -2204,7 +2321,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, *len = chan_index_24; for (i = 0; i < chan_index_24; i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); @@ -2215,23 +2333,27 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, break; case PM_5G_SCC_CH: case PM_5G_MCC_CH: - chan_index_5 = QDF_MIN(chan_index_5, weight_len); - qdf_mem_copy(pcl_channels, channel_list_5, - chan_index_5 * sizeof(*pcl_channels)); - *len = chan_index_5; - for (i = 0; i < chan_index_5; i++) - pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; - policy_mgr_get_connection_channels(psoc, + policy_mgr_add_5g_to_pcl( + psoc, pcl_channels, len, + pcl_weights, weight_len, + &i, + POLICY_MGR_PCL_GROUP_ID1_ID2, + channel_list_5, chan_index_5, + channel_list_6, chan_index_6); + + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, - POLICY_MGR_PCL_GROUP_ID2_ID3); - qdf_mem_copy(&pcl_channels[chan_index_5], channel_list, + POLICY_MGR_PCL_GROUP_ID3_ID4); + qdf_mem_copy(&pcl_channels[*len], channel_list, num_channels * sizeof(*pcl_channels)); *len += num_channels; status = QDF_STATUS_SUCCESS; break; case PM_SCC_ON_24_SCC_ON_5: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_24G_THEN_5G, skip_dfs_channel, pcl_weights, weight_len, &i, @@ -2242,7 +2364,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, status = QDF_STATUS_SUCCESS; break; case PM_SCC_ON_5_SCC_ON_24: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_5G_THEN_2G, skip_dfs_channel, pcl_weights, weight_len, &i, @@ -2253,7 +2376,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, status = QDF_STATUS_SUCCESS; break; case PM_SCC_ON_24_SCC_ON_5_24G: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_24G_THEN_5G, skip_dfs_channel, pcl_weights, weight_len, &i, @@ -2271,7 +2395,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, status = QDF_STATUS_SUCCESS; break; case PM_SCC_ON_24_SCC_ON_5_5G: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_24G_THEN_5G, skip_dfs_channel, pcl_weights, weight_len, &i, @@ -2279,17 +2404,18 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, qdf_mem_copy(pcl_channels, channel_list, num_channels * sizeof(*pcl_channels)); *len = num_channels; - chan_index_5 = QDF_MIN((num_channels + chan_index_5), - weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], channel_list_5, - chan_index_5 * sizeof(*pcl_channels)); - *len += chan_index_5; - for (j = 0; j < chan_index_5; i++, j++) - pcl_weights[i] = WEIGHT_OF_GROUP3_PCL_CHANNELS; + policy_mgr_add_5g_to_pcl( + psoc, &pcl_channels[num_channels], len, + pcl_weights, weight_len, + &i, + POLICY_MGR_PCL_GROUP_ID3_ID4, + channel_list_5, chan_index_5, + channel_list_6, chan_index_6); status = QDF_STATUS_SUCCESS; break; case PM_SCC_ON_5_SCC_ON_24_24G: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_5G_THEN_2G, skip_dfs_channel, pcl_weights, weight_len, &i, @@ -2307,7 +2433,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, status = QDF_STATUS_SUCCESS; break; case PM_SCC_ON_5_SCC_ON_24_5G: - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_5G_THEN_2G, skip_dfs_channel, pcl_weights, weight_len, &i, @@ -2315,13 +2442,13 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, qdf_mem_copy(pcl_channels, channel_list, num_channels * sizeof(*pcl_channels)); *len = num_channels; - chan_index_5 = QDF_MIN((num_channels + chan_index_5), - weight_len) - num_channels; - qdf_mem_copy(&pcl_channels[num_channels], channel_list_5, - chan_index_5 * sizeof(*pcl_channels)); - *len += chan_index_5; - for (j = 0; j < chan_index_5; i++, j++) - pcl_weights[i] = WEIGHT_OF_GROUP3_PCL_CHANNELS; + policy_mgr_add_5g_to_pcl( + psoc, &pcl_channels[num_channels], len, + pcl_weights, weight_len, + &i, + POLICY_MGR_PCL_GROUP_ID3_ID4, + channel_list_5, chan_index_5, + channel_list_6, chan_index_6); status = QDF_STATUS_SUCCESS; break; case PM_24G_SCC_CH_SBS_CH: @@ -2330,7 +2457,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, *len = chan_index_24; for (i = 0; ((i < chan_index_24) && (i < weight_len)); i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); @@ -2356,7 +2484,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, *len = chan_index_24; for (i = 0; ((i < chan_index_24) && (i < weight_len)); i++) pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); @@ -2374,14 +2503,15 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, sbs_num_channels * sizeof(*pcl_channels)); *len += sbs_num_channels; } else { - qdf_mem_copy( + policy_mgr_add_5g_to_pcl( + psoc, &pcl_channels[chan_index_24 + num_channels], - channel_list_5, - chan_index_5 * sizeof(*pcl_channels)); - *len += chan_index_5; - for (i = chan_index_24 + num_channels; - ((i < *len) && (i < weight_len)); i++) - pcl_weights[i] = WEIGHT_OF_GROUP3_PCL_CHANNELS; + len, + pcl_weights, weight_len, + &i, + POLICY_MGR_PCL_GROUP_ID3_ID4, + channel_list_5, chan_index_5, + channel_list_6, chan_index_6); } status = QDF_STATUS_SUCCESS; break; @@ -2401,7 +2531,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, sbs_num_channels * sizeof(*pcl_channels)); *len += sbs_num_channels; } - policy_mgr_get_connection_channels(psoc, + policy_mgr_get_connection_channels( + psoc, mode, channel_list, &num_channels, POLICY_MGR_PCL_ORDER_NONE, skip_dfs_channel, pcl_weights, weight_len, &i, POLICY_MGR_PCL_GROUP_ID2_ID3); @@ -2421,11 +2552,15 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, sbs_num_channels * sizeof(*pcl_channels)); *len += sbs_num_channels; } else { - qdf_mem_copy(pcl_channels, channel_list_5, - chan_index_5 * sizeof(*pcl_channels)); - *len = chan_index_5; - for (i = 0; ((i < *len) && (i < weight_len)); i++) - pcl_weights[i] = WEIGHT_OF_GROUP1_PCL_CHANNELS; + policy_mgr_add_5g_to_pcl( + psoc, + pcl_channels, + len, + pcl_weights, weight_len, + &i, + POLICY_MGR_PCL_GROUP_ID1_ID2, + channel_list_5, chan_index_5, + channel_list_6, chan_index_6); } status = QDF_STATUS_SUCCESS; break; @@ -2451,6 +2586,8 @@ end: qdf_mem_free(channel_list_24); qdf_mem_free(channel_list_5); qdf_mem_free(sbs_channel_list); + qdf_mem_free(channel_list_6); + return status; } diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index 45e88a0e7e87..41e39270308f 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -2187,6 +2187,17 @@ static bool policy_mgr_allow_multiple_sta_connections(struct wlan_objmgr_psoc *p return true; } +#if defined(CONFIG_BAND_6GHZ) && defined(WLAN_FEATURE_11AX) +bool policy_mgr_is_6ghz_conc_mode_supported( + struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode) +{ + if (mode == PM_STA_MODE || mode == PM_SAP_MODE) + return true; + else + return false; +} +#endif + bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, uint32_t ch_freq, diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h index f22ba692f28c..0fe285b4f921 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h @@ -247,6 +247,7 @@ struct sta_ap_intf_check_work_ctx { * @enable_mcc_adaptive_sch: Enable/Disable MCC adaptive scheduler * @enable_sta_cxn_5g_band: Enable/Disable STA connection in 5G band * @go_force_scc: Enable/Disable P2P GO force SCC + * @pcl_band_priority: PCL channel order between 5G and 6G. */ struct policy_mgr_cfg { uint8_t mcc_to_scc_switch; @@ -269,6 +270,7 @@ struct policy_mgr_cfg { uint32_t vdev_priority_list; uint32_t chnl_select_plcy; uint8_t go_force_scc; + enum policy_mgr_pcl_band_priority pcl_band_priority; }; /** diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c index d4fa468c942e..647a1a7d5f89 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c @@ -37,6 +37,7 @@ static QDF_STATUS policy_mgr_init_cfg(struct wlan_objmgr_psoc *psoc) cfg->max_conc_cxns = cfg_get(psoc, CFG_MAX_CONC_CXNS); cfg->conc_rule1 = cfg_get(psoc, CFG_ENABLE_CONC_RULE1); cfg->conc_rule2 = cfg_get(psoc, CFG_ENABLE_CONC_RULE2); + cfg->pcl_band_priority = cfg_get(psoc, CFG_PCL_BAND_PRIORITY); cfg->dbs_selection_plcy = cfg_get(psoc, CFG_DBS_SELECTION_PLCY); cfg->vdev_priority_list = cfg_get(psoc, CFG_VDEV_CUSTOM_PRIORITY_LIST); cfg->chnl_select_plcy = cfg_get(psoc, CFG_CHNL_SELECT_LOGIC_CONC);