Procházet zdrojové kódy

qcacld-3.0: Disable NDPs on SAP startup

NAN_NDP+SAP concurrency is not supported. Disable all NAN_NDP
sessions on SAP startup.

Change-Id: I73284ef4f820dd15df808b9c44da5f09c6b5db26
CRs-fixed: 2524112
Manikandan Mohan před 5 roky
rodič
revize
a440567c76

+ 5 - 2
components/nan/dispatcher/inc/nan_ucfg_api.h

@@ -314,11 +314,13 @@ int ucfg_nan_register_wma_callbacks(struct wlan_objmgr_psoc *psoc,
  * ucfg_nan_check_and_disable_unsupported_ndi: ucfg API to check if NAN Datapath
  * is active on multiple NDI's and disable the unsupported concurrencies.
  * @psoc: pointer to psoc object
+ * @force: When set forces NDI disable
  *
  * Return: QDF_STATUS
  */
 QDF_STATUS
-ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc);
+ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc,
+					   bool force);
 
 /**
  * ucfg_ndi_remove_entry_from_policy_mgr() - API to remove NDI entry from
@@ -342,7 +344,8 @@ static inline void ucfg_nan_disable_concurrency(struct wlan_objmgr_psoc *psoc)
 }
 
 static inline QDF_STATUS
-ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc)
+ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc,
+					   bool force)
 {
 	return QDF_STATUS_SUCCESS;
 }

+ 57 - 22
components/nan/dispatcher/src/nan_ucfg_api.c

@@ -724,12 +724,11 @@ void ucfg_nan_disable_concurrency(struct wlan_objmgr_psoc *psoc)
 	osif_request_put(request);
 }
 
-QDF_STATUS
-ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc)
+static QDF_STATUS
+ucfg_nan_disable_ndi(struct wlan_objmgr_psoc *psoc, uint32_t ndi_vdev_id)
 {
 	enum nan_datapath_state curr_ndi_state;
 	struct nan_datapath_host_event *event;
-	uint32_t ndi_count, first_ndi_vdev_id;
 	struct nan_vdev_priv_obj *ndi_vdev_priv;
 	struct nan_datapath_end_all_ndps req = {0};
 	struct wlan_objmgr_vdev *ndi_vdev;
@@ -741,27 +740,10 @@ ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc)
 		.timeout_ms = 1000,
 	};
 
-	if (!psoc) {
-		nan_err("psoc object is NULL, no action will be taken");
-		return QDF_STATUS_E_INVAL;
-	}
-
 	if (!ucfg_is_ndi_dbs_supported(psoc))
 		return QDF_STATUS_SUCCESS;
 
-	ndi_count = policy_mgr_mode_specific_connection_count(psoc, PM_NDI_MODE,
-							      NULL);
-	if (ndi_count < 2) {
-		nan_debug("No more than one NDI is active, nothing to do...");
-		return QDF_STATUS_SUCCESS;
-	}
-
-	/*
-	 * At least 2 NDI active concurrencies exist. Disable all NDP's on the
-	 * first NDI to support an incoming connection.
-	 */
-	first_ndi_vdev_id = policy_mgr_mode_specific_vdev_id(psoc, PM_NDI_MODE);
-	ndi_vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, first_ndi_vdev_id,
+	ndi_vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, ndi_vdev_id,
 							WLAN_NAN_ID);
 	if (!ndi_vdev) {
 		nan_err("Cannot obtain NDI vdev object!");
@@ -804,7 +786,7 @@ ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc)
 		goto cleanup;
 	}
 
-	nan_debug("Disabling all NDP's on NDI vdev id - %d", first_ndi_vdev_id);
+	nan_debug("Disabling all NDP's on NDI vdev id - %d", ndi_vdev_id);
 
 	err = osif_request_wait_for_response(request);
 	if (err) {
@@ -817,6 +799,13 @@ ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc)
 	if (!event->ndp_termination_in_progress) {
 		nan_err("Failed to terminate NDP's on NDI");
 		status = QDF_STATUS_E_FAILURE;
+	} else {
+		/*
+		 * Host can assume NDP delete is successful and
+		 * remove policy mgr entry
+		 */
+		policy_mgr_decr_session_set_pcl(psoc, QDF_NDI_MODE,
+						ndi_vdev_id);
 	}
 
 cleanup:
@@ -834,6 +823,52 @@ cleanup:
 	return status;
 }
 
+QDF_STATUS
+ucfg_nan_check_and_disable_unsupported_ndi(struct wlan_objmgr_psoc *psoc,
+					   bool force)
+{
+	uint32_t ndi_count, first_ndi_vdev_id, i;
+	QDF_STATUS status;
+
+	if (!psoc) {
+		nan_err("psoc object is NULL, no action will be taken");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!ucfg_is_ndi_dbs_supported(psoc))
+		return QDF_STATUS_SUCCESS;
+
+	ndi_count = policy_mgr_mode_specific_connection_count(psoc, PM_NDI_MODE,
+							      NULL);
+	/* NDP force disable is done for unsupported concurrencies: NDI+SAP */
+	if (force) {
+		nan_warn("Force disable all NDPs");
+		for (i = 0; i < ndi_count; i++) {
+			first_ndi_vdev_id =
+				policy_mgr_mode_specific_vdev_id(psoc,
+								 PM_NDI_MODE);
+			status = ucfg_nan_disable_ndi(psoc, first_ndi_vdev_id);
+			if (QDF_IS_STATUS_ERROR(status))
+				return status;
+		}
+		return QDF_STATUS_SUCCESS;
+	}
+
+	if (ndi_count < 2) {
+		nan_debug("No more than one NDI is active, nothing to do...");
+		return QDF_STATUS_SUCCESS;
+	}
+
+	/*
+	 * At least 2 NDI active concurrencies exist. Disable all NDP's on the
+	 * first NDI to support an incoming connection.
+	 */
+	first_ndi_vdev_id = policy_mgr_mode_specific_vdev_id(psoc, PM_NDI_MODE);
+	status = ucfg_nan_disable_ndi(psoc, first_ndi_vdev_id);
+
+	return status;
+}
+
 QDF_STATUS ucfg_ndi_remove_entry_from_policy_mgr(struct wlan_objmgr_vdev *vdev)
 {
 	struct wlan_objmgr_psoc *psoc;

+ 1 - 1
core/hdd/src/wlan_hdd_cfg80211.c

@@ -19574,7 +19574,7 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
 	 * STA+NDI concurrency gets preference over NDI+NDI. Disable
 	 * first NDI in case an NDI+NDI concurrency exists.
 	 */
-	ucfg_nan_check_and_disable_unsupported_ndi(hdd_ctx->psoc);
+	ucfg_nan_check_and_disable_unsupported_ndi(hdd_ctx->psoc, false);
 
 	if (req->bssid)
 		bssid = req->bssid;

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

@@ -6299,6 +6299,8 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 		ucfg_nan_disable_concurrency(hdd_ctx->psoc);
 	}
 
+	/* NDI + SAP not supported */
+	ucfg_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, channel))
 		hdd_debug("NAN disabled due to concurrency constraints");