qcacld-3.0: Check whether SAP need restart

If there is no STA/P2P CLI on same MAC of SAP/P2P GO,
SAP/P2P Go needn't switch channel to force scc.

Change-Id: I529a57f73f529e41b8c0097fccabbe3e0e516993
CRs-Fixed: 2643106
This commit is contained in:
Jianmin Zhu 2020-03-17 15:09:39 +08:00 • committed by nshrivas
commit 159c7d8bad
3 changed files with 69 additions and 0 deletions

View file

@ -3347,4 +3347,19 @@ bool policy_mgr_dump_channel_list(uint32_t len,
uint32_t *pcl_channels,
uint8_t *pcl_weight);
/**
* policy_mgr_is_restart_sap_required() - check whether sap need restart
* @psoc: psoc pointer
* @freq: sap current freq
* @scc_mode: mcc to scc switch mode
*
* If there is no STA/P2P CLI on same MAC of SAP/P2P GO,
* SAP/P2P Go needn't switch channel to force scc.
*
* Return: True or false
*/
bool policy_mgr_is_restart_sap_required(struct wlan_objmgr_psoc *psoc,
qdf_freq_t freq,
tQDF_MCC_TO_SCC_SWITCH_MODE scc_mode);
#endif /* __WLAN_POLICY_MGR_API_H */

View file

@ -4318,3 +4318,49 @@ bool policy_mgr_get_5g_scc_prefer(
return pm_ctx->cfg.prefer_5g_scc_to_dbs & (1 << mode);
}
bool policy_mgr_is_restart_sap_required(struct wlan_objmgr_psoc *psoc,
qdf_freq_t freq,
tQDF_MCC_TO_SCC_SWITCH_MODE scc_mode)
{
uint32_t i;
bool restart_required = false;
bool is_sta_p2p_cli;
bool is_same_band;
struct policy_mgr_psoc_priv_obj *pm_ctx;
struct policy_mgr_conc_connection_info *connection;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid psoc");
return false;
}
if (scc_mode == QDF_MCC_TO_SCC_SWITCH_DISABLE) {
policy_mgr_debug("No scc required");
return false;
}
qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
connection = pm_conc_connection_list;
for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
is_sta_p2p_cli =
connection[i].in_use &&
(connection[i].mode == PM_STA_MODE ||
connection[i].mode == PM_P2P_CLIENT_MODE);
is_same_band =
wlan_reg_is_24ghz_ch_freq(freq) ==
wlan_reg_is_24ghz_ch_freq(connection[i].freq) &&
connection[i].freq != freq;
if (is_sta_p2p_cli &&
(is_same_band || !policy_mgr_is_dbs_enable(psoc))) {
restart_required = true;
break;
}
}
qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
return restart_required;
}

View file

@ -3189,8 +3189,16 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
hdd_debug("p2p go no scc required");
return QDF_STATUS_E_FAILURE;
}
ucfg_policy_mgr_get_mcc_scc_switch(hdd_ctx->psoc,
&mcc_to_scc_switch);
if (!policy_mgr_is_restart_sap_required(hdd_ctx->psoc, *ch_freq,
mcc_to_scc_switch)) {
wlansap_context_put(sap_context);
hdd_debug("SAP needn't restart");
return QDF_STATUS_E_FAILURE;
}
/*
* Check if STA's channel is DFS or passive or part of LTE avoided
* channel list. In that case move SAP to other band if DBS is