From 54e6ba12b65aab97d40affd08457277e013f2d78 Mon Sep 17 00:00:00 2001 From: hqu Date: Thu, 1 Aug 2019 21:11:12 +0800 Subject: [PATCH] qcacld-3.0: Follow concurrent SAP switch channel in the same band When lte channel avoidance event triggered, multiple SAP will choose safe channel from pcl/acs combination and switch to the safe channel one by one. Actually when force SCC mode is enabled, if one SAP is the same band as other concurrent SAP whose channel is already safe, it doesn't need to choose safe channel from pcl/acs again, just needs to follow concurrent SAP channel. Add code to implement this policy. Change-Id: Icc9b2a53bb56915daeab8d94eceaaa64a660cb65 CRs-Fixed: 2500183 --- core/hdd/src/wlan_hdd_main.c | 52 +++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 438047b4c8dc..f8ee7ee1d01c 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9069,6 +9069,32 @@ int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason) } #if defined(FEATURE_WLAN_CH_AVOID) +/** + * hdd_store_sap_restart_channel() - store sap restart channel + * @restart_chan: restart channel + * @restart_chan_store: pointer to restart channel store + * + * The function will store new sap restart channel. + * + * Return - none + */ +static void +hdd_store_sap_restart_channel(uint8_t restart_chan, uint8_t *restart_chan_store) +{ + uint8_t i; + + for (i = 0; i < SAP_MAX_NUM_SESSION; i++) { + if (*(restart_chan_store + i) == restart_chan) + return; + + if (*(restart_chan_store + i)) + continue; + + *(restart_chan_store + i) = restart_chan; + return; + } +} + /** * hdd_unsafe_channel_restart_sap() - restart sap if sap is on unsafe channel * @hdd_ctx: hdd context pointer @@ -9084,6 +9110,7 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) struct hdd_adapter *adapter; uint32_t i; bool found = false; + uint8_t restart_chan_store[SAP_MAX_NUM_SESSION] = {0}; uint8_t restart_chan; uint8_t scc_on_lte_coex = 0; bool value; @@ -9132,6 +9159,9 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) } } if (!found) { + hdd_store_sap_restart_channel( + adapter->session.ap.operating_channel, + restart_chan_store); hdd_debug("ch:%d is safe. no need to change channel", adapter->session.ap.operating_channel); continue; @@ -9153,10 +9183,27 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) hdd_update_acs_timer_reason(adapter, QCA_WLAN_VENDOR_ACS_SELECT_REASON_LTE_COEX); continue; - } else + } + + restart_chan = 0; + for (i = 0; i < SAP_MAX_NUM_SESSION; i++) { + if (!restart_chan_store[i]) + continue; + + if (policy_mgr_is_force_scc(hdd_ctxt->psoc) && + WLAN_REG_IS_SAME_BAND_CHANNELS( + restart_chan_store[i], + adapter->session.ap. + operating_channel)) { + restart_chan = restart_chan_store[i]; + break; + } + } + if (!restart_chan) restart_chan = wlansap_get_safe_channel_from_pcl_and_acs_range( WLAN_HDD_GET_SAP_CTX_PTR(adapter)); + if (!restart_chan) { hdd_err("fail to restart SAP"); } else { @@ -9176,6 +9223,9 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) CSA_REASON_UNSAFE_CHANNEL); hdd_switch_sap_channel(adapter, restart_chan, true); + hdd_store_sap_restart_channel( + restart_chan, + restart_chan_store); } else { hdd_debug("sending coex indication");