From d8ecec378d4d9323fd604c10622e83d1ead9beb7 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Thu, 9 May 2019 04:47:47 -0400 Subject: [PATCH] qcacld-3.0: Add INI for P2P GO force SCC 1. Add g_enable_go_force_scc INI configuration to enable force SCC on P2P GO interface. This option only takes effect when gWlanMccToSccSwitchMode INI enabled. 2. Add API policy_mgr_is_go_allow_force_scc to get the above configuration value for GO. Driver will apply "MCC to SCC" logic to P2P GO interface based on STA active status and the configurated INI values. Change-Id: I1d16368b5f2d88984b91ef0a3e882148c20dcd23 CRs-Fixed: 2509555 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 10 +++ .../policy_mgr/inc/wlan_policy_mgr_cfg.h | 24 +++++- .../policy_mgr/src/wlan_policy_mgr_action.c | 36 +++++--- .../src/wlan_policy_mgr_get_set_utils.c | 21 +++++ .../policy_mgr/src/wlan_policy_mgr_i.h | 2 + .../policy_mgr/src/wlan_policy_mgr_ucfg.c | 1 + core/sap/src/sap_fsm.c | 85 +++---------------- 7 files changed, 91 insertions(+), 88 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 2a9ec491dd27..a2ef908f7e81 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 @@ -2659,6 +2659,16 @@ bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, */ bool policy_mgr_is_force_scc(struct wlan_objmgr_psoc *psoc); +/** + * policy_mgr_go_scc_enforced() - Get GO force SCC enabled or not + * @psoc: psoc object + * + * This function checks if force SCC logic should be used on GO interface. + * + * Return: True if allow GO force SCC + */ +bool policy_mgr_go_scc_enforced(struct wlan_objmgr_psoc *psoc); + /** * policy_mgr_valid_sap_conc_channel_check() - checks & updates * the channel SAP to come up on in case of STA+SAP concurrency 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 6bf072a19f6f..e406c1fd23f7 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 @@ -535,6 +535,27 @@ CFG_INI_UINT("g_sta_sap_scc_on_lte_coex_chan", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \ CFG_INI_UINT("g_mark_sap_indoor_as_disable", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \ "Enable/Disable Indoor channel") +/* + * + * g_enable_go_force_scc - Enable/Disable force SCC on P2P GO + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini and along with "gWlanMccToSccSwitchMode" is used to enable + * force SCC on P2P GO interface. + * + * Supported Feature: P2P GO + * + * Usage: External + * + * + */ + +#define CFG_P2P_GO_ENABLE_FORCE_SCC \ +CFG_INI_UINT("g_enable_go_force_scc", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \ + "Enable/Disable P2P GO force SCC") + #define CFG_POLICY_MGR_ALL \ CFG(CFG_MCC_TO_SCC_SWITCH) \ CFG(CFG_CONC_SYS_PREF) \ @@ -554,5 +575,6 @@ CFG_INI_UINT("g_mark_sap_indoor_as_disable", 0, 1, 0, CFG_VALUE_OR_DEFAULT, \ CFG(CFG_STA_SAP_SCC_ON_LTE_COEX_CHAN)\ 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_ALLOW_MCC_GO_DIFF_BI) \ + CFG(CFG_P2P_GO_ENABLE_FORCE_SCC) #endif diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index f4516b97b3ac..9f5b93e18c67 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -1268,25 +1268,29 @@ static bool policy_mgr_is_restart_sap_allowed( uint32_t sta_ap_bit_mask = QDF_STA_MASK | QDF_SAP_MASK; uint32_t sta_go_bit_mask = QDF_STA_MASK | QDF_P2P_GO_MASK; uint32_t ap_present, go_present; - - ap_present = policy_mgr_mode_specific_connection_count( - psoc, PM_SAP_MODE, NULL); - go_present = policy_mgr_mode_specific_connection_count( - psoc, PM_P2P_GO_MODE, NULL); + bool sta_ap_coexist, sta_go_coexist; if ((mcc_to_scc_switch == QDF_MCC_TO_SCC_SWITCH_DISABLE) || - !policy_mgr_concurrent_open_sessions_running(psoc) || - !((ap_present && ((policy_mgr_get_concurrency_mode(psoc) & - sta_ap_bit_mask) == sta_ap_bit_mask)) || - ((mcc_to_scc_switch == - QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) - && go_present && ((policy_mgr_get_concurrency_mode(psoc) & - sta_go_bit_mask) == sta_go_bit_mask)))) { + !policy_mgr_concurrent_open_sessions_running(psoc)) { policy_mgr_debug("MCC switch disabled or not concurrent STA/SAP, STA/GO"); return false; } + ap_present = policy_mgr_mode_specific_connection_count( + psoc, PM_SAP_MODE, NULL); + sta_ap_coexist = (policy_mgr_get_concurrency_mode(psoc) & + sta_ap_bit_mask) == sta_ap_bit_mask; + if (ap_present && sta_ap_coexist) + return true; - return true; + go_present = policy_mgr_mode_specific_connection_count( + psoc, PM_P2P_GO_MODE, NULL); + sta_go_coexist = (policy_mgr_get_concurrency_mode(psoc) & + sta_go_bit_mask) == sta_go_bit_mask; + if (go_present && sta_go_coexist && + policy_mgr_go_scc_enforced(psoc)) + return true; + + return false; } bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, @@ -1722,7 +1726,7 @@ static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) struct wlan_objmgr_psoc *psoc; struct policy_mgr_psoc_priv_obj *pm_ctx = NULL; struct sta_ap_intf_check_work_ctx *work_info = NULL; - uint32_t mcc_to_scc_switch, cc_count = 0, i; + uint32_t mcc_to_scc_switch, cc_count = 0, i, go_index_start; QDF_STATUS status; uint8_t channel, sec_ch; uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS]; @@ -1759,6 +1763,7 @@ static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) &vdev_id[cc_count], PM_SAP_MODE); policy_mgr_debug("Number of concurrent SAP: %d", cc_count); + go_index_start = cc_count; if (cc_count < MAX_NUMBER_OF_CONC_CONNECTIONS) cc_count = cc_count + policy_mgr_get_mode_specific_conn_info @@ -1789,6 +1794,9 @@ static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) } if (cc_count < MAX_NUMBER_OF_CONC_CONNECTIONS) for (i = 0; i < cc_count; i++) { + if (i >= go_index_start && + !policy_mgr_go_scc_enforced(psoc)) + continue; status = pm_ctx->hdd_cbacks. wlan_hdd_get_channel_for_sap_restart (psoc, 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 7947e9b57b8e..99f0bae1c6b4 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 @@ -3865,6 +3865,27 @@ bool policy_mgr_is_sta_sap_scc(struct wlan_objmgr_psoc *psoc, uint8_t sap_ch) return is_scc; } +bool policy_mgr_go_scc_enforced(struct wlan_objmgr_psoc *psoc) +{ + uint32_t mcc_to_scc_switch; + struct policy_mgr_psoc_priv_obj *pm_ctx; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid Context"); + return false; + } + mcc_to_scc_switch = policy_mgr_get_mcc_to_scc_switch_mode(psoc); + if (mcc_to_scc_switch == + QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) + return true; + + if (pm_ctx->cfg.go_force_scc && policy_mgr_is_force_scc(psoc)) + return true; + + return false; +} + QDF_STATUS policy_mgr_update_nan_vdev_mac_info(struct wlan_objmgr_psoc *psoc, uint8_t nan_vdev_id, uint8_t mac_id) 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 de3237aa7e3b..498d9cd508e5 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 @@ -245,6 +245,7 @@ struct sta_ap_intf_check_work_ctx { * @chnl_select_plcy: Channel selection policy * @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 */ struct policy_mgr_cfg { uint8_t mcc_to_scc_switch; @@ -266,6 +267,7 @@ struct policy_mgr_cfg { uint32_t dbs_selection_plcy; uint32_t vdev_priority_list; uint32_t chnl_select_plcy; + uint8_t go_force_scc; }; /** 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 a172c0d6a821..d4fa468c942e 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 @@ -62,6 +62,7 @@ static QDF_STATUS policy_mgr_init_cfg(struct wlan_objmgr_psoc *psoc) cfg_get(psoc, CFG_ENABLE_SAP_MANDATORY_CHAN_LIST); cfg->mark_indoor_chnl_disable = cfg_get(psoc, CFG_MARK_INDOOR_AS_DISABLE_FEATURE); + cfg->go_force_scc = cfg_get(psoc, CFG_P2P_GO_ENABLE_FORCE_SCC); return QDF_STATUS_SUCCESS; } diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 5f76f08b6fde..305171531067 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -719,11 +719,13 @@ sap_validate_chan(struct sap_context *sap_context, { QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; struct mac_context *mac_ctx; - bool is_dfs; - bool is_safe; mac_handle_t mac_handle; uint8_t con_ch; bool sta_sap_scc_on_dfs_chan; + uint32_t sta_go_bit_mask = QDF_STA_MASK | QDF_P2P_GO_MASK; + uint32_t sta_sap_bit_mask = QDF_STA_MASK | QDF_SAP_MASK; + uint32_t concurrent_state; + bool go_force_scc; mac_handle = cds_get_context(QDF_MODULE_ID_SME); mac_ctx = MAC_CONTEXT(mac_handle); @@ -739,78 +741,15 @@ sap_validate_chan(struct sap_context *sap_context, FL("Invalid channel")); return QDF_STATUS_E_FAILURE; } + go_force_scc = policy_mgr_go_scc_enforced(mac_ctx->psoc); + if (!go_force_scc && + (wlan_vdev_mlme_get_opmode(sap_context->vdev) == QDF_P2P_GO_MODE)) + goto validation_done; + concurrent_state = policy_mgr_get_concurrency_mode(mac_ctx->psoc); if (policy_mgr_concurrent_beaconing_sessions_running(mac_ctx->psoc) || - ((sap_context->cc_switch_mode == - QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) && - (policy_mgr_mode_specific_connection_count(mac_ctx->psoc, - PM_SAP_MODE, NULL) || - policy_mgr_mode_specific_connection_count(mac_ctx->psoc, - PM_P2P_GO_MODE, NULL)))) { - con_ch = - sme_get_beaconing_concurrent_operation_channel( - mac_handle, sap_context->sessionId); -#ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE - if (con_ch && sap_context->channel != con_ch && - wlan_reg_is_dfs_ch(mac_ctx->pdev, - sap_context->channel)) { - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_WARN, - FL("MCC DFS not supported in AP_AP Mode")); - return QDF_STATUS_E_ABORTED; - } -#endif -#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH - if (con_ch && (sap_context->cc_switch_mode != - QDF_MCC_TO_SCC_SWITCH_DISABLE)) { - /* - * For ACS request ,the sap_ctx->channel is 0, - * we skip below overlap checking. When the ACS - * finish and SAPBSS start, the sap_ctx->channel - * will not be 0. Then the overlap checking will be - * reactivated.If we use sap_ctx->channel = 0 - * to perform the overlap checking, an invalid overlap - * channel con_ch could becreated. That may cause - * SAP start failed. - */ - con_ch = sme_check_concurrent_channel_overlap( - mac_handle, - sap_context->channel, - sap_context->csr_roamProfile.phyMode, - sap_context->cc_switch_mode); - - sta_sap_scc_on_dfs_chan = - policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan( - mac_ctx->psoc); - - if (sap_context->cc_switch_mode == - QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) - sta_sap_scc_on_dfs_chan = false; - - is_dfs = wlan_reg_is_dfs_ch(mac_ctx->pdev, con_ch); - is_safe = policy_mgr_is_safe_channel( - mac_ctx->psoc, con_ch); - - if (con_ch && is_safe && - (!is_dfs || (is_dfs && sta_sap_scc_on_dfs_chan))) { - QDF_TRACE(QDF_MODULE_ID_SAP, - QDF_TRACE_LEVEL_ERROR, - "%s: Override ch %d to %d due to CC Intf", - __func__, sap_context->channel, con_ch); - sap_context->channel = con_ch; - wlan_reg_set_channel_params(mac_ctx->pdev, - sap_context->channel, 0, - &sap_context->ch_params); - } - } -#endif - } - - if ((policy_mgr_get_concurrency_mode(mac_ctx->psoc) == - (QDF_STA_MASK | QDF_SAP_MASK)) || - ((sap_context->cc_switch_mode == - QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) && - (policy_mgr_get_concurrency_mode(mac_ctx->psoc) == - (QDF_STA_MASK | QDF_P2P_GO_MASK)))) { + ((concurrent_state & sta_sap_bit_mask) == sta_sap_bit_mask) || + ((concurrent_state & sta_go_bit_mask) == sta_go_bit_mask)) { #ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE if (wlan_reg_is_dfs_ch(mac_ctx->pdev, sap_context->channel)) { @@ -872,7 +811,7 @@ sap_validate_chan(struct sap_context *sap_context, } #endif } - +validation_done: QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, FL("for configured channel, Ch= %d"), sap_context->channel);