Jelajahi Sumber

qcacmn: Add API to get the variant of the given ML element

Add API to get the variant of the given Multi-Link element or element
fragment sequence.

Change-Id: I09b10c8e14e1a7e7b500116782f07d9fde7a78e1
CRs-Fixed: 3040403
Krishna Rao 3 tahun lalu
induk
melakukan
b5253e0f65
2 mengubah file dengan 62 tambahan dan 0 penghapusan
  1. 31 0
      umac/mlo_mgr/inc/utils_mlo.h
  2. 31 0
      umac/mlo_mgr/src/utils_mlo.c

+ 31 - 0
umac/mlo_mgr/inc/utils_mlo.h

@@ -21,6 +21,7 @@
 #ifndef _WLAN_UTILS_MLO_H_
 #define _WLAN_UTILS_MLO_H_
 
+#include <wlan_cmn_ieee80211.h>
 #include "wlan_mlo_mgr_public_structs.h"
 #include <wlan_cm_ucfg_api.h>
 #include <wlan_objmgr_vdev_obj.h>
@@ -69,6 +70,29 @@ util_gen_link_assoc_rsp(uint8_t *frame, qdf_size_t len,
 QDF_STATUS
 util_find_mlie(uint8_t *buf, qdf_size_t buflen, uint8_t **mlieseq,
 	       qdf_size_t *mlieseqlen);
+
+/**
+ * util_get_mlie_variant - Get the variant of the given Multi-Link element or
+ * element fragment sequence.
+ *
+ * @mlieseq: Starting address of the Multi-Link element or Multi-Link element
+ * fragment sequence
+ * @mlieseqlen: Total length of the Multi-Link element or Multi-Link element
+ * fragment sequence
+ * @variant: Pointer to the location where the value of the variant should be
+ * updated. On success, the value should be interpreted by the caller as a
+ * member of enum wlan_ml_variant. (This enum is not directly used as an
+ * argument, so that non-MLO code that happens to call this function does not
+ * need to be aware of the definition of the enum, though such a call would
+ * ultimately result in an error). The value should be ignored by the caller if
+ * the function returns error.
+ *
+ * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
+ * the reason for error in the case of failure
+ */
+QDF_STATUS
+util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+		      int *variant);
 #else
 static inline QDF_STATUS
 util_gen_link_assoc_rsp(uint8_t *frame, qdf_size_t len,
@@ -83,5 +107,12 @@ util_find_mlie(uint8_t *buf, qdf_size_t buflen, uint8_t **mlieseq,
 {
 	return QDF_STATUS_E_NOSUPPORT;
 }
+
+static inline QDF_STATUS
+util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+		      int *variant)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
 #endif /* WLAN_FEATURE_11BE_MLO */
 #endif /* _WLAN_UTILS_MLO_H_ */

+ 31 - 0
umac/mlo_mgr/src/utils_mlo.c

@@ -473,4 +473,35 @@ util_find_mlie(uint8_t *buf, qdf_size_t buflen, uint8_t **mlieseq,
 	*mlieseqlen = ieseqlen;
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS
+util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
+		      int *variant)
+{
+	struct wlan_ie_multilink *mlie_fixed;
+	enum wlan_ml_variant var;
+	uint16_t mlcontrol;
+
+	if (!mlieseq || !mlieseqlen || !variant)
+		return QDF_STATUS_E_NULL_VALUE;
+
+	if (mlieseqlen < sizeof(struct wlan_ie_multilink))
+		return QDF_STATUS_E_INVAL;
+
+	mlie_fixed = (struct wlan_ie_multilink *)mlieseq;
+
+	if ((mlie_fixed->elem_id != WLAN_ELEMID_EXTN_ELEM) ||
+	    (mlie_fixed->elem_id_ext != WLAN_EXTN_ELEMID_MULTI_LINK))
+		return QDF_STATUS_E_INVAL;
+
+	mlcontrol = le16toh(mlie_fixed->mlcontrol);
+	var = QDF_GET_BITS(mlcontrol, WLAN_ML_CTRL_TYPE_IDX,
+			   WLAN_ML_CTRL_TYPE_BITS);
+
+	if (var >= WLAN_ML_VARIANT_INVALIDSTART)
+		return QDF_STATUS_E_PROTO;
+
+	*variant = var;
+	return QDF_STATUS_SUCCESS;
+}
 #endif