at v6.19 292 lines 9.5 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * IEEE 802.11 HT 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_HT_H 16#define LINUX_IEEE80211_HT_H 17 18#include <linux/types.h> 19#include <linux/if_ether.h> 20 21/* Maximal size of an A-MSDU that can be transported in a HT BA session */ 22#define IEEE80211_MAX_MPDU_LEN_HT_BA 4095 23 24/* Maximal size of an A-MSDU */ 25#define IEEE80211_MAX_MPDU_LEN_HT_3839 3839 26#define IEEE80211_MAX_MPDU_LEN_HT_7935 7935 27 28#define IEEE80211_HT_CTL_LEN 4 29 30enum ieee80211_ht_chanwidth_values { 31 IEEE80211_HT_CHANWIDTH_20MHZ = 0, 32 IEEE80211_HT_CHANWIDTH_ANY = 1, 33}; 34 35/** 36 * struct ieee80211_bar - Block Ack Request frame format 37 * @frame_control: Frame Control 38 * @duration: Duration 39 * @ra: RA 40 * @ta: TA 41 * @control: BAR Control 42 * @start_seq_num: Starting Sequence Number (see Figure 9-37) 43 * 44 * This structure represents the "BlockAckReq frame format" 45 * as described in IEEE Std 802.11-2020 section 9.3.1.7. 46*/ 47struct ieee80211_bar { 48 __le16 frame_control; 49 __le16 duration; 50 __u8 ra[ETH_ALEN]; 51 __u8 ta[ETH_ALEN]; 52 __le16 control; 53 __le16 start_seq_num; 54} __packed; 55 56/* 802.11 BAR control masks */ 57#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 58#define IEEE80211_BAR_CTRL_MULTI_TID 0x0002 59#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 60#define IEEE80211_BAR_CTRL_TID_INFO_MASK 0xf000 61#define IEEE80211_BAR_CTRL_TID_INFO_SHIFT 12 62 63#define IEEE80211_HT_MCS_MASK_LEN 10 64 65/** 66 * struct ieee80211_mcs_info - Supported MCS Set field 67 * @rx_mask: RX mask 68 * @rx_highest: highest supported RX rate. If set represents 69 * the highest supported RX data rate in units of 1 Mbps. 70 * If this field is 0 this value should not be used to 71 * consider the highest RX data rate supported. 72 * @tx_params: TX parameters 73 * @reserved: Reserved bits 74 * 75 * This structure represents the "Supported MCS Set field" as 76 * described in IEEE Std 802.11-2020 section 9.4.2.55.4. 77 */ 78struct ieee80211_mcs_info { 79 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN]; 80 __le16 rx_highest; 81 u8 tx_params; 82 u8 reserved[3]; 83} __packed; 84 85/* 802.11n HT capability MSC set */ 86#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff 87#define IEEE80211_HT_MCS_TX_DEFINED 0x01 88#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02 89/* value 0 == 1 stream etc */ 90#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C 91#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2 92#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4 93#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10 94 95#define IEEE80211_HT_MCS_CHAINS(mcs) ((mcs) == 32 ? 1 : (1 + ((mcs) >> 3))) 96 97/* 98 * 802.11n D5.0 20.3.5 / 20.6 says: 99 * - indices 0 to 7 and 32 are single spatial stream 100 * - 8 to 31 are multiple spatial streams using equal modulation 101 * [8..15 for two streams, 16..23 for three and 24..31 for four] 102 * - remainder are multiple spatial streams using unequal modulation 103 */ 104#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33 105#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \ 106 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8) 107 108/** 109 * struct ieee80211_ht_cap - HT capabilities element 110 * @cap_info: HT Capability Information 111 * @ampdu_params_info: A-MPDU Parameters 112 * @mcs: Supported MCS Set 113 * @extended_ht_cap_info: HT Extended Capabilities 114 * @tx_BF_cap_info: Transmit Beamforming Capabilities 115 * @antenna_selection_info: ASEL Capability 116 * 117 * This structure represents the payload of the "HT Capabilities 118 * element" as described in IEEE Std 802.11-2020 section 9.4.2.55. 119 */ 120struct ieee80211_ht_cap { 121 __le16 cap_info; 122 u8 ampdu_params_info; 123 124 /* 16 bytes MCS information */ 125 struct ieee80211_mcs_info mcs; 126 127 __le16 extended_ht_cap_info; 128 __le32 tx_BF_cap_info; 129 u8 antenna_selection_info; 130} __packed; 131 132/* 802.11n HT capabilities masks (for cap_info) */ 133#define IEEE80211_HT_CAP_LDPC_CODING 0x0001 134#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 135#define IEEE80211_HT_CAP_SM_PS 0x000C 136#define IEEE80211_HT_CAP_SM_PS_SHIFT 2 137#define IEEE80211_HT_CAP_GRN_FLD 0x0010 138#define IEEE80211_HT_CAP_SGI_20 0x0020 139#define IEEE80211_HT_CAP_SGI_40 0x0040 140#define IEEE80211_HT_CAP_TX_STBC 0x0080 141#define IEEE80211_HT_CAP_RX_STBC 0x0300 142#define IEEE80211_HT_CAP_RX_STBC_SHIFT 8 143#define IEEE80211_HT_CAP_DELAY_BA 0x0400 144#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 145#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 146#define IEEE80211_HT_CAP_RESERVED 0x2000 147#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 148#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 149 150/* 802.11n HT extended capabilities masks (for extended_ht_cap_info) */ 151#define IEEE80211_HT_EXT_CAP_PCO 0x0001 152#define IEEE80211_HT_EXT_CAP_PCO_TIME 0x0006 153#define IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT 1 154#define IEEE80211_HT_EXT_CAP_MCS_FB 0x0300 155#define IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT 8 156#define IEEE80211_HT_EXT_CAP_HTC_SUP 0x0400 157#define IEEE80211_HT_EXT_CAP_RD_RESPONDER 0x0800 158 159/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ 160#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03 161#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C 162#define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2 163 164/* 165 * Maximum length of AMPDU that the STA can receive in high-throughput (HT). 166 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) 167 */ 168enum ieee80211_max_ampdu_length_exp { 169 IEEE80211_HT_MAX_AMPDU_8K = 0, 170 IEEE80211_HT_MAX_AMPDU_16K = 1, 171 IEEE80211_HT_MAX_AMPDU_32K = 2, 172 IEEE80211_HT_MAX_AMPDU_64K = 3 173}; 174 175#define IEEE80211_HT_MAX_AMPDU_FACTOR 13 176 177/* Minimum MPDU start spacing */ 178enum ieee80211_min_mpdu_spacing { 179 IEEE80211_HT_MPDU_DENSITY_NONE = 0, /* No restriction */ 180 IEEE80211_HT_MPDU_DENSITY_0_25 = 1, /* 1/4 usec */ 181 IEEE80211_HT_MPDU_DENSITY_0_5 = 2, /* 1/2 usec */ 182 IEEE80211_HT_MPDU_DENSITY_1 = 3, /* 1 usec */ 183 IEEE80211_HT_MPDU_DENSITY_2 = 4, /* 2 usec */ 184 IEEE80211_HT_MPDU_DENSITY_4 = 5, /* 4 usec */ 185 IEEE80211_HT_MPDU_DENSITY_8 = 6, /* 8 usec */ 186 IEEE80211_HT_MPDU_DENSITY_16 = 7 /* 16 usec */ 187}; 188 189/** 190 * struct ieee80211_ht_operation - HT operation IE 191 * @primary_chan: Primary Channel 192 * @ht_param: HT Operation Information parameters 193 * @operation_mode: HT Operation Information operation mode 194 * @stbc_param: HT Operation Information STBC params 195 * @basic_set: Basic HT-MCS Set 196 * 197 * This structure represents the payload of the "HT Operation 198 * element" as described in IEEE Std 802.11-2020 section 9.4.2.56. 199 */ 200struct ieee80211_ht_operation { 201 u8 primary_chan; 202 u8 ht_param; 203 __le16 operation_mode; 204 __le16 stbc_param; 205 u8 basic_set[16]; 206} __packed; 207 208/* for ht_param */ 209#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03 210#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00 211#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01 212#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03 213#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04 214#define IEEE80211_HT_PARAM_RIFS_MODE 0x08 215 216/* for operation_mode */ 217#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003 218#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0 219#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1 220#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2 221#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3 222#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004 223#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010 224#define IEEE80211_HT_OP_MODE_CCFS2_SHIFT 5 225#define IEEE80211_HT_OP_MODE_CCFS2_MASK 0x1fe0 226 227/* for stbc_param */ 228#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040 229#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080 230#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100 231#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200 232#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400 233#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800 234 235 236/* block-ack parameters */ 237#define IEEE80211_ADDBA_PARAM_AMSDU_MASK 0x0001 238#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 239#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C 240#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0 241#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 242#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 243 244/* 245 * A-MPDU buffer sizes 246 * According to HT size varies from 8 to 64 frames 247 * HE adds the ability to have up to 256 frames. 248 * EHT adds the ability to have up to 1K frames. 249 */ 250#define IEEE80211_MIN_AMPDU_BUF 0x8 251#define IEEE80211_MAX_AMPDU_BUF_HT 0x40 252#define IEEE80211_MAX_AMPDU_BUF_HE 0x100 253#define IEEE80211_MAX_AMPDU_BUF_EHT 0x400 254 255 256/* Spatial Multiplexing Power Save Modes (for capability) */ 257#define WLAN_HT_CAP_SM_PS_STATIC 0 258#define WLAN_HT_CAP_SM_PS_DYNAMIC 1 259#define WLAN_HT_CAP_SM_PS_INVALID 2 260#define WLAN_HT_CAP_SM_PS_DISABLED 3 261 262/* for SM power control field lower two bits */ 263#define WLAN_HT_SMPS_CONTROL_DISABLED 0 264#define WLAN_HT_SMPS_CONTROL_STATIC 1 265#define WLAN_HT_SMPS_CONTROL_DYNAMIC 3 266 267/* HT action codes */ 268enum ieee80211_ht_actioncode { 269 WLAN_HT_ACTION_NOTIFY_CHANWIDTH = 0, 270 WLAN_HT_ACTION_SMPS = 1, 271 WLAN_HT_ACTION_PSMP = 2, 272 WLAN_HT_ACTION_PCO_PHASE = 3, 273 WLAN_HT_ACTION_CSI = 4, 274 WLAN_HT_ACTION_NONCOMPRESSED_BF = 5, 275 WLAN_HT_ACTION_COMPRESSED_BF = 6, 276 WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7, 277}; 278 279/* BACK action code */ 280enum ieee80211_back_actioncode { 281 WLAN_ACTION_ADDBA_REQ = 0, 282 WLAN_ACTION_ADDBA_RESP = 1, 283 WLAN_ACTION_DELBA = 2, 284}; 285 286/* BACK (block-ack) parties */ 287enum ieee80211_back_parties { 288 WLAN_BACK_RECIPIENT = 0, 289 WLAN_BACK_INITIATOR = 1, 290}; 291 292#endif /* LINUX_IEEE80211_HT_H */