From 5479cf853f851b327690bffbd1f168b9d0114fd2 Mon Sep 17 00:00:00 2001 From: Bala Venkatesh Date: Sat, 9 Jun 2018 20:02:38 +0530 Subject: [PATCH] qcacld-3.0: Skip CAC and ignore radar indication for SAP If STA is already connected on DFS channel and SAP is going to start on the same channel then skip the CAC for SAP. If STA and SAP sessions are already operating on same DFS channel, then ignore radar indication received on SAP interface. CRs-Fixed: 2130000 Change-Id: Ife0ab6979a07c8773001a43f5a30c9a555dab37a --- core/hdd/src/wlan_hdd_hostapd.c | 31 ++++++++++++++++++++++++- core/sap/src/sap_api_link_cntl.c | 13 +++++++++++ core/sap/src/sap_fsm.c | 39 ++++++++++++++++++++++++++++---- core/sap/src/sap_module.c | 8 +++++-- 4 files changed, 83 insertions(+), 8 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index e89acd1dd4a38..cbc2b41c29af1 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -7360,6 +7360,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, uint16_t prev_rsn_length = 0; enum dfs_mode mode; struct hdd_adapter *sta_adapter; + uint8_t ignore_cac = 0; hdd_enter(); @@ -7551,7 +7552,14 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, goto error; } } - wlansap_set_dfs_ignore_cac(mac_handle, iniConfig->ignoreCAC); + + if (iniConfig->ignoreCAC || + ((iniConfig->WlanMccToSccSwitchMode != + QDF_MCC_TO_SCC_SWITCH_DISABLE) && + iniConfig->sta_sap_scc_on_dfs_chan)) + ignore_cac = 1; + + wlansap_set_dfs_ignore_cac(mac_handle, ignore_cac); wlansap_set_dfs_restrict_japan_w53(mac_handle, iniConfig->gDisableDfsJapanW53); wlansap_set_dfs_preferred_channel_location(mac_handle, @@ -8425,6 +8433,8 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, int status; struct sme_sta_inactivity_timeout *sta_inactivity_timer; uint8_t channel; + bool sta_sap_scc_on_dfs_chan; + uint16_t sta_cnt; hdd_enter(); @@ -8473,6 +8483,25 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, adapter->session.ap.sap_config.ch_params.center_freq_seg1 = cds_freq_to_chan(params->chandef.center_freq2); + sta_sap_scc_on_dfs_chan = + policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan( + hdd_ctx->hdd_psoc); + sta_cnt = + policy_mgr_mode_specific_connection_count( + hdd_ctx->hdd_psoc, PM_STA_MODE, NULL); + + hdd_debug("sta_sap_scc_on_dfs_chan %u, sta_cnt %u", + sta_sap_scc_on_dfs_chan, sta_cnt); + + /* if sta_sap_scc_on_dfs_chan ini is set, DFS master capability is + * assumed disabled in the driver. + */ + if (channel && (reg_get_channel_state(hdd_ctx->hdd_pdev, channel) == + CHANNEL_STATE_DFS) && sta_sap_scc_on_dfs_chan && !sta_cnt) { + hdd_err("SAP not allowed on DFS channel!!"); + return -EINVAL; + } + if (cds_is_sub_20_mhz_enabled()) { enum channel_state ch_state; enum phy_ch_width sub_20_ch_width = CH_WIDTH_INVALID; diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index 8437ea68727c6..30bd195e5c4bc 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -932,6 +932,7 @@ wlansap_roam_callback(void *ctx, struct csr_roam_info *csr_roam_info, tHalHandle hal; tpAniSirGlobal mac_ctx = NULL; uint8_t intf; + bool sta_sap_scc_on_dfs_chan; if (QDF_IS_STATUS_ERROR(wlansap_context_get(ctx))) return QDF_STATUS_E_FAILURE; @@ -950,6 +951,8 @@ wlansap_roam_callback(void *ctx, struct csr_roam_info *csr_roam_info, FL("roam_status = %d, roam_result = %d"), roam_status, roam_result); + sta_sap_scc_on_dfs_chan = + policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(mac_ctx->psoc); switch (roam_status) { case eCSR_ROAM_INFRA_IND: @@ -1031,6 +1034,14 @@ wlansap_roam_callback(void *ctx, struct csr_roam_info *csr_roam_info, case eCSR_ROAM_DFS_RADAR_IND: QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, FL("Received Radar Indication")); + + if (sta_sap_scc_on_dfs_chan) { + QDF_TRACE(QDF_MODULE_ID_SAP, + QDF_TRACE_LEVEL_INFO_HIGH, + FL("Ignore the Radar indication")); + break; + } + if (sap_ctx->sapsMachine != eSAP_STARTED && sap_ctx->sapsMachine != eSAP_DFS_CAC_WAIT) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, @@ -1316,6 +1327,8 @@ wlansap_roam_callback(void *ctx, struct csr_roam_info *csr_roam_info, break; case eCSR_ROAM_RESULT_DFS_RADAR_FOUND_IND: + if (sta_sap_scc_on_dfs_chan) + break; wlansap_roam_process_dfs_radar_found(mac_ctx, sap_ctx, &qdf_ret_status); break; diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 8fe3157afeea8..f7565ffb43c9d 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -844,6 +844,8 @@ QDF_STATUS sap_goto_channel_sel(struct sap_context *sap_context, struct wlan_objmgr_vdev *vdev; uint8_t i; uint8_t pdev_id; + bool is_dfs; + bool is_safe; #ifdef SOFTAP_CHANNEL_RANGE uint8_t *channel_list = NULL; @@ -853,6 +855,7 @@ QDF_STATUS sap_goto_channel_sel(struct sap_context *sap_context, uint8_t con_ch; uint8_t vdev_id; uint32_t scan_id; + bool sta_sap_scc_on_dfs_chan; h_hal = cds_get_context(QDF_MODULE_ID_SME); if (NULL == h_hal) { @@ -906,10 +909,21 @@ QDF_STATUS sap_goto_channel_sel(struct sap_context *sap_context, sap_context->channel, sap_context->csr_roamProfile.phyMode, sap_context->cc_switch_mode); - if (con_ch && !(wlan_reg_is_dfs_ch(mac_ctx->pdev, - con_ch) && - sap_context->cc_switch_mode == - QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION)) { + + sta_sap_scc_on_dfs_chan = + policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan( + mac_ctx->psoc); + + if (sap_context->cc_switch_mode == + QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) + sta_sap_scc_on_dfs_chan = false; + + is_dfs = wlan_reg_is_dfs_ch(mac_ctx->pdev, con_ch); + is_safe = policy_mgr_is_safe_channel( + mac_ctx->psoc, con_ch); + + if (con_ch && is_safe && + (!is_dfs || (is_dfs && sta_sap_scc_on_dfs_chan))) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, "%s: Override ch %d to %d due to CC Intf", @@ -2508,6 +2522,12 @@ static QDF_STATUS sap_fsm_state_starting(struct sap_context *sap_ctx, eSAP_START_BSS_EVENT, (void *) eSAP_STATUS_SUCCESS); + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, + FL("ap_ctx->ch_params.ch_width %d, channel %d"), + sap_ctx->ch_params.ch_width, + reg_get_channel_state(mac_ctx->pdev, + sap_ctx->channel)); + /* * The upper layers have been informed that AP is up and * running, however, the AP is still not beaconing, until @@ -2531,12 +2551,18 @@ static QDF_STATUS sap_fsm_state_starting(struct sap_context *sap_ctx, is_dfs = true; } + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, + FL("is_dfs %d"), is_dfs); if (is_dfs) { sap_dfs_info = &mac_ctx->sap.SapDfsInfo; if ((false == sap_dfs_info->ignore_cac) && (eSAP_DFS_DO_NOT_SKIP_CAC == - sap_dfs_info->cac_state) && + sap_dfs_info->cac_state) && !sap_ctx->pre_cac_complete) { + QDF_TRACE(QDF_MODULE_ID_SAP, + QDF_TRACE_LEVEL_INFO_HIGH, + FL("start cac timer")); + /* Move the device in CAC_WAIT_STATE */ sap_ctx->sapsMachine = eSAP_DFS_CAC_WAIT; @@ -2552,6 +2578,9 @@ static QDF_STATUS sap_fsm_state_starting(struct sap_context *sap_ctx, qdf_status = sap_cac_start_notify(hal); } else { + QDF_TRACE(QDF_MODULE_ID_SAP, + QDF_TRACE_LEVEL_INFO_HIGH, + FL("skip cac timer")); wlansap_start_beacon_req(sap_ctx); } } diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index c0a5485f61685..671833d329a12 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -1292,6 +1292,7 @@ QDF_STATUS wlansap_set_channel_change_with_csa(struct sap_context *sapContext, void *hHal = NULL; bool valid; QDF_STATUS status; + bool sta_sap_scc_on_dfs_chan; if (NULL == sapContext) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, @@ -1319,6 +1320,8 @@ QDF_STATUS wlansap_set_channel_change_with_csa(struct sap_context *sapContext, policy_mgr_is_any_mode_active_on_band_along_with_session( pMac->psoc, sapContext->sessionId, POLICY_MGR_BAND_5)); + sta_sap_scc_on_dfs_chan = + policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(pMac->psoc); /* * Now, validate if the passed channel is valid in the * current regulatory domain. @@ -1328,9 +1331,10 @@ QDF_STATUS wlansap_set_channel_change_with_csa(struct sap_context *sapContext, CHANNEL_STATE_ENABLE) || (wlan_reg_get_channel_state(pMac->pdev, targetChannel) == CHANNEL_STATE_DFS && - !policy_mgr_is_any_mode_active_on_band_along_with_session( + (!policy_mgr_is_any_mode_active_on_band_along_with_session( pMac->psoc, sapContext->sessionId, - POLICY_MGR_BAND_5)))) { + POLICY_MGR_BAND_5) || + sta_sap_scc_on_dfs_chan)))) { /* * validate target channel switch w.r.t various concurrency * rules set.