|
@@ -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);
|
|
|
|