Ver código fonte

qcacld-3.0: Exempt STA + STA + NAN concurrency in host

Currently, host driver does not allow NDP formation if two STA is
in connected state. But driver should not allow NAN enable in first
if two STA is in connected state as STA + STA + NAN concurrency is
not allowed.

So, to fix this issue, add check for STA + STA concurrency in NAN
pre-enable in which NAN will drop if two STA + STA is present.

Change-Id: I6e6baa386d50b2903118660f10cc98ffcba60705
CRs-Fixed: 3481148
Rahul Gusain 1 ano atrás
pai
commit
8b87cede00

+ 14 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -4744,6 +4744,14 @@ bool policy_mgr_is_mlo_sap_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
 uint32_t
 policy_mgr_get_conc_ext_flags(struct wlan_objmgr_vdev *vdev, bool force_mlo);
 
+/**
+ * policy_mgr_is_non_ml_sta_present() - Check whether Non-ML STA is present
+ * @psoc: PSOC object information
+ *
+ * Return: True if non-ML STA is present, otherwise false.
+ */
+bool policy_mgr_is_non_ml_sta_present(struct wlan_objmgr_psoc *psoc);
+
 /**
  * policy_mgr_is_mlo_sta_present() - Check whether MLO STA is present
  * @psoc: PSOC object information
@@ -4888,6 +4896,12 @@ policy_mgr_get_conc_ext_flags(struct wlan_objmgr_vdev *vdev, bool force_mlo)
 	return 0;
 }
 
+static inline bool
+policy_mgr_is_non_ml_sta_present(struct wlan_objmgr_psoc *psoc)
+{
+	return true;
+}
+
 static inline bool policy_mgr_is_mlo_sta_present(struct wlan_objmgr_psoc *psoc)
 {
 	return false;

+ 41 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -5740,6 +5740,47 @@ policy_mgr_is_mlo_sap_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
 	return ret;
 }
 
+bool policy_mgr_is_non_ml_sta_present(struct wlan_objmgr_psoc *psoc)
+{
+	uint32_t conn_index = 0;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	struct wlan_objmgr_vdev *vdev;
+	bool non_ml_sta_present = false;
+	uint8_t vdev_id;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return false;
+	}
+
+	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
+	for (conn_index = 0;
+	     conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
+	     conn_index++) {
+		if (pm_conc_connection_list[conn_index].mode != PM_STA_MODE ||
+		    !pm_conc_connection_list[conn_index].in_use)
+			continue;
+
+		vdev_id = pm_conc_connection_list[conn_index].vdev_id;
+		vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+							    WLAN_POLICY_MGR_ID);
+		if (!vdev)
+			continue;
+
+		if (!wlan_vdev_mlme_is_mlo_vdev(vdev)) {
+			non_ml_sta_present = true;
+			wlan_objmgr_vdev_release_ref(vdev, WLAN_POLICY_MGR_ID);
+			break;
+		}
+
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_POLICY_MGR_ID);
+	}
+
+	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
+	return non_ml_sta_present;
+}
+
 bool policy_mgr_is_mlo_sta_present(struct wlan_objmgr_psoc *psoc)
 {
 	uint32_t conn_index = 0;

+ 40 - 0
components/nan/core/src/nan_main.c

@@ -1213,12 +1213,42 @@ void nan_handle_emlsr_concurrency(struct wlan_objmgr_psoc *psoc,
 	}
 }
 
+bool nan_is_sta_sta_concurrency_present(struct wlan_objmgr_psoc *psoc)
+{
+	uint32_t sta_cnt;
+
+	sta_cnt = policy_mgr_mode_specific_connection_count(psoc, PM_STA_MODE,
+							    NULL);
+	/* Allow if STA is not in connected state */
+	if (!sta_cnt)
+		return false;
+
+	/*
+	 * sta > 2 : (STA + STA + STA) or (ML STA + STA) or (ML STA + ML STA),
+	 * STA concurrency will be present.
+	 *
+	 * ML STA: Although both links would be treated as separate STAs
+	 * (sta cnt = 2) from policy mgr perspective, but it is not considered
+	 * as STA concurrency
+	 */
+	if (sta_cnt > 2 ||
+	    (sta_cnt == 2 && policy_mgr_is_non_ml_sta_present(psoc)))
+		return true;
+
+	return false;
+}
+
 QDF_STATUS nan_discovery_pre_enable(struct wlan_objmgr_pdev *pdev,
 				    uint32_t nan_ch_freq)
 {
 	QDF_STATUS status = QDF_STATUS_E_INVAL;
 	struct wlan_objmgr_psoc *psoc = wlan_pdev_get_psoc(pdev);
 
+	if (!psoc) {
+		nan_err("psoc is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
 	status = nan_set_discovery_state(psoc, NAN_DISC_ENABLE_IN_PROGRESS);
 
 	if (QDF_IS_STATUS_ERROR(status)) {
@@ -1235,6 +1265,16 @@ QDF_STATUS nan_discovery_pre_enable(struct wlan_objmgr_pdev *pdev,
 		goto pre_enable_failure;
 	}
 
+	/*
+	 * Reject STA+STA in below case
+	 * Non-ML STA: STA+STA+NAN concurrency is not supported
+	 */
+	if (nan_is_sta_sta_concurrency_present(psoc)) {
+		nan_err("STA+STA+NAN concurrency is not allowed");
+		status = QDF_STATUS_E_FAILURE;
+		goto pre_enable_failure;
+	}
+
 	wlan_p2p_abort_scan(pdev);
 
 	if (policy_mgr_is_hw_dbs_capable(psoc)) {

+ 8 - 0
components/nan/core/src/nan_main_i.h

@@ -316,5 +316,13 @@ uint8_t nan_get_vdev_id_from_bssid(struct wlan_objmgr_pdev *pdev,
 				   tSirMacAddr bssid,
 				   wlan_objmgr_ref_dbgid dbg_id);
 
+/*
+ * nan_is_sta_sta_concurrency_present: Queries whether STA + STA concurrency
+ * present
+ * @psoc: PSOC object
+ *
+ * Return: True if concurrency is present, False otherwise
+ */
+bool nan_is_sta_sta_concurrency_present(struct wlan_objmgr_psoc *psoc);
 #endif /* _WLAN_NAN_MAIN_I_H_ */
 #endif /* WLAN_FEATURE_NAN */

+ 2 - 14
components/nan/dispatcher/src/nan_ucfg_api.c

@@ -1167,21 +1167,9 @@ bool ucfg_nan_is_sta_ndp_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
 {
 	uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS];
 	uint32_t freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS];
-	uint32_t ndi_cnt, sta_cnt, id, conc_ext_flags;
+	uint32_t ndi_cnt, id, conc_ext_flags;
 
-	sta_cnt = policy_mgr_mode_specific_connection_count(psoc,
-							    PM_STA_MODE, NULL);
-	/* Allow if STA is not in connected state */
-	if (!sta_cnt)
-		return true;
-
-	/* Reject STA+STA in below case
-	 * Non-ML STA: STA+STA+NDP concurrency is not supported
-	 * ML STA: As both links would be treated as separate STAs from
-	 * policy mgr perspective, don't reject here and continue with further
-	 * checks
-	 */
-	if (sta_cnt > 1 && !policy_mgr_is_mlo_sta_present(psoc)) {
+	if (nan_is_sta_sta_concurrency_present(psoc)) {
 		nan_err("STA+STA+NDP concurrency is not allowed");
 		return false;
 	}