Переглянути джерело

qcacmn: Add APIs related to MLO link capabilities

Add the following APIs related MLO links in MLO manager.

1. Get number of active MLO links
2. Get valid MLO link bitmap

CRs-Fixed: 3154979
Change-Id: I49c544a5c73a9ce72305bbe83230a4566d909095
Edayilliam Jayadev 3 роки тому
батько
коміт
412d3efb03

+ 44 - 0
umac/mlo_mgr/inc/wlan_mlo_mgr_cmn.h

@@ -288,7 +288,33 @@ void mlo_mlme_handle_sta_csa_param(struct wlan_objmgr_vdev *vdev,
 				   struct csa_offload_params *csa_param);
 
 #define INVALID_HW_LINK_ID 0xFFFF
+#define WLAN_MLO_INVALID_NUM_LINKS             (-1)
 #ifdef WLAN_MLO_MULTI_CHIP
+/**
+ * wlan_mlo_get_max_num_links() - Get the maximum number of MLO links
+ * possible in the system
+ *
+ * Return: Maximum number of MLO links in the system
+ */
+int8_t wlan_mlo_get_max_num_links(void);
+
+/**
+ * wlan_mlo_get_num_active_links() - Get the number of active MLO links
+ * in the system
+ *
+ * Return: Number of active MLO links in the system
+ */
+int8_t wlan_mlo_get_num_active_links(void);
+
+/**
+ * wlan_mlo_get_valid_link_bitmap() - Get the bitmap indicating the valid
+ * MLO links in the system. If bit position i is set, link with id i is
+ * valid.
+ *
+ * Return: Valid link bitmap
+ */
+uint16_t wlan_mlo_get_valid_link_bitmap(void);
+
 /**
  * wlan_mlo_get_pdev_hw_link_id() - Get hw_link_id of pdev
  * @pdev: pdev object
@@ -325,6 +351,24 @@ wlan_mlo_get_pdev_by_hw_link_id(uint16_t hw_link_id,
 				wlan_objmgr_ref_dbgid refdbgid);
 
 #else
+static inline int8_t
+wlan_mlo_get_max_num_links(void)
+{
+	return WLAN_MLO_INVALID_NUM_LINKS;
+}
+
+static inline int8_t
+wlan_mlo_get_num_active_links(void)
+{
+	return WLAN_MLO_INVALID_NUM_LINKS;
+}
+
+static inline uint16_t
+wlan_mlo_get_valid_link_bitmap(void)
+{
+	return 0;
+}
+
 static inline struct wlan_objmgr_pdev *
 wlan_mlo_get_pdev_by_hw_link_id(uint16_t hw_link_id,
 				wlan_objmgr_ref_dbgid refdbgid)

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

@@ -93,6 +93,7 @@ enum MLO_LINK_STATE {
  * @pdev_list[MAX_MLO_LINKS]: pdev pointers belonging to this group
  * @soc_list[MAX_MLO_CHIPS]: psoc pointers belonging to this group
  * @state[MAX_MLO_LINKS]: MLO link state
+ * @valid_link_bitmap: valid MLO link bitmap
  * @state_lock: lock to protect access to link state
  * @qdf_event_t: event for tearodwn completion
  */
@@ -107,6 +108,7 @@ struct mlo_setup_info {
 	struct wlan_objmgr_pdev *pdev_list[MAX_MLO_LINKS];
 	struct wlan_objmgr_psoc *soc_list[MAX_MLO_CHIPS];
 	enum MLO_LINK_STATE state[MAX_MLO_LINKS];
+	uint16_t valid_link_bitmap;
 	qdf_spinlock_t state_lock;
 	qdf_event_t event;
 };

+ 35 - 0
umac/mlo_mgr/src/wlan_mlo_mgr_cmn.c

@@ -25,6 +25,8 @@
 #endif
 #include "wlan_serialization_api.h"
 #include <target_if_mlo_mgr.h>
+#include <cdp_txrx_cmn.h>
+#include <wlan_cfg.h>
 
 void mlo_get_link_information(struct qdf_mac_addr *mld_addr,
 			      struct mlo_link_info *info)
@@ -276,6 +278,39 @@ uint8_t mlo_get_link_vdev_ix(struct wlan_mlo_dev_context *ml_dev,
 }
 
 #ifdef WLAN_MLO_MULTI_CHIP
+int8_t wlan_mlo_get_max_num_links(void)
+{
+	struct mlo_mgr_context *mlo_ctx;
+
+	mlo_ctx = wlan_objmgr_get_mlo_ctx();
+	if (!mlo_ctx)
+		return WLAN_MLO_INVALID_NUM_LINKS;
+
+	return mlo_ctx->setup_info.tot_socs * WLAN_MAX_MLO_LINKS_PER_SOC;
+}
+
+int8_t wlan_mlo_get_num_active_links(void)
+{
+	struct mlo_mgr_context *mlo_ctx;
+
+	mlo_ctx = wlan_objmgr_get_mlo_ctx();
+	if (!mlo_ctx)
+		return WLAN_MLO_INVALID_NUM_LINKS;
+
+	return mlo_ctx->setup_info.tot_links;
+}
+
+uint16_t wlan_mlo_get_valid_link_bitmap(void)
+{
+	struct mlo_mgr_context *mlo_ctx;
+
+	mlo_ctx = wlan_objmgr_get_mlo_ctx();
+	if (!mlo_ctx)
+		return 0;
+
+	return mlo_ctx->setup_info.valid_link_bitmap;
+}
+
 uint16_t wlan_mlo_get_pdev_hw_link_id(struct wlan_objmgr_pdev *pdev)
 {
 	struct wlan_objmgr_psoc *psoc;