qcacmn: Add API to get MLD address from Basic Variant ML element

Add API to get the MLD MAC address from a given Basic variant
Multi-Link element or element fragment sequence.

CRs-Fixed: 3053521
Change-Id: I96cf893ae4a089c20bd2d8b783c4e3d1d4eb3e4a
This commit is contained in:
Krishna Rao
2021-10-10 15:05:03 +05:30
committed by Madan Koyyalamudi
parent 422905b63c
commit 77e686b250
2 changed files with 85 additions and 0 deletions

View File

@@ -93,6 +93,29 @@ util_find_mlie(uint8_t *buf, qdf_size_t buflen, uint8_t **mlieseq,
QDF_STATUS
util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
int *variant);
/**
* util_get_bvmlie_mldmacaddr - Get the MLD MAC address from a given Basic
* variant 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
* @mldmacaddrfound: Pointer to the location where a boolean status should be
* updated indicating whether the MLD MAC address was found or not. This should
* be ignored by the caller if the function returns error.
* @linkid: Pointer to the location where the MLD MAC address should be updated.
* This should be ignored by the caller if the function returns error, or if the
* function indicates that the MLD MAC address was not found.
*
* 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_bvmlie_mldmacaddr(uint8_t *mlieseq, qdf_size_t mlieseqlen,
bool *mldmacaddrfound,
struct qdf_mac_addr *mldmacaddr);
#else
static inline QDF_STATUS
util_gen_link_assoc_rsp(uint8_t *frame, qdf_size_t len,
@@ -114,5 +137,13 @@ util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
{
return QDF_STATUS_E_NOSUPPORT;
}
static inline QDF_STATUS
util_get_bvmlie_mldmacaddr(uint8_t *mlieseq, qdf_size_t mlieseqlen,
bool *mldmacaddrfound,
struct qdf_mac_addr *mldmacaddr)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif /* WLAN_FEATURE_11BE_MLO */
#endif /* _WLAN_UTILS_MLO_H_ */

View File

@@ -504,4 +504,58 @@ util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
*variant = var;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
util_get_bvmlie_mldmacaddr(uint8_t *mlieseq, qdf_size_t mlieseqlen,
bool *mldmacaddrfound,
struct qdf_mac_addr *mldmacaddr)
{
struct wlan_ie_multilink *mlie_fixed;
enum wlan_ml_variant variant;
uint16_t mlcontrol;
uint16_t presencebitmap;
if (!mlieseq || !mlieseqlen || !mldmacaddrfound || !mldmacaddr)
return QDF_STATUS_E_NULL_VALUE;
*mldmacaddrfound = false;
qdf_mem_zero(mldmacaddr, sizeof(*mldmacaddr));
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);
variant = QDF_GET_BITS(mlcontrol, WLAN_ML_CTRL_TYPE_IDX,
WLAN_ML_CTRL_TYPE_BITS);
if (variant != WLAN_ML_VARIANT_BASIC)
return QDF_STATUS_E_INVAL;
presencebitmap = QDF_GET_BITS(mlcontrol, WLAN_ML_CTRL_PBM_IDX,
WLAN_ML_CTRL_PBM_BITS);
if (presencebitmap & WLAN_ML_BV_CTRL_PBM_MLDMACADDR_P) {
/* Common Info starts at mlieseq + sizeof(struct
* wlan_ie_multilink). Check if there is sufficient space in
* Common Info for the MLD MAC address.
*/
if ((sizeof(struct wlan_ie_multilink) + QDF_MAC_ADDR_SIZE) >
mlieseqlen)
return QDF_STATUS_E_PROTO;
*mldmacaddrfound = true;
qdf_mem_copy(mldmacaddr->bytes,
mlieseq + sizeof(struct wlan_ie_multilink),
QDF_MAC_ADDR_SIZE);
}
return QDF_STATUS_SUCCESS;
}
#endif