瀏覽代碼

qcacmn: ml peer id allocation change

Change to allocate next available ML peer id
instead of using recently free peer_id

Change-Id: I493ef2d838d7880568462ae3e8024ae3be5f1ba7
CRs-Fixed: 3384320
Chaithanya Garrepalli 2 年之前
父節點
當前提交
7799db5d9e

+ 5 - 3
umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h

@@ -53,7 +53,8 @@ struct wlan_t2lm_context;
 /* Max LINK PEER support */
 #define MAX_MLO_LINK_PEERS WLAN_UMAC_MLO_MAX_VDEVS
 
-#define MAX_MLO_PEER_ID 2048
+/* MAX MLO peer_id supported by FW is 128 */
+#define MAX_MLO_PEER_ID 128
 #define MLO_INVALID_PEER_ID 0xFFFF
 
 /* IE nomenclature */
@@ -167,8 +168,8 @@ struct mlo_state_params {
  * @context: Array of MLO device context
  * @mlo_peer_id_bmap: bitmap to allocate MLO Peer ID
  * @max_mlo_peer_id: Max MLO Peer ID
- * @info: Pointer to MLO setup_info of all groups
- * @total_grp: Total number of MLO groups
+ * @last_mlo_peer_id: Previously allocated ML peer ID
+ * @setup_info: MLO setup_info of all groups
  * @mlme_ops: MLO MLME callback function pointers
  * @msgq_ctx: Context switch mgr
  * @mlo_is_force_primary_umac: Force Primary UMAC enable
@@ -187,6 +188,7 @@ struct mlo_mgr_context {
 	qdf_list_t ml_dev_list;
 	qdf_bitmap(mlo_peer_id_bmap, MAX_MLO_PEER_ID);
 	uint16_t max_mlo_peer_id;
+	uint16_t last_mlo_peer_id;
 #ifdef WLAN_MLO_MULTI_CHIP
 	struct mlo_setup_info *setup_info;
 	uint8_t total_grp;

+ 14 - 6
umac/mlo_mgr/src/wlan_mlo_mgr_ap.c

@@ -388,23 +388,31 @@ uint16_t mlo_ap_ml_peerid_alloc(void)
 {
 	struct mlo_mgr_context *mlo_ctx = wlan_objmgr_get_mlo_ctx();
 	uint16_t i;
+	uint16_t mlo_peer_id;
 
 	ml_peerid_lock_acquire(mlo_ctx);
+	mlo_peer_id = mlo_ctx->last_mlo_peer_id;
 	for (i = 0; i < mlo_ctx->max_mlo_peer_id; i++) {
-		if (qdf_test_bit(i, mlo_ctx->mlo_peer_id_bmap))
+		mlo_peer_id = (mlo_peer_id + 1) % mlo_ctx->max_mlo_peer_id;
+
+		if (!mlo_peer_id)
+			continue;
+
+		if (qdf_test_bit(mlo_peer_id, mlo_ctx->mlo_peer_id_bmap))
 			continue;
 
-		qdf_set_bit(i, mlo_ctx->mlo_peer_id_bmap);
+		qdf_set_bit(mlo_peer_id, mlo_ctx->mlo_peer_id_bmap);
 		break;
 	}
+	mlo_ctx->last_mlo_peer_id = mlo_peer_id;
 	ml_peerid_lock_release(mlo_ctx);
 
 	if (i == mlo_ctx->max_mlo_peer_id)
 		return MLO_INVALID_PEER_ID;
 
-	mlo_debug(" ML peer id %d is allocated", i + 1);
+	mlo_debug(" ML peer id %d is allocated", mlo_peer_id);
 
-	return i + 1;
+	return mlo_peer_id;
 }
 
 void mlo_ap_ml_peerid_free(uint16_t mlo_peer_id)
@@ -423,8 +431,8 @@ void mlo_ap_ml_peerid_free(uint16_t mlo_peer_id)
 	}
 
 	ml_peerid_lock_acquire(mlo_ctx);
-	if (qdf_test_bit(mlo_peer_id - 1, mlo_ctx->mlo_peer_id_bmap))
-		qdf_clear_bit(mlo_peer_id - 1, mlo_ctx->mlo_peer_id_bmap);
+	if (qdf_test_bit(mlo_peer_id, mlo_ctx->mlo_peer_id_bmap))
+		qdf_clear_bit(mlo_peer_id, mlo_ctx->mlo_peer_id_bmap);
 
 	ml_peerid_lock_release(mlo_ctx);
 

+ 1 - 0
umac/mlo_mgr/src/wlan_mlo_mgr_main.c

@@ -72,6 +72,7 @@ static void mlo_global_ctx_init(void)
 
 	qdf_list_create(&mlo_mgr_ctx->ml_dev_list, WLAN_UMAC_MLO_MAX_DEV);
 	mlo_mgr_ctx->max_mlo_peer_id = MAX_MLO_PEER_ID;
+	mlo_mgr_ctx->last_mlo_peer_id = 0;
 	ml_peerid_lock_create(mlo_mgr_ctx);
 	ml_link_lock_create(mlo_mgr_ctx);
 	ml_aid_lock_create(mlo_mgr_ctx);