Ver código fonte

qcacmn: Modify return type of primary umac selection API

Modify return type of primary umac selection API so that multiple
callers can use the same algo for selecting new primary umac

Change-Id: I6e38839ae3489b6643ef0337c8e20d7c738c3763
CRs-Fixed: 3529926
Himanshu Batra 2 anos atrás
pai
commit
6f407b1a93

+ 13 - 0
umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h

@@ -751,4 +751,17 @@ QDF_STATUS wlan_mlo_validate_reassocreq(struct wlan_mlo_peer_context *ml_peer);
  */
 void wlan_objmgr_mlo_update_primary_info(struct wlan_objmgr_peer *peer);
 #endif
+
+/**
+ * wlan_mld_get_best_primary_umac_w_rssi() - API to get primary umac using rssi
+ * @ml_peer: ml peer object
+ * @link_vdevs: list of vdevs from which new primary link is to be selected
+ *
+ * API to get primary umac using rssi
+ *
+ * Return: primary umac psoc id
+ */
+uint8_t
+wlan_mld_get_best_primary_umac_w_rssi(struct wlan_mlo_peer_context *ml_peer,
+				      struct wlan_objmgr_vdev *link_vdevs[]);
 #endif

+ 6 - 0
umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h

@@ -662,6 +662,10 @@ struct mlo_nstr_info {
  * @mesh_config: eack link peer's MESH configuration
  * @mlpeer_mldcap: MLD Capability information for ML peer
  * @mlpeer_nstrinfo: NSTR Capability info
+ * @migrate_primary_umac_psoc_id: primary umac psoc id selected for umac
+ * migration
+ * @primary_umac_migration_in_progress: flag to indicate primary umac migration
+ * in progress
  */
 struct wlan_mlo_peer_context {
 	qdf_list_node_t peer_node;
@@ -703,6 +707,8 @@ struct wlan_mlo_peer_context {
 #endif
 	struct wlan_mlo_mld_cap mlpeer_mldcap;
 	struct mlo_nstr_info mlpeer_nstrinfo[WLAN_UMAC_MLO_MAX_VDEVS];
+	uint8_t migrate_primary_umac_psoc_id;
+	bool primary_umac_migration_in_progress;
 };
 
 /**

+ 3 - 0
umac/mlo_mgr/src/wlan_mlo_mgr_peer.c

@@ -1433,6 +1433,9 @@ QDF_STATUS wlan_mlo_peer_create(struct wlan_objmgr_vdev *vdev,
 		ml_peer->mlpeer_state = ML_PEER_CREATED;
 		ml_peer->max_links = ml_info->num_partner_links;
 		ml_peer->primary_umac_psoc_id = ML_PRIMARY_UMAC_ID_INVAL;
+		ml_peer->migrate_primary_umac_psoc_id =
+						ML_PRIMARY_UMAC_ID_INVAL;
+		ml_peer->primary_umac_migration_in_progress = false;
 
 		ml_peer->mlo_peer_id = mlo_ap_ml_peerid_alloc();
 		if (ml_peer->mlo_peer_id == MLO_INVALID_PEER_ID) {

+ 40 - 20
umac/mlo_mgr/src/wlan_mlo_mgr_primary_umac.c

@@ -78,12 +78,25 @@ static void wlan_mlo_peer_get_rssi(struct wlan_objmgr_psoc *psoc,
 	if (!mlo_peer_ctx)
 		return;
 
-	/* If this psoc is not primary UMAC, don't account RSSI */
-	if (mlo_peer_ctx->primary_umac_psoc_id != rssi_data->current_psoc_id)
+	/* If this psoc is new primary UMAC after migration,
+	 * account RSSI on new link
+	 */
+	if (mlo_peer_ctx->migrate_primary_umac_psoc_id ==
+			rssi_data->current_psoc_id) {
+		tqm_params->total_rssi += mlo_peer_ctx->avg_link_rssi;
+		tqm_params->num_ml_peers += 1;
 		return;
+	}
 
-	tqm_params->total_rssi += mlo_peer_ctx->avg_link_rssi;
-	tqm_params->num_ml_peers += 1;
+	/* If this psoc is not primary UMAC or if TQM migration is happening
+	 * from current primary psoc, don't account RSSI
+	 */
+	if (mlo_peer_ctx->primary_umac_psoc_id == rssi_data->current_psoc_id &&
+	    mlo_peer_ctx->migrate_primary_umac_psoc_id ==
+	    ML_INVALID_PRIMARY_TQM) {
+		tqm_params->total_rssi += mlo_peer_ctx->avg_link_rssi;
+		tqm_params->num_ml_peers += 1;
+	}
 }
 
 static void wlan_get_rssi_data_each_psoc(struct wlan_objmgr_psoc *psoc,
@@ -117,9 +130,9 @@ static QDF_STATUS mld_get_link_rssi(struct mlo_all_link_rssi *rssi_data)
 	return QDF_STATUS_SUCCESS;
 }
 
-static void
-mld_get_best_primary_umac_w_rssi(struct wlan_mlo_peer_context *ml_peer,
-				 struct wlan_objmgr_vdev *link_vdevs[])
+uint8_t
+wlan_mld_get_best_primary_umac_w_rssi(struct wlan_mlo_peer_context *ml_peer,
+				      struct wlan_objmgr_vdev *link_vdevs[])
 {
 	struct mlo_all_link_rssi rssi_data;
 	uint8_t i;
@@ -128,7 +141,6 @@ mld_get_best_primary_umac_w_rssi(struct wlan_mlo_peer_context *ml_peer,
 	int32_t diff_low;
 	bool mld_sta_links[WLAN_OBJMGR_MAX_DEVICES] = {0};
 	bool mld_no_sta[WLAN_OBJMGR_MAX_DEVICES] = {0};
-	struct wlan_objmgr_peer *assoc_peer = NULL;
 	uint8_t prim_link, id, prim_link_hi;
 	uint8_t num_psocs;
 	struct mlpeer_data *tqm_params = NULL;
@@ -316,19 +328,26 @@ mld_get_best_primary_umac_w_rssi(struct wlan_mlo_peer_context *ml_peer,
 		}
 	}
 
-	if (prim_link != ML_INVALID_PRIMARY_TQM) {
-		ml_peer->primary_umac_psoc_id = prim_link;
-	} else {
-		assoc_peer = wlan_mlo_peer_get_assoc_peer(ml_peer);
-		if (!assoc_peer) {
-			mlo_err(QDF_MAC_ADDR_FMT ":Assoc peer is NULL",
-				QDF_MAC_ADDR_REF(ml_peer->peer_mld_addr.bytes));
-			QDF_BUG(0);
-			return;
+	if (prim_link != ML_INVALID_PRIMARY_TQM)
+		return prim_link;
+
+	/* If primary link id is not found, return id of 1st available link */
+	for (i = 0; i < WLAN_UMAC_MLO_MAX_VDEVS; i++) {
+		if (!link_vdevs[i])
+			continue;
+
+		if (wlan_vdev_skip_pumac(link_vdevs[i])) {
+			mlo_debug("Skip Radio for Primary MLO umac");
+			continue;
 		}
-		ml_peer->primary_umac_psoc_id =
-			wlan_peer_get_psoc_id(assoc_peer);
+		id = wlan_vdev_get_psoc_id(link_vdevs[i]);
+		if (id >= WLAN_OBJMGR_MAX_DEVICES)
+			continue;
+
+		return wlan_vdev_get_psoc_id(link_vdevs[i]);
 	}
+
+	return ML_INVALID_PRIMARY_TQM;
 }
 
 void mlo_peer_assign_primary_umac(
@@ -664,7 +683,8 @@ QDF_STATUS mlo_peer_allocate_primary_umac(
 	mlo_peer_calculate_avg_rssi(ml_dev, ml_peer, rssi,
 				    wlan_peer_get_vdev(assoc_peer));
 
-	mld_get_best_primary_umac_w_rssi(ml_peer, link_vdevs);
+	ml_peer->primary_umac_psoc_id =
+		wlan_mld_get_best_primary_umac_w_rssi(ml_peer, link_vdevs);
 
 	mlo_peer_assign_primary_umac(ml_peer, peer_entry);