From b5253e0f65cf0b787984622d7f31e3c7672af905 Mon Sep 17 00:00:00 2001 From: Krishna Rao Date: Mon, 20 Sep 2021 19:58:12 +0530 Subject: [PATCH] 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 --- umac/mlo_mgr/inc/utils_mlo.h | 31 +++++++++++++++++++++++++++++++ umac/mlo_mgr/src/utils_mlo.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/umac/mlo_mgr/inc/utils_mlo.h b/umac/mlo_mgr/inc/utils_mlo.h index 7ff36e7b08..143029bd76 100644 --- a/umac/mlo_mgr/inc/utils_mlo.h +++ b/umac/mlo_mgr/inc/utils_mlo.h @@ -21,6 +21,7 @@ #ifndef _WLAN_UTILS_MLO_H_ #define _WLAN_UTILS_MLO_H_ +#include #include "wlan_mlo_mgr_public_structs.h" #include #include @@ -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_ */ diff --git a/umac/mlo_mgr/src/utils_mlo.c b/umac/mlo_mgr/src/utils_mlo.c index 0c6a143a5f..ce59d4a600 100644 --- a/umac/mlo_mgr/src/utils_mlo.c +++ b/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