Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: ieee80211: split HE definitions out

The ieee80211.h file has gotten very long, continue splitting
it by putting HE definitions into a separate file.

Link: https://patch.msgid.link/20251105153843.6998c0802104.I3dd7cfea6abbd118b999ecdedd48437d39cb0533@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+827 -803
+824
include/linux/ieee80211-he.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * IEEE 802.11 HE definitions 4 + * 5 + * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen 6 + * <jkmaline@cc.hut.fi> 7 + * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> 8 + * Copyright (c) 2005, Devicescape Software, Inc. 9 + * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> 10 + * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH 11 + * Copyright (c) 2016 - 2017 Intel Deutschland GmbH 12 + * Copyright (c) 2018 - 2025 Intel Corporation 13 + */ 14 + 15 + #ifndef LINUX_IEEE80211_HE_H 16 + #define LINUX_IEEE80211_HE_H 17 + 18 + #include <linux/types.h> 19 + #include <linux/if_ether.h> 20 + 21 + #define IEEE80211_TWT_CONTROL_NDP BIT(0) 22 + #define IEEE80211_TWT_CONTROL_RESP_MODE BIT(1) 23 + #define IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST BIT(3) 24 + #define IEEE80211_TWT_CONTROL_RX_DISABLED BIT(4) 25 + #define IEEE80211_TWT_CONTROL_WAKE_DUR_UNIT BIT(5) 26 + 27 + #define IEEE80211_TWT_REQTYPE_REQUEST BIT(0) 28 + #define IEEE80211_TWT_REQTYPE_SETUP_CMD GENMASK(3, 1) 29 + #define IEEE80211_TWT_REQTYPE_TRIGGER BIT(4) 30 + #define IEEE80211_TWT_REQTYPE_IMPLICIT BIT(5) 31 + #define IEEE80211_TWT_REQTYPE_FLOWTYPE BIT(6) 32 + #define IEEE80211_TWT_REQTYPE_FLOWID GENMASK(9, 7) 33 + #define IEEE80211_TWT_REQTYPE_WAKE_INT_EXP GENMASK(14, 10) 34 + #define IEEE80211_TWT_REQTYPE_PROTECTION BIT(15) 35 + 36 + enum ieee80211_twt_setup_cmd { 37 + TWT_SETUP_CMD_REQUEST, 38 + TWT_SETUP_CMD_SUGGEST, 39 + TWT_SETUP_CMD_DEMAND, 40 + TWT_SETUP_CMD_GROUPING, 41 + TWT_SETUP_CMD_ACCEPT, 42 + TWT_SETUP_CMD_ALTERNATE, 43 + TWT_SETUP_CMD_DICTATE, 44 + TWT_SETUP_CMD_REJECT, 45 + }; 46 + 47 + struct ieee80211_twt_params { 48 + __le16 req_type; 49 + __le64 twt; 50 + u8 min_twt_dur; 51 + __le16 mantissa; 52 + u8 channel; 53 + } __packed; 54 + 55 + struct ieee80211_twt_setup { 56 + u8 dialog_token; 57 + u8 element_id; 58 + u8 length; 59 + u8 control; 60 + u8 params[]; 61 + } __packed; 62 + 63 + /** 64 + * struct ieee80211_he_cap_elem - HE capabilities element 65 + * @mac_cap_info: HE MAC Capabilities Information 66 + * @phy_cap_info: HE PHY Capabilities Information 67 + * 68 + * This structure represents the fixed fields of the payload of the 69 + * "HE capabilities element" as described in IEEE Std 802.11ax-2021 70 + * sections 9.4.2.248.2 and 9.4.2.248.3. 71 + */ 72 + struct ieee80211_he_cap_elem { 73 + u8 mac_cap_info[6]; 74 + u8 phy_cap_info[11]; 75 + } __packed; 76 + 77 + #define IEEE80211_TX_RX_MCS_NSS_DESC_MAX_LEN 5 78 + 79 + /** 80 + * enum ieee80211_he_mcs_support - HE MCS support definitions 81 + * @IEEE80211_HE_MCS_SUPPORT_0_7: MCSes 0-7 are supported for the 82 + * number of streams 83 + * @IEEE80211_HE_MCS_SUPPORT_0_9: MCSes 0-9 are supported 84 + * @IEEE80211_HE_MCS_SUPPORT_0_11: MCSes 0-11 are supported 85 + * @IEEE80211_HE_MCS_NOT_SUPPORTED: This number of streams isn't supported 86 + * 87 + * These definitions are used in each 2-bit subfield of the rx_mcs_* 88 + * and tx_mcs_* fields of &struct ieee80211_he_mcs_nss_supp, which are 89 + * both split into 8 subfields by number of streams. These values indicate 90 + * which MCSes are supported for the number of streams the value appears 91 + * for. 92 + */ 93 + enum ieee80211_he_mcs_support { 94 + IEEE80211_HE_MCS_SUPPORT_0_7 = 0, 95 + IEEE80211_HE_MCS_SUPPORT_0_9 = 1, 96 + IEEE80211_HE_MCS_SUPPORT_0_11 = 2, 97 + IEEE80211_HE_MCS_NOT_SUPPORTED = 3, 98 + }; 99 + 100 + /** 101 + * struct ieee80211_he_mcs_nss_supp - HE Tx/Rx HE MCS NSS Support Field 102 + * 103 + * This structure holds the data required for the Tx/Rx HE MCS NSS Support Field 104 + * described in P802.11ax_D2.0 section 9.4.2.237.4 105 + * 106 + * @rx_mcs_80: Rx MCS map 2 bits for each stream, total 8 streams, for channel 107 + * widths less than 80MHz. 108 + * @tx_mcs_80: Tx MCS map 2 bits for each stream, total 8 streams, for channel 109 + * widths less than 80MHz. 110 + * @rx_mcs_160: Rx MCS map 2 bits for each stream, total 8 streams, for channel 111 + * width 160MHz. 112 + * @tx_mcs_160: Tx MCS map 2 bits for each stream, total 8 streams, for channel 113 + * width 160MHz. 114 + * @rx_mcs_80p80: Rx MCS map 2 bits for each stream, total 8 streams, for 115 + * channel width 80p80MHz. 116 + * @tx_mcs_80p80: Tx MCS map 2 bits for each stream, total 8 streams, for 117 + * channel width 80p80MHz. 118 + */ 119 + struct ieee80211_he_mcs_nss_supp { 120 + __le16 rx_mcs_80; 121 + __le16 tx_mcs_80; 122 + __le16 rx_mcs_160; 123 + __le16 tx_mcs_160; 124 + __le16 rx_mcs_80p80; 125 + __le16 tx_mcs_80p80; 126 + } __packed; 127 + 128 + /** 129 + * struct ieee80211_he_operation - HE Operation element 130 + * @he_oper_params: HE Operation Parameters + BSS Color Information 131 + * @he_mcs_nss_set: Basic HE-MCS And NSS Set 132 + * @optional: Optional fields VHT Operation Information, Max Co-Hosted 133 + * BSSID Indicator, and 6 GHz Operation Information 134 + * 135 + * This structure represents the payload of the "HE Operation 136 + * element" as described in IEEE Std 802.11ax-2021 section 9.4.2.249. 137 + */ 138 + struct ieee80211_he_operation { 139 + __le32 he_oper_params; 140 + __le16 he_mcs_nss_set; 141 + u8 optional[]; 142 + } __packed; 143 + 144 + /** 145 + * struct ieee80211_he_spr - Spatial Reuse Parameter Set element 146 + * @he_sr_control: SR Control 147 + * @optional: Optional fields Non-SRG OBSS PD Max Offset, SRG OBSS PD 148 + * Min Offset, SRG OBSS PD Max Offset, SRG BSS Color 149 + * Bitmap, and SRG Partial BSSID Bitmap 150 + * 151 + * This structure represents the payload of the "Spatial Reuse 152 + * Parameter Set element" as described in IEEE Std 802.11ax-2021 153 + * section 9.4.2.252. 154 + */ 155 + struct ieee80211_he_spr { 156 + u8 he_sr_control; 157 + u8 optional[]; 158 + } __packed; 159 + 160 + /** 161 + * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field 162 + * @aifsn: ACI/AIFSN 163 + * @ecw_min_max: ECWmin/ECWmax 164 + * @mu_edca_timer: MU EDCA Timer 165 + * 166 + * This structure represents the "MU AC Parameter Record" as described 167 + * in IEEE Std 802.11ax-2021 section 9.4.2.251, Figure 9-788p. 168 + */ 169 + struct ieee80211_he_mu_edca_param_ac_rec { 170 + u8 aifsn; 171 + u8 ecw_min_max; 172 + u8 mu_edca_timer; 173 + } __packed; 174 + 175 + /** 176 + * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element 177 + * @mu_qos_info: QoS Info 178 + * @ac_be: MU AC_BE Parameter Record 179 + * @ac_bk: MU AC_BK Parameter Record 180 + * @ac_vi: MU AC_VI Parameter Record 181 + * @ac_vo: MU AC_VO Parameter Record 182 + * 183 + * This structure represents the payload of the "MU EDCA Parameter Set 184 + * element" as described in IEEE Std 802.11ax-2021 section 9.4.2.251. 185 + */ 186 + struct ieee80211_mu_edca_param_set { 187 + u8 mu_qos_info; 188 + struct ieee80211_he_mu_edca_param_ac_rec ac_be; 189 + struct ieee80211_he_mu_edca_param_ac_rec ac_bk; 190 + struct ieee80211_he_mu_edca_param_ac_rec ac_vi; 191 + struct ieee80211_he_mu_edca_param_ac_rec ac_vo; 192 + } __packed; 193 + 194 + /* 802.11ax HE MAC capabilities */ 195 + #define IEEE80211_HE_MAC_CAP0_HTC_HE 0x01 196 + #define IEEE80211_HE_MAC_CAP0_TWT_REQ 0x02 197 + #define IEEE80211_HE_MAC_CAP0_TWT_RES 0x04 198 + #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_NOT_SUPP 0x00 199 + #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_1 0x08 200 + #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_2 0x10 201 + #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_3 0x18 202 + #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_MASK 0x18 203 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_1 0x00 204 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_2 0x20 205 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_4 0x40 206 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_8 0x60 207 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_16 0x80 208 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_32 0xa0 209 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_64 0xc0 210 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_UNLIMITED 0xe0 211 + #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_MASK 0xe0 212 + 213 + #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_UNLIMITED 0x00 214 + #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_128 0x01 215 + #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_256 0x02 216 + #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_512 0x03 217 + #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_MASK 0x03 218 + #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_0US 0x00 219 + #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_8US 0x04 220 + #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x08 221 + #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK 0x0c 222 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_1 0x00 223 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_2 0x10 224 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_3 0x20 225 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_4 0x30 226 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_5 0x40 227 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_6 0x50 228 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_7 0x60 229 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8 0x70 230 + #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_MASK 0x70 231 + 232 + /* Link adaptation is split between byte HE_MAC_CAP1 and 233 + * HE_MAC_CAP2. It should be set only if IEEE80211_HE_MAC_CAP0_HTC_HE 234 + * in which case the following values apply: 235 + * 0 = No feedback. 236 + * 1 = reserved. 237 + * 2 = Unsolicited feedback. 238 + * 3 = both 239 + */ 240 + #define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION 0x80 241 + 242 + #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x01 243 + #define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x02 244 + #define IEEE80211_HE_MAC_CAP2_TRS 0x04 245 + #define IEEE80211_HE_MAC_CAP2_BSR 0x08 246 + #define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10 247 + #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x20 248 + #define IEEE80211_HE_MAC_CAP2_MU_CASCADING 0x40 249 + #define IEEE80211_HE_MAC_CAP2_ACK_EN 0x80 250 + 251 + #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x02 252 + #define IEEE80211_HE_MAC_CAP3_OFDMA_RA 0x04 253 + 254 + /* The maximum length of an A-MDPU is defined by the combination of the Maximum 255 + * A-MDPU Length Exponent field in the HT capabilities, VHT capabilities and the 256 + * same field in the HE capabilities. 257 + */ 258 + #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_0 0x00 259 + #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1 0x08 260 + #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2 0x10 261 + #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 0x18 262 + #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x18 263 + #define IEEE80211_HE_MAC_CAP3_AMSDU_FRAG 0x20 264 + #define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x40 265 + #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80 266 + 267 + #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x01 268 + #define IEEE80211_HE_MAC_CAP4_QTP 0x02 269 + #define IEEE80211_HE_MAC_CAP4_BQR 0x04 270 + #define IEEE80211_HE_MAC_CAP4_PSR_RESP 0x08 271 + #define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10 272 + #define IEEE80211_HE_MAC_CAP4_OPS 0x20 273 + #define IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU 0x40 274 + /* Multi TID agg TX is split between byte #4 and #5 275 + * The value is a combination of B39,B40,B41 276 + */ 277 + #define IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39 0x80 278 + 279 + #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x01 280 + #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x02 281 + #define IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION 0x04 282 + #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x08 283 + #define IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX 0x10 284 + #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x20 285 + #define IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING 0x40 286 + #define IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX 0x80 287 + 288 + #define IEEE80211_HE_VHT_MAX_AMPDU_FACTOR 20 289 + #define IEEE80211_HE_HT_MAX_AMPDU_FACTOR 16 290 + #define IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR 13 291 + 292 + /* 802.11ax HE PHY capabilities */ 293 + #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x02 294 + #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x04 295 + #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x08 296 + #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G 0x10 297 + #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL 0x1e 298 + 299 + #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G 0x20 300 + #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G 0x40 301 + #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK 0xfe 302 + 303 + #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_80MHZ_ONLY_SECOND_20MHZ 0x01 304 + #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_80MHZ_ONLY_SECOND_40MHZ 0x02 305 + #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_160MHZ_ONLY_SECOND_20MHZ 0x04 306 + #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_160MHZ_ONLY_SECOND_40MHZ 0x08 307 + #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK 0x0f 308 + #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x10 309 + #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x20 310 + #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x40 311 + /* Midamble RX/TX Max NSTS is split between byte #2 and byte #3 */ 312 + #define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS 0x80 313 + 314 + #define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS 0x01 315 + #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x02 316 + #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x04 317 + #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x08 318 + #define IEEE80211_HE_PHY_CAP2_DOPPLER_TX 0x10 319 + #define IEEE80211_HE_PHY_CAP2_DOPPLER_RX 0x20 320 + 321 + /* Note that the meaning of UL MU below is different between an AP and a non-AP 322 + * sta, where in the AP case it indicates support for Rx and in the non-AP sta 323 + * case it indicates support for Tx. 324 + */ 325 + #define IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO 0x40 326 + #define IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO 0x80 327 + 328 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM 0x00 329 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK 0x01 330 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK 0x02 331 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM 0x03 332 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK 0x03 333 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 0x00 334 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2 0x04 335 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM 0x00 336 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK 0x08 337 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK 0x10 338 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM 0x18 339 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x18 340 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x00 341 + #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2 0x20 342 + #define IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU 0x40 343 + #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x80 344 + 345 + #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x01 346 + #define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER 0x02 347 + 348 + /* Minimal allowed value of Max STS under 80MHz is 3 */ 349 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 0x0c 350 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_5 0x10 351 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_6 0x14 352 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_7 0x18 353 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8 0x1c 354 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK 0x1c 355 + 356 + /* Minimal allowed value of Max STS above 80MHz is 3 */ 357 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4 0x60 358 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_5 0x80 359 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_6 0xa0 360 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_7 0xc0 361 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 0xe0 362 + #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK 0xe0 363 + 364 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_1 0x00 365 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 0x01 366 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_3 0x02 367 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_4 0x03 368 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_5 0x04 369 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_6 0x05 370 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_7 0x06 371 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_8 0x07 372 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK 0x07 373 + 374 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_1 0x00 375 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 0x08 376 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_3 0x10 377 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_4 0x18 378 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_5 0x20 379 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_6 0x28 380 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_7 0x30 381 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_8 0x38 382 + #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK 0x38 383 + 384 + #define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK 0x40 385 + #define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK 0x80 386 + 387 + #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x01 388 + #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x02 389 + #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB 0x04 390 + #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB 0x08 391 + #define IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB 0x10 392 + #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x20 393 + #define IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO 0x40 394 + #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x80 395 + 396 + #define IEEE80211_HE_PHY_CAP7_PSR_BASED_SR 0x01 397 + #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP 0x02 398 + #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x04 399 + #define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x08 400 + #define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x10 401 + #define IEEE80211_HE_PHY_CAP7_MAX_NC_3 0x18 402 + #define IEEE80211_HE_PHY_CAP7_MAX_NC_4 0x20 403 + #define IEEE80211_HE_PHY_CAP7_MAX_NC_5 0x28 404 + #define IEEE80211_HE_PHY_CAP7_MAX_NC_6 0x30 405 + #define IEEE80211_HE_PHY_CAP7_MAX_NC_7 0x38 406 + #define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK 0x38 407 + #define IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ 0x40 408 + #define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ 0x80 409 + 410 + #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI 0x01 411 + #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G 0x02 412 + #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x04 413 + #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x08 414 + #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x10 415 + #define IEEE80211_HE_PHY_CAP8_MIDAMBLE_RX_TX_2X_AND_1XLTF 0x20 416 + #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242 0x00 417 + #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484 0x40 418 + #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996 0x80 419 + #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996 0xc0 420 + #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK 0xc0 421 + 422 + #define IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM 0x01 423 + #define IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK 0x02 424 + #define IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU 0x04 425 + #define IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU 0x08 426 + #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB 0x10 427 + #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB 0x20 428 + #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US 0x0 429 + #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x1 430 + #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2 431 + #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x3 432 + #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS 6 433 + #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK 0xc0 434 + 435 + #define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF 0x01 436 + 437 + /* 802.11ax HE TX/RX MCS NSS Support */ 438 + #define IEEE80211_TX_RX_MCS_NSS_SUPP_HIGHEST_MCS_POS (3) 439 + #define IEEE80211_TX_RX_MCS_NSS_SUPP_TX_BITMAP_POS (6) 440 + #define IEEE80211_TX_RX_MCS_NSS_SUPP_RX_BITMAP_POS (11) 441 + #define IEEE80211_TX_RX_MCS_NSS_SUPP_TX_BITMAP_MASK 0x07c0 442 + #define IEEE80211_TX_RX_MCS_NSS_SUPP_RX_BITMAP_MASK 0xf800 443 + 444 + /* TX/RX HE MCS Support field Highest MCS subfield encoding */ 445 + enum ieee80211_he_highest_mcs_supported_subfield_enc { 446 + HIGHEST_MCS_SUPPORTED_MCS7 = 0, 447 + HIGHEST_MCS_SUPPORTED_MCS8, 448 + HIGHEST_MCS_SUPPORTED_MCS9, 449 + HIGHEST_MCS_SUPPORTED_MCS10, 450 + HIGHEST_MCS_SUPPORTED_MCS11, 451 + }; 452 + 453 + /* Calculate 802.11ax HE capabilities IE Tx/Rx HE MCS NSS Support Field size */ 454 + static inline u8 455 + ieee80211_he_mcs_nss_size(const struct ieee80211_he_cap_elem *he_cap) 456 + { 457 + u8 count = 4; 458 + 459 + if (he_cap->phy_cap_info[0] & 460 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G) 461 + count += 4; 462 + 463 + if (he_cap->phy_cap_info[0] & 464 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) 465 + count += 4; 466 + 467 + return count; 468 + } 469 + 470 + /* 802.11ax HE PPE Thresholds */ 471 + #define IEEE80211_PPE_THRES_NSS_SUPPORT_2NSS (1) 472 + #define IEEE80211_PPE_THRES_NSS_POS (0) 473 + #define IEEE80211_PPE_THRES_NSS_MASK (7) 474 + #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_2x966_AND_966_RU \ 475 + (BIT(5) | BIT(6)) 476 + #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK 0x78 477 + #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_POS (3) 478 + #define IEEE80211_PPE_THRES_INFO_PPET_SIZE (3) 479 + #define IEEE80211_HE_PPE_THRES_INFO_HEADER_SIZE (7) 480 + 481 + /* 482 + * Calculate 802.11ax HE capabilities IE PPE field size 483 + * Input: Header byte of ppe_thres (first byte), and HE capa IE's PHY cap u8* 484 + */ 485 + static inline u8 486 + ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) 487 + { 488 + u8 n; 489 + 490 + if ((phy_cap_info[6] & 491 + IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) == 0) 492 + return 0; 493 + 494 + n = hweight8(ppe_thres_hdr & 495 + IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK); 496 + n *= (1 + ((ppe_thres_hdr & IEEE80211_PPE_THRES_NSS_MASK) >> 497 + IEEE80211_PPE_THRES_NSS_POS)); 498 + 499 + /* 500 + * Each pair is 6 bits, and we need to add the 7 "header" bits to the 501 + * total size. 502 + */ 503 + n = (n * IEEE80211_PPE_THRES_INFO_PPET_SIZE * 2) + 7; 504 + n = DIV_ROUND_UP(n, 8); 505 + 506 + return n; 507 + } 508 + 509 + static inline bool ieee80211_he_capa_size_ok(const u8 *data, u8 len) 510 + { 511 + const struct ieee80211_he_cap_elem *he_cap_ie_elem = (const void *)data; 512 + u8 needed = sizeof(*he_cap_ie_elem); 513 + 514 + if (len < needed) 515 + return false; 516 + 517 + needed += ieee80211_he_mcs_nss_size(he_cap_ie_elem); 518 + if (len < needed) 519 + return false; 520 + 521 + if (he_cap_ie_elem->phy_cap_info[6] & 522 + IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) { 523 + if (len < needed + 1) 524 + return false; 525 + needed += ieee80211_he_ppe_size(data[needed], 526 + he_cap_ie_elem->phy_cap_info); 527 + } 528 + 529 + return len >= needed; 530 + } 531 + 532 + /* HE Operation defines */ 533 + #define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x00000007 534 + #define IEEE80211_HE_OPERATION_TWT_REQUIRED 0x00000008 535 + #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK 0x00003ff0 536 + #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET 4 537 + #define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x00004000 538 + #define IEEE80211_HE_OPERATION_CO_HOSTED_BSS 0x00008000 539 + #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000 540 + #define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000 541 + #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000 542 + #define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24 543 + #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000 544 + #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x80000000 545 + 546 + #define IEEE80211_6GHZ_CTRL_REG_LPI_AP 0 547 + #define IEEE80211_6GHZ_CTRL_REG_SP_AP 1 548 + #define IEEE80211_6GHZ_CTRL_REG_VLP_AP 2 549 + #define IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP 3 550 + #define IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP_OLD 4 551 + #define IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP 8 552 + 553 + /** 554 + * struct ieee80211_he_6ghz_oper - HE 6 GHz operation Information field 555 + * @primary: primary channel 556 + * @control: control flags 557 + * @ccfs0: channel center frequency segment 0 558 + * @ccfs1: channel center frequency segment 1 559 + * @minrate: minimum rate (in 1 Mbps units) 560 + */ 561 + struct ieee80211_he_6ghz_oper { 562 + u8 primary; 563 + #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH 0x3 564 + #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_20MHZ 0 565 + #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_40MHZ 1 566 + #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_80MHZ 2 567 + #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_160MHZ 3 568 + #define IEEE80211_HE_6GHZ_OPER_CTRL_DUP_BEACON 0x4 569 + #define IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO 0x78 570 + u8 control; 571 + u8 ccfs0; 572 + u8 ccfs1; 573 + u8 minrate; 574 + } __packed; 575 + 576 + /** 577 + * enum ieee80211_reg_conn_bits - represents Regulatory connectivity field bits. 578 + * 579 + * This enumeration defines bit flags used to represent regulatory connectivity 580 + * field bits. 581 + * 582 + * @IEEE80211_REG_CONN_LPI_VALID: Indicates whether the LPI bit is valid. 583 + * @IEEE80211_REG_CONN_LPI_VALUE: Represents the value of the LPI bit. 584 + * @IEEE80211_REG_CONN_SP_VALID: Indicates whether the SP bit is valid. 585 + * @IEEE80211_REG_CONN_SP_VALUE: Represents the value of the SP bit. 586 + */ 587 + enum ieee80211_reg_conn_bits { 588 + IEEE80211_REG_CONN_LPI_VALID = BIT(0), 589 + IEEE80211_REG_CONN_LPI_VALUE = BIT(1), 590 + IEEE80211_REG_CONN_SP_VALID = BIT(2), 591 + IEEE80211_REG_CONN_SP_VALUE = BIT(3), 592 + }; 593 + 594 + /* transmit power interpretation type of transmit power envelope element */ 595 + enum ieee80211_tx_power_intrpt_type { 596 + IEEE80211_TPE_LOCAL_EIRP, 597 + IEEE80211_TPE_LOCAL_EIRP_PSD, 598 + IEEE80211_TPE_REG_CLIENT_EIRP, 599 + IEEE80211_TPE_REG_CLIENT_EIRP_PSD, 600 + }; 601 + 602 + /* category type of transmit power envelope element */ 603 + enum ieee80211_tx_power_category_6ghz { 604 + IEEE80211_TPE_CAT_6GHZ_DEFAULT = 0, 605 + IEEE80211_TPE_CAT_6GHZ_SUBORDINATE = 1, 606 + }; 607 + 608 + /* 609 + * For IEEE80211_TPE_LOCAL_EIRP / IEEE80211_TPE_REG_CLIENT_EIRP, 610 + * setting to 63.5 dBm means no constraint. 611 + */ 612 + #define IEEE80211_TPE_MAX_TX_PWR_NO_CONSTRAINT 127 613 + 614 + /* 615 + * For IEEE80211_TPE_LOCAL_EIRP_PSD / IEEE80211_TPE_REG_CLIENT_EIRP_PSD, 616 + * setting to 127 indicates no PSD limit for the 20 MHz channel. 617 + */ 618 + #define IEEE80211_TPE_PSD_NO_LIMIT 127 619 + 620 + /** 621 + * struct ieee80211_tx_pwr_env - Transmit Power Envelope 622 + * @info: Transmit Power Information field 623 + * @variable: Maximum Transmit Power field 624 + * 625 + * This structure represents the payload of the "Transmit Power 626 + * Envelope element" as described in IEEE Std 802.11ax-2021 section 627 + * 9.4.2.161 628 + */ 629 + struct ieee80211_tx_pwr_env { 630 + u8 info; 631 + u8 variable[]; 632 + } __packed; 633 + 634 + #define IEEE80211_TX_PWR_ENV_INFO_COUNT 0x7 635 + #define IEEE80211_TX_PWR_ENV_INFO_INTERPRET 0x38 636 + #define IEEE80211_TX_PWR_ENV_INFO_CATEGORY 0xC0 637 + 638 + #define IEEE80211_TX_PWR_ENV_EXT_COUNT 0xF 639 + 640 + static inline bool ieee80211_valid_tpe_element(const u8 *data, u8 len) 641 + { 642 + const struct ieee80211_tx_pwr_env *env = (const void *)data; 643 + u8 count, interpret, category; 644 + u8 needed = sizeof(*env); 645 + u8 N; /* also called N in the spec */ 646 + 647 + if (len < needed) 648 + return false; 649 + 650 + count = u8_get_bits(env->info, IEEE80211_TX_PWR_ENV_INFO_COUNT); 651 + interpret = u8_get_bits(env->info, IEEE80211_TX_PWR_ENV_INFO_INTERPRET); 652 + category = u8_get_bits(env->info, IEEE80211_TX_PWR_ENV_INFO_CATEGORY); 653 + 654 + switch (category) { 655 + case IEEE80211_TPE_CAT_6GHZ_DEFAULT: 656 + case IEEE80211_TPE_CAT_6GHZ_SUBORDINATE: 657 + break; 658 + default: 659 + return false; 660 + } 661 + 662 + switch (interpret) { 663 + case IEEE80211_TPE_LOCAL_EIRP: 664 + case IEEE80211_TPE_REG_CLIENT_EIRP: 665 + if (count > 3) 666 + return false; 667 + 668 + /* count == 0 encodes 1 value for 20 MHz, etc. */ 669 + needed += count + 1; 670 + 671 + if (len < needed) 672 + return false; 673 + 674 + /* there can be extension fields not accounted for in 'count' */ 675 + 676 + return true; 677 + case IEEE80211_TPE_LOCAL_EIRP_PSD: 678 + case IEEE80211_TPE_REG_CLIENT_EIRP_PSD: 679 + if (count > 4) 680 + return false; 681 + 682 + N = count ? 1 << (count - 1) : 1; 683 + needed += N; 684 + 685 + if (len < needed) 686 + return false; 687 + 688 + if (len > needed) { 689 + u8 K = u8_get_bits(env->variable[N], 690 + IEEE80211_TX_PWR_ENV_EXT_COUNT); 691 + 692 + needed += 1 + K; 693 + if (len < needed) 694 + return false; 695 + } 696 + 697 + return true; 698 + } 699 + 700 + return false; 701 + } 702 + 703 + /* 704 + * ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size 705 + * @he_oper_ie: byte data of the He Operations IE, stating from the byte 706 + * after the ext ID byte. It is assumed that he_oper_ie has at least 707 + * sizeof(struct ieee80211_he_operation) bytes, the caller must have 708 + * validated this. 709 + * @return the actual size of the IE data (not including header), or 0 on error 710 + */ 711 + static inline u8 712 + ieee80211_he_oper_size(const u8 *he_oper_ie) 713 + { 714 + const struct ieee80211_he_operation *he_oper = (const void *)he_oper_ie; 715 + u8 oper_len = sizeof(struct ieee80211_he_operation); 716 + u32 he_oper_params; 717 + 718 + /* Make sure the input is not NULL */ 719 + if (!he_oper_ie) 720 + return 0; 721 + 722 + /* Calc required length */ 723 + he_oper_params = le32_to_cpu(he_oper->he_oper_params); 724 + if (he_oper_params & IEEE80211_HE_OPERATION_VHT_OPER_INFO) 725 + oper_len += 3; 726 + if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS) 727 + oper_len++; 728 + if (he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO) 729 + oper_len += sizeof(struct ieee80211_he_6ghz_oper); 730 + 731 + /* Add the first byte (extension ID) to the total length */ 732 + oper_len++; 733 + 734 + return oper_len; 735 + } 736 + 737 + /** 738 + * ieee80211_he_6ghz_oper - obtain 6 GHz operation field 739 + * @he_oper: HE operation element (must be pre-validated for size) 740 + * but may be %NULL 741 + * 742 + * Return: a pointer to the 6 GHz operation field, or %NULL 743 + */ 744 + static inline const struct ieee80211_he_6ghz_oper * 745 + ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper) 746 + { 747 + const u8 *ret; 748 + u32 he_oper_params; 749 + 750 + if (!he_oper) 751 + return NULL; 752 + 753 + ret = (const void *)&he_oper->optional; 754 + 755 + he_oper_params = le32_to_cpu(he_oper->he_oper_params); 756 + 757 + if (!(he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO)) 758 + return NULL; 759 + if (he_oper_params & IEEE80211_HE_OPERATION_VHT_OPER_INFO) 760 + ret += 3; 761 + if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS) 762 + ret++; 763 + 764 + return (const void *)ret; 765 + } 766 + 767 + /* HE Spatial Reuse defines */ 768 + #define IEEE80211_HE_SPR_PSR_DISALLOWED BIT(0) 769 + #define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED BIT(1) 770 + #define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT BIT(2) 771 + #define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT BIT(3) 772 + #define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED BIT(4) 773 + 774 + /* 775 + * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size 776 + * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the byte 777 + * after the ext ID byte. It is assumed that he_spr_ie has at least 778 + * sizeof(struct ieee80211_he_spr) bytes, the caller must have validated 779 + * this 780 + * @return the actual size of the IE data (not including header), or 0 on error 781 + */ 782 + static inline u8 783 + ieee80211_he_spr_size(const u8 *he_spr_ie) 784 + { 785 + const struct ieee80211_he_spr *he_spr = (const void *)he_spr_ie; 786 + u8 spr_len = sizeof(struct ieee80211_he_spr); 787 + u8 he_spr_params; 788 + 789 + /* Make sure the input is not NULL */ 790 + if (!he_spr_ie) 791 + return 0; 792 + 793 + /* Calc required length */ 794 + he_spr_params = he_spr->he_sr_control; 795 + if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) 796 + spr_len++; 797 + if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) 798 + spr_len += 18; 799 + 800 + /* Add the first byte (extension ID) to the total length */ 801 + spr_len++; 802 + 803 + return spr_len; 804 + } 805 + 806 + struct ieee80211_he_6ghz_capa { 807 + /* uses IEEE80211_HE_6GHZ_CAP_* below */ 808 + __le16 capa; 809 + } __packed; 810 + 811 + /* HE 6 GHz band capabilities */ 812 + /* uses enum ieee80211_min_mpdu_spacing values */ 813 + #define IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START 0x0007 814 + /* uses enum ieee80211_vht_max_ampdu_length_exp values */ 815 + #define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP 0x0038 816 + /* uses IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_* values */ 817 + #define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN 0x00c0 818 + /* WLAN_HT_CAP_SM_PS_* values */ 819 + #define IEEE80211_HE_6GHZ_CAP_SM_PS 0x0600 820 + #define IEEE80211_HE_6GHZ_CAP_RD_RESPONDER 0x0800 821 + #define IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS 0x1000 822 + #define IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS 0x2000 823 + 824 + #endif /* LINUX_IEEE80211_HE_H */
+3 -803
include/linux/ieee80211.h
··· 1141 1141 return len; 1142 1142 } 1143 1143 1144 - #define IEEE80211_TWT_CONTROL_NDP BIT(0) 1145 - #define IEEE80211_TWT_CONTROL_RESP_MODE BIT(1) 1146 - #define IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST BIT(3) 1147 - #define IEEE80211_TWT_CONTROL_RX_DISABLED BIT(4) 1148 - #define IEEE80211_TWT_CONTROL_WAKE_DUR_UNIT BIT(5) 1149 - 1150 - #define IEEE80211_TWT_REQTYPE_REQUEST BIT(0) 1151 - #define IEEE80211_TWT_REQTYPE_SETUP_CMD GENMASK(3, 1) 1152 - #define IEEE80211_TWT_REQTYPE_TRIGGER BIT(4) 1153 - #define IEEE80211_TWT_REQTYPE_IMPLICIT BIT(5) 1154 - #define IEEE80211_TWT_REQTYPE_FLOWTYPE BIT(6) 1155 - #define IEEE80211_TWT_REQTYPE_FLOWID GENMASK(9, 7) 1156 - #define IEEE80211_TWT_REQTYPE_WAKE_INT_EXP GENMASK(14, 10) 1157 - #define IEEE80211_TWT_REQTYPE_PROTECTION BIT(15) 1158 - 1159 - enum ieee80211_twt_setup_cmd { 1160 - TWT_SETUP_CMD_REQUEST, 1161 - TWT_SETUP_CMD_SUGGEST, 1162 - TWT_SETUP_CMD_DEMAND, 1163 - TWT_SETUP_CMD_GROUPING, 1164 - TWT_SETUP_CMD_ACCEPT, 1165 - TWT_SETUP_CMD_ALTERNATE, 1166 - TWT_SETUP_CMD_DICTATE, 1167 - TWT_SETUP_CMD_REJECT, 1168 - }; 1169 - 1170 - struct ieee80211_twt_params { 1171 - __le16 req_type; 1172 - __le64 twt; 1173 - u8 min_twt_dur; 1174 - __le16 mantissa; 1175 - u8 channel; 1176 - } __packed; 1177 - 1178 - struct ieee80211_twt_setup { 1179 - u8 dialog_token; 1180 - u8 element_id; 1181 - u8 length; 1182 - u8 control; 1183 - u8 params[]; 1184 - } __packed; 1185 - 1186 1144 #define IEEE80211_TTLM_MAX_CNT 2 1187 1145 #define IEEE80211_TTLM_CONTROL_DIRECTION 0x03 1188 1146 #define IEEE80211_TTLM_CONTROL_DEF_LINK_MAP 0x04 ··· 1591 1633 #define IEEE80211_P2P_OPPPS_ENABLE_BIT BIT(7) 1592 1634 #define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7F 1593 1635 1594 - /** 1595 - * struct ieee80211_he_cap_elem - HE capabilities element 1596 - * @mac_cap_info: HE MAC Capabilities Information 1597 - * @phy_cap_info: HE PHY Capabilities Information 1598 - * 1599 - * This structure represents the fixed fields of the payload of the 1600 - * "HE capabilities element" as described in IEEE Std 802.11ax-2021 1601 - * sections 9.4.2.248.2 and 9.4.2.248.3. 1602 - */ 1603 - struct ieee80211_he_cap_elem { 1604 - u8 mac_cap_info[6]; 1605 - u8 phy_cap_info[11]; 1606 - } __packed; 1607 - 1608 - #define IEEE80211_TX_RX_MCS_NSS_DESC_MAX_LEN 5 1609 - 1610 - /** 1611 - * enum ieee80211_he_mcs_support - HE MCS support definitions 1612 - * @IEEE80211_HE_MCS_SUPPORT_0_7: MCSes 0-7 are supported for the 1613 - * number of streams 1614 - * @IEEE80211_HE_MCS_SUPPORT_0_9: MCSes 0-9 are supported 1615 - * @IEEE80211_HE_MCS_SUPPORT_0_11: MCSes 0-11 are supported 1616 - * @IEEE80211_HE_MCS_NOT_SUPPORTED: This number of streams isn't supported 1617 - * 1618 - * These definitions are used in each 2-bit subfield of the rx_mcs_* 1619 - * and tx_mcs_* fields of &struct ieee80211_he_mcs_nss_supp, which are 1620 - * both split into 8 subfields by number of streams. These values indicate 1621 - * which MCSes are supported for the number of streams the value appears 1622 - * for. 1623 - */ 1624 - enum ieee80211_he_mcs_support { 1625 - IEEE80211_HE_MCS_SUPPORT_0_7 = 0, 1626 - IEEE80211_HE_MCS_SUPPORT_0_9 = 1, 1627 - IEEE80211_HE_MCS_SUPPORT_0_11 = 2, 1628 - IEEE80211_HE_MCS_NOT_SUPPORTED = 3, 1629 - }; 1630 - 1631 - /** 1632 - * struct ieee80211_he_mcs_nss_supp - HE Tx/Rx HE MCS NSS Support Field 1633 - * 1634 - * This structure holds the data required for the Tx/Rx HE MCS NSS Support Field 1635 - * described in P802.11ax_D2.0 section 9.4.2.237.4 1636 - * 1637 - * @rx_mcs_80: Rx MCS map 2 bits for each stream, total 8 streams, for channel 1638 - * widths less than 80MHz. 1639 - * @tx_mcs_80: Tx MCS map 2 bits for each stream, total 8 streams, for channel 1640 - * widths less than 80MHz. 1641 - * @rx_mcs_160: Rx MCS map 2 bits for each stream, total 8 streams, for channel 1642 - * width 160MHz. 1643 - * @tx_mcs_160: Tx MCS map 2 bits for each stream, total 8 streams, for channel 1644 - * width 160MHz. 1645 - * @rx_mcs_80p80: Rx MCS map 2 bits for each stream, total 8 streams, for 1646 - * channel width 80p80MHz. 1647 - * @tx_mcs_80p80: Tx MCS map 2 bits for each stream, total 8 streams, for 1648 - * channel width 80p80MHz. 1649 - */ 1650 - struct ieee80211_he_mcs_nss_supp { 1651 - __le16 rx_mcs_80; 1652 - __le16 tx_mcs_80; 1653 - __le16 rx_mcs_160; 1654 - __le16 tx_mcs_160; 1655 - __le16 rx_mcs_80p80; 1656 - __le16 tx_mcs_80p80; 1657 - } __packed; 1658 - 1659 - /** 1660 - * struct ieee80211_he_operation - HE Operation element 1661 - * @he_oper_params: HE Operation Parameters + BSS Color Information 1662 - * @he_mcs_nss_set: Basic HE-MCS And NSS Set 1663 - * @optional: Optional fields VHT Operation Information, Max Co-Hosted 1664 - * BSSID Indicator, and 6 GHz Operation Information 1665 - * 1666 - * This structure represents the payload of the "HE Operation 1667 - * element" as described in IEEE Std 802.11ax-2021 section 9.4.2.249. 1668 - */ 1669 - struct ieee80211_he_operation { 1670 - __le32 he_oper_params; 1671 - __le16 he_mcs_nss_set; 1672 - u8 optional[]; 1673 - } __packed; 1674 - 1675 - /** 1676 - * struct ieee80211_he_spr - Spatial Reuse Parameter Set element 1677 - * @he_sr_control: SR Control 1678 - * @optional: Optional fields Non-SRG OBSS PD Max Offset, SRG OBSS PD 1679 - * Min Offset, SRG OBSS PD Max Offset, SRG BSS Color 1680 - * Bitmap, and SRG Partial BSSID Bitmap 1681 - * 1682 - * This structure represents the payload of the "Spatial Reuse 1683 - * Parameter Set element" as described in IEEE Std 802.11ax-2021 1684 - * section 9.4.2.252. 1685 - */ 1686 - struct ieee80211_he_spr { 1687 - u8 he_sr_control; 1688 - u8 optional[]; 1689 - } __packed; 1690 - 1691 - /** 1692 - * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field 1693 - * @aifsn: ACI/AIFSN 1694 - * @ecw_min_max: ECWmin/ECWmax 1695 - * @mu_edca_timer: MU EDCA Timer 1696 - * 1697 - * This structure represents the "MU AC Parameter Record" as described 1698 - * in IEEE Std 802.11ax-2021 section 9.4.2.251, Figure 9-788p. 1699 - */ 1700 - struct ieee80211_he_mu_edca_param_ac_rec { 1701 - u8 aifsn; 1702 - u8 ecw_min_max; 1703 - u8 mu_edca_timer; 1704 - } __packed; 1705 - 1706 - /** 1707 - * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element 1708 - * @mu_qos_info: QoS Info 1709 - * @ac_be: MU AC_BE Parameter Record 1710 - * @ac_bk: MU AC_BK Parameter Record 1711 - * @ac_vi: MU AC_VI Parameter Record 1712 - * @ac_vo: MU AC_VO Parameter Record 1713 - * 1714 - * This structure represents the payload of the "MU EDCA Parameter Set 1715 - * element" as described in IEEE Std 802.11ax-2021 section 9.4.2.251. 1716 - */ 1717 - struct ieee80211_mu_edca_param_set { 1718 - u8 mu_qos_info; 1719 - struct ieee80211_he_mu_edca_param_ac_rec ac_be; 1720 - struct ieee80211_he_mu_edca_param_ac_rec ac_bk; 1721 - struct ieee80211_he_mu_edca_param_ac_rec ac_vi; 1722 - struct ieee80211_he_mu_edca_param_ac_rec ac_vo; 1723 - } __packed; 1724 - 1725 1636 #define IEEE80211_EHT_MCS_NSS_RX 0x0f 1726 1637 #define IEEE80211_EHT_MCS_NSS_TX 0xf0 1727 1638 ··· 1728 1901 u8 ccfs1; 1729 1902 u8 optional[]; 1730 1903 } __packed; 1731 - 1732 - /* 802.11ax HE MAC capabilities */ 1733 - #define IEEE80211_HE_MAC_CAP0_HTC_HE 0x01 1734 - #define IEEE80211_HE_MAC_CAP0_TWT_REQ 0x02 1735 - #define IEEE80211_HE_MAC_CAP0_TWT_RES 0x04 1736 - #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_NOT_SUPP 0x00 1737 - #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_1 0x08 1738 - #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_2 0x10 1739 - #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_LEVEL_3 0x18 1740 - #define IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_MASK 0x18 1741 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_1 0x00 1742 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_2 0x20 1743 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_4 0x40 1744 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_8 0x60 1745 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_16 0x80 1746 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_32 0xa0 1747 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_64 0xc0 1748 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_UNLIMITED 0xe0 1749 - #define IEEE80211_HE_MAC_CAP0_MAX_NUM_FRAG_MSDU_MASK 0xe0 1750 - 1751 - #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_UNLIMITED 0x00 1752 - #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_128 0x01 1753 - #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_256 0x02 1754 - #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_512 0x03 1755 - #define IEEE80211_HE_MAC_CAP1_MIN_FRAG_SIZE_MASK 0x03 1756 - #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_0US 0x00 1757 - #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_8US 0x04 1758 - #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x08 1759 - #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK 0x0c 1760 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_1 0x00 1761 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_2 0x10 1762 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_3 0x20 1763 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_4 0x30 1764 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_5 0x40 1765 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_6 0x50 1766 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_7 0x60 1767 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8 0x70 1768 - #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_MASK 0x70 1769 - 1770 - /* Link adaptation is split between byte HE_MAC_CAP1 and 1771 - * HE_MAC_CAP2. It should be set only if IEEE80211_HE_MAC_CAP0_HTC_HE 1772 - * in which case the following values apply: 1773 - * 0 = No feedback. 1774 - * 1 = reserved. 1775 - * 2 = Unsolicited feedback. 1776 - * 3 = both 1777 - */ 1778 - #define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION 0x80 1779 - 1780 - #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x01 1781 - #define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x02 1782 - #define IEEE80211_HE_MAC_CAP2_TRS 0x04 1783 - #define IEEE80211_HE_MAC_CAP2_BSR 0x08 1784 - #define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10 1785 - #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x20 1786 - #define IEEE80211_HE_MAC_CAP2_MU_CASCADING 0x40 1787 - #define IEEE80211_HE_MAC_CAP2_ACK_EN 0x80 1788 - 1789 - #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x02 1790 - #define IEEE80211_HE_MAC_CAP3_OFDMA_RA 0x04 1791 - 1792 - /* The maximum length of an A-MDPU is defined by the combination of the Maximum 1793 - * A-MDPU Length Exponent field in the HT capabilities, VHT capabilities and the 1794 - * same field in the HE capabilities. 1795 - */ 1796 - #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_0 0x00 1797 - #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1 0x08 1798 - #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2 0x10 1799 - #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 0x18 1800 - #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x18 1801 - #define IEEE80211_HE_MAC_CAP3_AMSDU_FRAG 0x20 1802 - #define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x40 1803 - #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80 1804 - 1805 - #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x01 1806 - #define IEEE80211_HE_MAC_CAP4_QTP 0x02 1807 - #define IEEE80211_HE_MAC_CAP4_BQR 0x04 1808 - #define IEEE80211_HE_MAC_CAP4_PSR_RESP 0x08 1809 - #define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10 1810 - #define IEEE80211_HE_MAC_CAP4_OPS 0x20 1811 - #define IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU 0x40 1812 - /* Multi TID agg TX is split between byte #4 and #5 1813 - * The value is a combination of B39,B40,B41 1814 - */ 1815 - #define IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39 0x80 1816 - 1817 - #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x01 1818 - #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x02 1819 - #define IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION 0x04 1820 - #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x08 1821 - #define IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX 0x10 1822 - #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x20 1823 - #define IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING 0x40 1824 - #define IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX 0x80 1825 - 1826 - #define IEEE80211_HE_VHT_MAX_AMPDU_FACTOR 20 1827 - #define IEEE80211_HE_HT_MAX_AMPDU_FACTOR 16 1828 - #define IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR 13 1829 - 1830 - /* 802.11ax HE PHY capabilities */ 1831 - #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x02 1832 - #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x04 1833 - #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x08 1834 - #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G 0x10 1835 - #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL 0x1e 1836 - 1837 - #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G 0x20 1838 - #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G 0x40 1839 - #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK 0xfe 1840 - 1841 - #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_80MHZ_ONLY_SECOND_20MHZ 0x01 1842 - #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_80MHZ_ONLY_SECOND_40MHZ 0x02 1843 - #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_160MHZ_ONLY_SECOND_20MHZ 0x04 1844 - #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_160MHZ_ONLY_SECOND_40MHZ 0x08 1845 - #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK 0x0f 1846 - #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x10 1847 - #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x20 1848 - #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x40 1849 - /* Midamble RX/TX Max NSTS is split between byte #2 and byte #3 */ 1850 - #define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS 0x80 1851 - 1852 - #define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS 0x01 1853 - #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x02 1854 - #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x04 1855 - #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x08 1856 - #define IEEE80211_HE_PHY_CAP2_DOPPLER_TX 0x10 1857 - #define IEEE80211_HE_PHY_CAP2_DOPPLER_RX 0x20 1858 - 1859 - /* Note that the meaning of UL MU below is different between an AP and a non-AP 1860 - * sta, where in the AP case it indicates support for Rx and in the non-AP sta 1861 - * case it indicates support for Tx. 1862 - */ 1863 - #define IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO 0x40 1864 - #define IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO 0x80 1865 - 1866 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM 0x00 1867 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK 0x01 1868 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK 0x02 1869 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM 0x03 1870 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK 0x03 1871 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 0x00 1872 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2 0x04 1873 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM 0x00 1874 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK 0x08 1875 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK 0x10 1876 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM 0x18 1877 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x18 1878 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x00 1879 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2 0x20 1880 - #define IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU 0x40 1881 - #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x80 1882 - 1883 - #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x01 1884 - #define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER 0x02 1885 - 1886 - /* Minimal allowed value of Max STS under 80MHz is 3 */ 1887 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 0x0c 1888 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_5 0x10 1889 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_6 0x14 1890 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_7 0x18 1891 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8 0x1c 1892 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK 0x1c 1893 - 1894 - /* Minimal allowed value of Max STS above 80MHz is 3 */ 1895 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4 0x60 1896 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_5 0x80 1897 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_6 0xa0 1898 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_7 0xc0 1899 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 0xe0 1900 - #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK 0xe0 1901 - 1902 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_1 0x00 1903 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 0x01 1904 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_3 0x02 1905 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_4 0x03 1906 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_5 0x04 1907 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_6 0x05 1908 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_7 0x06 1909 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_8 0x07 1910 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK 0x07 1911 - 1912 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_1 0x00 1913 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 0x08 1914 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_3 0x10 1915 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_4 0x18 1916 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_5 0x20 1917 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_6 0x28 1918 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_7 0x30 1919 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_8 0x38 1920 - #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK 0x38 1921 - 1922 - #define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK 0x40 1923 - #define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK 0x80 1924 - 1925 - #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x01 1926 - #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x02 1927 - #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB 0x04 1928 - #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB 0x08 1929 - #define IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB 0x10 1930 - #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x20 1931 - #define IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO 0x40 1932 - #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x80 1933 - 1934 - #define IEEE80211_HE_PHY_CAP7_PSR_BASED_SR 0x01 1935 - #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP 0x02 1936 - #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x04 1937 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x08 1938 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x10 1939 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_3 0x18 1940 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_4 0x20 1941 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_5 0x28 1942 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_6 0x30 1943 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_7 0x38 1944 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK 0x38 1945 - #define IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ 0x40 1946 - #define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ 0x80 1947 - 1948 - #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI 0x01 1949 - #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G 0x02 1950 - #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x04 1951 - #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x08 1952 - #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x10 1953 - #define IEEE80211_HE_PHY_CAP8_MIDAMBLE_RX_TX_2X_AND_1XLTF 0x20 1954 - #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242 0x00 1955 - #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484 0x40 1956 - #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996 0x80 1957 - #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996 0xc0 1958 - #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK 0xc0 1959 - 1960 - #define IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM 0x01 1961 - #define IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK 0x02 1962 - #define IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU 0x04 1963 - #define IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU 0x08 1964 - #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB 0x10 1965 - #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB 0x20 1966 - #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US 0x0 1967 - #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x1 1968 - #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2 1969 - #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x3 1970 - #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS 6 1971 - #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK 0xc0 1972 - 1973 - #define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF 0x01 1974 - 1975 - /* 802.11ax HE TX/RX MCS NSS Support */ 1976 - #define IEEE80211_TX_RX_MCS_NSS_SUPP_HIGHEST_MCS_POS (3) 1977 - #define IEEE80211_TX_RX_MCS_NSS_SUPP_TX_BITMAP_POS (6) 1978 - #define IEEE80211_TX_RX_MCS_NSS_SUPP_RX_BITMAP_POS (11) 1979 - #define IEEE80211_TX_RX_MCS_NSS_SUPP_TX_BITMAP_MASK 0x07c0 1980 - #define IEEE80211_TX_RX_MCS_NSS_SUPP_RX_BITMAP_MASK 0xf800 1981 - 1982 - /* TX/RX HE MCS Support field Highest MCS subfield encoding */ 1983 - enum ieee80211_he_highest_mcs_supported_subfield_enc { 1984 - HIGHEST_MCS_SUPPORTED_MCS7 = 0, 1985 - HIGHEST_MCS_SUPPORTED_MCS8, 1986 - HIGHEST_MCS_SUPPORTED_MCS9, 1987 - HIGHEST_MCS_SUPPORTED_MCS10, 1988 - HIGHEST_MCS_SUPPORTED_MCS11, 1989 - }; 1990 - 1991 - /* Calculate 802.11ax HE capabilities IE Tx/Rx HE MCS NSS Support Field size */ 1992 - static inline u8 1993 - ieee80211_he_mcs_nss_size(const struct ieee80211_he_cap_elem *he_cap) 1994 - { 1995 - u8 count = 4; 1996 - 1997 - if (he_cap->phy_cap_info[0] & 1998 - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G) 1999 - count += 4; 2000 - 2001 - if (he_cap->phy_cap_info[0] & 2002 - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) 2003 - count += 4; 2004 - 2005 - return count; 2006 - } 2007 - 2008 - /* 802.11ax HE PPE Thresholds */ 2009 - #define IEEE80211_PPE_THRES_NSS_SUPPORT_2NSS (1) 2010 - #define IEEE80211_PPE_THRES_NSS_POS (0) 2011 - #define IEEE80211_PPE_THRES_NSS_MASK (7) 2012 - #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_2x966_AND_966_RU \ 2013 - (BIT(5) | BIT(6)) 2014 - #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK 0x78 2015 - #define IEEE80211_PPE_THRES_RU_INDEX_BITMASK_POS (3) 2016 - #define IEEE80211_PPE_THRES_INFO_PPET_SIZE (3) 2017 - #define IEEE80211_HE_PPE_THRES_INFO_HEADER_SIZE (7) 2018 - 2019 - /* 2020 - * Calculate 802.11ax HE capabilities IE PPE field size 2021 - * Input: Header byte of ppe_thres (first byte), and HE capa IE's PHY cap u8* 2022 - */ 2023 - static inline u8 2024 - ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) 2025 - { 2026 - u8 n; 2027 - 2028 - if ((phy_cap_info[6] & 2029 - IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) == 0) 2030 - return 0; 2031 - 2032 - n = hweight8(ppe_thres_hdr & 2033 - IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK); 2034 - n *= (1 + ((ppe_thres_hdr & IEEE80211_PPE_THRES_NSS_MASK) >> 2035 - IEEE80211_PPE_THRES_NSS_POS)); 2036 - 2037 - /* 2038 - * Each pair is 6 bits, and we need to add the 7 "header" bits to the 2039 - * total size. 2040 - */ 2041 - n = (n * IEEE80211_PPE_THRES_INFO_PPET_SIZE * 2) + 7; 2042 - n = DIV_ROUND_UP(n, 8); 2043 - 2044 - return n; 2045 - } 2046 - 2047 - static inline bool ieee80211_he_capa_size_ok(const u8 *data, u8 len) 2048 - { 2049 - const struct ieee80211_he_cap_elem *he_cap_ie_elem = (const void *)data; 2050 - u8 needed = sizeof(*he_cap_ie_elem); 2051 - 2052 - if (len < needed) 2053 - return false; 2054 - 2055 - needed += ieee80211_he_mcs_nss_size(he_cap_ie_elem); 2056 - if (len < needed) 2057 - return false; 2058 - 2059 - if (he_cap_ie_elem->phy_cap_info[6] & 2060 - IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) { 2061 - if (len < needed + 1) 2062 - return false; 2063 - needed += ieee80211_he_ppe_size(data[needed], 2064 - he_cap_ie_elem->phy_cap_info); 2065 - } 2066 - 2067 - return len >= needed; 2068 - } 2069 - 2070 - /* HE Operation defines */ 2071 - #define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x00000007 2072 - #define IEEE80211_HE_OPERATION_TWT_REQUIRED 0x00000008 2073 - #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK 0x00003ff0 2074 - #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET 4 2075 - #define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x00004000 2076 - #define IEEE80211_HE_OPERATION_CO_HOSTED_BSS 0x00008000 2077 - #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000 2078 - #define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000 2079 - #define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000 2080 - #define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24 2081 - #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000 2082 - #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x80000000 2083 - 2084 - #define IEEE80211_6GHZ_CTRL_REG_LPI_AP 0 2085 - #define IEEE80211_6GHZ_CTRL_REG_SP_AP 1 2086 - #define IEEE80211_6GHZ_CTRL_REG_VLP_AP 2 2087 - #define IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP 3 2088 - #define IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP_OLD 4 2089 - #define IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP 8 2090 - 2091 - /** 2092 - * struct ieee80211_he_6ghz_oper - HE 6 GHz operation Information field 2093 - * @primary: primary channel 2094 - * @control: control flags 2095 - * @ccfs0: channel center frequency segment 0 2096 - * @ccfs1: channel center frequency segment 1 2097 - * @minrate: minimum rate (in 1 Mbps units) 2098 - */ 2099 - struct ieee80211_he_6ghz_oper { 2100 - u8 primary; 2101 - #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH 0x3 2102 - #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_20MHZ 0 2103 - #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_40MHZ 1 2104 - #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_80MHZ 2 2105 - #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_160MHZ 3 2106 - #define IEEE80211_HE_6GHZ_OPER_CTRL_DUP_BEACON 0x4 2107 - #define IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO 0x78 2108 - u8 control; 2109 - u8 ccfs0; 2110 - u8 ccfs1; 2111 - u8 minrate; 2112 - } __packed; 2113 - 2114 - /** 2115 - * enum ieee80211_reg_conn_bits - represents Regulatory connectivity field bits. 2116 - * 2117 - * This enumeration defines bit flags used to represent regulatory connectivity 2118 - * field bits. 2119 - * 2120 - * @IEEE80211_REG_CONN_LPI_VALID: Indicates whether the LPI bit is valid. 2121 - * @IEEE80211_REG_CONN_LPI_VALUE: Represents the value of the LPI bit. 2122 - * @IEEE80211_REG_CONN_SP_VALID: Indicates whether the SP bit is valid. 2123 - * @IEEE80211_REG_CONN_SP_VALUE: Represents the value of the SP bit. 2124 - */ 2125 - enum ieee80211_reg_conn_bits { 2126 - IEEE80211_REG_CONN_LPI_VALID = BIT(0), 2127 - IEEE80211_REG_CONN_LPI_VALUE = BIT(1), 2128 - IEEE80211_REG_CONN_SP_VALID = BIT(2), 2129 - IEEE80211_REG_CONN_SP_VALUE = BIT(3), 2130 - }; 2131 - 2132 - /* transmit power interpretation type of transmit power envelope element */ 2133 - enum ieee80211_tx_power_intrpt_type { 2134 - IEEE80211_TPE_LOCAL_EIRP, 2135 - IEEE80211_TPE_LOCAL_EIRP_PSD, 2136 - IEEE80211_TPE_REG_CLIENT_EIRP, 2137 - IEEE80211_TPE_REG_CLIENT_EIRP_PSD, 2138 - }; 2139 - 2140 - /* category type of transmit power envelope element */ 2141 - enum ieee80211_tx_power_category_6ghz { 2142 - IEEE80211_TPE_CAT_6GHZ_DEFAULT = 0, 2143 - IEEE80211_TPE_CAT_6GHZ_SUBORDINATE = 1, 2144 - }; 2145 - 2146 - /* 2147 - * For IEEE80211_TPE_LOCAL_EIRP / IEEE80211_TPE_REG_CLIENT_EIRP, 2148 - * setting to 63.5 dBm means no constraint. 2149 - */ 2150 - #define IEEE80211_TPE_MAX_TX_PWR_NO_CONSTRAINT 127 2151 - 2152 - /* 2153 - * For IEEE80211_TPE_LOCAL_EIRP_PSD / IEEE80211_TPE_REG_CLIENT_EIRP_PSD, 2154 - * setting to 127 indicates no PSD limit for the 20 MHz channel. 2155 - */ 2156 - #define IEEE80211_TPE_PSD_NO_LIMIT 127 2157 - 2158 - /** 2159 - * struct ieee80211_tx_pwr_env - Transmit Power Envelope 2160 - * @info: Transmit Power Information field 2161 - * @variable: Maximum Transmit Power field 2162 - * 2163 - * This structure represents the payload of the "Transmit Power 2164 - * Envelope element" as described in IEEE Std 802.11ax-2021 section 2165 - * 9.4.2.161 2166 - */ 2167 - struct ieee80211_tx_pwr_env { 2168 - u8 info; 2169 - u8 variable[]; 2170 - } __packed; 2171 - 2172 - #define IEEE80211_TX_PWR_ENV_INFO_COUNT 0x7 2173 - #define IEEE80211_TX_PWR_ENV_INFO_INTERPRET 0x38 2174 - #define IEEE80211_TX_PWR_ENV_INFO_CATEGORY 0xC0 2175 - 2176 - #define IEEE80211_TX_PWR_ENV_EXT_COUNT 0xF 2177 - 2178 - static inline bool ieee80211_valid_tpe_element(const u8 *data, u8 len) 2179 - { 2180 - const struct ieee80211_tx_pwr_env *env = (const void *)data; 2181 - u8 count, interpret, category; 2182 - u8 needed = sizeof(*env); 2183 - u8 N; /* also called N in the spec */ 2184 - 2185 - if (len < needed) 2186 - return false; 2187 - 2188 - count = u8_get_bits(env->info, IEEE80211_TX_PWR_ENV_INFO_COUNT); 2189 - interpret = u8_get_bits(env->info, IEEE80211_TX_PWR_ENV_INFO_INTERPRET); 2190 - category = u8_get_bits(env->info, IEEE80211_TX_PWR_ENV_INFO_CATEGORY); 2191 - 2192 - switch (category) { 2193 - case IEEE80211_TPE_CAT_6GHZ_DEFAULT: 2194 - case IEEE80211_TPE_CAT_6GHZ_SUBORDINATE: 2195 - break; 2196 - default: 2197 - return false; 2198 - } 2199 - 2200 - switch (interpret) { 2201 - case IEEE80211_TPE_LOCAL_EIRP: 2202 - case IEEE80211_TPE_REG_CLIENT_EIRP: 2203 - if (count > 3) 2204 - return false; 2205 - 2206 - /* count == 0 encodes 1 value for 20 MHz, etc. */ 2207 - needed += count + 1; 2208 - 2209 - if (len < needed) 2210 - return false; 2211 - 2212 - /* there can be extension fields not accounted for in 'count' */ 2213 - 2214 - return true; 2215 - case IEEE80211_TPE_LOCAL_EIRP_PSD: 2216 - case IEEE80211_TPE_REG_CLIENT_EIRP_PSD: 2217 - if (count > 4) 2218 - return false; 2219 - 2220 - N = count ? 1 << (count - 1) : 1; 2221 - needed += N; 2222 - 2223 - if (len < needed) 2224 - return false; 2225 - 2226 - if (len > needed) { 2227 - u8 K = u8_get_bits(env->variable[N], 2228 - IEEE80211_TX_PWR_ENV_EXT_COUNT); 2229 - 2230 - needed += 1 + K; 2231 - if (len < needed) 2232 - return false; 2233 - } 2234 - 2235 - return true; 2236 - } 2237 - 2238 - return false; 2239 - } 2240 - 2241 - /* 2242 - * ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size 2243 - * @he_oper_ie: byte data of the He Operations IE, stating from the byte 2244 - * after the ext ID byte. It is assumed that he_oper_ie has at least 2245 - * sizeof(struct ieee80211_he_operation) bytes, the caller must have 2246 - * validated this. 2247 - * @return the actual size of the IE data (not including header), or 0 on error 2248 - */ 2249 - static inline u8 2250 - ieee80211_he_oper_size(const u8 *he_oper_ie) 2251 - { 2252 - const struct ieee80211_he_operation *he_oper = (const void *)he_oper_ie; 2253 - u8 oper_len = sizeof(struct ieee80211_he_operation); 2254 - u32 he_oper_params; 2255 - 2256 - /* Make sure the input is not NULL */ 2257 - if (!he_oper_ie) 2258 - return 0; 2259 - 2260 - /* Calc required length */ 2261 - he_oper_params = le32_to_cpu(he_oper->he_oper_params); 2262 - if (he_oper_params & IEEE80211_HE_OPERATION_VHT_OPER_INFO) 2263 - oper_len += 3; 2264 - if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS) 2265 - oper_len++; 2266 - if (he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO) 2267 - oper_len += sizeof(struct ieee80211_he_6ghz_oper); 2268 - 2269 - /* Add the first byte (extension ID) to the total length */ 2270 - oper_len++; 2271 - 2272 - return oper_len; 2273 - } 2274 - 2275 - /** 2276 - * ieee80211_he_6ghz_oper - obtain 6 GHz operation field 2277 - * @he_oper: HE operation element (must be pre-validated for size) 2278 - * but may be %NULL 2279 - * 2280 - * Return: a pointer to the 6 GHz operation field, or %NULL 2281 - */ 2282 - static inline const struct ieee80211_he_6ghz_oper * 2283 - ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper) 2284 - { 2285 - const u8 *ret; 2286 - u32 he_oper_params; 2287 - 2288 - if (!he_oper) 2289 - return NULL; 2290 - 2291 - ret = (const void *)&he_oper->optional; 2292 - 2293 - he_oper_params = le32_to_cpu(he_oper->he_oper_params); 2294 - 2295 - if (!(he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO)) 2296 - return NULL; 2297 - if (he_oper_params & IEEE80211_HE_OPERATION_VHT_OPER_INFO) 2298 - ret += 3; 2299 - if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS) 2300 - ret++; 2301 - 2302 - return (const void *)ret; 2303 - } 2304 - 2305 - /* HE Spatial Reuse defines */ 2306 - #define IEEE80211_HE_SPR_PSR_DISALLOWED BIT(0) 2307 - #define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED BIT(1) 2308 - #define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT BIT(2) 2309 - #define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT BIT(3) 2310 - #define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED BIT(4) 2311 - 2312 - /* 2313 - * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size 2314 - * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the byte 2315 - * after the ext ID byte. It is assumed that he_spr_ie has at least 2316 - * sizeof(struct ieee80211_he_spr) bytes, the caller must have validated 2317 - * this 2318 - * @return the actual size of the IE data (not including header), or 0 on error 2319 - */ 2320 - static inline u8 2321 - ieee80211_he_spr_size(const u8 *he_spr_ie) 2322 - { 2323 - const struct ieee80211_he_spr *he_spr = (const void *)he_spr_ie; 2324 - u8 spr_len = sizeof(struct ieee80211_he_spr); 2325 - u8 he_spr_params; 2326 - 2327 - /* Make sure the input is not NULL */ 2328 - if (!he_spr_ie) 2329 - return 0; 2330 - 2331 - /* Calc required length */ 2332 - he_spr_params = he_spr->he_sr_control; 2333 - if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) 2334 - spr_len++; 2335 - if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) 2336 - spr_len += 18; 2337 - 2338 - /* Add the first byte (extension ID) to the total length */ 2339 - spr_len++; 2340 - 2341 - return spr_len; 2342 - } 2343 1904 2344 1905 /* S1G Capabilities Information field */ 2345 1906 #define IEEE80211_S1G_CAPABILITY_LEN 15 ··· 1911 2696 #define IEEE80211_EHT_OPER_CHAN_WIDTH_80MHZ 2 1912 2697 #define IEEE80211_EHT_OPER_CHAN_WIDTH_160MHZ 3 1913 2698 #define IEEE80211_EHT_OPER_CHAN_WIDTH_320MHZ 4 2699 + 2700 + /* need HE definitions for EHT functions */ 2701 + #include "ieee80211-he.h" 1914 2702 1915 2703 /* Calculate 802.11be EHT capabilities IE Tx/Rx EHT MCS NSS Support Field size */ 1916 2704 static inline u8 ··· 3032 3814 __le16 sba; 3033 3815 __le16 medium_time; 3034 3816 } __packed; 3035 - 3036 - struct ieee80211_he_6ghz_capa { 3037 - /* uses IEEE80211_HE_6GHZ_CAP_* below */ 3038 - __le16 capa; 3039 - } __packed; 3040 - 3041 - /* HE 6 GHz band capabilities */ 3042 - /* uses enum ieee80211_min_mpdu_spacing values */ 3043 - #define IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START 0x0007 3044 - /* uses enum ieee80211_vht_max_ampdu_length_exp values */ 3045 - #define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP 0x0038 3046 - /* uses IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_* values */ 3047 - #define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN 0x00c0 3048 - /* WLAN_HT_CAP_SM_PS_* values */ 3049 - #define IEEE80211_HE_6GHZ_CAP_SM_PS 0x0600 3050 - #define IEEE80211_HE_6GHZ_CAP_RD_RESPONDER 0x0800 3051 - #define IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS 0x1000 3052 - #define IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS 0x2000 3053 3817 3054 3818 /** 3055 3819 * ieee80211_get_qos_ctl - get pointer to qos control bytes