Ver Fonte

qcacmn: Add wmi changes to send the T2LM command to FW

Add WMI changes to send preferred link to FW

Change-Id: I8b8d7354d979705b1a938e9792de334c4faf65b6
CRs-Fixed: 3393604
Guru Pratap Sharma há 2 anos atrás
pai
commit
d32fe4db3c

+ 61 - 0
umac/mlo_mgr/inc/wlan_mlo_t2lm.h

@@ -23,6 +23,9 @@
 
 #include <wlan_cmn_ieee80211.h>
 #include <wlan_mlo_mgr_public_structs.h>
+#ifdef WMI_AP_SUPPORT
+#include <wlan_cmn.h>
+#endif
 
 struct mlo_vdev_host_tid_to_link_map_resp;
 struct wlan_mlo_dev_context;
@@ -30,6 +33,11 @@ struct wlan_mlo_dev_context;
 /* Max T2LM TIDS count */
 #define T2LM_MAX_NUM_TIDS 8
 
+#ifdef WMI_AP_SUPPORT
+/* Max no. of Preferred links */
+#define MAX_PREFERRED_LINKS 4
+#endif
+
 /* Max T2LM callback handlers */
 #define MAX_T2LM_HANDLERS 50
 
@@ -64,6 +72,45 @@ enum wlan_t2lm_direction {
 	WLAN_T2LM_INVALID_DIRECTION,
 };
 
+#ifdef WMI_AP_SUPPORT
+/**
+ * enum wlan_link_band_caps - Represents the band capability of
+ * a link.
+ *
+ * @WLAN_LINK_BAND_INVALID: Invalid band
+ * @WLAN_LINK_BAND_2GHZ: 2GHz link
+ * @WLAN_LINK_BAND_5GHZ: 5GHz link
+ * @WLAN_LINK_BAND_5GHZ_LOW: 5GHz Low band link
+ * @WLAN_LINK_BAND_5GHZ_HIGH: 5GHz High band link
+ * @WLAN_LINK_BAND_6GHZ: 6GHz link
+ * @WLAN_LINK_BAND_6GHZ_LOW: 6GHz Low band link
+ * @WLAN_LINK_BAND_6GHZ_HIGH: 6GHz High band link
+ */
+enum wlan_link_band_caps {
+	WLAN_LINK_BAND_INVALID = 0,
+	WLAN_LINK_BAND_2GHZ = 1,
+	WLAN_LINK_BAND_5GHZ = 2,
+	WLAN_LINK_BAND_5GHZ_LOW = 3,
+	WLAN_LINK_BAND_5GHZ_HIGH = 4,
+	WLAN_LINK_BAND_6GHZ = 5,
+	WLAN_LINK_BAND_6GHZ_LOW = 6,
+	WLAN_LINK_BAND_6GHZ_HIGH = 7,
+};
+
+/**
+ * struct wlan_link_preference - Preferred link structure
+ * @num_pref_links: non-zero values indicate that preferred link order
+ * is present.
+ * @pref_order: Preferred links in order.it is in form of hardware link id.
+ * @timeout: timeout values for all the access categories.
+ */
+struct wlan_link_preference {
+	uint8_t num_pref_links;
+	uint8_t pref_order[MAX_PREFERRED_LINKS];
+	uint32_t timeout[WIFI_AC_MAX];
+};
+#endif
+
 /**
  * struct wlan_t2lm_info - TID-to-Link mapping information for the frames
  * transmitted on the uplink, downlink and bidirectional.
@@ -173,10 +220,14 @@ enum wlan_t2lm_enable {
  *
  * @dialog_token: Save the dialog token used in T2LM request and response frame.
  * @t2lm_info: Provides the TID to LINK mapping information
+ * @link_preference: Provides the preferred link information
  */
 struct wlan_prev_t2lm_negotiated_info {
 	uint16_t dialog_token;
 	struct wlan_t2lm_info t2lm_info[WLAN_T2LM_MAX_DIRECTION];
+#ifdef WMI_AP_SUPPORT
+	struct wlan_link_preference link_preference;
+#endif
 };
 
 /**
@@ -188,6 +239,10 @@ struct wlan_prev_t2lm_negotiated_info {
  * @t2lm_info: Provides the TID-to-link mapping info for UL/DL/BiDi
  * @t2lm_tx_status: Status code corresponds to the transmitted T2LM frames
  * @t2lm_resp_type: T2LM status corresponds to T2LM response frame.
+ * @link_preference: Provides the preferred link information
+ * @t2lm_info_present: It will show the t2lm_info present or not
+ * @pref_link_present: It will show the preference link is present or not
+ * @ml_grp_id: MLO Group id which it belongs to
  */
 struct wlan_t2lm_onging_negotiation_info {
 	enum wlan_t2lm_category category;
@@ -195,6 +250,12 @@ struct wlan_t2lm_onging_negotiation_info {
 	struct wlan_t2lm_info t2lm_info[WLAN_T2LM_MAX_DIRECTION];
 	enum wlan_t2lm_tx_status t2lm_tx_status;
 	enum wlan_t2lm_resp_frm_type t2lm_resp_type;
+#ifdef WMI_AP_SUPPORT
+	struct wlan_link_preference link_preference;
+	bool t2lm_info_present;
+	bool pref_link_present;
+	uint8_t ml_grp_id;
+#endif
 };
 
 /**

+ 26 - 6
wmi/inc/wmi_unified_param.h

@@ -555,6 +555,13 @@
 #define TARGET_GET_INIT_STATUS_MODULE_ID(status) (((status) >> 16) & 0xffff)
 
 #define MAX_ASSOC_IE_LENGTH 1024
+
+/*
+ * The WLAN_MAX_AC macro cannot be changed without breaking
+ * WMI compatibility.
+ * The maximum value of access category
+ */
+#define WMI_HOST_WLAN_MAX_AC  4
 typedef uint32_t TARGET_INIT_STATUS;
 
 /*
@@ -1096,6 +1103,21 @@ typedef struct {
 } wmi_host_mac_addr;
 
 #ifdef WLAN_FEATURE_11BE
+#ifdef WMI_AP_SUPPORT
+/**
+ * struct wlan_host_preferred_links - Preferred link info.
+ * @num_pref_links: non-zero values indicate that preferred link order
+ * is present.
+ * @preffered_link_order: Preferred links in order.
+ * @timeout: timeout values for all the access categories.
+ */
+struct wlan_host_preferred_links {
+	uint8_t num_pref_links;
+	uint8_t  preffered_link_order[MAX_PREFERRED_LINKS];
+	uint32_t timeout[WMI_HOST_WLAN_MAX_AC];
+};
+#endif
+
 /**
  * struct wlan_host_t2lm_of_tids - TID-to-link mapping info
  * @direction:  0 - Downlink, 1 - uplink 2 - Both uplink and downlink
@@ -1116,12 +1138,16 @@ struct wlan_host_t2lm_of_tids {
  * @peer_macaddr: link peer macaddr
  * @num_dir: number of directions for which T2LM info is available
  * @t2lm_info: TID-to-link mapping info for the given directions
+ * @preferred_links: Preferred link info.
  */
 struct wmi_host_tid_to_link_map_params {
 	uint8_t pdev_id;
 	uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE];
 	uint8_t num_dir;
 	struct wlan_host_t2lm_of_tids t2lm_info[WLAN_T2LM_MAX_DIRECTION];
+#ifdef WMI_AP_SUPPORT
+	struct wlan_host_preferred_links preferred_links;
+#endif
 };
 
 /**
@@ -4573,12 +4599,6 @@ typedef struct {
 #define WMI_HOST_MAX_TX_RATE_VALUES	10	/*Max Tx Rates */
 #define WMI_HOST_MAX_RSSI_VALUES	10	/*Max Rssi values */
 
-/* The WLAN_MAX_AC macro cannot be changed without breaking
- *  * WMI compatibility.
- *   * The maximum value of access category
- *	*/
-#define WMI_HOST_WLAN_MAX_AC  4
-
 /* The WMI_HOST_MAX_CHAINS macro cannot be changed without breaking WMI
  * compatibility.
  * The maximum value of number of chains

+ 75 - 4
wmi/src/wmi_unified_11be_tlv.c

@@ -901,6 +901,79 @@ uint8_t *peer_assoc_add_tid_to_link_map(uint8_t *buf_ptr,
 	return buf_ptr;
 }
 
+#ifdef WMI_AP_SUPPORT
+static uint32_t find_buf_len_pref_link(
+		struct wmi_host_tid_to_link_map_params *params)
+{
+	uint32_t buf_len = 0;
+
+	buf_len = sizeof(wmi_peer_tid_to_link_map_fixed_param) +
+		WMI_TLV_HDR_SIZE + (params->num_dir * T2LM_MAX_NUM_TIDS *
+		 sizeof(wmi_tid_to_link_map)) +
+		WMI_TLV_HDR_SIZE + sizeof(wmi_peer_preferred_link_map);
+	return buf_len;
+}
+
+static uint8_t *populate_preferred_link_tlv(
+		uint8_t *buf_ptr,
+		struct wmi_host_tid_to_link_map_params *params)
+{
+	wmi_peer_preferred_link_map *pref_links;
+	uint8_t pref_link = 0;
+	uint8_t latency = 0;
+	uint8_t links = 0;
+
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       sizeof(wmi_peer_preferred_link_map));
+	buf_ptr += sizeof(uint32_t);
+
+	pref_links = (wmi_peer_preferred_link_map *)buf_ptr;
+
+	WMITLV_SET_HDR(&pref_links->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_peer_preferred_link_map,
+		       WMITLV_GET_STRUCT_TLVLEN(wmi_peer_preferred_link_map));
+
+	pref_links->num_preferred_links =
+		params->preferred_links.num_pref_links;
+	links = params->preferred_links.num_pref_links;
+
+	for (pref_link = 0; pref_link < links; pref_link++) {
+		pref_links->preferred_link_order[pref_link] =
+			params->preferred_links.preffered_link_order[pref_link];
+		wmi_debug("Add preference link TLV: preffered_link_order: %d",
+			  pref_links->preferred_link_order[pref_link]);
+	}
+
+	for (latency = 0; latency < WLAN_MAX_AC; latency++) {
+		pref_links->expected_max_latency_ms[latency] =
+			params->preferred_links.timeout[latency];
+		wmi_debug("Add preference link TLV: expected_timeout_ms: %d",
+			  pref_links->expected_max_latency_ms[latency]);
+	}
+
+	buf_ptr += sizeof(wmi_peer_preferred_link_map);
+	return buf_ptr;
+}
+#else
+static uint32_t find_buf_len_pref_link(
+		struct wmi_host_tid_to_link_map_params *params)
+{
+	uint32_t buf_len = 0;
+
+	buf_len = sizeof(wmi_peer_tid_to_link_map_fixed_param) +
+		WMI_TLV_HDR_SIZE + (params->num_dir * T2LM_MAX_NUM_TIDS *
+		 sizeof(wmi_tid_to_link_map));
+	return buf_len;
+}
+
+static uint8_t *populate_preferred_link_tlv(
+		uint8_t *buf_ptr,
+		struct wmi_host_tid_to_link_map_params *params)
+{
+	return buf_ptr;
+}
+#endif
+
 static QDF_STATUS send_mlo_peer_tid_to_link_map_cmd_tlv(
 		wmi_unified_t wmi_handle,
 		struct wmi_host_tid_to_link_map_params *params)
@@ -914,10 +987,7 @@ static QDF_STATUS send_mlo_peer_tid_to_link_map_cmd_tlv(
 	uint8_t dir = 0;
 	uint8_t tid_num = 0;
 
-	buf_len = sizeof(wmi_peer_tid_to_link_map_fixed_param) +
-		WMI_TLV_HDR_SIZE + (params->num_dir * T2LM_MAX_NUM_TIDS *
-		 sizeof(wmi_tid_to_link_map));
-
+	buf_len = find_buf_len_pref_link(params);
 	buf = wmi_buf_alloc(wmi_handle, buf_len);
 	if (!buf) {
 		wmi_err("wmi buf alloc failed for mlo_peer_mac: "
@@ -987,6 +1057,7 @@ static QDF_STATUS send_mlo_peer_tid_to_link_map_cmd_tlv(
 		}
 	}
 
+	buf_ptr = populate_preferred_link_tlv(buf_ptr, params);
 	wmi_mtrace(WMI_MLO_PEER_TID_TO_LINK_MAP_CMDID, cmd->pdev_id, 0);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, buf_len,
 				   WMI_MLO_PEER_TID_TO_LINK_MAP_CMDID);