ソースを参照

qcacld-3.0: Pass psoc instead of vdev for teardown links

As part of start_ap or connect_start to teardown active tdls peers
hdd_notify_teardown_tdls_links is called with argument vdev. But
TDLS might not be enabled on that vdev. With recent changes,
osif_priv object is initialized as part of tdls_vdev_init.
For the new interface if TDLS is not initialized then osif_priv
object will not be found and TDLS peers are not removed.

Change-Id: Idcf690bba2766664700a4851d390ee620f2fe73a
CRs-Fixed: 2460108
Bala Venkatesh 5 年 前
コミット
9bb9c05e83

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

@@ -1084,6 +1084,7 @@ QDF_STATUS nan_discovery_pre_enable(struct wlan_objmgr_psoc *psoc,
 		goto pre_enable_failure;
 	}
 	vdev_id = wlan_vdev_get_id(vdev);
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID);
 
 	status = policy_mgr_update_and_wait_for_connection_update(psoc,	vdev_id,
 					nan_social_channel,
@@ -1094,13 +1095,11 @@ QDF_STATUS nan_discovery_pre_enable(struct wlan_objmgr_psoc *psoc,
 	}
 
 	/* Try to teardown TDLS links, but do not wait */
-	status = ucfg_tdls_teardown_links(vdev);
+	status = ucfg_tdls_teardown_links(psoc);
 	if (QDF_IS_STATUS_ERROR(status))
 		nan_err("Failed to teardown TDLS links");
 
 pre_enable_failure:
-	if (vdev)
-		wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID);
 	if (pdev)
 		wlan_objmgr_pdev_release_ref(pdev, WLAN_NAN_ID);
 

+ 10 - 12
components/tdls/core/src/wlan_tdls_ct.c

@@ -1280,32 +1280,30 @@ void tdls_disable_offchan_and_teardown_links(
 	}
 }
 
-void tdls_teardown_connections(struct wlan_objmgr_vdev *vdev)
+void tdls_teardown_connections(struct wlan_objmgr_psoc *psoc)
 {
 	struct tdls_osif_indication indication;
 	struct tdls_soc_priv_obj *tdls_soc;
-	struct wlan_objmgr_vdev *tdls_vdev_obj;
+	struct wlan_objmgr_vdev *tdls_vdev;
 
-	if (!vdev) {
-		QDF_ASSERT(0);
-		return;
-	}
 
-	tdls_soc = wlan_vdev_get_tdls_soc_obj(vdev);
+	tdls_soc = wlan_psoc_get_tdls_soc_obj(psoc);
 	if (!tdls_soc)
 		return;
 
 	/* Get the tdls specific vdev and clear the links */
-	tdls_vdev_obj = tdls_get_vdev(tdls_soc->soc, WLAN_TDLS_SB_ID);
-	if (tdls_vdev_obj) {
-		tdls_disable_offchan_and_teardown_links(tdls_vdev_obj);
-		wlan_objmgr_vdev_release_ref(tdls_vdev_obj, WLAN_TDLS_SB_ID);
+	tdls_vdev = tdls_get_vdev(psoc, WLAN_TDLS_SB_ID);
+	if (!tdls_vdev) {
+		tdls_err("Unable get the vdev");
+		return;
 	}
+	tdls_disable_offchan_and_teardown_links(tdls_vdev);
 
-	indication.vdev = vdev;
+	indication.vdev = tdls_vdev;
 
 	if (tdls_soc->tdls_event_cb)
 		tdls_soc->tdls_event_cb(tdls_soc->tdls_evt_cb_data,
 				     TDLS_EVENT_TEARDOWN_LINKS_DONE,
 				     &indication);
+	wlan_objmgr_vdev_release_ref(tdls_vdev, WLAN_TDLS_SB_ID);
 }

+ 2 - 2
components/tdls/core/src/wlan_tdls_ct.h

@@ -161,11 +161,11 @@ bool tdls_is_vdev_authenticated(struct wlan_objmgr_vdev *vdev);
 
 /**
  * tdls_teardown_connections() -teardown and delete all the tdls peers
- * @vdev: vdev oobject
+ * @psoc: psoc object
  *
  * Return: true or false
  */
-void tdls_teardown_connections(struct wlan_objmgr_vdev *vdev);
+void tdls_teardown_connections(struct wlan_objmgr_psoc *psoc);
 
 /**
  * tdls_disable_offchan_and_teardown_links - Disable offchannel

+ 25 - 3
components/tdls/dispatcher/inc/wlan_tdls_ucfg_api.h

@@ -153,11 +153,11 @@ QDF_STATUS ucfg_tdls_responder(struct tdls_set_responder_req *msg_req);
 
 /**
  * ucfg_tdls_teardown_links() - teardown all TDLS links
- * @vdev: vdev object manager
+ * @psoc: psoc object
  *
  * Return: None
  */
-QDF_STATUS ucfg_tdls_teardown_links(struct wlan_objmgr_vdev *vdev);
+QDF_STATUS ucfg_tdls_teardown_links(struct wlan_objmgr_psoc *psoc);
 
 /**
  * ucfg_tdls_notify_reset_adapter() - notify reset adapter
@@ -278,6 +278,20 @@ QDF_STATUS ucfg_tdls_set_rssi(struct wlan_objmgr_vdev *vdev,
  * Return: void
  */
 void ucfg_tdls_notify_connect_failure(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_get_tdls_vdev() - Ucfg api to get tdls specific vdev object
+ * @psoc: wlan psoc object manager
+ * @dbg_id: debug id
+ *
+ * If TDLS is enabled on any vdev then return the corresponding vdev.
+ *
+ * This api increases the ref count of the returned vdev.
+ * Return: vdev manager pointer or NULL.
+ */
+struct wlan_objmgr_vdev *ucfg_get_tdls_vdev(struct wlan_objmgr_psoc *psoc,
+					    wlan_objmgr_ref_dbgid dbg_id);
+
 #else
 
 static inline
@@ -330,7 +344,7 @@ void ucfg_tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
 }
 
 static inline
-QDF_STATUS ucfg_tdls_teardown_links(struct wlan_objmgr_vdev *vdev)
+QDF_STATUS ucfg_tdls_teardown_links(struct wlan_objmgr_psoc *psoc)
 {
 	return QDF_STATUS_SUCCESS;
 }
@@ -346,5 +360,13 @@ static inline
 void ucfg_tdls_notify_connect_failure(struct wlan_objmgr_psoc *psoc)
 {
 }
+
+static inline
+struct wlan_objmgr_vdev *ucfg_get_tdls_vdev(struct wlan_objmgr_psoc *psoc,
+					    wlan_objmgr_ref_dbgid dbg_id)
+{
+	return NULL;
+}
+
 #endif /* FEATURE_WLAN_TDLS */
 #endif

+ 8 - 6
components/tdls/dispatcher/src/wlan_tdls_ucfg_api.c

@@ -764,18 +764,14 @@ QDF_STATUS ucfg_tdls_responder(struct tdls_set_responder_req *req)
 	return status;
 }
 
-QDF_STATUS ucfg_tdls_teardown_links(struct wlan_objmgr_vdev *vdev)
+QDF_STATUS ucfg_tdls_teardown_links(struct wlan_objmgr_psoc *psoc)
 {
 	QDF_STATUS status;
 	struct scheduler_msg msg = {0, };
 
-	if (!vdev) {
-		tdls_err("vdev is NULL ");
-		return QDF_STATUS_E_NULL_VALUE;
-	}
 	tdls_debug("Enter ");
 
-	msg.bodyptr = vdev;
+	msg.bodyptr = psoc;
 	msg.callback = tdls_process_cmd;
 	msg.flush_callback = ucfg_tdls_post_msg_flush_cb;
 	msg.type = TDLS_CMD_TEARDOWN_LINKS;
@@ -1123,3 +1119,9 @@ void ucfg_tdls_notify_connect_failure(struct wlan_objmgr_psoc *psoc)
 {
 	return tdls_notify_decrement_session(psoc);
 }
+
+struct wlan_objmgr_vdev *ucfg_get_tdls_vdev(struct wlan_objmgr_psoc *psoc,
+					    wlan_objmgr_ref_dbgid dbg_id)
+{
+	return tdls_get_vdev(psoc, dbg_id);
+}

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

@@ -16477,13 +16477,7 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter,
 	/* Disable roaming on all other adapters before connect start */
 	wlan_hdd_disable_roaming(adapter);
 
-	vdev = hdd_objmgr_get_vdev(adapter);
-	if (!vdev) {
-		status = -EINVAL;
-		goto ret_status;
-	}
-	hdd_notify_teardown_tdls_links(vdev);
-	hdd_objmgr_put_vdev(vdev);
+	hdd_notify_teardown_tdls_links(hdd_ctx->psoc);
 
 	qdf_mem_zero(&hdd_sta_ctx->conn_info.conn_flag,
 		     sizeof(hdd_sta_ctx->conn_info.conn_flag));

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

@@ -4942,7 +4942,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 
 	hdd_enter();
 
-	hdd_notify_teardown_tdls_links(adapter->vdev);
+	hdd_notify_teardown_tdls_links(hdd_ctx->psoc);
 
 	ucfg_mlme_get_sap_force_11n_for_11ac(hdd_ctx->psoc,
 					     &sap_force_11n_for_11ac);

+ 3 - 3
os_if/tdls/inc/wlan_cfg80211_tdls.h

@@ -261,14 +261,14 @@ void hdd_notify_sta_disconnect(uint8_t session_id,
 
 /**
  * hdd_notify_teardown_tdls_links() - notify TDLS to teardown links
- * @vdev: vdev object manager
+ * @psoc: psoc object
  *
  * Notify tdls to teardown all the links, due to certain events
  * in the system
  *
  * Return: None
  */
-void hdd_notify_teardown_tdls_links(struct wlan_objmgr_vdev *vdev);
+void hdd_notify_teardown_tdls_links(struct wlan_objmgr_psoc *psoc);
 
 #else /* FEATURE_WLAN_TDLS */
 static inline
@@ -312,7 +312,7 @@ int wlan_cfg80211_tdls_configure_mode(struct wlan_objmgr_vdev *vdev,
 }
 
 static inline
-void hdd_notify_teardown_tdls_links(struct wlan_objmgr_vdev *vdev)
+void hdd_notify_teardown_tdls_links(struct wlan_objmgr_psoc *psoc)
 {
 
 }

+ 17 - 8
os_if/tdls/src/wlan_cfg80211_tdls.c

@@ -101,27 +101,32 @@ void wlan_cfg80211_tdls_osif_priv_deinit(struct wlan_objmgr_vdev *vdev)
 	osif_priv->osif_tdls = NULL;
 }
 
-void hdd_notify_teardown_tdls_links(struct wlan_objmgr_vdev *vdev)
+void hdd_notify_teardown_tdls_links(struct wlan_objmgr_psoc *psoc)
 {
 	struct vdev_osif_priv *osif_priv;
 	struct osif_tdls_vdev *tdls_priv;
 	QDF_STATUS status;
 	unsigned long rc;
+	struct wlan_objmgr_vdev *vdev;
 
-	if (!vdev)
+	vdev = ucfg_get_tdls_vdev(psoc, WLAN_OSIF_ID);
+	if (!vdev) {
+		cfg80211_err("Unable to get the vdev");
 		return;
-
+	}
 	osif_priv = wlan_vdev_get_ospriv(vdev);
 
 	tdls_priv = osif_priv->osif_tdls;
-	if (!tdls_priv)
-		return;
+	if (!tdls_priv) {
+		cfg80211_err("tdls priv is NULL");
+		goto release_ref;
+	}
 
 	reinit_completion(&tdls_priv->tdls_teardown_comp);
-	status = ucfg_tdls_teardown_links(vdev);
+	status = ucfg_tdls_teardown_links(psoc);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		cfg80211_err("ucfg_tdls_teardown_links failed err %d", status);
-		return;
+		goto release_ref;
 	}
 
 	cfg80211_debug("Wait for tdls teardown completion. Timeout %u ms",
@@ -133,10 +138,14 @@ void hdd_notify_teardown_tdls_links(struct wlan_objmgr_vdev *vdev)
 
 	if (0 == rc) {
 		cfg80211_err(" Teardown Completion timed out rc: %ld", rc);
-		return;
+		goto release_ref;
 	}
 
 	cfg80211_debug("TDLS teardown completion status %ld ", rc);
+
+release_ref:
+	wlan_objmgr_vdev_release_ref(vdev,
+				     WLAN_OSIF_ID);
 }
 
 void hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev)