common: Combine definitions for Multi-Link and per STA profile control

The control fields are 16 bit wide. Combine the per byte definitions to
make it more convenient.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
Andrei Otcheretianski 2022-11-30 15:09:25 +02:00 committed by Jouni Malinen
parent 7a7ce95746
commit 5f17763ad4
2 changed files with 26 additions and 22 deletions

View file

@ -2547,28 +2547,26 @@ struct ieee80211_eht_capabilities {
/* IEEE P802.11be/D2.2, 9.4.2.312.2 - Basic Multi-Link element */
/* Figure 9-1002g: Presence Bitmap subfield of the Basic Multi-Link element */
#define BASIC_MULTI_LINK_CTRL0_PRES_LINK_ID 0x10
#define BASIC_MULTI_LINK_CTRL0_PRES_BSS_PARAM_CH_COUNT 0x20
#define BASIC_MULTI_LINK_CTRL0_PRES_MSD_INFO 0x40
#define BASIC_MULTI_LINK_CTRL0_PRES_EML_CAPA 0x80
#define BASIC_MULTI_LINK_CTRL1_PRES_MLD_CAPA 0x01
#define BASIC_MULTI_LINK_CTRL1_PRES_AP_MLD_ID 0x02
#define BASIC_MULTI_LINK_CTRL_PRES_LINK_ID 0x0010
#define BASIC_MULTI_LINK_CTRL_PRES_BSS_PARAM_CH_COUNT 0x0020
#define BASIC_MULTI_LINK_CTRL_PRES_MSD_INFO 0x0040
#define BASIC_MULTI_LINK_CTRL_PRES_EML_CAPA 0x0080
#define BASIC_MULTI_LINK_CTRL_PRES_MLD_CAPA 0x0100
#define BASIC_MULTI_LINK_CTRL_PRES_AP_MLD_ID 0x0200
/*
* STA Control field definitions of Per-STA Profile subelement in Basic
* Multi-Link element as described in Figure 9-1002n: STA Control field format.
*/
#define BASIC_MLE_STA_CTRL0_LINK_ID_SHIFT 0
#define BASIC_MLE_STA_CTRL0_LINK_ID_MASK 0x0F
#define BASIC_MLE_STA_CTRL0_COMPLETE_PROFILE 0x10
#define BASIC_MLE_STA_CTRL0_PRES_STA_MAC 0x20
#define BASIC_MLE_STA_CTRL0_PRES_BEACON_INT 0x40
#define BASIC_MLE_STA_CTRL0_PRES_TSF_OFFSET 0x80
#define BASIC_MLE_STA_CTRL1_PRES_DTIM_INFO 0x01
#define BASIC_MLE_STA_CTRL1_PRES_NSTR_LINK_PAIR 0x02
#define BASIC_MLE_STA_CTRL1_NSTR_BITMAP 0x04
#define BASIC_MLE_STA_CTRL1_PRES_BSS_PARAM_COUNT 0x08
#define BASIC_MLE_STA_CTRL_LINK_ID_MASK 0x000F
#define BASIC_MLE_STA_CTRL_COMPLETE_PROFILE 0x0010
#define BASIC_MLE_STA_CTRL_PRES_STA_MAC 0x0020
#define BASIC_MLE_STA_CTRL_PRES_BEACON_INT 0x0040
#define BASIC_MLE_STA_CTRL_PRES_TSF_OFFSET 0x0080
#define BASIC_MLE_STA_CTRL_PRES_DTIM_INFO 0x0100
#define BASIC_MLE_STA_CTRL_PRES_NSTR_LINK_PAIR 0x0200
#define BASIC_MLE_STA_CTRL_NSTR_BITMAP 0x0400
#define BASIC_MLE_STA_CTRL_PRES_BSS_PARAM_COUNT 0x0800
#define BASIC_MLE_STA_PROF_STA_MAC_IDX 3

View file

@ -536,18 +536,18 @@ static void nl80211_get_basic_mle_links_info(const u8 *mle, size_t mle_len,
if (pos[0] == MULTI_LINK_SUB_ELEM_ID_PER_STA_PROFILE) {
u8 link_id;
const u8 *sta_profile;
u16 sta_ctrl;
if (pos[1] < BASIC_MLE_STA_PROF_STA_MAC_IDX + ETH_ALEN)
goto next_subelem;
sta_profile = &pos[2];
link_id = sta_profile[0] &
BASIC_MLE_STA_CTRL0_LINK_ID_MASK;
sta_ctrl = WPA_GET_LE16(sta_profile);
link_id = sta_ctrl & BASIC_MLE_STA_CTRL_LINK_ID_MASK;
if (link_id >= MAX_NUM_MLD_LINKS)
goto next_subelem;
if (!(sta_profile[0] &
BASIC_MLE_STA_CTRL0_PRES_STA_MAC))
if (!(sta_ctrl & BASIC_MLE_STA_CTRL_PRES_STA_MAC))
goto next_subelem;
info->non_assoc_links |= BIT(link_id);
@ -640,7 +640,13 @@ static int nl80211_update_rejected_links_info(struct driver_sta_mlo_info *mlo,
static int nl80211_get_assoc_link_id(const u8 *data, u8 len)
{
if (!(data[0] & BASIC_MULTI_LINK_CTRL0_PRES_LINK_ID))
u16 control;
if (len < 2)
return -1;
control = WPA_GET_LE16(data);
if (!(control & BASIC_MULTI_LINK_CTRL_PRES_LINK_ID))
return -1;
#define BASIC_ML_IE_COMMON_INFO_LINK_ID_IDX \