فهرست منبع

qcacmn: Modify API to check peer address in global ML ctx

Modify the mlo_mgr_ml_peer_exist() API to accept
pointer to vdev_id of the peer and rename as
mlo_mgr_ml_peer_exist_on_diff_ml_ctx().

The API returns true if the peer address matches on
any vdev which is on different ML dev context, if
match is found on same ML dev context the API will
return false.
If the peer address match is found but the pointer
to peer vdev ID is NULL, the API will return true.

Change-Id: I8045325f31850782551c7468aa1eac7c5f77fd69
CRs-Fixed: 3377752
Vinod Kumar Pirla 2 سال پیش
والد
کامیت
ba7c39769d
2فایلهای تغییر یافته به همراه58 افزوده شده و 10 حذف شده
  1. 13 6
      umac/mlo_mgr/inc/wlan_mlo_mgr_main.h
  2. 45 4
      umac/mlo_mgr/src/wlan_mlo_mgr_main.c

+ 13 - 6
umac/mlo_mgr/inc/wlan_mlo_mgr_main.h

@@ -902,16 +902,22 @@ QDF_STATUS wlan_mlo_check_valid_config(struct wlan_mlo_dev_context *ml_dev,
 				       enum QDF_OPMODE opmode);
 
 /**
- * mlo_mgr_ml_peer_exist() - Check if MAC address matches any MLD address
+ * mlo_mgr_ml_peer_exist_on_diff_ml_ctx() - Check if MAC address matches any
+ * MLD address
  * @peer_addr: Address to search for a match
+ * @peer_vdev_id: vdev ID of peer
  *
- * The API iterates through all the ML dev ctx in the driver and checks
- * if MAC address pointed by @peer_addr matches the MLD address of
- * MLD dev or any of the ML peers in the ML dev ctx.
+ * The API iterates through all the ML dev ctx in the global MLO
+ * manager to check if MAC address pointed by @peer_addr matches
+ * the MLD address of any ML dev context or its ML peers.
+ * If @peer_vdev_id is a valid pointer address, then API returns
+ * true only if the matching MAC address is not part of the same
+ * ML dev context.
  *
  * Return: True if a matching entity is found else false.
  */
-bool mlo_mgr_ml_peer_exist(uint8_t *peer_addr);
+bool mlo_mgr_ml_peer_exist_on_diff_ml_ctx(uint8_t *peer_addr,
+					  uint8_t *peer_vdev_id);
 #else
 static inline QDF_STATUS wlan_mlo_mgr_init(void)
 {
@@ -931,7 +937,8 @@ wlan_mlo_mgr_update_mld_addr(struct qdf_mac_addr *old_mac,
 }
 
 static inline
-bool mlo_mgr_ml_peer_exist(uint8_t *peer_addr)
+bool mlo_mgr_ml_peer_exist_on_diff_ml_ctx(uint8_t *peer_addr,
+					  uint8_t *peer_vdev_id)
 {
 	return false;
 }

+ 45 - 4
umac/mlo_mgr/src/wlan_mlo_mgr_main.c

@@ -289,12 +289,15 @@ bool wlan_mlo_is_mld_ctx_exist(struct qdf_mac_addr *mldaddr)
 }
 
 #ifdef WLAN_FEATURE_11BE_MLO
-bool mlo_mgr_ml_peer_exist(uint8_t *peer_addr)
+bool mlo_mgr_ml_peer_exist_on_diff_ml_ctx(uint8_t *peer_addr,
+					  uint8_t *peer_vdev_id)
 {
 	qdf_list_t *ml_list;
+	uint32_t idx, count;
 	struct wlan_mlo_dev_context *mld_cur, *mld_next;
 	struct wlan_mlo_peer_list *mlo_peer_list;
-	bool ret_status = false;
+	struct wlan_objmgr_vdev *vdev;
+	bool ret_status = false, same_ml_ctx = false;
 	struct mlo_mgr_context *g_mlo_ctx = wlan_objmgr_get_mlo_ctx();
 
 	if (!g_mlo_ctx || !peer_addr ||
@@ -311,23 +314,57 @@ bool mlo_mgr_ml_peer_exist(uint8_t *peer_addr)
 		mlo_dev_lock_acquire(mld_cur);
 		if (qdf_is_macaddr_equal(&mld_cur->mld_addr,
 					 (struct qdf_mac_addr *)peer_addr)) {
+			/* For self peer, the address passed will match the
+			 * MLD address of its own ML dev context, so allow
+			 * peer creation in this scenario as both are in
+			 * same ML dev context.
+			 */
+			if (peer_vdev_id) {
+				count = QDF_ARRAY_SIZE(mld_cur->wlan_vdev_list);
+				for (idx = 0; idx < count; idx++) {
+					vdev = mld_cur->wlan_vdev_list[idx];
+					if (!vdev)
+						continue;
+					if (*peer_vdev_id ==
+					    wlan_vdev_get_id(vdev)) {
+						same_ml_ctx = true;
+						break;
+					}
+				}
+			}
 			mlo_dev_lock_release(mld_cur);
 			mlo_err("MLD ID %d exists with mac " QDF_MAC_ADDR_FMT,
 				mld_cur->mld_id, QDF_MAC_ADDR_REF(peer_addr));
 			ret_status = true;
-			goto g_ml_ref;
+			goto check_same_ml_ctx;
 		}
 
 		/* Check the peer list for a MAC address match */
 		mlo_peer_list = &mld_cur->mlo_peer_list;
 		ml_peerlist_lock_acquire(mlo_peer_list);
 		if (mlo_get_mlpeer(mld_cur, (struct qdf_mac_addr *)peer_addr)) {
+			/* If peer_vdev_id is NULL, then API will treat any
+			 * match as happening on another dev context
+			 */
+			if (peer_vdev_id) {
+				count = QDF_ARRAY_SIZE(mld_cur->wlan_vdev_list);
+				for (idx = 0; idx < count; idx++) {
+					vdev = mld_cur->wlan_vdev_list[idx];
+					if (!vdev)
+						continue;
+					if (*peer_vdev_id ==
+					    wlan_vdev_get_id(vdev)) {
+						same_ml_ctx = true;
+						break;
+					}
+				}
+			}
 			ml_peerlist_lock_release(mlo_peer_list);
 			mlo_dev_lock_release(mld_cur);
 			mlo_err("MLD ID %d ML Peer exists with mac " QDF_MAC_ADDR_FMT,
 				mld_cur->mld_id, QDF_MAC_ADDR_REF(peer_addr));
 			ret_status = true;
-			goto g_ml_ref;
+			goto check_same_ml_ctx;
 		}
 		ml_peerlist_lock_release(mlo_peer_list);
 
@@ -336,6 +373,10 @@ bool mlo_mgr_ml_peer_exist(uint8_t *peer_addr)
 		mld_cur = mld_next;
 	}
 
+check_same_ml_ctx:
+	if (same_ml_ctx)
+		ret_status = false;
+
 g_ml_ref:
 	ml_link_lock_release(g_mlo_ctx);
 	return ret_status;