Browse Source

qcacmn: primary UMAC selection for 3 link MLO association

Add capabilities to select primary TQM in case of
3-link association in a four chip HW.
The idea is to find the link that is adjacent to both the
other links and use it as the primary UMAC

CRs-Fixed: 3417387
Change-Id: Ibf2f6040cbc6f355980cdfcb5491109998ad8919
Krunalsinh Padhar 2 years ago
parent
commit
66e6f0c19c
1 changed files with 71 additions and 1 deletions
  1. 71 1
      umac/mlo_mgr/src/wlan_mlo_mgr_primary_umac.c

+ 71 - 1
umac/mlo_mgr/src/wlan_mlo_mgr_primary_umac.c

@@ -1,6 +1,6 @@
 /*
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * purpose with or without fee is hereby granted, provided that the above
@@ -367,6 +367,62 @@ static void mlo_peer_calculate_avg_rssi(
 	ml_peer->avg_link_rssi = total_rssi / num_psocs;
 	ml_peer->avg_link_rssi = total_rssi / num_psocs;
 }
 }
 
 
+#ifdef WLAN_MLO_MULTI_CHIP
+static QDF_STATUS mlo_set_3_link_primary_umac(
+		struct wlan_mlo_peer_context *ml_peer,
+		struct wlan_objmgr_vdev *link_vdevs[])
+{
+	uint8_t prim_psoc_id, psoc_ids[MAX_MLO_CHIPS];
+	uint8_t adjacent = 0;
+
+	if (ml_peer->max_links != 3)
+		return QDF_STATUS_E_FAILURE;
+
+	/* Some 3 link RDPs have restriction on the primary umac.
+	 * Only the link that is adjacent to both the links can be
+	 * a primary umac.
+	 * Note: it means umac migration is also restricted.
+	 */
+	psoc_ids[0] = wlan_vdev_get_psoc_id(link_vdevs[0]);
+	psoc_ids[1] = wlan_vdev_get_psoc_id(link_vdevs[1]);
+	psoc_ids[2] = wlan_vdev_get_psoc_id(link_vdevs[2]);
+
+	mlo_chip_adjacent(psoc_ids[0], psoc_ids[1], &adjacent);
+	if (!adjacent) {
+		prim_psoc_id = psoc_ids[2];
+	} else {
+		mlo_chip_adjacent(psoc_ids[0], psoc_ids[2], &adjacent);
+		if (!adjacent) {
+			prim_psoc_id = psoc_ids[1];
+		} else {
+			/* If all links are adjacent to each other,
+			 * no need to restrict the primary umac.
+			 * return failure the caller will handle.
+			 */
+			mlo_chip_adjacent(psoc_ids[1], psoc_ids[2],
+					  &adjacent);
+			if (!adjacent)
+				prim_psoc_id = psoc_ids[0];
+			else
+				return QDF_STATUS_E_FAILURE;
+		}
+	}
+
+	ml_peer->primary_umac_psoc_id = prim_psoc_id;
+	mlo_peer_assign_primary_umac(ml_peer,
+				     &ml_peer->peer_list[0]);
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static QDF_STATUS mlo_set_3_link_primary_umac(
+		struct wlan_mlo_peer_context *ml_peer,
+		struct wlan_objmgr_vdev *link_vdevs[])
+{
+	return QDF_STATUS_E_FAILURE;
+}
+#endif
+
 QDF_STATUS mlo_peer_allocate_primary_umac(
 QDF_STATUS mlo_peer_allocate_primary_umac(
 		struct wlan_mlo_dev_context *ml_dev,
 		struct wlan_mlo_dev_context *ml_dev,
 		struct wlan_mlo_peer_context *ml_peer,
 		struct wlan_mlo_peer_context *ml_peer,
@@ -411,6 +467,20 @@ QDF_STATUS mlo_peer_allocate_primary_umac(
 		return QDF_STATUS_SUCCESS;
 		return QDF_STATUS_SUCCESS;
 	}
 	}
 
 
+	if (mlo_set_3_link_primary_umac(ml_peer, link_vdevs) ==
+	    QDF_STATUS_SUCCESS) {
+		/* If success then the primary umac is restricted and assigned.
+		 * if not, there is no restriction, so just fallthrough
+		 */
+		mlo_info("MLD ID %d ML Peer " QDF_MAC_ADDR_FMT
+			 " center primary umac soc %d ",
+			 ml_dev->mld_id,
+			 QDF_MAC_ADDR_REF(ml_peer->peer_mld_addr.bytes),
+			 ml_peer->primary_umac_psoc_id);
+
+		return QDF_STATUS_SUCCESS;
+	}
+
 	if (mlo_ctx->mlo_is_force_primary_umac) {
 	if (mlo_ctx->mlo_is_force_primary_umac) {
 		for (i = 0; i < WLAN_UMAC_MLO_MAX_VDEVS; i++) {
 		for (i = 0; i < WLAN_UMAC_MLO_MAX_VDEVS; i++) {
 			if (!link_vdevs[i])
 			if (!link_vdevs[i])