浏览代码

qcacmn: Update vdev mlme MAC address based on connection type

Management frames from STA should carry SA as link MAC address for ML
connection and net device address for non-ML connection.

To achieve this, update vdev mlme MAC address to link MAC address for
ML connection and to net dev MAC address for non-ML connection.

Change-Id: I2285a43882039dfc706fbf73a494cc09bcba19c7
CRs-Fixed: 2993031
Bapiraju Alla 4 年之前
父节点
当前提交
e95a45c0f7

+ 41 - 1
umac/cmn_services/obj_mgr/inc/wlan_objmgr_vdev_obj.h

@@ -298,8 +298,10 @@ struct wlan_channel {
  * @vdev_feat_ext2_caps: More VDEV Extended feature caps
  * @vdev_op_flags:      Operation flags
  * @mataddr[]:          MAT address
- * @macaddr[]:          VDEV self MAC address
+ * @macaddr[]:          Contains link MAC address for ML connection and
+ *                      net dev address for non-ML connection
  * @mldaddr[]:          MLD address
+ * @linkaddr[]:         Link MAC address
  * @link_id:            link id for mlo connection
  */
 struct wlan_objmgr_vdev_mlme {
@@ -316,6 +318,7 @@ struct wlan_objmgr_vdev_mlme {
 	uint8_t  mataddr[QDF_MAC_ADDR_SIZE];
 	uint8_t  macaddr[QDF_MAC_ADDR_SIZE];
 	uint8_t  mldaddr[QDF_MAC_ADDR_SIZE];
+	uint8_t  linkaddr[QDF_MAC_ADDR_SIZE];
 #ifdef WLAN_FEATURE_11BE_MLO
 	uint8_t  mlo_link_id;
 #endif
@@ -782,6 +785,43 @@ static inline void wlan_vdev_mlme_set_mldaddr(struct wlan_objmgr_vdev *vdev,
 	WLAN_ADDR_COPY(vdev->vdev_mlme.mldaddr, mldaddr);
 }
 
+/**
+ * wlan_vdev_mlme_get_linkaddr() - get vdev linkaddr
+ * @vdev: VDEV object
+ *
+ * API to get link MAC address from vdev object
+ *
+ * Caller need to acquire lock with wlan_vdev_obj_lock()
+ *
+ * Return:
+ * @linkaddr: Link MAC address
+ */
+static inline
+uint8_t *wlan_vdev_mlme_get_linkaddr(struct wlan_objmgr_vdev *vdev)
+{
+	/* This API is invoked with lock acquired, do not add log prints */
+	return vdev->vdev_mlme.linkaddr;
+}
+
+/**
+ * wlan_vdev_mlme_set_linkaddr() - set vdev linkaddr
+ * @vdev: VDEV object
+ * @linkaddr: Link address
+ *
+ * API to set link addr in vdev object
+ *
+ * Caller need to acquire lock with wlan_vdev_obj_lock()
+ *
+ * Return: void
+ */
+static inline void wlan_vdev_mlme_set_linkaddr(struct wlan_objmgr_vdev *vdev,
+					       uint8_t *linkaddr)
+{
+	/* This API is invoked with lock acquired, do not add log prints */
+	qdf_copy_macaddr((struct qdf_mac_addr *)vdev->vdev_mlme.linkaddr,
+			 (struct qdf_mac_addr *)linkaddr);
+}
+
 /**
  * wlan_vdev_mlme_get_mataddr() - get mataddr
  * @vdev: VDEV object

+ 2 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c

@@ -210,6 +210,8 @@ struct wlan_objmgr_vdev *wlan_objmgr_vdev_obj_create(
 	wlan_vdev_mlme_set_mataddr(vdev, params->mataddr);
 	/* set MLD address */
 	wlan_vdev_mlme_set_mldaddr(vdev, params->mldaddr);
+	/* set link address */
+	wlan_vdev_mlme_set_linkaddr(vdev, params->macaddr);
 	/* Set create flags */
 	vdev->vdev_objmgr.c_flags = params->flags;
 	/* store os-specific pointer */

+ 42 - 4
umac/mlme/connection_mgr/core/src/wlan_cm_connect.c

@@ -458,17 +458,43 @@ void cm_set_vdev_link_id(struct cnx_mgr *cm_ctx,
 		}
 	}
 }
+
+static void cm_update_vdev_mlme_macaddr(struct cnx_mgr *cm_ctx,
+					struct cm_connect_req *req)
+{
+	wlan_vdev_obj_lock(cm_ctx->vdev);
+	if (req->cur_candidate->entry->ie_list.multi_link) {
+		/* Use link address for ML connection */
+		wlan_vdev_mlme_set_macaddr(cm_ctx->vdev,
+					   cm_ctx->vdev->vdev_mlme.linkaddr);
+	} else {
+		/* Use net_dev address for non-ML connection */
+		wlan_vdev_mlme_set_macaddr(cm_ctx->vdev,
+					   cm_ctx->vdev->vdev_mlme.mldaddr);
+	}
+	wlan_vdev_obj_unlock(cm_ctx->vdev);
+}
 #else
 static inline
 void cm_set_vdev_link_id(struct cnx_mgr *cm_ctx,
 			 struct cm_connect_req *req)
 { }
+
+static void cm_update_vdev_mlme_macaddr(struct cnx_mgr *cm_ctx,
+					struct cm_connect_req *req)
+{
+}
 #endif
 #else
 static inline
 void cm_set_vdev_link_id(struct cnx_mgr *cm_ctx,
 			 struct cm_connect_req *req)
 { }
+
+static void cm_update_vdev_mlme_macaddr(struct cnx_mgr *cm_ctx,
+					struct cm_connect_req *req)
+{
+}
 #endif
 
 static void cm_create_bss_peer(struct cnx_mgr *cm_ctx,
@@ -848,6 +874,9 @@ cm_peer_create_on_bss_select_ind_resp(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id)
 	if (!cm_req)
 		return QDF_STATUS_E_FAILURE;
 
+	/* Update vdev mlme mac address based on connection type */
+	cm_update_vdev_mlme_macaddr(cm_ctx, &cm_req->connect_req);
+
 	cm_create_bss_peer(cm_ctx, &cm_req->connect_req);
 
 	return QDF_STATUS_SUCCESS;
@@ -1448,14 +1477,19 @@ QDF_STATUS cm_try_next_candidate(struct cnx_mgr *cm_ctx,
 	cm_update_ser_timer_for_new_candidate(cm_ctx, resp->cm_id);
 
 	status = cm_send_bss_select_ind(cm_ctx, &cm_req->connect_req);
+
 	/*
 	 * If candidate select indication is not supported continue with bss
 	 * peer create, else peer will be created after resp.
 	 */
-	if (status == QDF_STATUS_E_NOSUPPORT)
+	if (status == QDF_STATUS_E_NOSUPPORT) {
+		/* Update vdev mlme mac address based on connection type */
+		cm_update_vdev_mlme_macaddr(cm_ctx, &cm_req->connect_req);
+
 		cm_create_bss_peer(cm_ctx, &cm_req->connect_req);
-	else if (QDF_IS_STATUS_ERROR(status))
+	} else if (QDF_IS_STATUS_ERROR(status)) {
 		goto connect_err;
+	}
 
 	return QDF_STATUS_SUCCESS;
 
@@ -1518,10 +1552,14 @@ QDF_STATUS cm_connect_active(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id)
 	 * If candidate select indication is not supported continue with bss
 	 * peer create, else peer will be created after resp.
 	 */
-	if (status == QDF_STATUS_E_NOSUPPORT)
+	if (status == QDF_STATUS_E_NOSUPPORT) {
+		/* Update vdev mlme mac address based on connection type */
+		cm_update_vdev_mlme_macaddr(cm_ctx, &cm_req->connect_req);
+
 		cm_create_bss_peer(cm_ctx, &cm_req->connect_req);
-	else if (QDF_IS_STATUS_ERROR(status))
+	} else if (QDF_IS_STATUS_ERROR(status)) {
 		goto connect_err;
+	}
 
 	return QDF_STATUS_SUCCESS;