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");