Browse Source

qcacld-3.0: Handle SAP+NAN concurrency when NAN_DBS isn't supported

When nan_sap and nan_disable are supported but nan_dbs is not
supported,
1. Allow SAP+NAN concurrency if force SCC is supported
2. Disable NAN if SAP comes up on a different band and force SCC is
   not supported
3. Reject NAN enable if SAP is already on a different band and force SCC is
   not supported

Change-Id: Ic53eedcda2e5b314f9be2a4bd913d5e63f6613a2
CRs-Fixed: 2729986
Srinivas Dasari 4 years ago
parent
commit
8e493f081d

+ 31 - 18
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -1605,30 +1605,35 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc,
 
 	if (!wlan_nan_get_sap_conc_support(pm_ctx->psoc)) {
 		policy_mgr_debug("NAN+SAP not supported in fw");
+		/* Reject NAN as SAP is of high priority */
 		if (mode == PM_NAN_DISC_MODE)
 			return false;
 		/* Before SAP start disable NAN */
 		ucfg_nan_disable_concurrency(pm_ctx->psoc);
+		return true;
 	}
+
 	if (mode == PM_NAN_DISC_MODE) {
 		sap_freq = policy_mgr_mode_specific_get_channel(pm_ctx->psoc,
 								PM_SAP_MODE);
 		policy_mgr_debug("FREQ SAP: %d NAN: %d", sap_freq, ch_freq);
-		if (WLAN_REG_IS_SAME_BAND_FREQS(sap_freq, ch_freq)) {
-			if (sap_freq == ch_freq) {
-				policy_mgr_debug("NAN+SAP SCC");
-				return true;
-			}
+		if (ucfg_is_nan_dbs_supported(pm_ctx->psoc) &&
+		    !WLAN_REG_IS_SAME_BAND_FREQS(sap_freq, ch_freq))
+			return true;
 
-			if (!policy_mgr_is_force_scc(pm_ctx->psoc)) {
-				policy_mgr_debug("SAP force SCC disabled");
-				return false;
-			}
-			if (!policy_mgr_is_nan_sap_unsafe_ch_scc_allowed(
-							pm_ctx, ch_freq)) {
-				policy_mgr_debug("NAN+SAP unsafe ch SCC disabled");
-				return false;
-			}
+		if (sap_freq == ch_freq) {
+			policy_mgr_debug("NAN+SAP SCC");
+			return true;
+		}
+
+		if (!policy_mgr_is_force_scc(pm_ctx->psoc)) {
+			policy_mgr_debug("SAP force SCC disabled");
+			return false;
+		}
+		if (!policy_mgr_is_nan_sap_unsafe_ch_scc_allowed(
+						pm_ctx, ch_freq)) {
+			policy_mgr_debug("NAN+SAP unsafe ch SCC disabled");
+			return false;
 		}
 	} else if (mode == PM_SAP_MODE) {
 		nan_2g_freq =
@@ -1637,8 +1642,16 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc,
 		nan_5g_freq = wlan_nan_get_disc_5g_ch_freq(pm_ctx->psoc);
 		policy_mgr_debug("SAP CH: %d NAN Ch: %d %d", ch_freq,
 				 nan_2g_freq, nan_5g_freq);
-		if (WLAN_REG_IS_SAME_BAND_FREQS(nan_2g_freq, ch_freq) ||
-		    WLAN_REG_IS_SAME_BAND_FREQS(nan_5g_freq, ch_freq)) {
+		if (ucfg_is_nan_conc_control_supported(pm_ctx->psoc) &&
+		    !ucfg_is_nan_dbs_supported(pm_ctx->psoc) &&
+		    !WLAN_REG_IS_SAME_BAND_FREQS(nan_2g_freq, ch_freq)) {
+			if (!policy_mgr_is_force_scc(pm_ctx->psoc)) {
+				policy_mgr_debug("NAN and SAP are in different bands but SAP force SCC disabled");
+				ucfg_nan_disable_concurrency(pm_ctx->psoc);
+				return true;
+			}
+		} else if (WLAN_REG_IS_SAME_BAND_FREQS(nan_2g_freq, ch_freq) ||
+			   WLAN_REG_IS_SAME_BAND_FREQS(nan_5g_freq, ch_freq)) {
 			if (ch_freq == nan_2g_freq || ch_freq == nan_5g_freq) {
 				policy_mgr_debug("NAN+SAP SCC");
 				return true;
@@ -1646,7 +1659,7 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc,
 			if (!policy_mgr_is_force_scc(pm_ctx->psoc)) {
 				policy_mgr_debug("SAP force SCC disabled");
 				ucfg_nan_disable_concurrency(pm_ctx->psoc);
-				return false;
+				return true;
 			}
 			if ((WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) &&
 			     !policy_mgr_is_nan_sap_unsafe_ch_scc_allowed(
@@ -1656,7 +1669,7 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc,
 			     pm_ctx, nan_2g_freq))) {
 				policy_mgr_debug("NAN+SAP unsafe ch SCC disabled");
 				ucfg_nan_disable_concurrency(pm_ctx->psoc);
-				return false;
+				return true;
 			}
 		}
 	}

+ 4 - 3
components/nan/core/src/nan_main.c

@@ -1146,7 +1146,9 @@ QDF_STATUS nan_discovery_pre_enable(struct wlan_objmgr_psoc *psoc,
 		goto pre_enable_failure;
 	}
 
-	if (!policy_mgr_nan_sap_pre_enable_conc_check(psoc, PM_NAN_DISC_MODE,
+	if (policy_mgr_mode_specific_connection_count(psoc, PM_SAP_MODE,
+						      NULL) &&
+	    !policy_mgr_nan_sap_pre_enable_conc_check(psoc, PM_NAN_DISC_MODE,
 						      nan_ch_freq)) {
 		nan_debug("NAN not enabled due to concurrency constraints");
 		status = QDF_STATUS_E_INVAL;
@@ -1386,6 +1388,5 @@ bool wlan_nan_get_sap_conc_support(struct wlan_objmgr_psoc *psoc)
 	}
 
 	return (psoc_nan_obj->nan_caps.nan_sap_supported &&
-		psoc_nan_obj->nan_caps.nan_dbs_supported &&
-		psoc_nan_obj->nan_caps.nan_conc_control);
+		ucfg_is_nan_conc_control_supported(psoc));
 }

+ 6 - 0
components/nan/dispatcher/inc/nan_ucfg_api.h

@@ -546,5 +546,11 @@ bool ucfg_is_nan_vdev(struct wlan_objmgr_vdev *vdev)
 {
 	return false;
 }
+
+static inline
+bool ucfg_is_nan_dbs_supported(struct wlan_objmgr_psoc *psoc)
+{
+	return false;
+}
 #endif /* WLAN_FEATURE_NAN */
 #endif /* _NAN_UCFG_API_H_ */

+ 5 - 2
core/hdd/src/wlan_hdd_hostapd.c

@@ -6482,8 +6482,11 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 
 	/* NDI + SAP conditional supported */
 	hdd_sap_nan_check_and_disable_unsupported_ndi(hdd_ctx->psoc, true);
-	if (!policy_mgr_nan_sap_pre_enable_conc_check(
-	    hdd_ctx->psoc, PM_SAP_MODE, wlan_chan_to_freq(channel)))
+
+	if (policy_mgr_mode_specific_connection_count(hdd_ctx->psoc,
+						      PM_NAN_DISC_MODE, NULL) &&
+	    !policy_mgr_nan_sap_pre_enable_conc_check(hdd_ctx->psoc,
+				PM_SAP_MODE, wlan_chan_to_freq(channel)))
 		hdd_debug("NAN disabled due to concurrency constraints");
 
 	/* check if concurrency is allowed */