From 956b69e3e0f60330c280d249066a7627e56e66c4 Mon Sep 17 00:00:00 2001 From: Manikandan Mohan Date: Thu, 14 Feb 2019 13:08:14 -0800 Subject: [PATCH] qcacld-3.0: Add NAN+SAP concurrency related checks Add NAN+SAP concurrency setup constraints in HDD. Change-Id: Ie7f2fa5694fc1b8af5931e9216164acbfcf3eafd CRs-fixed: 2431539 --- core/hdd/src/wlan_hdd_cfg80211.c | 19 +++++++++++++------ core/hdd/src/wlan_hdd_hostapd.c | 23 ++++++++++++++++------- core/hdd/src/wlan_hdd_main.c | 14 +++++++++----- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 809bb6d1abf1..d9d3c954a37a 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -18254,7 +18254,7 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, struct cfg80211_connect_params *req) { int status; - u16 channel; + u16 channel, sap_cnt, sta_cnt; const u8 *bssid = NULL; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) const u8 *bssid_hint = req->bssid_hint; @@ -18301,13 +18301,20 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, /* * Disable NAN Discovery if incoming connection is P2P or if a STA - * connection already exists and if this is a case of STA+STA. + * connection already exists and if this is a case of STA+STA + * or SAP+STA concurrency */ - if (adapter->device_mode == QDF_P2P_CLIENT_MODE || - policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, - PM_STA_MODE, NULL)) - ucfg_nan_disable_concurrency(hdd_ctx->psoc); + sta_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, + PM_STA_MODE, NULL); + sap_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, + PM_SAP_MODE, NULL); + if (adapter->device_mode == QDF_P2P_CLIENT_MODE || sap_cnt || sta_cnt) { + hdd_debug("Invalid NAN concurrency. SAP: %d STA: %d P2P: %d", + sap_cnt, sta_cnt, + (adapter->device_mode == QDF_P2P_CLIENT_MODE)); + ucfg_nan_disable_concurrency(hdd_ctx->psoc); + } /* * STA+NDI concurrency gets preference over NDI+NDI. Disable * first NDI in case an NDI+NDI concurrency exists. diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 2f2bf5cfd030..77efae3d02b9 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -5586,7 +5586,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, hdd_unsafe_channel_restart_sap(hdd_ctx); hdd_set_connection_in_progress(false); - + policy_mgr_nan_sap_post_enable_conc_check(hdd_ctx->psoc); ret = 0; goto free; @@ -5948,7 +5948,7 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, struct sme_sta_inactivity_timeout *sta_inactivity_timer; uint8_t channel, mandt_chnl_list = 0; bool sta_sap_scc_on_dfs_chan; - uint16_t sta_cnt; + uint16_t sta_cnt, sap_cnt; bool val; struct wireless_dev *wdev = dev->ieee80211_ptr; @@ -6026,9 +6026,10 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan( hdd_ctx->psoc); - sta_cnt = - policy_mgr_mode_specific_connection_count( - hdd_ctx->psoc, PM_STA_MODE, NULL); + sta_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, + PM_STA_MODE, NULL); + sap_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, + PM_SAP_MODE, NULL); hdd_debug("sta_sap_scc_on_dfs_chan %u, sta_cnt %u", sta_sap_scc_on_dfs_chan, sta_cnt); @@ -6080,9 +6081,17 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, sap_cfg->SapHw_mode = eCSR_DOT11_MODE_abg; } - /* Disable NAN Discovery before starting P2P GO */ - if (adapter->device_mode == QDF_P2P_GO_MODE) + /* Disable NAN Disc before starting P2P GO or STA+SAP or SAP+SAP */ + if (adapter->device_mode == QDF_P2P_GO_MODE || sta_cnt || sap_cnt) { + hdd_debug("Invalid NAN concurrency. SAP: %d STA: %d P2P_GO: %d", + sap_cnt, sta_cnt, + (adapter->device_mode == QDF_P2P_GO_MODE)); ucfg_nan_disable_concurrency(hdd_ctx->psoc); + } + + if (!policy_mgr_nan_sap_pre_enable_conc_check(hdd_ctx->psoc, + PM_SAP_MODE, channel)) + hdd_debug("NAN disabled due to concurrency constraints"); /* check if concurrency is allowed */ if (!policy_mgr_allow_concurrency(hdd_ctx->psoc, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 291b5fc2c47a..63a139a23e00 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -8787,11 +8787,15 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt) * 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, - adapter->session.ap.operating_channel) && - scc_on_lte_coex) - hdd_debug("SAP is allowed on SCC channel, no need to move SAP"); - else { + if ((policy_mgr_is_sta_sap_scc( + hdd_ctxt->psoc, + adapter->session.ap.operating_channel) && + scc_on_lte_coex) || + policy_mgr_nan_sap_scc_on_unsafe_ch_chk( + hdd_ctxt->psoc, + adapter->session.ap.operating_channel)) { + hdd_debug("SAP allowed in unsafe SCC channel"); + } else { for (i = 0; i < hdd_ctxt->unsafe_channel_count; i++) { if (adapter->session.ap.operating_channel == hdd_ctxt->unsafe_channel_list[i]) {