diff options
| author | Ganesh Kondabattini <ganeshk@codeaurora.org> | 2017-11-23 19:28:40 +0530 |
|---|---|---|
| committer | snandini <snandini@codeaurora.org> | 2017-11-30 05:49:29 -0800 |
| commit | 6599bd87ea6cba2e5c5e47bd4811110818230036 (patch) | |
| tree | 7aaafce4f83985957491da686c059a35e908aba4 | |
| parent | 3ef0d643e0a8316bead16808cd6719806fc65240 (diff) | |
qcacld-3.0: Move the SAP to non DFS channel after STA disconnection
Standalone SAP is not allowed on DFS channel if STA+SAP SCC enabled
on DFS channel. So move the SAP to a non DFS channel as soon as STA
gets disconnect.
CRs-Fixed: 2145495
Change-Id: I27d018739f53997641a7113cfc7c844e02bd7e29
| -rw-r--r-- | core/cds/src/cds_concurrency.c | 139 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_assoc.c | 3 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_hostapd.c | 2 | ||||
| -rw-r--r-- | core/sap/inc/sap_api.h | 1 |
4 files changed, 126 insertions, 19 deletions
diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index bac4efd8d9db..a896d9295e95 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -7685,6 +7685,60 @@ bool cds_is_safe_channel(uint8_t channel) } /** + * cds_is_sap_restart_required_after_sta_disconnect() - is sap restart required + * after sta disconnection + * @hdd_ctx: pointer to hdd context + * @intf_ch: sap channel + * + * Check if SAP should be moved to a non dfs channel after STA disconnection. + * This API applicable only for STA+SAP SCC and ini 'sta_sap_scc_on_dfs_chan' + * is enabled. + * + * Return: true if sap restart is required, otherwise false + */ + +static bool cds_is_sap_restart_required_after_sta_disconnect( + hdd_context_t *hdd_ctx, uint8_t *intf_ch) +{ + hdd_adapter_t *ap_adapter; + hdd_ap_ctx_t *hdd_ap_ctx; + uint8_t sap_chan = cds_mode_specific_get_channel(CDS_SAP_MODE); + bool sta_sap_scc_on_dfs_chan = + cds_is_sta_sap_scc_allowed_on_dfs_channel(); + + *intf_ch = 0; + + cds_debug("sta_sap_scc_on_dfs_chan %u, sap_chan %u", + sta_sap_scc_on_dfs_chan, sap_chan); + if (!sta_sap_scc_on_dfs_chan || + !(sap_chan && CDS_IS_CHANNEL_5GHZ(sap_chan) && + (cds_get_channel_state(sap_chan) == + CHANNEL_STATE_DFS))) { + return false; + } + + ap_adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE); + if (ap_adapter == NULL) { + cds_err("Invalid ap_adapter"); + return false; + } + + if (!test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) { + cds_err("SOFTAP_BSS_STARTED not set"); + return false; + } + + hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter); + + *intf_ch = + hdd_ap_ctx->sapConfig.user_config_channel; + + cds_debug("Standalone SAP is not allowed on DFS channel, Move it to channel %u", + *intf_ch); + return true; +} + +/** * __cds_check_sta_ap_concurrent_ch_intf() - Restart SAP in * STA-AP case * @data: Pointer to STA adapter @@ -7703,6 +7757,7 @@ static void __cds_check_sta_ap_concurrent_ch_intf(void *data) uint8_t intf_ch = 0; p_cds_contextType cds_ctx; hdd_station_ctx_t *hdd_sta_ctx; + bool skip_conc_check = false; cds_ctx = cds_get_global_context(); if (!cds_ctx) { @@ -7730,6 +7785,21 @@ static void __cds_check_sta_ap_concurrent_ch_intf(void *data) hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(sta_adapter); + if (cds_get_connection_count() == 1) { + /* + * If STA+SAP sessions are on DFS channel and STA+SAP SCC is + * enabled on DFS channel then move the SAP out of DFS channel + * as soon as STA gets disconnect. + */ + if (cds_is_sap_restart_required_after_sta_disconnect( + hdd_ctx, &intf_ch)) { + cds_debug("move the SAP to configured channel %u", + intf_ch); + skip_conc_check = true; + goto sap_restart; + } + } + cds_debug("cds_concurrent_open_sessions_running: %d", cds_concurrent_open_sessions_running()); @@ -7742,6 +7812,7 @@ static void __cds_check_sta_ap_concurrent_ch_intf(void *data) goto end; } +sap_restart: ap_adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE); if (ap_adapter == NULL) { cds_err("Invalid ap_adapter"); @@ -7761,30 +7832,33 @@ static void __cds_check_sta_ap_concurrent_ch_intf(void *data) goto end; } - /* - * 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 - * supported, return from here if DBS is not supported. - * Need to take care of 3 port cases with 2 STA iface in future. - */ - intf_ch = wlansap_check_cc_intf(hdd_ap_ctx->sapContext); + if (!skip_conc_check) { + /* + * 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 supported, return from here if DBS is not + * supported. Need to take care of 3 port cases with 2 STA + * iface in future. + */ + intf_ch = wlansap_check_cc_intf(hdd_ap_ctx->sapContext); - cds_debug("intf_ch:%d", intf_ch); - if (QDF_IS_STATUS_ERROR( - cds_valid_sap_conc_channel_check(&intf_ch, + cds_debug("intf_ch:%d", intf_ch); + if (QDF_IS_STATUS_ERROR(cds_valid_sap_conc_channel_check( + &intf_ch, cds_mode_specific_get_channel(CDS_SAP_MODE)))) { cds_debug("can't move sap to %d", hdd_sta_ctx->conn_info.operationChannel); goto end; - } - if (intf_ch == 0) { - cds_debug("No need for sap channel change"); - goto end; - } + } - cds_debug("SAP moves due to MCC->SCC/DBS switch, orig chan: %d, new chan: %d", - hdd_ap_ctx->sapConfig.channel, intf_ch); + if (intf_ch == 0) { + cds_debug("No need for sap channel change"); + goto end; + } + cds_debug("SAP moves due to MCC->SCC/DBS switch, orig chan: %d, new chan: %d", + hdd_ap_ctx->sapConfig.channel, intf_ch); + } hdd_ap_ctx->sapConfig.channel = intf_ch; hdd_ap_ctx->sapConfig.ch_params.ch_width = hdd_ap_ctx->sapConfig.ch_width_orig; @@ -7845,6 +7919,8 @@ void cds_check_concurrent_intf_and_restart_sap(hdd_adapter_t *adapter) { hdd_context_t *hdd_ctx; hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); + bool restart_sap = false; + uint8_t sap_ch; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (!hdd_ctx) { @@ -7852,6 +7928,21 @@ void cds_check_concurrent_intf_and_restart_sap(hdd_adapter_t *adapter) return; } + if (cds_get_connection_count() == 1) { + /* + * If STA+SAP sessions are on DFS channel and STA+SAP SCC is + * enabled on DFS channel then move the SAP out of DFS channel + * as soon as STA gets disconnect. + */ + if (cds_is_sap_restart_required_after_sta_disconnect(hdd_ctx, + &sap_ch)) { + cds_debug("move the SAP to configured channel %u", + sap_ch); + restart_sap = true; + goto sap_restart; + } + } + cds_debug("mode:%d rule1:%d rule2:%d chan:%d", hdd_ctx->config->WlanMccToSccSwitchMode, hdd_ctx->config->conc_custom_rule1, @@ -7867,13 +7958,23 @@ void cds_check_concurrent_intf_and_restart_sap(hdd_adapter_t *adapter) return; } - if ((hdd_ctx->config->WlanMccToSccSwitchMode +sap_restart: + /* + * If sta_sap_scc_on_dfs_chan is true then standalone SAP is not + * allowed on DFS channel. SAP is allowed on DFS channel only when STA + * is already connected on that channel. + * In following condition restart_sap will be true if + * sta_sap_scc_on_dfs_chan is true and SAP is on DFS channel. + * This scenario can come if STA+SAP are operating on DFS channel and + * STA gets disconnected. + */ + if (restart_sap || ((hdd_ctx->config->WlanMccToSccSwitchMode != QDF_MCC_TO_SCC_SWITCH_DISABLE) && ((0 == hdd_ctx->config->conc_custom_rule1) && (0 == hdd_ctx->config->conc_custom_rule2)) && cds_valid_sta_channel_check(hdd_sta_ctx->conn_info. operationChannel) && - !hdd_ctx->sta_ap_intf_check_work_info) { + !hdd_ctx->sta_ap_intf_check_work_info)) { struct sta_ap_intf_check_work_ctx *work_info; work_info = qdf_mem_malloc( diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index eb5a2297a30d..61d1010281e1 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1718,6 +1718,9 @@ static QDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter, pAdapter->hdd_stats.hddTxRxStats.cont_txtimeout_cnt = 0; + hdd_debug("check for SAP restart"); + cds_check_concurrent_intf_and_restart_sap(pAdapter); + /* Unblock anyone waiting for disconnect to complete */ complete(&pAdapter->disconnect_comp_var); diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 79778160b1ed..e9a01efd5cb1 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -7932,6 +7932,8 @@ int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, pConfig->acs_dfs_mode = wlan_hdd_get_dfs_mode(mode); } + pConfig->user_config_channel = pConfig->channel; + hdd_debug("pConfig->channel %d, pConfig->acs_dfs_mode %d", pConfig->channel, pConfig->acs_dfs_mode); diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 80f214efcac1..1f975e305bed 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -626,6 +626,7 @@ typedef struct sap_Config { uint16_t reduced_beacon_interval; bool dfs_beacon_tx_enhanced; bool chan_switch_hostapd_rate_enabled; + uint32_t user_config_channel; } tsap_Config_t; #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE |
