qcacld-3.0: Refactor hdd_unsafe_channel_restart_sap() iterator
Iterate through all the active links in adapter to restart SAP on unsafe channels. Change-Id: Ieb4eff375b9156b18613d42d044533094a11a352 CRs-Fixed: 3522689
This commit is contained in:

committed by
Rahul Choudhary

parent
6de48cc3e3
commit
a49097833e
@@ -12431,7 +12431,7 @@ hdd_check_chn_bw_boundary_unsafe(struct hdd_context *hdd_ctxt,
|
||||
|
||||
/**
|
||||
* hdd_unsafe_channel_restart_sap() - restart sap if sap is on unsafe channel
|
||||
* @hdd_ctxt: hdd context pointer
|
||||
* @hdd_ctx: hdd context pointer
|
||||
*
|
||||
* hdd_unsafe_channel_restart_sap check all unsafe channel list
|
||||
* and if ACS is enabled, driver will ask userspace to restart the
|
||||
@@ -12439,7 +12439,7 @@ hdd_check_chn_bw_boundary_unsafe(struct hdd_context *hdd_ctxt,
|
||||
*
|
||||
* Return - none
|
||||
*/
|
||||
QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
|
||||
QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx)
|
||||
{
|
||||
struct hdd_adapter *adapter, *next_adapter = NULL;
|
||||
struct hdd_ap_ctx *ap_ctx;
|
||||
@@ -12455,65 +12455,71 @@ QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
|
||||
cfg_default(CFG_USER_AUTO_CHANNEL_SELECTION);
|
||||
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_UNSAFE_CHANNEL_RESTART_SAP;
|
||||
enum phy_ch_width ch_width;
|
||||
struct wlan_hdd_link_info *link_info;
|
||||
|
||||
hdd_for_each_adapter_dev_held_safe(hdd_ctxt, adapter, next_adapter,
|
||||
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
|
||||
dbgid) {
|
||||
ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
|
||||
if (!(adapter->device_mode == QDF_SAP_MODE &&
|
||||
ap_ctx->sap_config.acs_cfg.acs_mode)) {
|
||||
hdd_debug_rl("skip device mode:%d acs:%d",
|
||||
adapter->device_mode,
|
||||
ap_ctx->sap_config.acs_cfg.acs_mode);
|
||||
if (adapter->device_mode != QDF_SAP_MODE) {
|
||||
hdd_debug_rl("skip device mode:%d",
|
||||
adapter->device_mode);
|
||||
hdd_adapter_dev_put_debug(adapter, dbgid);
|
||||
continue;
|
||||
}
|
||||
|
||||
hdd_adapter_for_each_active_link_info(adapter, link_info) {
|
||||
ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(link_info);
|
||||
if (!ap_ctx->sap_config.acs_cfg.acs_mode) {
|
||||
hdd_debug_rl("skip acs:%d",
|
||||
ap_ctx->sap_config.acs_cfg.acs_mode);
|
||||
continue;
|
||||
}
|
||||
|
||||
ap_chan_freq = ap_ctx->operating_chan_freq;
|
||||
ch_width = ap_ctx->sap_config.ch_width_orig;
|
||||
found = false;
|
||||
status =
|
||||
ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl(hdd_ctxt->psoc,
|
||||
ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl(hdd_ctx->psoc,
|
||||
&scc_on_lte_coex);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status))
|
||||
hdd_err("can't get scc on lte coex chnl, use def");
|
||||
/*
|
||||
* If STA+SAP is doing SCC & g_sta_sap_scc_on_lte_coex_chan
|
||||
* is set, no need to move SAP.
|
||||
* If STA+SAP is doing SCC &
|
||||
* g_sta_sap_scc_on_lte_coex_chan is set,
|
||||
* no need to move SAP.
|
||||
*/
|
||||
if ((policy_mgr_is_sta_sap_scc(hdd_ctxt->psoc, ap_ctx->operating_chan_freq) &&
|
||||
if ((policy_mgr_is_sta_sap_scc(hdd_ctx->psoc,
|
||||
ap_chan_freq) &&
|
||||
scc_on_lte_coex) ||
|
||||
policy_mgr_nan_sap_scc_on_unsafe_ch_chk(hdd_ctxt->psoc,
|
||||
policy_mgr_nan_sap_scc_on_unsafe_ch_chk(hdd_ctx->psoc,
|
||||
ap_chan_freq))
|
||||
hdd_debug("SAP allowed in unsafe SCC channel");
|
||||
else
|
||||
found = hdd_check_chn_bw_boundary_unsafe(hdd_ctxt,
|
||||
found = hdd_check_chn_bw_boundary_unsafe(hdd_ctx,
|
||||
adapter);
|
||||
if (!found) {
|
||||
hdd_store_sap_restart_channel(
|
||||
ap_chan_freq,
|
||||
hdd_store_sap_restart_channel(ap_chan_freq,
|
||||
restart_chan_store);
|
||||
hdd_debug("ch freq:%d is safe. no need to change channel",
|
||||
ap_chan_freq);
|
||||
hdd_adapter_dev_put_debug(adapter, dbgid);
|
||||
continue;
|
||||
}
|
||||
|
||||
status = ucfg_mlme_get_acs_support_for_dfs_ltecoex(
|
||||
hdd_ctxt->psoc,
|
||||
hdd_ctx->psoc,
|
||||
&is_acs_support_for_dfs_ltecoex);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status))
|
||||
hdd_err("get_acs_support_for_dfs_ltecoex failed,set def");
|
||||
|
||||
status = ucfg_mlme_get_vendor_acs_support(
|
||||
hdd_ctxt->psoc,
|
||||
hdd_ctx->psoc,
|
||||
&is_vendor_acs_support);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status))
|
||||
hdd_err("get_vendor_acs_support failed, set default");
|
||||
|
||||
if (is_vendor_acs_support && is_acs_support_for_dfs_ltecoex) {
|
||||
if (is_vendor_acs_support &&
|
||||
is_acs_support_for_dfs_ltecoex) {
|
||||
hdd_update_acs_timer_reason(adapter,
|
||||
QCA_WLAN_VENDOR_ACS_SELECT_REASON_LTE_COEX);
|
||||
hdd_adapter_dev_put_debug(adapter, dbgid);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -12522,7 +12528,7 @@ QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
|
||||
if (!restart_chan_store[i])
|
||||
continue;
|
||||
|
||||
if (policy_mgr_is_force_scc(hdd_ctxt->psoc) &&
|
||||
if (policy_mgr_is_force_scc(hdd_ctx->psoc) &&
|
||||
WLAN_REG_IS_SAME_BAND_FREQS(
|
||||
restart_chan_store[i],
|
||||
ap_chan_freq)) {
|
||||
@@ -12533,16 +12539,15 @@ QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
|
||||
if (!restart_freq) {
|
||||
restart_freq =
|
||||
wlansap_get_safe_channel_from_pcl_and_acs_range(
|
||||
WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
|
||||
WLAN_HDD_GET_SAP_CTX_PTR(link_info),
|
||||
&ch_width);
|
||||
}
|
||||
if (!restart_freq) {
|
||||
wlan_hdd_set_sap_csa_reason(hdd_ctxt->psoc,
|
||||
adapter->deflink->vdev_id,
|
||||
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc,
|
||||
link_info->vdev_id,
|
||||
CSA_REASON_UNSAFE_CHANNEL);
|
||||
hdd_err("Unable to find safe chan, Stop the SAP if restriction mask is set else set txpower");
|
||||
hdd_stop_sap_set_tx_power(hdd_ctxt->psoc, adapter);
|
||||
hdd_adapter_dev_put_debug(adapter, dbgid);
|
||||
hdd_stop_sap_set_tx_power(hdd_ctx->psoc, adapter);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
@@ -12552,22 +12557,24 @@ QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
|
||||
* 0. Otherwise these settings will override
|
||||
* the ACS while restart.
|
||||
*/
|
||||
hdd_ctxt->acs_policy.acs_chan_freq =
|
||||
hdd_ctx->acs_policy.acs_chan_freq =
|
||||
AUTO_CHANNEL_SELECT;
|
||||
ucfg_mlme_get_sap_internal_restart(hdd_ctxt->psoc,
|
||||
ucfg_mlme_get_sap_internal_restart(hdd_ctx->psoc,
|
||||
&value);
|
||||
if (value) {
|
||||
wlan_hdd_set_sap_csa_reason(hdd_ctxt->psoc,
|
||||
adapter->deflink->vdev_id,
|
||||
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc,
|
||||
link_info->vdev_id,
|
||||
CSA_REASON_UNSAFE_CHANNEL);
|
||||
status = hdd_switch_sap_chan_freq(adapter,
|
||||
restart_freq,
|
||||
ch_width,
|
||||
true);
|
||||
if (QDF_IS_STATUS_SUCCESS(status)) {
|
||||
hdd_adapter_dev_put_debug(adapter, dbgid);
|
||||
hdd_adapter_dev_put_debug(adapter,
|
||||
dbgid);
|
||||
if (next_adapter)
|
||||
hdd_adapter_dev_put_debug(next_adapter,
|
||||
hdd_adapter_dev_put_debug(
|
||||
next_adapter,
|
||||
dbgid);
|
||||
return QDF_STATUS_E_PENDING;
|
||||
} else {
|
||||
@@ -12576,7 +12583,7 @@ QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
|
||||
} else {
|
||||
hdd_debug("sending coex indication");
|
||||
wlan_hdd_send_svc_nlink_msg(
|
||||
hdd_ctxt->radio_index,
|
||||
hdd_ctx->radio_index,
|
||||
WLAN_SVC_LTE_COEX_IND, NULL, 0);
|
||||
hdd_adapter_dev_put_debug(adapter, dbgid);
|
||||
if (next_adapter)
|
||||
@@ -12584,6 +12591,7 @@ QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
|
||||
dbgid);
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
/* dev_put has to be done here */
|
||||
hdd_adapter_dev_put_debug(adapter, dbgid);
|
||||
}
|
||||
|
Reference in New Issue
Block a user