Sfoglia il codice sorgente

qcacld-3.0: Send NDI del rsp in NAN_DATA_DISCONNECTED_STATE state

NDI delete response is sent to userspace only when NDI is in
NAN_DATA_NDI_DELETING_STATE state. But NDI could be in
NAN_DATA_DISCONNECTED_STATE state if cleanup happens through
NDP_END_ALL path. Driver doesn't send response to userspace in
this case.
Send the response to userspace in NAN_DATA_DISCONNECTED_STATE also
as the application might be waiting for NDI delete status.
Also, use set/get APIs and avoid accessing NDI state directly.

Change-Id: I81a6b19a77144c76dde145f126c45b2ca67ff093
CRs-Fixed: 2679581
Srinivas Dasari 4 anni fa
parent
commit
632c058365

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

@@ -27,15 +27,20 @@
 #include "nan_public_structs.h"
 
 #ifdef WLAN_FEATURE_NAN
+#define ucfg_nan_set_ndi_state(vdev, state) \
+	__ucfg_nan_set_ndi_state(vdev, state, __func__)
+
 /**
  * ucfg_nan_set_ndi_state: set ndi state
  * @vdev: pointer to vdev object
  * @state: value to set
+ * @func: Caller of this API
  *
  * Return: status of operation
  */
-QDF_STATUS ucfg_nan_set_ndi_state(struct wlan_objmgr_vdev *vdev,
-				  uint32_t state);
+QDF_STATUS __ucfg_nan_set_ndi_state(struct wlan_objmgr_vdev *vdev,
+				    enum nan_datapath_state state,
+				    const char *func);
 
 /**
  * ucfg_nan_psoc_open: Setup NAN priv object params on PSOC open

+ 11 - 11
components/nan/dispatcher/src/nan_ucfg_api.c

@@ -108,18 +108,23 @@ void ucfg_nan_psoc_close(struct wlan_objmgr_psoc *psoc)
 	/* No cleanup required on psoc close for NAN */
 }
 
-inline QDF_STATUS ucfg_nan_set_ndi_state(struct wlan_objmgr_vdev *vdev,
-					 uint32_t state)
+inline QDF_STATUS __ucfg_nan_set_ndi_state(struct wlan_objmgr_vdev *vdev,
+					   enum nan_datapath_state state,
+					   const char *func)
 {
 	struct nan_vdev_priv_obj *priv_obj = nan_get_vdev_priv_obj(vdev);
+	enum nan_datapath_state current_state;
 
 	if (!priv_obj) {
 		nan_err("priv_obj is null");
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 	qdf_spin_lock_bh(&priv_obj->lock);
+	current_state = priv_obj->state;
 	priv_obj->state = state;
 	qdf_spin_unlock_bh(&priv_obj->lock);
+	nan_nofl_debug("%s: ndi state: current: %u, new: %u", func,
+		       current_state, state);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -839,21 +844,18 @@ ucfg_nan_disable_ndi(struct wlan_objmgr_psoc *psoc, uint32_t ndi_vdev_id)
 		wlan_objmgr_vdev_release_ref(ndi_vdev, WLAN_NAN_ID);
 		return QDF_STATUS_E_INVAL;
 	}
+	curr_ndi_state = ucfg_nan_get_ndi_state(ndi_vdev);
 
-	qdf_spin_lock_bh(&ndi_vdev_priv->lock);
-	curr_ndi_state = ndi_vdev_priv->state;
 	/*
 	 * Nothing to do if NDI is in DATA_END state.
 	 * Continue cleanup in NAN_DATA_NDI_DELETING_STATE as this API
 	 * can be called from hdd_ndi_delete.
 	 */
 	if (curr_ndi_state == NAN_DATA_END_STATE) {
-		qdf_spin_unlock_bh(&ndi_vdev_priv->lock);
 		wlan_objmgr_vdev_release_ref(ndi_vdev, WLAN_NAN_ID);
 		return QDF_STATUS_SUCCESS;
 	}
-	ndi_vdev_priv->state = NAN_DATA_END_STATE;
-	qdf_spin_unlock_bh(&ndi_vdev_priv->lock);
+	ucfg_nan_set_ndi_state(ndi_vdev, NAN_DATA_END_STATE);
 
 	request = osif_request_alloc(&params);
 	if (!request) {
@@ -896,12 +898,10 @@ ucfg_nan_disable_ndi(struct wlan_objmgr_psoc *psoc, uint32_t ndi_vdev_id)
 
 cleanup:
 	/* Restore original NDI state in case of failure */
-	qdf_spin_lock_bh(&ndi_vdev_priv->lock);
 	if (QDF_IS_STATUS_SUCCESS(status))
-		ndi_vdev_priv->state = NAN_DATA_DISCONNECTED_STATE;
+		ucfg_nan_set_ndi_state(ndi_vdev, NAN_DATA_DISCONNECTED_STATE);
 	else
-		ndi_vdev_priv->state = curr_ndi_state;
-	qdf_spin_unlock_bh(&ndi_vdev_priv->lock);
+		ucfg_nan_set_ndi_state(ndi_vdev, curr_ndi_state);
 
 	if (request)
 		osif_request_put(request);

+ 5 - 2
os_if/nan/src/os_if_nan.c

@@ -2369,14 +2369,17 @@ void os_if_nan_ndi_session_end(struct wlan_objmgr_vdev *vdev)
 	struct sk_buff *vendor_event;
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
+	enum nan_datapath_state state;
 
 	/*
 	 * The virtual adapters are stopped and closed even during
 	 * driver unload or stop, the service layer is not required
 	 * to be informed in that case (response is not expected)
 	 */
-	if (NAN_DATA_NDI_DELETING_STATE != ucfg_nan_get_ndi_state(vdev)) {
-		osif_err("NDI interface deleted");
+	state = ucfg_nan_get_ndi_state(vdev);
+	if (state != NAN_DATA_NDI_DELETING_STATE &&
+	    state != NAN_DATA_DISCONNECTED_STATE) {
+		osif_err("NDI interface deleted: state: %u", state);
 		return;
 	}