Selaa lähdekoodia

qcacmn: APIs to set and get chip adjacencies in 4 link MLO

For 4 LINK MLO new API's for
1. Update chip info with the chip id and adjacent chip id's.
2. Given two psoc ID's return if two psoc are adjacent.

Sample topology

        chip0
      /      \
    chip1    chip2
      \      /
        chip3

Above, chip0 has chip1 and chip2 as adjacent chips.

Change-Id: I7eafde7779e957bc8161ef37baa6077278800e81
CRs-Fixed: 3381066
Uraj Sasan 2 vuotta sitten
vanhempi
sitoutus
f48d910d04

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

@@ -111,6 +111,19 @@ enum MLO_SOC_LIST {
 
 #define MAX_MLO_LINKS 6
 #define MAX_MLO_CHIPS 5
+#define MAX_ADJ_CHIPS 2
+
+/**
+ * struct mlo_chip_info: MLO chip info per link
+ * @info_valid: If the info here is valid or not
+ * @chip_id: Chip ID as assigned by platform
+ * @adj_chip_ids: Chip IDs of Adjacent chips
+ */
+struct mlo_chip_info {
+	uint8_t info_valid;
+	uint8_t chip_id[MAX_MLO_CHIPS];
+	uint8_t adj_chip_ids[MAX_MLO_CHIPS][MAX_ADJ_CHIPS];
+};
 
 /**
  * struct mlo_setup_info: MLO setup status per link
@@ -128,6 +141,7 @@ enum MLO_SOC_LIST {
  * @state_lock: lock to protect access to link state
  * @event: event for teardown completion
  * @dp_handle: pointer to DP ML context
+ * @chip_info: chip specific info of the soc
  */
 struct mlo_setup_info {
 	uint8_t ml_grp_id;
@@ -144,6 +158,7 @@ struct mlo_setup_info {
 	qdf_spinlock_t state_lock;
 	qdf_event_t event;
 	struct cdp_mlo_ctxt *dp_handle;
+	struct mlo_chip_info chip_info;
 };
 
 /**

+ 21 - 0
umac/mlo_mgr/inc/wlan_mlo_mgr_setup.h

@@ -116,6 +116,27 @@ void mlo_setup_update_num_links(struct wlan_objmgr_psoc *psoc,
 				uint8_t grp_id,
 				uint8_t num_links);
 
+/**
+ * mlo_setup_update_chip_info() - API to update mlo chip info
+ * @psoc: soc to be checked
+ * @chip_id: chip_id to update the info about
+ * @adj_chip_id: adjacent chip ID's
+ *
+ * Return: None.
+ */
+void mlo_setup_update_chip_info(struct wlan_objmgr_psoc *psoc, uint8_t chip_id,
+				uint8_t *adj_chip_id);
+
+/**
+ * mlo_chip_adjacent() - API to return if two chips are adjacent
+ * @psoc_id_1: Psoc id 1
+ * @psoc_id_2: Psoc id 2
+ * @is_adjacent: Are the above 2 psocs adjacent or not
+ * Return: QDF_STATUS: success / failure.
+ */
+QDF_STATUS mlo_chip_adjacent(uint8_t psoc_id_1, uint8_t psoc_id_2,
+			     uint8_t *is_adjacent);
+
 /**
  * mlo_setup_update_soc_ready() - API to notify when FW init done
  * @psoc: soc object of SoC ready

+ 71 - 0
umac/mlo_mgr/src/wlan_mlo_mgr_setup.c

@@ -458,6 +458,77 @@ void mlo_setup_deinit(void)
 
 qdf_export_symbol(mlo_setup_deinit);
 
+void mlo_setup_update_chip_info(struct wlan_objmgr_psoc *psoc,
+				uint8_t chip_id, uint8_t *adj_chip_id)
+{
+	uint8_t psoc_id, i;
+	struct mlo_mgr_context *mlo_ctx = wlan_objmgr_get_mlo_ctx();
+	struct mlo_chip_info *chip_info;
+
+	if (!mlo_ctx)
+		return;
+
+	chip_info = &mlo_ctx->setup_info->chip_info;
+	/* get psoc_id of a soc */
+	psoc_id = wlan_psoc_get_id(psoc);
+
+	if (psoc_id >= MAX_MLO_CHIPS)
+		return;
+	/* chip id & psoc id need not be same, assign here based on psoc index*/
+	chip_info->chip_id[psoc_id] = chip_id;
+
+	/* For a particular psoc id populate the adjacent chip id's */
+	for (i = 0; i < MAX_ADJ_CHIPS; i++)
+		chip_info->adj_chip_ids[psoc_id][i] = adj_chip_id[i];
+
+	chip_info->info_valid = 1;
+}
+
+qdf_export_symbol(mlo_setup_update_chip_info);
+
+QDF_STATUS mlo_chip_adjacent(uint8_t psoc_id_1, uint8_t psoc_id_2,
+			     uint8_t *is_adjacent)
+{
+	struct mlo_mgr_context *mlo_ctx = wlan_objmgr_get_mlo_ctx();
+	uint8_t chip_id2, i;
+	struct mlo_chip_info *chip_info;
+
+	if (!mlo_ctx)
+		return QDF_STATUS_E_FAILURE;
+
+	if ((psoc_id_1 >= MAX_MLO_CHIPS) || (psoc_id_2 >= MAX_MLO_CHIPS)) {
+		mlo_err("psoc id's greater then max limit of %d",
+			MAX_MLO_CHIPS);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	chip_info = &mlo_ctx->setup_info->chip_info;
+
+	/* default case is adjacent */
+	*is_adjacent = 1;
+
+	if (!chip_info->info_valid) {
+		/* This is default (non-ini), they are adjacent */
+		return QDF_STATUS_SUCCESS;
+	}
+
+	if (psoc_id_1 == psoc_id_2) {
+		/* this is probably a single soc case, they are adjacent */
+		return QDF_STATUS_SUCCESS;
+	}
+	/* get chip id from psoc */
+	chip_id2 = chip_info->chip_id[psoc_id_2];
+	for (i = 0; i < MAX_ADJ_CHIPS; i++) {
+		if (chip_info->adj_chip_ids[psoc_id_1][i] == chip_id2)
+			return QDF_STATUS_SUCCESS;
+	}
+
+	*is_adjacent = 0;
+	return QDF_STATUS_SUCCESS;
+}
+
+qdf_export_symbol(mlo_chip_adjacent);
+
 void mlo_setup_update_num_links(struct wlan_objmgr_psoc *psoc,
 				uint8_t grp_id, uint8_t num_links)
 {