hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/linux/ieee80211.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * IEEE 802.11 defines
34 *
....@@ -8,11 +9,7 @@
89 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
910 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
1011 * Copyright (c) 2016 - 2017 Intel Deutschland GmbH
11
- * Copyright (c) 2018 Intel Corporation
12
- *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License version 2 as
15
- * published by the Free Software Foundation.
12
+ * Copyright (c) 2018 - 2020 Intel Corporation
1613 */
1714
1815 #ifndef LINUX_IEEE80211_H
....@@ -108,6 +105,54 @@
108105
109106 /* extension, added by 802.11ad */
110107 #define IEEE80211_STYPE_DMG_BEACON 0x0000
108
+#define IEEE80211_STYPE_S1G_BEACON 0x0010
109
+
110
+/* bits unique to S1G beacon */
111
+#define IEEE80211_S1G_BCN_NEXT_TBTT 0x100
112
+
113
+/* see 802.11ah-2016 9.9 NDP CMAC frames */
114
+#define IEEE80211_S1G_1MHZ_NDP_BITS 25
115
+#define IEEE80211_S1G_1MHZ_NDP_BYTES 4
116
+#define IEEE80211_S1G_2MHZ_NDP_BITS 37
117
+#define IEEE80211_S1G_2MHZ_NDP_BYTES 5
118
+
119
+#define IEEE80211_NDP_FTYPE_CTS 0
120
+#define IEEE80211_NDP_FTYPE_CF_END 0
121
+#define IEEE80211_NDP_FTYPE_PS_POLL 1
122
+#define IEEE80211_NDP_FTYPE_ACK 2
123
+#define IEEE80211_NDP_FTYPE_PS_POLL_ACK 3
124
+#define IEEE80211_NDP_FTYPE_BA 4
125
+#define IEEE80211_NDP_FTYPE_BF_REPORT_POLL 5
126
+#define IEEE80211_NDP_FTYPE_PAGING 6
127
+#define IEEE80211_NDP_FTYPE_PREQ 7
128
+
129
+#define SM64(f, v) ((((u64)v) << f##_S) & f)
130
+
131
+/* NDP CMAC frame fields */
132
+#define IEEE80211_NDP_FTYPE 0x0000000000000007
133
+#define IEEE80211_NDP_FTYPE_S 0x0000000000000000
134
+
135
+/* 1M Probe Request 11ah 9.9.3.1.1 */
136
+#define IEEE80211_NDP_1M_PREQ_ANO 0x0000000000000008
137
+#define IEEE80211_NDP_1M_PREQ_ANO_S 3
138
+#define IEEE80211_NDP_1M_PREQ_CSSID 0x00000000000FFFF0
139
+#define IEEE80211_NDP_1M_PREQ_CSSID_S 4
140
+#define IEEE80211_NDP_1M_PREQ_RTYPE 0x0000000000100000
141
+#define IEEE80211_NDP_1M_PREQ_RTYPE_S 20
142
+#define IEEE80211_NDP_1M_PREQ_RSV 0x0000000001E00000
143
+#define IEEE80211_NDP_1M_PREQ_RSV 0x0000000001E00000
144
+/* 2M Probe Request 11ah 9.9.3.1.2 */
145
+#define IEEE80211_NDP_2M_PREQ_ANO 0x0000000000000008
146
+#define IEEE80211_NDP_2M_PREQ_ANO_S 3
147
+#define IEEE80211_NDP_2M_PREQ_CSSID 0x0000000FFFFFFFF0
148
+#define IEEE80211_NDP_2M_PREQ_CSSID_S 4
149
+#define IEEE80211_NDP_2M_PREQ_RTYPE 0x0000001000000000
150
+#define IEEE80211_NDP_2M_PREQ_RTYPE_S 36
151
+
152
+#define IEEE80211_ANO_NETTYPE_WILD 15
153
+
154
+/* bits unique to S1G beacon */
155
+#define IEEE80211_S1G_BCN_NEXT_TBTT 0x100
111156
112157 /* control extension - for IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTL_EXT */
113158 #define IEEE80211_CTL_EXT_POLL 0x2000
....@@ -123,6 +168,21 @@
123168 #define IEEE80211_SN_MASK ((IEEE80211_SCTL_SEQ) >> 4)
124169 #define IEEE80211_MAX_SN IEEE80211_SN_MASK
125170 #define IEEE80211_SN_MODULO (IEEE80211_MAX_SN + 1)
171
+
172
+
173
+/* PV1 Layout 11ah 9.8.3.1 */
174
+#define IEEE80211_PV1_FCTL_VERS 0x0003
175
+#define IEEE80211_PV1_FCTL_FTYPE 0x001c
176
+#define IEEE80211_PV1_FCTL_STYPE 0x00e0
177
+#define IEEE80211_PV1_FCTL_TODS 0x0100
178
+#define IEEE80211_PV1_FCTL_MOREFRAGS 0x0200
179
+#define IEEE80211_PV1_FCTL_PM 0x0400
180
+#define IEEE80211_PV1_FCTL_MOREDATA 0x0800
181
+#define IEEE80211_PV1_FCTL_PROTECTED 0x1000
182
+#define IEEE80211_PV1_FCTL_END_SP 0x2000
183
+#define IEEE80211_PV1_FCTL_RELAYED 0x4000
184
+#define IEEE80211_PV1_FCTL_ACK_POLICY 0x8000
185
+#define IEEE80211_PV1_FCTL_CTL_EXT 0x0f00
126186
127187 static inline bool ieee80211_sn_less(u16 sn1, u16 sn2)
128188 {
....@@ -151,6 +211,7 @@
151211 #define IEEE80211_MAX_FRAG_THRESHOLD 2352
152212 #define IEEE80211_MAX_RTS_THRESHOLD 2353
153213 #define IEEE80211_MAX_AID 2007
214
+#define IEEE80211_MAX_AID_S1G 8191
154215 #define IEEE80211_MAX_TIM_LEN 251
155216 #define IEEE80211_MAX_MESH_PEERINGS 63
156217 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
....@@ -375,6 +436,17 @@
375436 }
376437
377438 /**
439
+ * ieee80211_is_ext - check if type is IEEE80211_FTYPE_EXT
440
+ * @fc: frame control bytes in little-endian byteorder
441
+ */
442
+static inline bool ieee80211_is_ext(__le16 fc)
443
+{
444
+ return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
445
+ cpu_to_le16(IEEE80211_FTYPE_EXT);
446
+}
447
+
448
+
449
+/**
378450 * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set
379451 * @fc: frame control bytes in little-endian byteorder
380452 */
....@@ -470,6 +542,40 @@
470542 {
471543 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
472544 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
545
+}
546
+
547
+/**
548
+ * ieee80211_is_s1g_beacon - check if IEEE80211_FTYPE_EXT &&
549
+ * IEEE80211_STYPE_S1G_BEACON
550
+ * @fc: frame control bytes in little-endian byteorder
551
+ */
552
+static inline bool ieee80211_is_s1g_beacon(__le16 fc)
553
+{
554
+ return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE |
555
+ IEEE80211_FCTL_STYPE)) ==
556
+ cpu_to_le16(IEEE80211_FTYPE_EXT | IEEE80211_STYPE_S1G_BEACON);
557
+}
558
+
559
+/**
560
+ * ieee80211_next_tbtt_present - check if IEEE80211_FTYPE_EXT &&
561
+ * IEEE80211_STYPE_S1G_BEACON && IEEE80211_S1G_BCN_NEXT_TBTT
562
+ * @fc: frame control bytes in little-endian byteorder
563
+ */
564
+static inline bool ieee80211_next_tbtt_present(__le16 fc)
565
+{
566
+ return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
567
+ cpu_to_le16(IEEE80211_FTYPE_EXT | IEEE80211_STYPE_S1G_BEACON) &&
568
+ fc & cpu_to_le16(IEEE80211_S1G_BCN_NEXT_TBTT);
569
+}
570
+
571
+/**
572
+ * ieee80211_is_s1g_short_beacon - check if next tbtt present bit is set. Only
573
+ * true for S1G beacons when they're short.
574
+ * @fc: frame control bytes in little-endian byteorder
575
+ */
576
+static inline bool ieee80211_is_s1g_short_beacon(__le16 fc)
577
+{
578
+ return ieee80211_is_s1g_beacon(fc) && ieee80211_next_tbtt_present(fc);
473579 }
474580
475581 /**
....@@ -719,7 +825,7 @@
719825 u8 token;
720826 u8 mode;
721827 u8 type;
722
- u8 request[0];
828
+ u8 request[];
723829 } __packed;
724830
725831 /**
....@@ -821,6 +927,8 @@
821927 IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL = 0x40,
822928 };
823929
930
+#define IEEE80211_MESHCONF_FORM_CONNECTED_TO_GATE 0x1
931
+
824932 /**
825933 * mesh channel switch parameters element's flag indicator
826934 *
....@@ -860,6 +968,7 @@
860968 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ: 40 MHz channel width
861969 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ: 80 MHz channel width
862970 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ: 160 MHz or 80+80 MHz channel width
971
+ * @IEEE80211_OPMODE_NOTIF_BW_160_80P80: 160 / 80+80 MHz indicator flag
863972 * @IEEE80211_OPMODE_NOTIF_RX_NSS_MASK: number of spatial streams mask
864973 * (the NSS value is the value of this field + 1)
865974 * @IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT: number of spatial streams shift
....@@ -867,14 +976,34 @@
867976 * using a beamforming steering matrix
868977 */
869978 enum ieee80211_vht_opmode_bits {
870
- IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK = 3,
979
+ IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK = 0x03,
871980 IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ = 0,
872981 IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ = 1,
873982 IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ = 2,
874983 IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ = 3,
984
+ IEEE80211_OPMODE_NOTIF_BW_160_80P80 = 0x04,
875985 IEEE80211_OPMODE_NOTIF_RX_NSS_MASK = 0x70,
876986 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,
877987 IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF = 0x80,
988
+};
989
+
990
+/**
991
+ * enum ieee80211_s1g_chanwidth
992
+ * These are defined in IEEE802.11-2016ah Table 10-20
993
+ * as BSS Channel Width
994
+ *
995
+ * @IEEE80211_S1G_CHANWIDTH_1MHZ: 1MHz operating channel
996
+ * @IEEE80211_S1G_CHANWIDTH_2MHZ: 2MHz operating channel
997
+ * @IEEE80211_S1G_CHANWIDTH_4MHZ: 4MHz operating channel
998
+ * @IEEE80211_S1G_CHANWIDTH_8MHZ: 8MHz operating channel
999
+ * @IEEE80211_S1G_CHANWIDTH_16MHZ: 16MHz operating channel
1000
+ */
1001
+enum ieee80211_s1g_chanwidth {
1002
+ IEEE80211_S1G_CHANWIDTH_1MHZ = 0,
1003
+ IEEE80211_S1G_CHANWIDTH_2MHZ = 1,
1004
+ IEEE80211_S1G_CHANWIDTH_4MHZ = 3,
1005
+ IEEE80211_S1G_CHANWIDTH_8MHZ = 7,
1006
+ IEEE80211_S1G_CHANWIDTH_16MHZ = 15,
8781007 };
8791008
8801009 #define WLAN_SA_QUERY_TR_ID_LEN 2
....@@ -890,6 +1019,74 @@
8901019 u8 tx_power;
8911020 u8 link_margin;
8921021 } __packed;
1022
+
1023
+#define IEEE80211_ADDBA_EXT_FRAG_LEVEL_MASK GENMASK(2, 1)
1024
+#define IEEE80211_ADDBA_EXT_FRAG_LEVEL_SHIFT 1
1025
+#define IEEE80211_ADDBA_EXT_NO_FRAG BIT(0)
1026
+
1027
+struct ieee80211_addba_ext_ie {
1028
+ u8 data;
1029
+} __packed;
1030
+
1031
+/**
1032
+ * struct ieee80211_s1g_bcn_compat_ie
1033
+ *
1034
+ * S1G Beacon Compatibility element
1035
+ */
1036
+struct ieee80211_s1g_bcn_compat_ie {
1037
+ __le16 compat_info;
1038
+ __le16 beacon_int;
1039
+ __le32 tsf_completion;
1040
+} __packed;
1041
+
1042
+/**
1043
+ * struct ieee80211_s1g_oper_ie
1044
+ *
1045
+ * S1G Operation element
1046
+ */
1047
+struct ieee80211_s1g_oper_ie {
1048
+ u8 ch_width;
1049
+ u8 oper_class;
1050
+ u8 primary_ch;
1051
+ u8 oper_ch;
1052
+ __le16 basic_mcs_nss;
1053
+} __packed;
1054
+
1055
+/**
1056
+ * struct ieee80211_aid_response_ie
1057
+ *
1058
+ * AID Response element
1059
+ */
1060
+struct ieee80211_aid_response_ie {
1061
+ __le16 aid;
1062
+ u8 switch_count;
1063
+ __le16 response_int;
1064
+} __packed;
1065
+
1066
+struct ieee80211_s1g_cap {
1067
+ u8 capab_info[10];
1068
+ u8 supp_mcs_nss[5];
1069
+} __packed;
1070
+
1071
+struct ieee80211_ext {
1072
+ __le16 frame_control;
1073
+ __le16 duration;
1074
+ union {
1075
+ struct {
1076
+ u8 sa[ETH_ALEN];
1077
+ __le32 timestamp;
1078
+ u8 change_seq;
1079
+ u8 variable[0];
1080
+ } __packed s1g_beacon;
1081
+ struct {
1082
+ u8 sa[ETH_ALEN];
1083
+ __le32 timestamp;
1084
+ u8 change_seq;
1085
+ u8 next_tbtt[3];
1086
+ u8 variable[0];
1087
+ } __packed s1g_short_beacon;
1088
+ } u;
1089
+} __packed __aligned(2);
8931090
8941091 struct ieee80211_mgmt {
8951092 __le16 frame_control;
....@@ -922,6 +1119,11 @@
9221119 /* followed by Supported rates */
9231120 u8 variable[0];
9241121 } __packed assoc_resp, reassoc_resp;
1122
+ struct {
1123
+ __le16 capab_info;
1124
+ __le16 status_code;
1125
+ u8 variable[0];
1126
+ } __packed s1g_assoc_resp, s1g_reassoc_resp;
9251127 struct {
9261128 __le16 capab_info;
9271129 __le16 listen_interval;
....@@ -983,6 +1185,8 @@
9831185 __le16 capab;
9841186 __le16 timeout;
9851187 __le16 start_seq_num;
1188
+ /* followed by BA Extension */
1189
+ u8 variable[0];
9861190 } __packed addba_req;
9871191 struct{
9881192 u8 action_code;
....@@ -1056,6 +1260,7 @@
10561260 /* Supported rates membership selectors */
10571261 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
10581262 #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126
1263
+#define BSS_MEMBERSHIP_SELECTOR_HE_PHY 122
10591264
10601265 /* mgmt header + 1 byte category code */
10611266 #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
....@@ -1469,13 +1674,16 @@
14691674 * STA can receive. Rate expressed in units of 1 Mbps.
14701675 * If this field is 0 this value should not be used to
14711676 * consider the highest RX data rate supported.
1472
- * The top 3 bits of this field are reserved.
1677
+ * The top 3 bits of this field indicate the Maximum NSTS,total
1678
+ * (a beamformee capability.)
14731679 * @tx_mcs_map: TX MCS map 2 bits for each stream, total 8 streams
14741680 * @tx_highest: Indicates highest long GI VHT PPDU data rate
14751681 * STA can transmit. Rate expressed in units of 1 Mbps.
14761682 * If this field is 0 this value should not be used to
14771683 * consider the highest TX data rate supported.
1478
- * The top 3 bits of this field are reserved.
1684
+ * The top 2 bits of this field are reserved, the
1685
+ * 3rd bit from the top indiciates VHT Extended NSS BW
1686
+ * Capability.
14791687 */
14801688 struct ieee80211_vht_mcs_info {
14811689 __le16 rx_mcs_map;
....@@ -1483,6 +1691,13 @@
14831691 __le16 tx_mcs_map;
14841692 __le16 tx_highest;
14851693 } __packed;
1694
+
1695
+/* for rx_highest */
1696
+#define IEEE80211_VHT_MAX_NSTS_TOTAL_SHIFT 13
1697
+#define IEEE80211_VHT_MAX_NSTS_TOTAL_MASK (7 << IEEE80211_VHT_MAX_NSTS_TOTAL_SHIFT)
1698
+
1699
+/* for tx_highest */
1700
+#define IEEE80211_VHT_EXT_NSS_BW_CAPABLE (1 << 13)
14861701
14871702 /**
14881703 * enum ieee80211_vht_mcs_support - VHT MCS support definitions
....@@ -1554,11 +1769,11 @@
15541769 * struct ieee80211_he_cap_elem - HE capabilities element
15551770 *
15561771 * This structure is the "HE capabilities element" fixed fields as
1557
- * described in P802.11ax_D2.0 section 9.4.2.237.2 and 9.4.2.237.3
1772
+ * described in P802.11ax_D4.0 section 9.4.2.242.2 and 9.4.2.242.3
15581773 */
15591774 struct ieee80211_he_cap_elem {
1560
- u8 mac_cap_info[5];
1561
- u8 phy_cap_info[9];
1775
+ u8 mac_cap_info[6];
1776
+ u8 phy_cap_info[11];
15621777 } __packed;
15631778
15641779 #define IEEE80211_TX_RX_MCS_NSS_DESC_MAX_LEN 5
....@@ -1616,20 +1831,32 @@
16161831 * struct ieee80211_he_operation - HE capabilities element
16171832 *
16181833 * This structure is the "HE operation element" fields as
1619
- * described in P802.11ax_D2.0 section 9.4.2.238
1834
+ * described in P802.11ax_D4.0 section 9.4.2.243
16201835 */
16211836 struct ieee80211_he_operation {
16221837 __le32 he_oper_params;
16231838 __le16 he_mcs_nss_set;
1624
- /* Optional 0,1,3 or 4 bytes: depends on @he_oper_params */
1625
- u8 optional[0];
1839
+ /* Optional 0,1,3,4,5,7 or 8 bytes: depends on @he_oper_params */
1840
+ u8 optional[];
1841
+} __packed;
1842
+
1843
+/**
1844
+ * struct ieee80211_he_spr - HE spatial reuse element
1845
+ *
1846
+ * This structure is the "HE spatial reuse element" element as
1847
+ * described in P802.11ax_D4.0 section 9.4.2.241
1848
+ */
1849
+struct ieee80211_he_spr {
1850
+ u8 he_sr_control;
1851
+ /* Optional 0 to 19 bytes: depends on @he_sr_control */
1852
+ u8 optional[];
16261853 } __packed;
16271854
16281855 /**
16291856 * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field
16301857 *
16311858 * This structure is the "MU AC Parameter Record" fields as
1632
- * described in P802.11ax_D2.0 section 9.4.2.240
1859
+ * described in P802.11ax_D4.0 section 9.4.2.245
16331860 */
16341861 struct ieee80211_he_mu_edca_param_ac_rec {
16351862 u8 aifsn;
....@@ -1641,7 +1868,7 @@
16411868 * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element
16421869 *
16431870 * This structure is the "MU EDCA Parameter Set element" fields as
1644
- * described in P802.11ax_D2.0 section 9.4.2.240
1871
+ * described in P802.11ax_D4.0 section 9.4.2.245
16451872 */
16461873 struct ieee80211_mu_edca_param_set {
16471874 u8 mu_qos_info;
....@@ -1659,6 +1886,7 @@
16591886 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
16601887 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
16611888 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000C
1889
+#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_SHIFT 2
16621890 #define IEEE80211_VHT_CAP_RXLDPC 0x00000010
16631891 #define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020
16641892 #define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040
....@@ -1668,6 +1896,7 @@
16681896 #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
16691897 #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
16701898 #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
1899
+#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
16711900 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
16721901 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
16731902 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
....@@ -1687,6 +1916,30 @@
16871916 #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000
16881917 #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000
16891918 #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000
1919
+#define IEEE80211_VHT_CAP_EXT_NSS_BW_SHIFT 30
1920
+#define IEEE80211_VHT_CAP_EXT_NSS_BW_MASK 0xc0000000
1921
+
1922
+/**
1923
+ * ieee80211_get_vht_max_nss - return max NSS for a given bandwidth/MCS
1924
+ * @cap: VHT capabilities of the peer
1925
+ * @bw: bandwidth to use
1926
+ * @mcs: MCS index to use
1927
+ * @ext_nss_bw_capable: indicates whether or not the local transmitter
1928
+ * (rate scaling algorithm) can deal with the new logic
1929
+ * (dot11VHTExtendedNSSBWCapable)
1930
+ * @max_vht_nss: current maximum NSS as advertised by the STA in
1931
+ * operating mode notification, can be 0 in which case the
1932
+ * capability data will be used to derive this (from MCS support)
1933
+ *
1934
+ * Due to the VHT Extended NSS Bandwidth Support, the maximum NSS can
1935
+ * vary for a given BW/MCS. This function parses the data.
1936
+ *
1937
+ * Note: This function is exported by cfg80211.
1938
+ */
1939
+int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap,
1940
+ enum ieee80211_vht_chanwidth bw,
1941
+ int mcs, bool ext_nss_bw_capable,
1942
+ unsigned int max_vht_nss);
16901943
16911944 /* 802.11ax HE MAC capabilities */
16921945 #define IEEE80211_HE_MAC_CAP0_HTC_HE 0x01
....@@ -1716,15 +1969,15 @@
17161969 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_8US 0x04
17171970 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x08
17181971 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK 0x0c
1719
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_1 0x00
1720
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_2 0x10
1721
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_3 0x20
1722
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_4 0x30
1723
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_5 0x40
1724
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_6 0x50
1725
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_7 0x60
1726
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_8 0x70
1727
-#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_QOS_MASK 0x70
1972
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_1 0x00
1973
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_2 0x10
1974
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_3 0x20
1975
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_4 0x30
1976
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_5 0x40
1977
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_6 0x50
1978
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_7 0x60
1979
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8 0x70
1980
+#define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_MASK 0x70
17281981
17291982 /* Link adaptation is split between byte HE_MAC_CAP1 and
17301983 * HE_MAC_CAP2. It should be set only if IEEE80211_HE_MAC_CAP0_HTC_HE
....@@ -1738,14 +1991,13 @@
17381991
17391992 #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x01
17401993 #define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x02
1741
-#define IEEE80211_HE_MAC_CAP2_UL_MU_RESP_SCHED 0x04
1994
+#define IEEE80211_HE_MAC_CAP2_TRS 0x04
17421995 #define IEEE80211_HE_MAC_CAP2_BSR 0x08
17431996 #define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10
17441997 #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x20
17451998 #define IEEE80211_HE_MAC_CAP2_MU_CASCADING 0x40
17461999 #define IEEE80211_HE_MAC_CAP2_ACK_EN 0x80
17472000
1748
-#define IEEE80211_HE_MAC_CAP3_GRP_ADDR_MULTI_STA_BA_DL_MU 0x01
17492001 #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x02
17502002 #define IEEE80211_HE_MAC_CAP3_OFDMA_RA 0x04
17512003
....@@ -1753,25 +2005,42 @@
17532005 * A-MDPU Length Exponent field in the HT capabilities, VHT capabilities and the
17542006 * same field in the HE capabilities.
17552007 */
1756
-#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_USE_VHT 0x00
1757
-#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_VHT_1 0x08
1758
-#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_VHT_2 0x10
1759
-#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_RESERVED 0x18
1760
-#define IEEE80211_HE_MAC_CAP3_MAX_A_AMPDU_LEN_EXP_MASK 0x18
1761
-#define IEEE80211_HE_MAC_CAP3_A_AMSDU_FRAG 0x20
2008
+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_USE_VHT 0x00
2009
+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_1 0x08
2010
+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2 0x10
2011
+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_RESERVED 0x18
2012
+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x18
2013
+#define IEEE80211_HE_MAC_CAP3_AMSDU_FRAG 0x20
17622014 #define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x40
17632015 #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80
2016
+
2017
+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_SHIFT 3
17642018
17652019 #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x01
17662020 #define IEEE80211_HE_MAC_CAP4_QTP 0x02
17672021 #define IEEE80211_HE_MAC_CAP4_BQR 0x04
1768
-#define IEEE80211_HE_MAC_CAP4_SR_RESP 0x08
2022
+#define IEEE80211_HE_MAC_CAP4_SRP_RESP 0x08
17692023 #define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10
17702024 #define IEEE80211_HE_MAC_CAP4_OPS 0x20
17712025 #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x40
2026
+/* Multi TID agg TX is split between byte #4 and #5
2027
+ * The value is a combination of B39,B40,B41
2028
+ */
2029
+#define IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39 0x80
2030
+
2031
+#define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x01
2032
+#define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x02
2033
+#define IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECVITE_TRANSMISSION 0x04
2034
+#define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x08
2035
+#define IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX 0x10
2036
+#define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x20
2037
+#define IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING 0x40
2038
+#define IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX 0x80
2039
+
2040
+#define IEEE80211_HE_VHT_MAX_AMPDU_FACTOR 20
2041
+#define IEEE80211_HE_HT_MAX_AMPDU_FACTOR 16
17722042
17732043 /* 802.11ax HE PHY capabilities */
1774
-#define IEEE80211_HE_PHY_CAP0_DUAL_BAND 0x01
17752044 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x02
17762045 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x04
17772046 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x08
....@@ -1788,10 +2057,10 @@
17882057 #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x10
17892058 #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x20
17902059 #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x40
1791
-/* Midamble RX Max NSTS is split between byte #2 and byte #3 */
1792
-#define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_MAX_NSTS 0x80
2060
+/* Midamble RX/TX Max NSTS is split between byte #2 and byte #3 */
2061
+#define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS 0x80
17932062
1794
-#define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_MAX_NSTS 0x01
2063
+#define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS 0x01
17952064 #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x02
17962065 #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x04
17972066 #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x08
....@@ -1892,7 +2161,24 @@
18922161 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x04
18932162 #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x08
18942163 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x10
1895
-#define IEEE80211_HE_PHY_CAP8_MIDAMBLE_RX_2X_AND_1XLTF 0x20
2164
+#define IEEE80211_HE_PHY_CAP8_MIDAMBLE_RX_TX_2X_AND_1XLTF 0x20
2165
+#define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242 0x00
2166
+#define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484 0x40
2167
+#define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996 0x80
2168
+#define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996 0xc0
2169
+#define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK 0xc0
2170
+
2171
+#define IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM 0x01
2172
+#define IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK 0x02
2173
+#define IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU 0x04
2174
+#define IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU 0x08
2175
+#define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB 0x10
2176
+#define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB 0x20
2177
+#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_0US 0x00
2178
+#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_8US 0x40
2179
+#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US 0x80
2180
+#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_RESERVED 0xc0
2181
+#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_MASK 0xc0
18962182
18972183 /* 802.11ax HE TX/RX MCS NSS Support */
18982184 #define IEEE80211_TX_RX_MCS_NSS_SUPP_HIGHEST_MCS_POS (3)
....@@ -1966,24 +2252,47 @@
19662252 }
19672253
19682254 /* HE Operation defines */
1969
-#define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x0000003f
1970
-#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x000001c0
1971
-#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_OFFSET 6
1972
-#define IEEE80211_HE_OPERATION_TWT_REQUIRED 0x00000200
1973
-#define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK 0x000ffc00
1974
-#define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET 10
1975
-#define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x000100000
1976
-#define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x000200000
1977
-#define IEEE80211_HE_OPERATION_MULTI_BSSID_AP 0x10000000
1978
-#define IEEE80211_HE_OPERATION_TX_BSSID_INDICATOR 0x20000000
1979
-#define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x40000000
2255
+#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x00000007
2256
+#define IEEE80211_HE_OPERATION_TWT_REQUIRED 0x00000008
2257
+#define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK 0x00003ff0
2258
+#define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET 4
2259
+#define IEEE80211_HE_OPERATION_VHT_OPER_INFO 0x00004000
2260
+#define IEEE80211_HE_OPERATION_CO_HOSTED_BSS 0x00008000
2261
+#define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x00010000
2262
+#define IEEE80211_HE_OPERATION_6GHZ_OP_INFO 0x00020000
2263
+#define IEEE80211_HE_OPERATION_BSS_COLOR_MASK 0x3f000000
2264
+#define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 24
2265
+#define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000
2266
+#define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x80000000
2267
+
2268
+/**
2269
+ * ieee80211_he_6ghz_oper - HE 6 GHz operation Information field
2270
+ * @primary: primary channel
2271
+ * @control: control flags
2272
+ * @ccfs0: channel center frequency segment 0
2273
+ * @ccfs1: channel center frequency segment 1
2274
+ * @minrate: minimum rate (in 1 Mbps units)
2275
+ */
2276
+struct ieee80211_he_6ghz_oper {
2277
+ u8 primary;
2278
+#define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH 0x3
2279
+#define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_20MHZ 0
2280
+#define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_40MHZ 1
2281
+#define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_80MHZ 2
2282
+#define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_160MHZ 3
2283
+#define IEEE80211_HE_6GHZ_OPER_CTRL_DUP_BEACON 0x4
2284
+ u8 control;
2285
+ u8 ccfs0;
2286
+ u8 ccfs1;
2287
+ u8 minrate;
2288
+} __packed;
19802289
19812290 /*
19822291 * ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size
1983
- * @he_oper_ie: byte data of the He Operations IE, stating from the the byte
2292
+ * @he_oper_ie: byte data of the He Operations IE, stating from the byte
19842293 * after the ext ID byte. It is assumed that he_oper_ie has at least
1985
- * sizeof(struct ieee80211_he_operation) bytes, checked already in
1986
- * ieee802_11_parse_elems_crc()
2294
+ * sizeof(struct ieee80211_he_operation) bytes, the caller must have
2295
+ * validated this.
19872296 * @return the actual size of the IE data (not including header), or 0 on error
19882297 */
19892298 static inline u8
....@@ -2001,14 +2310,172 @@
20012310 he_oper_params = le32_to_cpu(he_oper->he_oper_params);
20022311 if (he_oper_params & IEEE80211_HE_OPERATION_VHT_OPER_INFO)
20032312 oper_len += 3;
2004
- if (he_oper_params & IEEE80211_HE_OPERATION_MULTI_BSSID_AP)
2313
+ if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS)
20052314 oper_len++;
2315
+ if (he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO)
2316
+ oper_len += sizeof(struct ieee80211_he_6ghz_oper);
20062317
20072318 /* Add the first byte (extension ID) to the total length */
20082319 oper_len++;
20092320
20102321 return oper_len;
20112322 }
2323
+
2324
+/**
2325
+ * ieee80211_he_6ghz_oper - obtain 6 GHz operation field
2326
+ * @he_oper: HE operation element (must be pre-validated for size)
2327
+ * but may be %NULL
2328
+ *
2329
+ * Return: a pointer to the 6 GHz operation field, or %NULL
2330
+ */
2331
+static inline const struct ieee80211_he_6ghz_oper *
2332
+ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper)
2333
+{
2334
+ const u8 *ret = (void *)&he_oper->optional;
2335
+ u32 he_oper_params;
2336
+
2337
+ if (!he_oper)
2338
+ return NULL;
2339
+
2340
+ he_oper_params = le32_to_cpu(he_oper->he_oper_params);
2341
+
2342
+ if (!(he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO))
2343
+ return NULL;
2344
+ if (he_oper_params & IEEE80211_HE_OPERATION_VHT_OPER_INFO)
2345
+ ret += 3;
2346
+ if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS)
2347
+ ret++;
2348
+
2349
+ return (void *)ret;
2350
+}
2351
+
2352
+/* HE Spatial Reuse defines */
2353
+#define IEEE80211_HE_SPR_PSR_DISALLOWED BIT(0)
2354
+#define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED BIT(1)
2355
+#define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT BIT(2)
2356
+#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT BIT(3)
2357
+#define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED BIT(4)
2358
+
2359
+/*
2360
+ * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size
2361
+ * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the byte
2362
+ * after the ext ID byte. It is assumed that he_spr_ie has at least
2363
+ * sizeof(struct ieee80211_he_spr) bytes, the caller must have validated
2364
+ * this
2365
+ * @return the actual size of the IE data (not including header), or 0 on error
2366
+ */
2367
+static inline u8
2368
+ieee80211_he_spr_size(const u8 *he_spr_ie)
2369
+{
2370
+ struct ieee80211_he_spr *he_spr = (void *)he_spr_ie;
2371
+ u8 spr_len = sizeof(struct ieee80211_he_spr);
2372
+ u8 he_spr_params;
2373
+
2374
+ /* Make sure the input is not NULL */
2375
+ if (!he_spr_ie)
2376
+ return 0;
2377
+
2378
+ /* Calc required length */
2379
+ he_spr_params = he_spr->he_sr_control;
2380
+ if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
2381
+ spr_len++;
2382
+ if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)
2383
+ spr_len += 18;
2384
+
2385
+ /* Add the first byte (extension ID) to the total length */
2386
+ spr_len++;
2387
+
2388
+ return spr_len;
2389
+}
2390
+
2391
+/* S1G Capabilities Information field */
2392
+#define IEEE80211_S1G_CAPABILITY_LEN 15
2393
+
2394
+#define S1G_CAP0_S1G_LONG BIT(0)
2395
+#define S1G_CAP0_SGI_1MHZ BIT(1)
2396
+#define S1G_CAP0_SGI_2MHZ BIT(2)
2397
+#define S1G_CAP0_SGI_4MHZ BIT(3)
2398
+#define S1G_CAP0_SGI_8MHZ BIT(4)
2399
+#define S1G_CAP0_SGI_16MHZ BIT(5)
2400
+#define S1G_CAP0_SUPP_CH_WIDTH GENMASK(7, 6)
2401
+
2402
+#define S1G_SUPP_CH_WIDTH_2 0
2403
+#define S1G_SUPP_CH_WIDTH_4 1
2404
+#define S1G_SUPP_CH_WIDTH_8 2
2405
+#define S1G_SUPP_CH_WIDTH_16 3
2406
+#define S1G_SUPP_CH_WIDTH_MAX(cap) ((1 << FIELD_GET(S1G_CAP0_SUPP_CH_WIDTH, \
2407
+ cap[0])) << 1)
2408
+
2409
+#define S1G_CAP1_RX_LDPC BIT(0)
2410
+#define S1G_CAP1_TX_STBC BIT(1)
2411
+#define S1G_CAP1_RX_STBC BIT(2)
2412
+#define S1G_CAP1_SU_BFER BIT(3)
2413
+#define S1G_CAP1_SU_BFEE BIT(4)
2414
+#define S1G_CAP1_BFEE_STS GENMASK(7, 5)
2415
+
2416
+#define S1G_CAP2_SOUNDING_DIMENSIONS GENMASK(2, 0)
2417
+#define S1G_CAP2_MU_BFER BIT(3)
2418
+#define S1G_CAP2_MU_BFEE BIT(4)
2419
+#define S1G_CAP2_PLUS_HTC_VHT BIT(5)
2420
+#define S1G_CAP2_TRAVELING_PILOT GENMASK(7, 6)
2421
+
2422
+#define S1G_CAP3_RD_RESPONDER BIT(0)
2423
+#define S1G_CAP3_HT_DELAYED_BA BIT(1)
2424
+#define S1G_CAP3_MAX_MPDU_LEN BIT(2)
2425
+#define S1G_CAP3_MAX_AMPDU_LEN_EXP GENMASK(4, 3)
2426
+#define S1G_CAP3_MIN_MPDU_START GENMASK(7, 5)
2427
+
2428
+#define S1G_CAP4_UPLINK_SYNC BIT(0)
2429
+#define S1G_CAP4_DYNAMIC_AID BIT(1)
2430
+#define S1G_CAP4_BAT BIT(2)
2431
+#define S1G_CAP4_TIME_ADE BIT(3)
2432
+#define S1G_CAP4_NON_TIM BIT(4)
2433
+#define S1G_CAP4_GROUP_AID BIT(5)
2434
+#define S1G_CAP4_STA_TYPE GENMASK(7, 6)
2435
+
2436
+#define S1G_CAP5_CENT_AUTH_CONTROL BIT(0)
2437
+#define S1G_CAP5_DIST_AUTH_CONTROL BIT(1)
2438
+#define S1G_CAP5_AMSDU BIT(2)
2439
+#define S1G_CAP5_AMPDU BIT(3)
2440
+#define S1G_CAP5_ASYMMETRIC_BA BIT(4)
2441
+#define S1G_CAP5_FLOW_CONTROL BIT(5)
2442
+#define S1G_CAP5_SECTORIZED_BEAM GENMASK(7, 6)
2443
+
2444
+#define S1G_CAP6_OBSS_MITIGATION BIT(0)
2445
+#define S1G_CAP6_FRAGMENT_BA BIT(1)
2446
+#define S1G_CAP6_NDP_PS_POLL BIT(2)
2447
+#define S1G_CAP6_RAW_OPERATION BIT(3)
2448
+#define S1G_CAP6_PAGE_SLICING BIT(4)
2449
+#define S1G_CAP6_TXOP_SHARING_IMP_ACK BIT(5)
2450
+#define S1G_CAP6_VHT_LINK_ADAPT GENMASK(7, 6)
2451
+
2452
+#define S1G_CAP7_TACK_AS_PS_POLL BIT(0)
2453
+#define S1G_CAP7_DUP_1MHZ BIT(1)
2454
+#define S1G_CAP7_MCS_NEGOTIATION BIT(2)
2455
+#define S1G_CAP7_1MHZ_CTL_RESPONSE_PREAMBLE BIT(3)
2456
+#define S1G_CAP7_NDP_BFING_REPORT_POLL BIT(4)
2457
+#define S1G_CAP7_UNSOLICITED_DYN_AID BIT(5)
2458
+#define S1G_CAP7_SECTOR_TRAINING_OPERATION BIT(6)
2459
+#define S1G_CAP7_TEMP_PS_MODE_SWITCH BIT(7)
2460
+
2461
+#define S1G_CAP8_TWT_GROUPING BIT(0)
2462
+#define S1G_CAP8_BDT BIT(1)
2463
+#define S1G_CAP8_COLOR GENMASK(4, 2)
2464
+#define S1G_CAP8_TWT_REQUEST BIT(5)
2465
+#define S1G_CAP8_TWT_RESPOND BIT(6)
2466
+#define S1G_CAP8_PV1_FRAME BIT(7)
2467
+
2468
+#define S1G_CAP9_LINK_ADAPT_PER_CONTROL_RESPONSE BIT(0)
2469
+
2470
+#define S1G_OPER_CH_WIDTH_PRIMARY_1MHZ BIT(0)
2471
+#define S1G_OPER_CH_WIDTH_OPER GENMASK(4, 1)
2472
+
2473
+
2474
+#define LISTEN_INT_USF GENMASK(15, 14)
2475
+#define LISTEN_INT_UI GENMASK(13, 0)
2476
+
2477
+#define IEEE80211_MAX_USF FIELD_MAX(LISTEN_INT_USF)
2478
+#define IEEE80211_MAX_UI FIELD_MAX(LISTEN_INT_UI)
20122479
20132480 /* Authentication algorithms */
20142481 #define WLAN_AUTH_OPEN 0
....@@ -2073,6 +2540,8 @@
20732540 #define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0
20742541 #define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1
20752542 #define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2
2543
+#define IEEE80211_SPCT_MSR_RPRT_TYPE_LCI 8
2544
+#define IEEE80211_SPCT_MSR_RPRT_TYPE_CIVIC 11
20762545
20772546 /* 802.11g ERP information element */
20782547 #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
....@@ -2160,6 +2629,8 @@
21602629 /* 802.11ai */
21612630 WLAN_STATUS_FILS_AUTHENTICATION_FAILURE = 108,
21622631 WLAN_STATUS_UNKNOWN_AUTHENTICATION_SERVER = 109,
2632
+ WLAN_STATUS_SAE_HASH_TO_ELEMENT = 126,
2633
+ WLAN_STATUS_SAE_PK = 127,
21632634 };
21642635
21652636
....@@ -2403,13 +2874,22 @@
24032874 WLAN_EID_QUIET_CHANNEL = 198,
24042875 WLAN_EID_OPMODE_NOTIF = 199,
24052876
2877
+ WLAN_EID_REDUCED_NEIGHBOR_REPORT = 201,
2878
+
2879
+ WLAN_EID_AID_REQUEST = 210,
2880
+ WLAN_EID_AID_RESPONSE = 211,
2881
+ WLAN_EID_S1G_BCN_COMPAT = 213,
2882
+ WLAN_EID_S1G_SHORT_BCN_INTERVAL = 214,
2883
+ WLAN_EID_S1G_CAPABILITIES = 217,
24062884 WLAN_EID_VENDOR_SPECIFIC = 221,
24072885 WLAN_EID_QOS_PARAMETER = 222,
2886
+ WLAN_EID_S1G_OPERATION = 232,
24082887 WLAN_EID_CAG_NUMBER = 237,
24092888 WLAN_EID_AP_CSN = 239,
24102889 WLAN_EID_FILS_INDICATION = 240,
24112890 WLAN_EID_DILS = 241,
24122891 WLAN_EID_FRAGMENT = 242,
2892
+ WLAN_EID_RSNX = 244,
24132893 WLAN_EID_EXTENSION = 255
24142894 };
24152895
....@@ -2430,6 +2910,20 @@
24302910 WLAN_EID_EXT_HE_OPERATION = 36,
24312911 WLAN_EID_EXT_UORA = 37,
24322912 WLAN_EID_EXT_HE_MU_EDCA = 38,
2913
+ WLAN_EID_EXT_HE_SPR = 39,
2914
+ WLAN_EID_EXT_NDP_FEEDBACK_REPORT_PARAMSET = 41,
2915
+ WLAN_EID_EXT_BSS_COLOR_CHG_ANN = 42,
2916
+ WLAN_EID_EXT_QUIET_TIME_PERIOD_SETUP = 43,
2917
+ WLAN_EID_EXT_ESS_REPORT = 45,
2918
+ WLAN_EID_EXT_OPS = 46,
2919
+ WLAN_EID_EXT_HE_BSS_LOAD = 47,
2920
+ WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME = 52,
2921
+ WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION = 55,
2922
+ WLAN_EID_EXT_NON_INHERITANCE = 56,
2923
+ WLAN_EID_EXT_KNOWN_BSSID = 57,
2924
+ WLAN_EID_EXT_SHORT_SSID_LIST = 58,
2925
+ WLAN_EID_EXT_HE_6GHZ_CAPA = 59,
2926
+ WLAN_EID_EXT_UL_MU_POWER_CAPA = 60,
24332927 };
24342928
24352929 /* Action category code */
....@@ -2551,6 +3045,7 @@
25513045 #define FILS_ERP_MAX_RRK_LEN 64
25523046
25533047 #define PMK_MAX_LEN 64
3048
+#define SAE_PASSWORD_MAX_LEN 128
25543049
25553050 /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */
25563051 enum ieee80211_pub_actioncode {
....@@ -2611,7 +3106,12 @@
26113106 */
26123107 #define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2)
26133108
2614
-/* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */
3109
+/* Multiple BSSID capability is set in the 6th bit of 3rd byte of the
3110
+ * @WLAN_EID_EXT_CAPABILITY information element
3111
+ */
3112
+#define WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT BIT(6)
3113
+
3114
+/* TDLS capabilities in the 4th byte of @WLAN_EID_EXT_CAPABILITY */
26153115 #define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)
26163116 #define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)
26173117 #define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6)
....@@ -2641,6 +3141,20 @@
26413141 * information element
26423142 */
26433143 #define WLAN_EXT_CAPA9_FTM_INITIATOR BIT(7)
3144
+
3145
+/* Defines support for TWT Requester and TWT Responder */
3146
+#define WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT BIT(5)
3147
+#define WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT BIT(6)
3148
+
3149
+/*
3150
+ * When set, indicates that the AP is able to tolerate 26-tone RU UL
3151
+ * OFDMA transmissions using HE TB PPDU from OBSS (not falsely classify the
3152
+ * 26-tone RU UL OFDMA transmissions as radar pulses).
3153
+ */
3154
+#define WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT BIT(7)
3155
+
3156
+/* Defines support for enhanced multi-bssid advertisement*/
3157
+#define WLAN_EXT_CAPA11_EMA_SUPPORT BIT(3)
26443158
26453159 /* TDLS specific payload type in the LLC/SNAP header */
26463160 #define WLAN_TDLS_SNAP_RFTYPE 0x2
....@@ -2833,6 +3347,34 @@
28333347 WLAN_ACTION_SA_QUERY_RESPONSE = 1,
28343348 };
28353349
3350
+/**
3351
+ * struct ieee80211_bssid_index
3352
+ *
3353
+ * This structure refers to "Multiple BSSID-index element"
3354
+ *
3355
+ * @bssid_index: BSSID index
3356
+ * @dtim_period: optional, overrides transmitted BSS dtim period
3357
+ * @dtim_count: optional, overrides transmitted BSS dtim count
3358
+ */
3359
+struct ieee80211_bssid_index {
3360
+ u8 bssid_index;
3361
+ u8 dtim_period;
3362
+ u8 dtim_count;
3363
+};
3364
+
3365
+/**
3366
+ * struct ieee80211_multiple_bssid_configuration
3367
+ *
3368
+ * This structure refers to "Multiple BSSID Configuration element"
3369
+ *
3370
+ * @bssid_count: total number of active BSSIDs in the set
3371
+ * @profile_periodicity: the least number of beacon frames need to be received
3372
+ * in order to discover all the nontransmitted BSSIDs in the set.
3373
+ */
3374
+struct ieee80211_multiple_bssid_configuration {
3375
+ u8 bssid_count;
3376
+ u8 profile_periodicity;
3377
+};
28363378
28373379 #define SUITE(oui, id) (((oui) << 8) | (id))
28383380
....@@ -2863,12 +3405,17 @@
28633405 #define WLAN_AKM_SUITE_TDLS SUITE(0x000FAC, 7)
28643406 #define WLAN_AKM_SUITE_SAE SUITE(0x000FAC, 8)
28653407 #define WLAN_AKM_SUITE_FT_OVER_SAE SUITE(0x000FAC, 9)
3408
+#define WLAN_AKM_SUITE_AP_PEER_KEY SUITE(0x000FAC, 10)
28663409 #define WLAN_AKM_SUITE_8021X_SUITE_B SUITE(0x000FAC, 11)
28673410 #define WLAN_AKM_SUITE_8021X_SUITE_B_192 SUITE(0x000FAC, 12)
3411
+#define WLAN_AKM_SUITE_FT_8021X_SHA384 SUITE(0x000FAC, 13)
28683412 #define WLAN_AKM_SUITE_FILS_SHA256 SUITE(0x000FAC, 14)
28693413 #define WLAN_AKM_SUITE_FILS_SHA384 SUITE(0x000FAC, 15)
28703414 #define WLAN_AKM_SUITE_FT_FILS_SHA256 SUITE(0x000FAC, 16)
28713415 #define WLAN_AKM_SUITE_FT_FILS_SHA384 SUITE(0x000FAC, 17)
3416
+#define WLAN_AKM_SUITE_OWE SUITE(0x000FAC, 18)
3417
+#define WLAN_AKM_SUITE_FT_PSK_SHA384 SUITE(0x000FAC, 19)
3418
+#define WLAN_AKM_SUITE_PSK_SHA384 SUITE(0x000FAC, 20)
28723419
28733420 #define WLAN_MAX_KEY_LEN 32
28743421
....@@ -2922,6 +3469,24 @@
29223469 __le16 sba;
29233470 __le16 medium_time;
29243471 } __packed;
3472
+
3473
+struct ieee80211_he_6ghz_capa {
3474
+ /* uses IEEE80211_HE_6GHZ_CAP_* below */
3475
+ __le16 capa;
3476
+} __packed;
3477
+
3478
+/* HE 6 GHz band capabilities */
3479
+/* uses enum ieee80211_min_mpdu_spacing values */
3480
+#define IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START 0x0007
3481
+/* uses enum ieee80211_vht_max_ampdu_length_exp values */
3482
+#define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP 0x0038
3483
+/* uses IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_* values */
3484
+#define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN 0x00c0
3485
+/* WLAN_HT_CAP_SM_PS_* values */
3486
+#define IEEE80211_HE_6GHZ_CAP_SM_PS 0x0600
3487
+#define IEEE80211_HE_6GHZ_CAP_RD_RESPONDER 0x0800
3488
+#define IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS 0x1000
3489
+#define IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS 0x2000
29253490
29263491 /**
29273492 * ieee80211_get_qos_ctl - get pointer to qos control bytes
....@@ -3147,6 +3712,18 @@
31473712 #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
31483713 #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
31493714
3715
+/* convert frequencies */
3716
+#define MHZ_TO_KHZ(freq) ((freq) * 1000)
3717
+#define KHZ_TO_MHZ(freq) ((freq) / 1000)
3718
+#define PR_KHZ(f) KHZ_TO_MHZ(f), f % 1000
3719
+#define KHZ_F "%d.%03d"
3720
+
3721
+/* convert powers */
3722
+#define DBI_TO_MBI(gain) ((gain) * 100)
3723
+#define MBI_TO_DBI(gain) ((gain) / 100)
3724
+#define DBM_TO_MBM(gain) ((gain) * 100)
3725
+#define MBM_TO_DBM(gain) ((gain) / 100)
3726
+
31503727 /**
31513728 * ieee80211_action_contains_tpc - checks if the frame contains TPC element
31523729 * @skb: the skb containing the frame, length will be checked
....@@ -3213,8 +3790,8 @@
32133790 for_each_element(element, data, datalen) \
32143791 if (element->id == (_id))
32153792
3216
-#define for_each_element_extid(element, extid, data, datalen) \
3217
- for_each_element(element, data, datalen) \
3793
+#define for_each_element_extid(element, extid, _data, _datalen) \
3794
+ for_each_element(element, _data, _datalen) \
32183795 if (element->id == WLAN_EID_EXTENSION && \
32193796 element->datalen > 0 && \
32203797 element->data[0] == (extid))
....@@ -3247,4 +3824,37 @@
32473824 return (const u8 *)element == (const u8 *)data + datalen;
32483825 }
32493826
3827
+/**
3828
+ * RSNX Capabilities:
3829
+ * bits 0-3: Field length (n-1)
3830
+ */
3831
+#define WLAN_RSNX_CAPA_PROTECTED_TWT BIT(4)
3832
+#define WLAN_RSNX_CAPA_SAE_H2E BIT(5)
3833
+
3834
+/*
3835
+ * reduced neighbor report, based on Draft P802.11ax_D5.0,
3836
+ * section 9.4.2.170
3837
+ */
3838
+#define IEEE80211_AP_INFO_TBTT_HDR_TYPE 0x03
3839
+#define IEEE80211_AP_INFO_TBTT_HDR_FILTERED 0x04
3840
+#define IEEE80211_AP_INFO_TBTT_HDR_COLOC 0x08
3841
+#define IEEE80211_AP_INFO_TBTT_HDR_COUNT 0xF0
3842
+#define IEEE80211_TBTT_INFO_OFFSET_BSSID_BSS_PARAM 8
3843
+#define IEEE80211_TBTT_INFO_OFFSET_BSSID_SSSID_BSS_PARAM 12
3844
+
3845
+#define IEEE80211_RNR_TBTT_PARAMS_OCT_RECOMMENDED 0x01
3846
+#define IEEE80211_RNR_TBTT_PARAMS_SAME_SSID 0x02
3847
+#define IEEE80211_RNR_TBTT_PARAMS_MULTI_BSSID 0x04
3848
+#define IEEE80211_RNR_TBTT_PARAMS_TRANSMITTED_BSSID 0x08
3849
+#define IEEE80211_RNR_TBTT_PARAMS_COLOC_ESS 0x10
3850
+#define IEEE80211_RNR_TBTT_PARAMS_PROBE_ACTIVE 0x20
3851
+#define IEEE80211_RNR_TBTT_PARAMS_COLOC_AP 0x40
3852
+
3853
+struct ieee80211_neighbor_ap_info {
3854
+ u8 tbtt_info_hdr;
3855
+ u8 tbtt_info_len;
3856
+ u8 op_class;
3857
+ u8 channel;
3858
+} __packed;
3859
+
32503860 #endif /* LINUX_IEEE80211_H */