Ver código fonte

qcacmn: Fix issue with is_primary flag in splitphy mode

Currently, for all link peers of ML peer, is_primary set as
true, since all link peers are attached to same PSOC.

But, FW and DP needs only one peer to be set primary.
So far, FW and DP are considering last peer created or last peer
assoc received as primary peer.

This method causing issue since the order is not guaranteed
between FW and DP layer.

So, added a change to set is_primary to one of the link peers
only

Change-Id: I1c1aa87056baf86091fefc780180b5fc6a16af0d
CRs-Fixed: 3274360
Srinivas Pitla 2 anos atrás
pai
commit
5aab8590be
1 arquivos alterados com 37 adições e 4 exclusões
  1. 37 4
      umac/mlo_mgr/src/wlan_mlo_mgr_primary_umac.c

+ 37 - 4
umac/mlo_mgr/src/wlan_mlo_mgr_primary_umac.c

@@ -225,6 +225,10 @@ void mlo_peer_assign_primary_umac(
 		struct wlan_mlo_peer_context *ml_peer,
 		struct wlan_mlo_link_peer_entry *peer_entry)
 {
+	struct wlan_mlo_link_peer_entry *peer_ent_iter;
+	uint8_t i;
+	uint8_t primary_umac_set = 0;
+
 	/* If MLD is within single SOC, then assoc link becomes
 	 * primary umac
 	 */
@@ -237,11 +241,40 @@ void mlo_peer_assign_primary_umac(
 			peer_entry->is_primary = false;
 		}
 	} else {
-		if (wlan_peer_get_psoc_id(peer_entry->link_peer) ==
-				ml_peer->primary_umac_psoc_id)
-			peer_entry->is_primary = true;
-		else
+		/* If this peer PSOC is not derived as Primary PSOC,
+		 * mark is_primary as false
+		 */
+		if (wlan_peer_get_psoc_id(peer_entry->link_peer) !=
+				ml_peer->primary_umac_psoc_id) {
+			peer_entry->is_primary = false;
+			return;
+		}
+
+		/* For single SOC, check whether is_primary is set for
+		 * other partner peer, then mark is_primary false for this peer
+		 */
+		for (i = 0; i < MAX_MLO_LINK_PEERS; i++) {
+			peer_ent_iter = &ml_peer->peer_list[i];
+
+			if (!peer_ent_iter->link_peer)
+				continue;
+
+			/* Check for other link peers */
+			if (peer_ent_iter == peer_entry)
+				continue;
+
+			if (wlan_peer_get_psoc_id(peer_ent_iter->link_peer) !=
+					ml_peer->primary_umac_psoc_id)
+				continue;
+
+			if (peer_ent_iter->is_primary)
+				primary_umac_set = 1;
+		}
+
+		if (primary_umac_set)
 			peer_entry->is_primary = false;
+		else
+			peer_entry->is_primary = true;
 	}
 }