Prechádzať zdrojové kódy

qcacmn: Separate peer object creation from other initialization

Seperate the dp peer object allocation from setting the peer's
default routing and default rx tid queues.

This change is to address a race condition where the HTT peer map
message arrives before the peer object is created.

Change-Id: Ibb0671d29ffac41fd06bb8a88476f37120d99ccb
CRs-Fixed: 1089662
Dhanashri Atre 8 rokov pred
rodič
commit
6d90ef32d5
4 zmenil súbory, kde vykonal 73 pridanie a 21 odobranie
  1. 24 6
      dp/inc/cdp_txrx_cmn.h
  2. 8 2
      dp/inc/cdp_txrx_ops.h
  3. 38 13
      dp/wifi3.0/dp_main.c
  4. 3 0
      dp/wifi3.0/dp_rx.c

+ 24 - 6
dp/inc/cdp_txrx_cmn.h

@@ -102,21 +102,39 @@ cdp_pdev_detach(ol_txrx_soc_handle soc, void *pdev, int force)
 	return;
 }
 
-static inline void *cdp_peer_attach
+static inline void *cdp_peer_create
 	(ol_txrx_soc_handle soc, void *vdev,
 	uint8_t *peer_mac_addr)
 {
-	if (soc->ops->cmn_drv_ops->txrx_peer_attach)
-		return soc->ops->cmn_drv_ops->txrx_peer_attach(vdev,
+	if (soc->ops->cmn_drv_ops->txrx_peer_create)
+		return soc->ops->cmn_drv_ops->txrx_peer_create(vdev,
 			peer_mac_addr);
 	return NULL;
 }
 
+static inline void cdp_peer_setup
+	(ol_txrx_soc_handle soc, void *vdev, void *peer)
+{
+	if (soc->ops->cmn_drv_ops->txrx_peer_setup)
+		return soc->ops->cmn_drv_ops->txrx_peer_setup(vdev,
+			peer);
+	return;
+}
+
+static inline void cdp_peer_teardown
+	(ol_txrx_soc_handle soc, void *vdev, void *peer)
+{
+	if (soc->ops->cmn_drv_ops->txrx_peer_teardown)
+		return soc->ops->cmn_drv_ops->txrx_peer_teardown(vdev,
+			peer);
+	return;
+}
+
 static inline void
-cdp_peer_detach(ol_txrx_soc_handle soc, void *peer)
+cdp_peer_delete(ol_txrx_soc_handle soc, void *peer)
 {
-	if (soc->ops->cmn_drv_ops->txrx_peer_detach)
-		return soc->ops->cmn_drv_ops->txrx_peer_detach(peer);
+	if (soc->ops->cmn_drv_ops->txrx_peer_delete)
+		return soc->ops->cmn_drv_ops->txrx_peer_delete(peer);
 	return;
 }
 

+ 8 - 2
dp/inc/cdp_txrx_ops.h

@@ -59,10 +59,16 @@ struct cdp_cmn_ops {
 
 	void(*txrx_pdev_detach)(void *pdev, int force);
 
-	void *(*txrx_peer_attach)
+	void *(*txrx_peer_create)
 		(void *vdev, uint8_t *peer_mac_addr);
 
-	void(*txrx_peer_detach)(void *peer);
+	void (*txrx_peer_setup)
+		(void *vdev_hdl, void *peer_hdl);
+
+	void (*txrx_peer_teardown)
+		(void *vdev_hdl, void *peer_hdl);
+
+	void(*txrx_peer_delete)(void *peer);
 
 	int(*txrx_set_monitor_mode)(void *vdev);
 

+ 38 - 13
dp/wifi3.0/dp_main.c

@@ -1292,13 +1292,13 @@ void dp_vdev_detach_wifi3(void *vdev_handle,
 }
 
 /*
- * dp_peer_attach_wifi3() - attach txrx peer
+ * dp_peer_create_wifi3() - attach txrx peer
  * @txrx_vdev: Datapath VDEV handle
  * @peer_mac_addr: Peer MAC address
  *
  * Return: DP peeer handle on success, NULL on failure
  */
-void *dp_peer_attach_wifi3(void *vdev_handle, uint8_t *peer_mac_addr)
+void *dp_peer_create_wifi3(void *vdev_handle, uint8_t *peer_mac_addr)
 {
 	struct dp_peer *peer;
 	int i;
@@ -1333,8 +1333,6 @@ void *dp_peer_attach_wifi3(void *vdev_handle, uint8_t *peer_mac_addr)
 	/* TODO: See of rx_opt_proc is really required */
 	peer->rx_opt_proc = soc->rx_opt_proc;
 
-	dp_peer_rx_init(pdev, peer);
-
 	/* initialize the peer_id */
 	for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++)
 		peer->peer_ids[i] = HTT_INVALID_PEER;
@@ -1353,12 +1351,6 @@ void *dp_peer_attach_wifi3(void *vdev_handle, uint8_t *peer_mac_addr)
 	/* TODO: See if hash based search is required */
 	dp_peer_find_hash_add(soc, peer);
 
-	if (soc->cdp_soc.ol_ops->peer_set_default_routing) {
-		/* TODO: Check on the destination ring number to be passed to FW */
-		soc->cdp_soc.ol_ops->peer_set_default_routing(soc->osif_soc, peer->mac_addr.raw,
-			peer->vdev->vdev_id, 0, 1);
-	}
-
 	QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
 		"vdev %p created peer %p (%02x:%02x:%02x:%02x:%02x:%02x)\n",
 		vdev, peer,
@@ -1381,6 +1373,37 @@ void *dp_peer_attach_wifi3(void *vdev_handle, uint8_t *peer_mac_addr)
 	return (void *)peer;
 }
 
+/*
+ * dp_peer_setup_wifi3() - initialize the peer
+ * @vdev_hdl: virtual device object
+ * @peer: Peer object
+ *
+ * Return: void
+ */
+void dp_peer_setup_wifi3(void *vdev_hdl, void *peer_hdl)
+{
+	struct dp_peer *peer = (struct dp_peer *)peer_hdl;
+	struct dp_vdev *vdev = (struct dp_vdev *)vdev_hdl;
+	struct dp_pdev *pdev;
+	struct dp_soc *soc;
+
+	/* preconditions */
+	qdf_assert(vdev);
+	qdf_assert(peer);
+
+	pdev = vdev->pdev;
+	soc = pdev->soc;
+
+	dp_peer_rx_init(pdev, peer);
+
+	if (soc->cdp_soc.ol_ops->peer_set_default_routing) {
+		/* TODO: Check the destination ring number to be passed to FW */
+		soc->cdp_soc.ol_ops->peer_set_default_routing(soc->osif_soc,
+			 peer->mac_addr.raw, peer->vdev->vdev_id, 0, 1);
+	}
+	return;
+}
+
 /*
  * dp_peer_authorize() - authorize txrx peer
  * @peer_handle:		Datapath peer handle
@@ -1524,7 +1547,7 @@ void dp_peer_unref_delete(void *peer_handle)
  * @peer_handle:		Datapath peer handle
  *
  */
-void dp_peer_detach_wifi3(void *peer_handle)
+void dp_peer_delete_wifi3(void *peer_handle)
 {
 	struct dp_peer *peer = (struct dp_peer *)peer_handle;
 
@@ -1606,8 +1629,10 @@ static struct cdp_cmn_ops dp_ops_cmn = {
 	.txrx_vdev_detach = dp_vdev_detach_wifi3,
 	.txrx_pdev_attach = dp_pdev_attach_wifi3,
 	.txrx_pdev_detach = dp_pdev_detach_wifi3,
-	.txrx_peer_attach = dp_peer_attach_wifi3,
-	.txrx_peer_detach = dp_peer_detach_wifi3,
+	.txrx_peer_create = dp_peer_create_wifi3,
+	.txrx_peer_setup = dp_peer_setup_wifi3,
+	.txrx_peer_teardown = NULL,
+	.txrx_peer_delete = dp_peer_delete_wifi3,
 	.txrx_vdev_register = dp_vdev_register_wifi3,
 	.txrx_soc_detach = dp_soc_detach_wifi3,
 	.txrx_get_vdev_mac_addr = dp_get_vdev_mac_addr_wifi3,

+ 3 - 0
dp/wifi3.0/dp_rx.c

@@ -337,6 +337,9 @@ dp_rx_process(struct dp_soc *soc, void *hal_ring, uint32_t quota)
 		 */
 		/* Peer lookup failed */
 		if (!peer) {
+			QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
+				 "%s %d : peer look-up failed peer id %d\n",
+				 __func__, __LINE__, peer_id);
 
 			/* Drop & free packet */
 			qdf_nbuf_free(rx_desc->nbuf);