Browse Source

qcacmn: Use MLO Device Context for finding MLO Partner vdev's

Use vdev list present in MLO device context structure to find
MLO Partner vdev.

Change-Id: I6660ab91b27474dbe80562cc763417f07a7a2776
CRs-Fixed: 3583614
Kenvish Butani 1 year ago
parent
commit
59bc72aa0f
6 changed files with 112 additions and 35 deletions
  1. 31 10
      dp/wifi3.0/be/dp_be.c
  2. 3 1
      dp/wifi3.0/be/dp_be.h
  3. 17 6
      dp/wifi3.0/be/dp_be_rx.c
  4. 10 5
      dp/wifi3.0/be/dp_be_tx.c
  5. 49 13
      dp/wifi3.0/be/mlo/dp_mlo.c
  6. 2 0
      dp/wifi3.0/dp_types.h

+ 31 - 10
dp/wifi3.0/be/dp_be.c

@@ -854,11 +854,13 @@ void dp_reo_shared_qaddr_detach(struct dp_soc *soc)
 static QDF_STATUS dp_soc_detach_be(struct dp_soc *soc)
 {
 	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
-	dp_mlo_dev_obj_t mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
+	dp_mlo_dev_obj_t mlo_dev_obj;
 	int i = 0;
 
 	dp_soc_ppeds_detach_be(soc);
 	dp_reo_shared_qaddr_detach(soc);
+
+	mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
 	dp_mlo_dev_ctxt_list_detach_wrapper(mlo_dev_obj);
 
 	for (i = 0; i < MAX_TXDESC_POOLS; i++)
@@ -1021,13 +1023,18 @@ dp_attach_vdev_list_in_mlo_dev_ctxt(struct dp_soc_be *be_soc,
 	qdf_spin_unlock_bh(&mlo_dev_ctxt->vdev_list_lock);
 }
 
-static inline void
+static inline QDF_STATUS
 dp_detach_vdev_list_in_mlo_dev_ctxt(struct dp_soc_be *be_soc,
 				    struct dp_vdev *vdev,
 				    struct dp_mlo_dev_ctxt *mlo_dev_ctxt)
 {
 	uint8_t pdev_id = vdev->pdev->pdev_id;
 
+	if (mlo_dev_ctxt->vdev_list[be_soc->mlo_chip_id][pdev_id] ==
+	    CDP_INVALID_VDEV_ID) {
+		return QDF_STATUS_E_INVAL;
+	}
+
 	qdf_spin_lock_bh(&mlo_dev_ctxt->vdev_list_lock);
 	if (vdev->is_bridge_vdev) {
 		mlo_dev_ctxt->bridge_vdev[be_soc->mlo_chip_id][pdev_id] =
@@ -1038,6 +1045,8 @@ dp_detach_vdev_list_in_mlo_dev_ctxt(struct dp_soc_be *be_soc,
 	}
 	mlo_dev_ctxt->vdev_count--;
 	qdf_spin_unlock_bh(&mlo_dev_ctxt->vdev_list_lock);
+
+	return QDF_STATUS_SUCCESS;
 }
 #endif /* WLAN_DP_MLO_DEV_CTX */
 #else
@@ -1065,7 +1074,7 @@ dp_attach_vdev_list_in_mlo_dev_ctxt(struct dp_soc_be *be_soc,
 {
 }
 
-static inline void
+static inline QDF_STATUS
 dp_detach_vdev_list_in_mlo_dev_ctxt(struct dp_soc_be *be_soc,
 				    struct dp_vdev *vdev,
 				    struct dp_mlo_dev_ctxt *mlo_dev_ctxt)
@@ -1082,8 +1091,9 @@ static QDF_STATUS dp_soc_attach_be(struct dp_soc *soc,
 	uint32_t max_tx_rx_desc_num, num_spt_pages;
 	uint32_t num_entries;
 	int i = 0;
-	dp_mlo_dev_obj_t mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
+	dp_mlo_dev_obj_t mlo_dev_obj;
 
+	mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
 	max_tx_rx_desc_num = WLAN_CFG_NUM_TX_DESC_MAX * MAX_TXDESC_POOLS +
 		WLAN_CFG_RX_SW_DESC_NUM_SIZE_MAX * MAX_RXDESC_POOLS +
 		WLAN_CFG_NUM_PPEDS_TX_DESC_MAX * MAX_PPE_TXDESC_POOLS;
@@ -2569,7 +2579,8 @@ static void dp_txrx_set_mlo_mcast_primary_vdev_param_be(
 				      dp_mlo_mcast_reset_pri_mcast,
 				      (void *)&be_vdev->mcast_primary,
 				      DP_MOD_ID_TX_MCAST,
-				      DP_LINK_VDEV_ITER);
+				      DP_LINK_VDEV_ITER,
+				      DP_VDEV_ITERATE_SKIP_SELF);
 
 		params.chip_id = be_soc->mlo_chip_id;
 		params.pdev_id = be_vdev->vdev.pdev->pdev_id;
@@ -2614,7 +2625,8 @@ static void dp_txrx_set_mlo_mcast_primary_vdev_param_be(
 				      dp_mlo_mcast_reset_pri_mcast,
 				      (void *)&be_vdev->mcast_primary,
 				      DP_MOD_ID_TX_MCAST,
-				      DP_LINK_VDEV_ITER);
+				      DP_LINK_VDEV_ITER,
+				      DP_VDEV_ITERATE_SKIP_SELF);
 
 		params.chip_id = be_soc->mlo_chip_id;
 		params.pdev_id = vdev->pdev->pdev_id;
@@ -2865,8 +2877,9 @@ dp_get_mlo_dev_ctx_by_mld_mac_addr(struct dp_soc_be *be_soc,
 {
 	struct dp_mlo_dev_ctxt *mld_cur = NULL;
 	struct dp_mlo_dev_ctxt *tmp_mld_cur = NULL;
-	dp_mlo_dev_obj_t mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
+	dp_mlo_dev_obj_t mlo_dev_obj;
 
+	mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
 	if (!mlo_dev_obj) {
 		dp_err("DP Global MLO Context is NULL");
 		return NULL;
@@ -2906,8 +2919,9 @@ QDF_STATUS dp_mlo_dev_ctxt_create(struct cdp_soc_t *soc_hdl,
 	struct dp_mlo_dev_ctxt *mlo_dev_ctxt = NULL;
 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
 	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
-	dp_mlo_dev_obj_t mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
+	dp_mlo_dev_obj_t mlo_dev_obj;
 
+	mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
 	if (!mlo_dev_obj) {
 		dp_err("DP Global MLO Context is NULL");
 		return QDF_STATUS_E_FAILURE;
@@ -2970,8 +2984,9 @@ QDF_STATUS dp_mlo_dev_ctxt_destroy(struct cdp_soc_t *soc_hdl,
 	struct dp_mlo_dev_ctxt *mlo_dev_ctxt = NULL;
 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
 	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
-	dp_mlo_dev_obj_t mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
+	dp_mlo_dev_obj_t mlo_dev_obj;
 
+	mlo_dev_obj = dp_get_mlo_dev_list_obj(be_soc);
 	if (!mlo_dev_obj) {
 		dp_err("DP Global MLO Context is NULL");
 		return QDF_STATUS_E_INVAL;
@@ -3096,7 +3111,13 @@ QDF_STATUS dp_mlo_dev_ctxt_vdev_detach(struct cdp_soc_t *soc_hdl,
 		dp_mlo_dev_get_ref(mlo_dev_ctxt, DP_MOD_ID_MLO_DEV);
 	}
 
-	dp_detach_vdev_list_in_mlo_dev_ctxt(be_soc, vdev, mlo_dev_ctxt);
+	if (dp_detach_vdev_list_in_mlo_dev_ctxt(be_soc, vdev, mlo_dev_ctxt)
+	    != QDF_STATUS_SUCCESS) {
+		dp_mlo_dev_ctxt_unref_delete(mlo_dev_ctxt, DP_MOD_ID_MLO_DEV);
+		dp_vdev_unref_delete(soc, vdev, DP_MOD_ID_CDP);
+		return QDF_STATUS_SUCCESS;
+	}
+
 	be_vdev->mlo_dev_ctxt = NULL;
 
 	/* unref for mlo ctxt removed from be_vdev*/

+ 3 - 1
dp/wifi3.0/be/dp_be.h

@@ -600,6 +600,7 @@ typedef void dp_ptnr_vdev_iter_func(struct dp_vdev_be *be_vdev,
  * @arg: argument need to be passed to func
  * @mod_id: module id
  * @type: iterate type
+ * @include_self_vdev: flag to include/exclude self vdev in iteration
  *
  * Return: None
  */
@@ -607,7 +608,8 @@ void dp_mlo_iter_ptnr_vdev(struct dp_soc_be *be_soc,
 			   struct dp_vdev_be *be_vdev,
 			   dp_ptnr_vdev_iter_func func, void *arg,
 			   enum dp_mod_id mod_id,
-			   uint8_t type);
+			   uint8_t type,
+			   bool include_self_vdev);
 #endif
 
 #ifdef WLAN_MCAST_MLO

+ 17 - 6
dp/wifi3.0/be/dp_be_rx.c

@@ -1364,6 +1364,11 @@ dp_rx_intrabss_ucast_check_be(qdf_nbuf_t nbuf,
 	if (!qdf_nbuf_is_intra_bss(nbuf))
 		return false;
 
+	if (!be_vdev->mlo_dev_ctxt) {
+		params->tx_vdev_id = ta_peer->vdev->vdev_id;
+		return true;
+	}
+
 	hal_rx_tlv_get_dest_chip_pmac_id(rx_tlv_hdr,
 					 &dest_chip_id,
 					 &dest_chip_pmac_id);
@@ -1396,13 +1401,14 @@ dp_rx_intrabss_ucast_check_be(qdf_nbuf_t nbuf,
 			params->tx_vdev_id = ta_peer->vdev->vdev_id;
 		else
 			params->tx_vdev_id =
-				be_vdev->partner_vdev_list[dest_chip_id]
+				be_vdev->mlo_dev_ctxt->vdev_list[dest_chip_id]
 							  [dest_chip_pmac_id];
 		return true;
 	}
 
 	params->tx_vdev_id =
-		be_vdev->partner_vdev_list[dest_chip_id][dest_chip_pmac_id];
+		be_vdev->mlo_dev_ctxt->vdev_list[dest_chip_id]
+						[dest_chip_pmac_id];
 
 	return true;
 }
@@ -1490,14 +1496,19 @@ dp_rx_intrabss_ucast_check_be(qdf_nbuf_t nbuf,
 		goto rel_da_peer;
 	}
 
+	if (!be_vdev->mlo_dev_ctxt)
+		ret = false;
+		goto rel_da_peer;
+	}
+
 	/* MLO specific Intra-BSS check */
 	if (dp_rx_intrabss_fwd_mlo_allow(ta_peer, da_peer)) {
 		/* use dest chip id for legacy dest peer */
 		if (!(da_peer_id & HAL_RX_DA_IDX_ML_PEER_MASK)) {
-			if (!(be_vdev->partner_vdev_list[dest_chip_id][0] ==
-			      params->tx_vdev_id) &&
-			    !(be_vdev->partner_vdev_list[dest_chip_id][1] ==
-			      params->tx_vdev_id)) {
+			if (!(be_vdev->mlo_dev_ctxt->vdev_list[dest_chip_id][0]
+			      == params->tx_vdev_id) &&
+			    !(be_vdev->mlo_dev_ctxt->vdev_list[dest_chip_id][1]
+			      == params->tx_vdev_id)) {
 				/*dp_soc_unref_delete(soc);*/
 				goto rel_da_peer;
 			}

+ 10 - 5
dp/wifi3.0/be/dp_be_tx.c

@@ -664,7 +664,8 @@ dp_tx_mlo_mcast_multipass_handler(struct dp_soc *soc,
 		dp_mlo_iter_ptnr_vdev(be_soc, be_vdev,
 				      dp_tx_mlo_mcast_multipass_lookup,
 				      &mpass_buf, DP_MOD_ID_TX,
-				      DP_ALL_VDEV_ITER);
+				      DP_ALL_VDEV_ITER,
+				      DP_VDEV_ITERATE_SKIP_SELF);
 		/*
 		 * Do not drop the frame when vlan_id doesn't match.
 		 * Send the frame as it is.
@@ -700,7 +701,8 @@ dp_tx_mlo_mcast_multipass_handler(struct dp_soc *soc,
 		dp_mlo_iter_ptnr_vdev(be_soc, be_vdev,
 				      dp_tx_mlo_mcast_multipass_send,
 				      &mpass_buf_copy, DP_MOD_ID_TX,
-				      DP_LINK_VDEV_ITER);
+				      DP_LINK_VDEV_ITER,
+				      DP_VDEV_ITERATE_SKIP_SELF);
 
 		/* send frame on mcast primary vdev */
 		dp_tx_mlo_mcast_multipass_send(be_vdev, vdev, &mpass_buf_copy);
@@ -713,7 +715,8 @@ dp_tx_mlo_mcast_multipass_handler(struct dp_soc *soc,
 
 	dp_mlo_iter_ptnr_vdev(be_soc, be_vdev,
 			      dp_tx_mlo_mcast_multipass_send,
-			      &mpass_buf, DP_MOD_ID_TX, DP_LINK_VDEV_ITER);
+			      &mpass_buf, DP_MOD_ID_TX, DP_LINK_VDEV_ITER,
+			      DP_VDEV_ITERATE_SKIP_SELF);
 	dp_tx_mlo_mcast_multipass_send(be_vdev, vdev, &mpass_buf);
 
 	if (qdf_unlikely(be_vdev->mlo_dev_ctxt->seq_num > MAX_GSN_NUM))
@@ -809,7 +812,8 @@ void dp_tx_mlo_mcast_handler_be(struct dp_soc *soc,
 	/* send frame on partner vdevs */
 	dp_mlo_iter_ptnr_vdev(be_soc, be_vdev,
 			      dp_tx_mlo_mcast_pkt_send,
-			      nbuf, DP_MOD_ID_REINJECT, DP_LINK_VDEV_ITER);
+			      nbuf, DP_MOD_ID_REINJECT, DP_LINK_VDEV_ITER,
+			      DP_VDEV_ITERATE_SKIP_SELF);
 
 	/* send frame on mcast primary vdev */
 	dp_tx_mlo_mcast_pkt_send(be_vdev, vdev, nbuf);
@@ -893,7 +897,8 @@ dp_tx_mlo_mcast_send_be(struct dp_soc *soc, struct dp_vdev *vdev,
 			dp_mlo_iter_ptnr_vdev(be_soc, be_vdev,
 					      dp_tx_mlo_mcast_enhance_be,
 					      nbuf, DP_MOD_ID_TX,
-					      DP_ALL_VDEV_ITER);
+					      DP_ALL_VDEV_ITER,
+					      DP_VDEV_ITERATE_SKIP_SELF);
 			qdf_nbuf_free(nbuf);
 			return NULL;
 		}

+ 49 - 13
dp/wifi3.0/be/mlo/dp_mlo.c

@@ -507,7 +507,8 @@ void dp_aggregate_interface_stats_based_on_peer_type(
 					      dp_mlo_vdev_stats_aggr_bridge_vap,
 					      (void *)vdev_stats,
 					      DP_MOD_ID_GENERIC_STATS,
-					      DP_BRIDGE_VDEV_ITER);
+					      DP_BRIDGE_VDEV_ITER,
+					      DP_VDEV_ITERATE_SKIP_SELF);
 		}
 		dp_aggregate_vdev_ingress_stats(tgt_vdev_stats,
 						&vdev->stats);
@@ -550,7 +551,8 @@ void dp_aggregate_interface_stats(struct dp_vdev *vdev,
 		dp_mlo_iter_ptnr_vdev(be_soc, be_vdev,
 				      dp_mlo_vdev_stats_aggr_bridge_vap,
 				      (void *)vdev_stats, DP_MOD_ID_GENERIC_STATS,
-				      DP_BRIDGE_VDEV_ITER);
+				      DP_BRIDGE_VDEV_ITER,
+				      DP_VDEV_ITERATE_SKIP_SELF);
 	}
 
 	dp_aggregate_all_vdev_stats(vdev_stats, &be_vdev->mlo_stats);
@@ -691,7 +693,8 @@ static QDF_STATUS dp_mlo_get_mld_vdev_stats(struct cdp_soc_t *soc_hdl,
 				      dp_mlo_aggr_ptnr_iface_stats_mlo_links,
 				      buf,
 				      DP_MOD_ID_GENERIC_STATS,
-				      DP_LINK_VDEV_ITER);
+				      DP_LINK_VDEV_ITER,
+				      DP_VDEV_ITERATE_SKIP_SELF);
 	} else {
 		dp_aggregate_interface_stats(vdev, buf);
 
@@ -702,7 +705,8 @@ static QDF_STATUS dp_mlo_get_mld_vdev_stats(struct cdp_soc_t *soc_hdl,
 		dp_mlo_iter_ptnr_vdev(be_soc, vdev_be,
 				      dp_mlo_aggr_ptnr_iface_stats, buf,
 				      DP_MOD_ID_GENERIC_STATS,
-				      DP_LINK_VDEV_ITER);
+				      DP_LINK_VDEV_ITER,
+				      DP_VDEV_ITERATE_SKIP_SELF);
 	}
 
 	/* Aggregate vdev stats from MLO ctx for detached MLO Links */
@@ -1043,17 +1047,25 @@ void dp_mlo_iter_ptnr_vdev(struct dp_soc_be *be_soc,
 			   dp_ptnr_vdev_iter_func func,
 			   void *arg,
 			   enum dp_mod_id mod_id,
-			   uint8_t type)
+			   uint8_t type,
+			   bool include_self_vdev)
 {
 	int i = 0;
 	int j = 0;
 	struct dp_mlo_ctxt *dp_mlo = be_soc->ml_ctxt;
+	struct dp_vdev *self_vdev = &be_vdev->vdev;
 
 	if (type < DP_LINK_VDEV_ITER || type > DP_ALL_VDEV_ITER) {
 		dp_err("invalid iterate type");
 		return;
 	}
 
+	if (!be_vdev->mlo_dev_ctxt) {
+		if (!include_self_vdev)
+			return;
+		(*func)(be_vdev, self_vdev, arg);
+	}
+
 	for (i = 0; (i < WLAN_MAX_MLO_CHIPS) &&
 	     IS_LINK_VDEV_ITER_REQUIRED(type); i++) {
 		struct dp_soc *ptnr_soc =
@@ -1065,11 +1077,19 @@ void dp_mlo_iter_ptnr_vdev(struct dp_soc_be *be_soc,
 			struct dp_vdev *ptnr_vdev;
 
 			ptnr_vdev = dp_vdev_get_ref_by_id(
-					ptnr_soc,
-					be_vdev->partner_vdev_list[i][j],
-					mod_id);
+				ptnr_soc,
+				be_vdev->mlo_dev_ctxt->vdev_list[i][j],
+				mod_id);
 			if (!ptnr_vdev)
 				continue;
+
+			if ((ptnr_vdev == self_vdev) && (!include_self_vdev)) {
+				dp_vdev_unref_delete(ptnr_vdev->pdev->soc,
+						     ptnr_vdev,
+						     mod_id);
+				continue;
+			}
+
 			(*func)(be_vdev, ptnr_vdev, arg);
 			dp_vdev_unref_delete(ptnr_vdev->pdev->soc,
 					     ptnr_vdev,
@@ -1088,11 +1108,22 @@ void dp_mlo_iter_ptnr_vdev(struct dp_soc_be *be_soc,
 			struct dp_vdev *bridge_vdev;
 
 			bridge_vdev = dp_vdev_get_ref_by_id(
-					ptnr_soc,
-					be_vdev->bridge_vdev_list[i][j],
-					mod_id);
+				ptnr_soc,
+				be_vdev->mlo_dev_ctxt->bridge_vdev[i][j],
+				mod_id);
+
 			if (!bridge_vdev)
 				continue;
+
+			if ((bridge_vdev == self_vdev) &&
+			    (!include_self_vdev)) {
+				dp_vdev_unref_delete(
+						bridge_vdev->pdev->soc,
+						bridge_vdev,
+						mod_id);
+				continue;
+			}
+
 			(*func)(be_vdev, bridge_vdev, arg);
 			dp_vdev_unref_delete(bridge_vdev->pdev->soc,
 					     bridge_vdev,
@@ -1121,7 +1152,8 @@ void dp_mlo_debug_print_ptnr_info(struct dp_vdev *vdev)
 	dp_mlo_iter_ptnr_vdev(be_soc, be_vdev,
 			      dp_print_mlo_partner_list,
 			      NULL, DP_MOD_ID_GENERIC_STATS,
-			      DP_ALL_VDEV_ITER);
+			      DP_ALL_VDEV_ITER,
+			      DP_VDEV_ITERATE_SKIP_SELF);
 }
 #endif
 
@@ -1135,6 +1167,10 @@ struct dp_vdev *dp_mlo_get_mcast_primary_vdev(struct dp_soc_be *be_soc,
 	struct dp_mlo_ctxt *dp_mlo = be_soc->ml_ctxt;
 	struct dp_vdev *vdev = (struct dp_vdev *)be_vdev;
 
+	if (!be_vdev->mlo_dev_ctxt) {
+		return NULL;
+	}
+
 	if (be_vdev->mcast_primary) {
 		if (dp_vdev_get_ref((struct dp_soc *)be_soc, vdev, mod_id) !=
 					QDF_STATUS_SUCCESS)
@@ -1155,7 +1191,7 @@ struct dp_vdev *dp_mlo_get_mcast_primary_vdev(struct dp_soc_be *be_soc,
 
 			ptnr_vdev = dp_vdev_get_ref_by_id(
 					ptnr_soc,
-					be_vdev->partner_vdev_list[i][j],
+					be_vdev->mlo_dev_ctxt->vdev_list[i][j],
 					mod_id);
 			if (!ptnr_vdev)
 				continue;

+ 2 - 0
dp/wifi3.0/dp_types.h

@@ -206,6 +206,8 @@ typedef void dp_ptnr_soc_iter_func(struct dp_soc *ptnr_soc, void *arg,
 #define DP_ALL_VDEV_ITER 3
 #define IS_LINK_VDEV_ITER_REQUIRED(type) (type & DP_LINK_VDEV_ITER)
 #define IS_BRIDGE_VDEV_ITER_REQUIRED(type) (type & DP_BRIDGE_VDEV_ITER)
+#define DP_VDEV_ITERATE_ALL 1
+#define DP_VDEV_ITERATE_SKIP_SELF 0
 #endif
 
 enum rx_pktlog_mode {