Эх сурвалжийг харах

qcacmn: Maintain dp_mlo_ctxt per each MLO group

As per current design, dp_mlo_ctxt is allocated during the
initialization of module while the MLO grouping information is
understood after WMI_READY_EVENT. The same is deinitialized while
unregistering the module.
To ensure dp_mlo_ctxt exists per MLO group, bring the dp_handle
a layer below in the hierarchy into the mlo_setup_info and allocate
dp_mlo_ctxt after the WMI_READY_EVENT is received from all the SOCs
for a given group. Deallocate it after the WMI_MLO_TEARDOWN_COMPLETE
event is received.

CRs-Fixed: 3355405
Change-Id: Ic3102a34a8d44877827e2ff1f7da2e414b2b463f
Surya Prakash Raajen 2 жил өмнө
parent
commit
49ca504dbd

+ 0 - 1
dp/wifi3.0/be/dp_be.c

@@ -886,7 +886,6 @@ static QDF_STATUS dp_pdev_attach_be(struct dp_pdev *pdev,
 				    struct cdp_pdev_attach_params *params)
 {
 	dp_pdev_mlo_fill_params(pdev, params);
-	dp_mlo_update_link_to_pdev_map(pdev->soc, pdev);
 
 	return QDF_STATUS_SUCCESS;
 }

+ 9 - 0
dp/wifi3.0/be/mlo/dp_mlo.c

@@ -265,10 +265,19 @@ static void dp_mlo_soc_setup(struct cdp_soc_t *soc_hdl,
 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
 	struct dp_mlo_ctxt *mlo_ctxt = cdp_mlo_ctx_to_dp(cdp_ml_ctxt);
 	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
+	uint8_t pdev_id;
 
 	if (!cdp_ml_ctxt)
 		return;
 
+	be_soc->ml_ctxt = mlo_ctxt;
+
+	for (pdev_id = 0; pdev_id < MAX_PDEV_CNT; pdev_id++) {
+		if (soc->pdev_list[pdev_id])
+			dp_mlo_update_link_to_pdev_map(soc,
+						       soc->pdev_list[pdev_id]);
+	}
+
 	dp_mlo_set_soc_by_chip_id(mlo_ctxt, soc, be_soc->mlo_chip_id);
 }
 

+ 4 - 2
umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c

@@ -912,6 +912,7 @@ void wlan_objmgr_set_mlo_ctx(struct mlo_mgr_context *ctx)
 	g_umac_glb_obj->mlo_ctx = ctx;
 }
 
+#ifdef WLAN_MLO_MULTI_CHIP
 void wlan_objmgr_set_dp_mlo_ctx(void *dp_handle)
 {
 	struct mlo_mgr_context *mlo_ctx = wlan_objmgr_get_mlo_ctx();
@@ -919,7 +920,7 @@ void wlan_objmgr_set_dp_mlo_ctx(void *dp_handle)
 	if (!mlo_ctx)
 		return;
 
-	mlo_ctx->dp_handle = dp_handle;
+	mlo_ctx->setup_info.dp_handle = dp_handle;
 }
 
 qdf_export_symbol(wlan_objmgr_set_dp_mlo_ctx);
@@ -931,8 +932,9 @@ void *wlan_objmgr_get_dp_mlo_ctx(void)
 	if (!mlo_ctx)
 		return NULL;
 
-	return mlo_ctx->dp_handle;
+	return mlo_ctx->setup_info.dp_handle;
 }
 
 qdf_export_symbol(wlan_objmgr_get_dp_mlo_ctx);
+#endif /* WLAN_MLO_MULTI_CHIP */
 #endif

+ 2 - 2
umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h

@@ -98,6 +98,7 @@ enum MLO_LINK_STATE {
  * @valid_link_bitmap: valid MLO link bitmap
  * @state_lock: lock to protect access to link state
  * @qdf_event_t: event for teardown completion
+ * @dp_handle: pointer to DP ML context
  */
 #define MAX_MLO_LINKS 6
 #define MAX_MLO_CHIPS 5
@@ -113,6 +114,7 @@ struct mlo_setup_info {
 	uint16_t valid_link_bitmap;
 	qdf_spinlock_t state_lock;
 	qdf_event_t event;
+	 struct cdp_mlo_ctxt *dp_handle;
 };
 
 /**
@@ -141,7 +143,6 @@ struct mlo_state_params {
  * @msgq_ctx: Context switch mgr
  * @mlo_is_force_primary_umac: Force Primary UMAC enable
  * @mlo_forced_primary_umac_id: Force Primary UMAC ID
- * @dp_handle: pointer to DP ML context
  */
 struct mlo_mgr_context {
 #ifdef WLAN_MLO_USE_SPINLOCK
@@ -163,7 +164,6 @@ struct mlo_mgr_context {
 	struct ctxt_switch_mgr *msgq_ctx;
 	bool mlo_is_force_primary_umac;
 	uint8_t mlo_forced_primary_umac_id;
-	void *dp_handle;
 };
 
 /*

+ 31 - 6
umac/mlo_mgr/src/wlan_mlo_mgr_setup.c

@@ -233,6 +233,7 @@ void mlo_setup_update_soc_ready(struct wlan_objmgr_psoc *psoc)
 {
 	struct mlo_mgr_context *mlo_ctx = wlan_objmgr_get_mlo_ctx();
 	uint8_t chip_idx, tot_socs = 0;
+	struct cdp_mlo_ctxt *dp_mlo_ctxt;
 
 	if (!mlo_ctx || !mlo_ctx->setup_info.tot_socs)
 		return;
@@ -252,17 +253,20 @@ void mlo_setup_update_soc_ready(struct wlan_objmgr_psoc *psoc)
 
 	if (mlo_ctx->setup_info.num_soc != mlo_ctx->setup_info.tot_socs)
 		return;
+	dp_mlo_ctxt = cdp_mlo_ctxt_attach(wlan_psoc_get_dp_handle(psoc),
+					  (struct cdp_ctrl_mlo_mgr *)mlo_ctx);
+	wlan_objmgr_set_dp_mlo_ctx(dp_mlo_ctxt);
 
 	for (chip_idx = 0; chip_idx < MAX_MLO_CHIPS; chip_idx++) {
 		struct wlan_objmgr_psoc *tmp_soc =
 			mlo_ctx->setup_info.soc_list[chip_idx];
 		if (tmp_soc)
 			cdp_soc_mlo_soc_setup(wlan_psoc_get_dp_handle(tmp_soc),
-					      mlo_ctx->dp_handle);
+					      mlo_ctx->setup_info.dp_handle);
 	}
 
 	cdp_mlo_setup_complete(wlan_psoc_get_dp_handle(psoc),
-			       mlo_ctx->dp_handle);
+			       mlo_ctx->setup_info.dp_handle);
 }
 
 qdf_export_symbol(mlo_setup_update_soc_ready);
@@ -435,12 +439,21 @@ void mlo_setup_update_soc_down(struct wlan_objmgr_psoc *psoc)
 
 qdf_export_symbol(mlo_setup_update_soc_down);
 
+static void mlo_dp_ctxt_detach(struct wlan_objmgr_psoc *psoc,
+			       struct cdp_mlo_ctxt *dp_mlo_ctxt)
+{
+	wlan_objmgr_set_dp_mlo_ctx(NULL);
+	if (dp_mlo_ctxt)
+		cdp_mlo_ctxt_detach(wlan_psoc_get_dp_handle(psoc), dp_mlo_ctxt);
+}
+
 void mlo_link_teardown_complete(struct wlan_objmgr_pdev *pdev)
 {
 	struct mlo_mgr_context *mlo_ctx = wlan_objmgr_get_mlo_ctx();
 	uint8_t link_idx;
 	struct wlan_objmgr_psoc *soc;
 	uint8_t chip_idx;
+	uint8_t num_soc = 0;
 
 	if (!mlo_ctx)
 		return;
@@ -467,10 +480,15 @@ void mlo_link_teardown_complete(struct wlan_objmgr_pdev *pdev)
 
 	for (chip_idx = 0; chip_idx < MAX_MLO_CHIPS; chip_idx++) {
 		soc = mlo_ctx->setup_info.soc_list[chip_idx];
-		if (soc)
+		if (soc) {
+			num_soc++;
 			cdp_soc_mlo_soc_teardown(wlan_psoc_get_dp_handle(soc),
-						 mlo_ctx->dp_handle,
+						 mlo_ctx->setup_info.dp_handle,
 						 false);
+			if (num_soc == mlo_ctx->setup_info.tot_socs)
+				mlo_dp_ctxt_detach(soc,
+						 mlo_ctx->setup_info.dp_handle);
+		}
 	}
 
 	qdf_event_set(&mlo_ctx->setup_info.event);
@@ -484,6 +502,7 @@ static void mlo_force_teardown(void)
 	struct wlan_objmgr_psoc *soc;
 	uint8_t link_idx = 0;
 	uint8_t chip_idx;
+	uint8_t num_soc = 0;
 
 	if (!mlo_ctx)
 		return;
@@ -493,10 +512,15 @@ static void mlo_force_teardown(void)
 
 	for (chip_idx = 0; chip_idx < MAX_MLO_CHIPS; chip_idx++) {
 		soc = mlo_ctx->setup_info.soc_list[chip_idx];
-		if (soc)
+		if (soc) {
+			num_soc++;
 			cdp_soc_mlo_soc_teardown(wlan_psoc_get_dp_handle(soc),
-						 mlo_ctx->dp_handle,
+						 mlo_ctx->setup_info.dp_handle,
 						 true);
+			if (num_soc == mlo_ctx->setup_info.tot_socs)
+				mlo_dp_ctxt_detach(soc,
+						 mlo_ctx->setup_info.dp_handle);
+		}
 	}
 }
 
@@ -532,6 +556,7 @@ QDF_STATUS mlo_link_teardown_link(struct wlan_objmgr_psoc *psoc,
 
 	if (reason == WMI_MLO_TEARDOWN_REASON_SSR) {
 		/* do not wait for teardown event completion here for SSR */
+		mlo_dp_ctxt_detach(psoc, mlo_ctx->setup_info.dp_handle);
 		return QDF_STATUS_SUCCESS;
 	}