Browse Source

qcacld-3.0: Remove WLAN_FEATURE_11BE_MLO from middle of function

Remove all WLAN_FEATURE_11BE_MLO from middle of function.

Change-Id: I17cbaf90ae9b6f428c785413723a5dfb3619de0c
CRs-Fixed: 3175450
chunquan 3 years ago
parent
commit
2e87d35525

+ 5 - 0
components/umac/mlme/mlo_mgr/inc/wlan_mlo_mgr_roam.h

@@ -220,10 +220,15 @@ mlo_roam_get_link_id(uint8_t vdev_id,
 	return 0;
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
+void mlo_cm_roam_sync_cb(struct wlan_objmgr_vdev *vdev,
+			 void *event, uint32_t event_data_len);
+#else
 static inline void
 mlo_cm_roam_sync_cb(struct wlan_objmgr_vdev *vdev,
 		    void *event, uint32_t event_data_len)
 {}
+#endif
 
 static inline bool
 is_multi_link_roam(struct roam_offload_synch_ind *sync_ind)

+ 90 - 65
core/hdd/src/wlan_hdd_hostapd.c

@@ -1898,6 +1898,74 @@ static QDF_STATUS hdd_hostapd_chan_change(struct hdd_adapter *adapter,
 				      chan_change, legacy_phymode);
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static inline QDF_STATUS
+hdd_hostapd_sap_register_mlo_sta(struct hdd_adapter *adapter,
+				 struct hdd_ap_ctx *ap_ctx,
+				 struct hdd_context *hdd_ctx,
+				 tSap_StationAssocReassocCompleteEvent *event,
+				 bool bAuthRequired,
+				 uint8_t *notify_new_sta)
+{
+	uint8_t *mld;
+	QDF_STATUS qdf_status;
+	struct wlan_objmgr_peer *peer;
+
+	hdd_debug("Registering STA MLD :" QDF_MAC_ADDR_FMT,
+		  QDF_MAC_ADDR_REF(event->sta_mld.bytes));
+	qdf_status = hdd_softap_register_sta(adapter,
+					     bAuthRequired,
+					     ap_ctx->privacy,
+					     (struct qdf_mac_addr *)
+					     &event->sta_mld,
+					     event);
+
+	if (!QDF_IS_STATUS_SUCCESS(qdf_status))
+		hdd_err("Failed to register STA MLD %d "
+			QDF_MAC_ADDR_FMT, qdf_status,
+			QDF_MAC_ADDR_REF(event->sta_mld.bytes));
+
+	peer = wlan_objmgr_get_peer_by_mac(hdd_ctx->psoc,
+					   event->staMac.bytes,
+					   WLAN_OSIF_ID);
+	if (!peer) {
+		hdd_err("Peer object not found");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (bAuthRequired) {
+		mld = wlan_peer_mlme_get_mldaddr(peer);
+		if (!wlan_peer_mlme_is_assoc_peer(peer) &&
+		    !qdf_is_macaddr_zero((struct qdf_mac_addr *)mld)) {
+			hdd_err("skip userspace notification");
+			*notify_new_sta = 0;
+		}
+	} else {
+		if (!qdf_is_macaddr_zero((struct qdf_mac_addr *)
+				peer->mldaddr) &&
+		    !wlan_peer_mlme_is_assoc_peer(peer)) {
+			wlan_objmgr_peer_release_ref(peer, WLAN_OSIF_ID);
+			return QDF_STATUS_E_NOSUPPORT;
+		}
+	}
+
+	wlan_objmgr_peer_release_ref(peer, WLAN_OSIF_ID);
+
+	return QDF_STATUS_SUCCESS;
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline QDF_STATUS
+hdd_hostapd_sap_register_mlo_sta(struct hdd_adapter *adapter,
+				 struct hdd_ap_ctx *ap_ctx,
+				 struct hdd_context *hdd_ctx,
+				 tSap_StationAssocReassocCompleteEvent *event,
+				 bool bAuthRequired,
+				 uint8_t *notify_new_sta)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 				    void *context)
 {
@@ -1934,10 +2002,6 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 	struct sap_config *sap_config;
 	struct sap_context *sap_ctx = NULL;
 	uint8_t pdev_id;
-#ifdef WLAN_FEATURE_11BE_MLO
-	struct wlan_objmgr_peer *peer;
-	uint8_t *mld;
-#endif
 	bool notify_new_sta = true;
 	struct wlan_objmgr_vdev *vdev;
 
@@ -2435,38 +2499,18 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 				hdd_err("Failed to register STA %d "
 					QDF_MAC_ADDR_FMT, qdf_status,
 					QDF_MAC_ADDR_REF(wrqu.addr.sa_data));
-#ifdef WLAN_FEATURE_11BE_MLO
-			hdd_debug("Registering STA MLD :" QDF_MAC_ADDR_FMT,
-				  QDF_MAC_ADDR_REF(event->sta_mld.bytes));
-			qdf_status = hdd_softap_register_sta(
-						adapter,
-						true,
-						ap_ctx->privacy,
-						(struct qdf_mac_addr *)
-						&event->sta_mld,
-						event);
-			if (!QDF_IS_STATUS_SUCCESS(qdf_status))
-				hdd_err("Failed to register STA MLD %d "
-					QDF_MAC_ADDR_FMT, qdf_status,
-					QDF_MAC_ADDR_REF(event->sta_mld.bytes));
-
-			peer = wlan_objmgr_get_peer_by_mac(hdd_ctx->psoc,
-							   event->staMac.bytes,
-							   WLAN_OSIF_ID);
-			if (!peer) {
-				hdd_err("Peer object not found");
+			qdf_status = hdd_hostapd_sap_register_mlo_sta(adapter,
+								      ap_ctx,
+								      hdd_ctx,
+								      event,
+								      bAuthRequired,
+								      (uint8_t *)&notify_new_sta);
+
+			if (qdf_status == QDF_STATUS_E_NOSUPPORT)
+				goto skip_reassoc;
+			else if (qdf_status == QDF_STATUS_E_INVAL)
 				return QDF_STATUS_E_INVAL;
-			}
-
-			mld = wlan_peer_mlme_get_mldaddr(peer);
-			if (!wlan_peer_mlme_is_assoc_peer(peer) &&
-			    !qdf_is_macaddr_zero((struct qdf_mac_addr *)mld)) {
-				hdd_err("skip userspace notification");
-				notify_new_sta = false;
-			}
 
-			wlan_objmgr_peer_release_ref(peer, WLAN_OSIF_ID);
-#endif
 		} else {
 			qdf_status = hdd_softap_register_sta(
 						adapter,
@@ -2481,38 +2525,17 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 				hdd_err("Failed to register STA %d "
 					QDF_MAC_ADDR_FMT, qdf_status,
 					QDF_MAC_ADDR_REF(wrqu.addr.sa_data));
-#ifdef WLAN_FEATURE_11BE_MLO
-			hdd_debug("Registering STA MLD :" QDF_MAC_ADDR_FMT,
-				  QDF_MAC_ADDR_REF(event->sta_mld.bytes));
-			qdf_status = hdd_softap_register_sta(
-						adapter,
-						false,
-						ap_ctx->privacy,
-						(struct qdf_mac_addr *)
-						&event->sta_mld,
-						event);
-			if (!QDF_IS_STATUS_SUCCESS(qdf_status))
-				hdd_err("Failed to register STA MLD %d "
-					QDF_MAC_ADDR_FMT, qdf_status,
-					QDF_MAC_ADDR_REF(event->sta_mld.bytes));
-			peer = wlan_objmgr_get_peer_by_mac(hdd_ctx->psoc,
-							   event->staMac.bytes,
-							   WLAN_OSIF_ID);
-			if (!peer) {
-				hdd_err("Peer object not found");
+			qdf_status = hdd_hostapd_sap_register_mlo_sta(adapter,
+								      ap_ctx,
+								      hdd_ctx,
+								      event,
+								      bAuthRequired,
+								      (uint8_t *)&notify_new_sta);
+
+			if (qdf_status == QDF_STATUS_E_NOSUPPORT)
+				goto skip_reassoc;
+			else if (qdf_status == QDF_STATUS_E_INVAL)
 				return QDF_STATUS_E_INVAL;
-			}
-
-			if (!qdf_is_macaddr_zero((struct qdf_mac_addr *)
-							peer->mldaddr) &&
-			    !wlan_peer_mlme_is_assoc_peer(peer)) {
-				wlan_objmgr_peer_release_ref(peer,
-							     WLAN_OSIF_ID);
-				break;
-			}
-
-			wlan_objmgr_peer_release_ref(peer, WLAN_OSIF_ID);
-#endif
 		}
 
 		sta_id = event->staId;
@@ -2968,6 +2991,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		goto stopbss;
 		return QDF_STATUS_SUCCESS;
 	}
+
+skip_reassoc:
 	hdd_wext_send_event(dev, we_event, &wrqu,
 			    (char *)we_custom_event_generic);
 	qdf_mem_free(we_custom_start_event);

+ 21 - 4
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -2983,6 +2983,25 @@ static void lim_fill_assoc_ind_real_max_mcs_idx(tpLimMlmAssocInd assoc_ind,
 		assoc_ind->max_real_mcs_idx = assoc_ind->max_supp_idx;
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+lim_fill_lim_assoc_ind_mac_addr_copy(tpLimMlmAssocInd assoc_ind,
+				     tpDphHashNode sta_ds,
+				     uint32_t num_bytes)
+{
+	qdf_mem_copy((uint8_t *)assoc_ind->peer_mld_addr,
+		     (uint8_t *)sta_ds->mld_addr,
+		     num_bytes);
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+lim_fill_lim_assoc_ind_mac_addr_copy(tpLimMlmAssocInd assoc_ind,
+				     tpDphHashNode sta_ds,
+				     uint32_t num_bytes)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 bool lim_fill_lim_assoc_ind_params(
 		tpLimMlmAssocInd assoc_ind,
 		struct mac_context *mac_ctx,
@@ -3018,10 +3037,8 @@ bool lim_fill_lim_assoc_ind_params(
 
 	qdf_mem_copy((uint8_t *)assoc_ind->peerMacAddr,
 		     (uint8_t *)sta_ds->staAddr, sizeof(tSirMacAddr));
-#ifdef WLAN_FEATURE_11BE_MLO
-	qdf_mem_copy((uint8_t *)assoc_ind->peer_mld_addr,
-		     (uint8_t *)sta_ds->mld_addr, sizeof(tSirMacAddr));
-#endif
+	lim_fill_lim_assoc_ind_mac_addr_copy(assoc_ind, sta_ds,
+					     sizeof(tSirMacAddr));
 	assoc_ind->aid = sta_ds->assocId;
 	qdf_mem_copy((uint8_t *)&assoc_ind->ssId,
 		     (uint8_t *)&assoc_req->ssId,

+ 35 - 20
core/mac/src/pe/lim/lim_process_mlm_req_messages.c

@@ -351,28 +351,19 @@ end:
 		lim_send_start_bss_confirm(mac_ctx, &mlm_start_cnf);
 }
 
-void lim_send_peer_create_resp(struct mac_context *mac, uint8_t vdev_id,
-			       QDF_STATUS qdf_status, uint8_t *peer_mac)
-{
-	struct wlan_objmgr_vdev *vdev;
 #ifdef WLAN_FEATURE_11BE_MLO
-	struct wlan_objmgr_peer *link_peer = NULL;
+static void
+lim_send_peer_create_resp_mlo(struct wlan_objmgr_vdev *vdev,
+			      struct mac_context *mac,
+			      uint8_t *peer_mac,
+			      QDF_STATUS status)
+{
 	uint8_t link_id;
 	struct mlo_partner_info partner_info;
-#endif
-	QDF_STATUS status;
-
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac->psoc,
-						    vdev_id,
-						    WLAN_LEGACY_MAC_ID);
-	if (!vdev)
-		return;
-	status = wlan_cm_bss_peer_create_rsp(vdev, qdf_status,
-					     (struct qdf_mac_addr *)peer_mac);
+	struct wlan_objmgr_peer *link_peer = NULL;
 
-#ifdef WLAN_FEATURE_11BE_MLO
 	if (!wlan_vdev_mlme_is_mlo_vdev(vdev))
-		goto end;
+		return;
 
 	link_id = vdev->vdev_mlme.mlo_link_id;
 	/* currently only 2 link MLO supported */
@@ -390,7 +381,7 @@ void lim_send_peer_create_resp(struct mac_context *mac, uint8_t vdev_id,
 							WLAN_LEGACY_MAC_ID);
 		if (!link_peer) {
 			pe_err("Link peer is NULL");
-			goto end;
+			return;
 		}
 
 		status = wlan_mlo_peer_create(vdev, link_peer,
@@ -401,8 +392,32 @@ void lim_send_peer_create_resp(struct mac_context *mac, uint8_t vdev_id,
 
 		wlan_objmgr_peer_release_ref(link_peer, WLAN_LEGACY_MAC_ID);
 	}
-end:
-#endif
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+lim_send_peer_create_resp_mlo(struct wlan_objmgr_vdev *vdev,
+			      struct mac_context *mac,
+			      uint8_t *peer_mac,
+			      QDF_STATUS status)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
+void lim_send_peer_create_resp(struct mac_context *mac, uint8_t vdev_id,
+			       QDF_STATUS qdf_status, uint8_t *peer_mac)
+{
+	struct wlan_objmgr_vdev *vdev;
+	QDF_STATUS status;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac->psoc,
+						    vdev_id,
+						    WLAN_LEGACY_MAC_ID);
+	if (!vdev)
+		return;
+	status = wlan_cm_bss_peer_create_rsp(vdev, qdf_status,
+					     (struct qdf_mac_addr *)peer_mac);
+	lim_send_peer_create_resp_mlo(vdev, mac, peer_mac, status);
+
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
 }
 

+ 152 - 79
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -705,6 +705,24 @@ void lim_process_mlm_assoc_cnf(struct mac_context *mac_ctx,
 	}
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+lim_fill_sme_assoc_ind_mlo_mld_addr_copy(struct assoc_ind *sme_assoc_ind,
+					 tpLimMlmAssocInd assoc_ind,
+					 uint32_t num_bytes)
+{
+	qdf_mem_copy(sme_assoc_ind->peer_mld_addr, assoc_ind->peer_mld_addr,
+		     num_bytes);
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+lim_fill_sme_assoc_ind_mlo_mld_addr_copy(struct assoc_ind *sme_assoc_ind,
+					 tpLimMlmAssocInd assoc_ind,
+					 uint32_t num_bytes)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 void
 lim_fill_sme_assoc_ind_params(
 	struct mac_context *mac_ctx,
@@ -728,10 +746,8 @@ lim_fill_sme_assoc_ind_params(
 	/* Fill in peerMacAddr */
 	qdf_mem_copy(sme_assoc_ind->peerMacAddr, assoc_ind->peerMacAddr,
 		sizeof(tSirMacAddr));
-#ifdef WLAN_FEATURE_11BE_MLO
-	qdf_mem_copy(sme_assoc_ind->peer_mld_addr, assoc_ind->peer_mld_addr,
-		     sizeof(tSirMacAddr));
-#endif
+	lim_fill_sme_assoc_ind_mlo_mld_addr_copy(sme_assoc_ind, assoc_ind,
+						 sizeof(tSirMacAddr));
 	/* Fill in aid */
 	sme_assoc_ind->aid = assoc_ind->aid;
 	/* Fill in bssId */
@@ -1418,6 +1434,29 @@ void lim_process_mlm_add_sta_rsp(struct mac_context *mac,
 	lim_process_sta_mlm_add_sta_rsp(mac, limMsgQ, pe_session);
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+lim_process_add_sta_rsp_mlo(struct mac_context *mac_ctx,
+			    tLimMlmAssocCnf *mlm_assoc_cnf,
+			    struct pe_session *session_entry)
+{
+	if (wlan_vdev_mlme_is_mlo_link_vdev(session_entry->vdev)) {
+		pe_err("sending assoc cnf for MLO link vdev");
+		mlm_assoc_cnf->resultCode = eSIR_SME_SUCCESS;
+		mlm_assoc_cnf->sessionId = session_entry->peSessionId;
+		lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF,
+				     (uint32_t *)mlm_assoc_cnf);
+	}
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+lim_process_add_sta_rsp_mlo(struct mac_context *mac_ctx,
+			    tLimMlmAssocCnf *mlm_assoc_cnf,
+			    struct pe_session *session_entry)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 /**
  * lim_process_sta_mlm_add_sta_rsp () - Process add sta response
  * @mac_ctx:  Pointer to mac context
@@ -1497,16 +1536,8 @@ void lim_process_sta_mlm_add_sta_rsp(struct mac_context *mac_ctx,
 		MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE,
 			session_entry->peSessionId,
 			session_entry->limMlmState));
-#ifdef WLAN_FEATURE_11BE_MLO
-		if (wlan_vdev_mlme_is_mlo_link_vdev(session_entry->vdev)) {
-			pe_err("sending assoc cnf for MLO link vdev");
-			mlm_assoc_cnf.resultCode = eSIR_SME_SUCCESS;
-			mlm_assoc_cnf.sessionId = session_entry->peSessionId;
-			lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF,
-					     (uint32_t *)&mlm_assoc_cnf);
-		}
-#endif
-
+		lim_process_add_sta_rsp_mlo(mac_ctx, &mlm_assoc_cnf,
+					    session_entry);
 #ifdef WLAN_DEBUG
 		mac_ctx->lim.gLimNumLinkEsts++;
 #endif
@@ -2112,6 +2143,28 @@ static void lim_update_fils_auth_mode(struct pe_session *session_entry,
 { }
 #endif
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static bool
+lim_process_mlo_sta_add_bss_skip_auth(tLimMlmAuthReq *pMlmAuthReq,
+				      struct pe_session *session_entry)
+{
+	if (wlan_vdev_mlme_is_mlo_link_vdev(session_entry->vdev)) {
+		qdf_mem_free(pMlmAuthReq);
+		pe_err("vdev is an MLO link, skip Auth");
+		return true;
+	}
+
+	return false;
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline bool
+lim_process_mlo_sta_add_bss_skip_auth(tLimMlmAuthReq *pMlmAuthReq,
+				      struct pe_session *session_entry)
+{
+	return false;
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 void lim_process_sta_add_bss_rsp_pre_assoc(struct mac_context *mac_ctx,
 					   struct bss_params *add_bss_params,
 					   struct pe_session *session_entry,
@@ -2168,13 +2221,10 @@ void lim_process_sta_add_bss_rsp_pre_assoc(struct mac_context *mac_ctx,
 		MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE,
 			session_entry->peSessionId,
 			session_entry->limSmeState));
-#ifdef WLAN_FEATURE_11BE_MLO
-		if (wlan_vdev_mlme_is_mlo_link_vdev(session_entry->vdev)) {
-			qdf_mem_free(pMlmAuthReq);
-			pe_err("vdev is an MLO link, skip Auth");
+
+		if (lim_process_mlo_sta_add_bss_skip_auth(pMlmAuthReq,
+							  session_entry))
 			return;
-		}
-#endif
 		lim_post_mlm_message(mac_ctx, LIM_MLM_AUTH_REQ,
 			(uint32_t *) pMlmAuthReq);
 		return;
@@ -2681,6 +2731,81 @@ end:
 			     (uint32_t *) &mlmReassocCnf);
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static QDF_STATUS
+lim_process_switch_channel_join_mlo(struct pe_session *session_entry,
+				    struct mac_context *mac_ctx)
+{
+	QDF_STATUS status;
+
+	struct element_info assoc_rsp;
+	struct qdf_mac_addr sta_link_addr;
+
+	pe_err("sta_link_addr" QDF_MAC_ADDR_FMT,
+	       QDF_MAC_ADDR_REF(&sta_link_addr));
+	assoc_rsp.len = 0;
+	mlo_get_assoc_rsp(session_entry->vdev, &assoc_rsp);
+
+	if (!session_entry->lim_join_req->partner_info.num_partner_links) {
+		pe_debug("MLO: num_partner_links is 0");
+		return QDF_STATUS_E_INVAL;
+	}
+	/* Todo: update the sta addr by matching link id */
+	qdf_mem_copy(&sta_link_addr, session_entry->self_mac_addr,
+		     QDF_MAC_ADDR_SIZE);
+
+	if (assoc_rsp.len) {
+		struct element_info link_assoc_rsp;
+		tLimMlmJoinCnf mlm_join_cnf;
+
+		mlm_join_cnf.resultCode = eSIR_SME_SUCCESS;
+		mlm_join_cnf.protStatusCode = STATUS_SUCCESS;
+		/* Update PE sessionId */
+		mlm_join_cnf.sessionId = session_entry->peSessionId;
+		lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF,
+				     (uint32_t *)&mlm_join_cnf);
+
+		session_entry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
+		assoc_rsp.len += SIR_MAC_HDR_LEN_3A;
+		pe_debug("MLO:assoc rsp len + hdr %d ", assoc_rsp.len);
+
+		link_assoc_rsp.ptr = qdf_mem_malloc(assoc_rsp.len);
+		if (!link_assoc_rsp.ptr)
+			return QDF_STATUS_E_NOMEM;
+
+		link_assoc_rsp.len = assoc_rsp.len + 24;
+		session_entry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE;
+		pe_debug("MLO: Generate and process assoc rsp for link vdev");
+
+		status = util_gen_link_assoc_rsp(assoc_rsp.ptr,
+						 assoc_rsp.len - 24,
+						 false, sta_link_addr,
+						 link_assoc_rsp.ptr,
+						 assoc_rsp.len,
+						 (qdf_size_t *)&link_assoc_rsp.len);
+
+		if (QDF_IS_STATUS_SUCCESS(status)) {
+			pe_debug("MLO: process assoc rsp for link vdev");
+			lim_process_assoc_rsp_frame(mac_ctx,
+						    link_assoc_rsp.ptr,
+						    link_assoc_rsp.len,
+						    LIM_ASSOC,
+						    session_entry);
+			qdf_mem_free(link_assoc_rsp.ptr);
+		}
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+#else /* WLAN_FEATURE_11BE_MLO */
+static QDF_STATUS
+lim_process_switch_channel_join_mlo(struct pe_session *session_entry,
+				    struct mac_context *mac_ctx)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
 
 /**
  * lim_process_switch_channel_join_req() -Initiates probe request
@@ -2705,6 +2830,7 @@ static void lim_process_switch_channel_join_req(
 	struct vdev_mlme_obj *mlme_obj;
 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 	bool tpe_change = false;
+	QDF_STATUS mlo_status;
 
 	if (status != QDF_STATUS_SUCCESS) {
 		pe_err("Change channel failed!!");
@@ -2726,69 +2852,16 @@ static void lim_process_switch_channel_join_req(
 	/* Apply previously set configuration at HW */
 	lim_apply_configuration(mac_ctx, session_entry);
 
-/* WLAN_FEATURE_11BE_MLO flag will be removed
- * once the MLO testing is complete
- */
-#ifdef WLAN_FEATURE_11BE_MLO
 	if (wlan_vdev_mlme_is_mlo_link_vdev(session_entry->vdev)) {
-		struct element_info assoc_rsp;
-		struct qdf_mac_addr sta_link_addr;
-
-		pe_err("sta_link_addr" QDF_MAC_ADDR_FMT,
-		       QDF_MAC_ADDR_REF(&sta_link_addr));
-		assoc_rsp.len = 0;
-		mlo_get_assoc_rsp(session_entry->vdev, &assoc_rsp);
+		mlo_status = lim_process_switch_channel_join_mlo(session_entry,
+								 mac_ctx);
 
-		if (!session_entry->lim_join_req->
-					partner_info.num_partner_links) {
-			pe_debug("MLO: num_partner_links is 0");
+		if (mlo_status == QDF_STATUS_E_INVAL)
 			goto error;
-		}
-		/* Todo: update the sta addr by matching link id */
-		qdf_mem_copy(&sta_link_addr, session_entry->self_mac_addr,
-			     QDF_MAC_ADDR_SIZE);
-
-		if (assoc_rsp.len) {
-			struct element_info link_assoc_rsp;
-			tLimMlmJoinCnf mlm_join_cnf;
-
-			mlm_join_cnf.resultCode = eSIR_SME_SUCCESS;
-			mlm_join_cnf.protStatusCode = STATUS_SUCCESS;
-			/* Update PE sessionId */
-			mlm_join_cnf.sessionId = session_entry->peSessionId;
-			lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF,
-					     (uint32_t *)&mlm_join_cnf);
-
-			session_entry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
-			assoc_rsp.len += SIR_MAC_HDR_LEN_3A;
-			pe_debug("MLO:assoc rsp len + hdr %d ", assoc_rsp.len);
-
-			link_assoc_rsp.ptr = qdf_mem_malloc(assoc_rsp.len);
-			if (!link_assoc_rsp.ptr)
-				return;
-
-			link_assoc_rsp.len = assoc_rsp.len + 24;
-			session_entry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE;
-			pe_debug("MLO: Generate and process assoc rsp for link vdev");
-
-			if (QDF_IS_STATUS_SUCCESS(
-				util_gen_link_assoc_rsp(
-					assoc_rsp.ptr, assoc_rsp.len - 24,
-					false, sta_link_addr,
-					link_assoc_rsp.ptr, assoc_rsp.len,
-					(qdf_size_t *)&link_assoc_rsp.len))) {
-				pe_debug("MLO: process assoc rsp for link vdev");
-				lim_process_assoc_rsp_frame(mac_ctx,
-							    link_assoc_rsp.ptr,
-							    link_assoc_rsp.len,
-							    LIM_ASSOC,
-							    session_entry);
-				qdf_mem_free(link_assoc_rsp.ptr);
-			}
-		}
-		return;
+		else
+			return;
 	}
-#endif
+
 	/*
 	* If deauth_before_connection is enabled, Send Deauth first to AP if
 	* last disconnection was caused by HB failure.

+ 20 - 5
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -2180,6 +2180,25 @@ QDF_STATUS lim_fill_adaptive_11r_ie(struct pe_session *pe_session,
 }
 #endif
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+lim_send_assoc_req_mgmt_frame_mlo(struct mac_context *mac_ctx,
+				  struct pe_session *pe_session,
+				  tDot11fAssocRequest *frm)
+{
+	if ((wlan_vdev_mlme_get_opmode(pe_session->vdev) == QDF_STA_MODE) &&
+	    wlan_vdev_mlme_is_mlo_vdev(pe_session->vdev))
+		populate_dot11f_assoc_req_mlo_ie(mac_ctx, pe_session, frm);
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+lim_send_assoc_req_mgmt_frame_mlo(struct mac_context *mac_ctx,
+				  struct pe_session *pe_session,
+				  tDot11fAssocRequest *frm)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 /**
  * lim_send_assoc_req_mgmt_frame() - Send association request
  * @mac_ctx: Handle to MAC context
@@ -2459,12 +2478,8 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 
 	if (lim_is_session_eht_capable(pe_session))
 		populate_dot11f_eht_caps(mac_ctx, pe_session, &frm->eht_cap);
+	lim_send_assoc_req_mgmt_frame_mlo(mac_ctx, pe_session, frm);
 
-#ifdef WLAN_FEATURE_11BE_MLO
-	if ((wlan_vdev_mlme_get_opmode(pe_session->vdev) == QDF_STA_MODE) &&
-	    wlan_vdev_mlme_is_mlo_vdev(pe_session->vdev))
-		populate_dot11f_assoc_req_mlo_ie(mac_ctx, pe_session, frm);
-#endif
 	if (pe_session->is11Rconnection) {
 		struct bss_description *bssdescr;
 

+ 8 - 3
core/mac/src/pe/lim/lim_send_sme_rsp_messages.c

@@ -445,7 +445,14 @@ static void lim_copy_ml_partner_info(struct cm_vdev_join_rsp *rsp,
 		}
 	}
 }
-#endif
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+lim_copy_ml_partner_info(struct cm_vdev_join_rsp *rsp,
+			 struct pe_session *pe_session)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 void lim_cm_send_connect_rsp(struct mac_context *mac_ctx,
 			     struct pe_session *pe_session,
 			     struct cm_vdev_join_req *req,
@@ -478,9 +485,7 @@ void lim_cm_send_connect_rsp(struct mac_context *mac_ctx,
 								connect_status,
 								status_code);
 		lim_free_pession_ies(pe_session);
-#ifdef WLAN_FEATURE_11BE_MLO
 		lim_copy_ml_partner_info(rsp, pe_session);
-#endif
 		if (QDF_IS_STATUS_ERROR(status)) {
 			pe_err("vdev_id: %d cm_id 0x%x : fail to prepare rsp",
 			       rsp->connect_rsp.vdev_id,

+ 19 - 6
core/sap/src/sap_fsm.c

@@ -2068,6 +2068,24 @@ QDF_STATUS sap_populate_peer_assoc_info(struct mac_context *mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+sap_reassoc_mld_copy(struct csr_roam_info *csr_roaminfo,
+		     tSap_StationAssocReassocCompleteEvent *reassoc_complete)
+{
+	qdf_copy_macaddr(&reassoc_complete->sta_mld,
+			 &csr_roaminfo->peer_mld);
+	sap_debug("reassoc_complete->staMld: " QDF_MAC_ADDR_FMT,
+		  QDF_MAC_ADDR_REF(reassoc_complete->sta_mld.bytes));
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+sap_reassoc_mld_copy(struct csr_roam_info *csr_roaminfo,
+		     tSap_StationAssocReassocCompleteEvent *reassoc_complete)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 /**
  * sap_signal_hdd_event() - send event notification
  * @sap_ctx: Sap Context
@@ -2250,12 +2268,7 @@ QDF_STATUS sap_signal_hdd_event(struct sap_context *sap_ctx,
 
 		qdf_copy_macaddr(&reassoc_complete->staMac,
 				 &csr_roaminfo->peerMac);
-#ifdef WLAN_FEATURE_11BE_MLO
-		qdf_copy_macaddr(&reassoc_complete->sta_mld,
-				 &csr_roaminfo->peer_mld);
-		sap_debug("reassoc_complete->staMld: " QDF_MAC_ADDR_FMT,
-			  QDF_MAC_ADDR_REF(reassoc_complete->sta_mld.bytes));
-#endif
+		sap_reassoc_mld_copy(csr_roaminfo, reassoc_complete);
 		reassoc_complete->staId = csr_roaminfo->staId;
 		reassoc_complete->status_code = csr_roaminfo->status_code;
 

+ 39 - 9
core/sme/src/csr/csr_api_roam.c

@@ -3171,6 +3171,25 @@ void csr_roaming_state_msg_processor(struct mac_context *mac, void *msg_buf)
 	}
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+csr_roam_assoc_cnf_mld_copy(struct csr_roam_info *roam_info,
+			    tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf,
+			    uint32_t num_bytes)
+{
+	qdf_mem_copy(roam_info->peer_mld.bytes,
+		     pUpperLayerAssocCnf->peer_mld_addr,
+		     num_bytes);
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+csr_roam_assoc_cnf_mld_copy(struct csr_roam_info *roam_info,
+			    tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf,
+			    uint32_t num_bytes)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 void csr_roam_joined_state_msg_processor(struct mac_context *mac, void *msg_buf)
 {
 	tSirSmeRsp *pSirMsg = (tSirSmeRsp *)msg_buf;
@@ -3228,11 +3247,9 @@ void csr_roam_joined_state_msg_processor(struct mac_context *mac, void *msg_buf)
 		qdf_mem_copy(roam_info->peerMac.bytes,
 			     pUpperLayerAssocCnf->peerMacAddr,
 			     sizeof(tSirMacAddr));
-#ifdef WLAN_FEATURE_11BE_MLO
-		qdf_mem_copy(roam_info->peer_mld.bytes,
-			     pUpperLayerAssocCnf->peer_mld_addr,
-			     sizeof(tSirMacAddr));
-#endif
+		csr_roam_assoc_cnf_mld_copy(roam_info,
+					    pUpperLayerAssocCnf,
+					    sizeof(tSirMacAddr));
 		qdf_mem_copy(&roam_info->bssid,
 			     pUpperLayerAssocCnf->bssId,
 			     sizeof(struct qdf_mac_addr));
@@ -3731,6 +3748,22 @@ static bool csr_is_sae_peer_allowed(struct mac_context *mac_ctx,
 	return is_allowed;
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void
+csr_send_assoc_ind_to_upper_layer_mac_copy(tSirSmeAssocIndToUpperLayerCnf *cnf,
+					   struct assoc_ind *ind)
+{
+	qdf_mem_copy(&cnf->peer_mld_addr, &ind->peer_mld_addr,
+		     sizeof(cnf->peer_mld_addr));
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void
+csr_send_assoc_ind_to_upper_layer_mac_copy(tSirSmeAssocIndToUpperLayerCnf *cnf,
+					   struct assoc_ind *ind)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 static QDF_STATUS
 csr_send_assoc_ind_to_upper_layer_cnf_msg(struct mac_context *mac,
 					  struct assoc_ind *ind,
@@ -3755,10 +3788,7 @@ csr_send_assoc_ind_to_upper_layer_cnf_msg(struct mac_context *mac,
 	qdf_mem_copy(&cnf->bssId, &ind->bssId, sizeof(cnf->bssId));
 	qdf_mem_copy(&cnf->peerMacAddr, &ind->peerMacAddr,
 		     sizeof(cnf->peerMacAddr));
-#ifdef WLAN_FEATURE_11BE_MLO
-	qdf_mem_copy(&cnf->peer_mld_addr, &ind->peer_mld_addr,
-		     sizeof(cnf->peer_mld_addr));
-#endif
+	csr_send_assoc_ind_to_upper_layer_mac_copy(cnf, ind);
 	cnf->aid = ind->staId;
 	cnf->wmmEnabledSta = ind->wmmEnabledSta;
 	cnf->rsnIE = ind->rsnIE;

+ 20 - 11
core/wma/src/wma_dev_if.c

@@ -2396,6 +2396,25 @@ static void wma_send_vdev_down_req(tp_wma_handle wma,
 				      sizeof(*resp), resp);
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc,
+				uint8_t *macaddr)
+{
+	struct wlan_objmgr_peer *peer = NULL;
+
+	peer = wlan_objmgr_get_peer_by_mac(psoc, macaddr, WLAN_LEGACY_WMA_ID);
+	if (peer) {
+		wlan_mlo_link_peer_delete(peer);
+		wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_WMA_ID);
+	}
+}
+#else /* WLAN_FEATURE_11BE_MLO */
+static inline void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc,
+				       uint8_t *macaddr)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 static QDF_STATUS
 wma_delete_peer_on_vdev_stop(tp_wma_handle wma, uint8_t vdev_id)
 {
@@ -2404,9 +2423,6 @@ wma_delete_peer_on_vdev_stop(tp_wma_handle wma, uint8_t vdev_id)
 	struct wma_txrx_node *iface;
 	QDF_STATUS status;
 	struct qdf_mac_addr bssid;
-#ifdef WLAN_FEATURE_11BE_MLO
-	struct wlan_objmgr_peer *peer = NULL;
-#endif
 
 	iface = &wma->interfaces[vdev_id];
 	status = wlan_vdev_get_bss_peer_mac(iface->vdev, &bssid);
@@ -2422,14 +2438,7 @@ wma_delete_peer_on_vdev_stop(tp_wma_handle wma, uint8_t vdev_id)
 		return QDF_STATUS_E_INVAL;
 	}
 
-#ifdef WLAN_FEATURE_11BE_MLO
-	peer = wlan_objmgr_get_peer_by_mac(wma->psoc, bssid.bytes,
-					   WLAN_LEGACY_WMA_ID);
-	if (peer) {
-		wlan_mlo_link_peer_delete(peer);
-		wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_WMA_ID);
-	}
-#endif
+	wma_delete_peer_mlo(wma->psoc, bssid.bytes);
 
 	vdev_stop_resp = qdf_mem_malloc(sizeof(*vdev_stop_resp));
 	if (!vdev_stop_resp)