1 /* 2 * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: contains commnon ieee80211 definitions 21 */ 22 23 #ifndef _WLAN_CMN_IEEE80211_H_ 24 #define _WLAN_CMN_IEEE80211_H_ 25 #include <qdf_types.h> 26 #include <osdep.h> 27 28 #define IEEE80211_CCMP_HEADERLEN 8 29 #define IEEE80211_CCMP_MICLEN 8 30 #define WLAN_IEEE80211_GCMP_HEADERLEN 8 31 #define WLAN_IEEE80211_GCMP_MICLEN 16 32 #define IEEE80211_FC1_WEP 0x40 33 #define WLAN_HDR_IV_LEN 3 34 #define WLAN_HDR_EXT_IV_BIT 0x20 35 #define WLAN_HDR_EXT_IV_LEN 4 36 37 #define WLAN_SEQ_SEQ_SHIFT 4 38 39 #define P2P_WFA_OUI {0x50, 0x6f, 0x9a} 40 #define P2P_WFA_VER 0x09 41 42 #define WSC_OUI 0x0050f204 43 #define MBO_OCE_OUI 0x506f9a16 44 #define MBO_OCE_OUI_SIZE 4 45 #define REDUCED_WAN_METRICS_ATTR 103 46 47 /* WCN IE */ 48 /* Microsoft OUI */ 49 #define WCN_OUI 0xf25000 50 /* WCN */ 51 #define WCN_OUI_TYPE 0x04 52 #define WME_OUI 0xf25000 53 #define WME_OUI_TYPE 0x02 54 #define WME_PARAM_OUI_SUBTYPE 0x01 55 #define WME_INFO_OUI_SUBTYPE 0x00 56 /* Atheros OUI */ 57 #define ATH_OUI 0x7f0300 58 #define ATH_OUI_TYPE 0x01 59 /* Atheros Extended Cap Type */ 60 #define ATH_OUI_EXTCAP_TYPE 0x04 61 /* QCA Bandwidth NSS Mapping Type */ 62 #define ATH_OUI_BW_NSS_MAP_TYPE 0x05 63 #define SFA_OUI 0x964000 64 #define SFA_OUI_TYPE 0x14 65 /* QCA OUI (in little endian) */ 66 #define QCA_OUI 0xf0fd8c 67 #define QCA_OUI_WHC_TYPE 0x00 68 69 /* Extender vendor specific IE */ 70 #define QCA_OUI_EXTENDER_TYPE 0x03 71 72 /* Temporary vendor specific IE for 11n pre-standard interoperability */ 73 #define VENDOR_HT_OUI 0x00904c 74 #define VENDOR_HT_CAP_ID 51 75 #define VENDOR_HT_INFO_ID 52 76 77 #define VHT_INTEROP_OUI 0x00904c 78 #define VHT_INTEROP_TYPE 0x04 79 #define VHT_INTEROP_OUI_SUBTYPE 0x08 80 #define VHT_INTEROP_OUI_SUBTYPE_VENDORSPEC 0x18 81 82 /* ATH HE OUI ( in little endian) */ 83 #define ATH_HE_OUI 0x741300 84 #define ATH_HE_CAP_SUBTYPE 0x01 85 #define ATH_HE_OP_SUBTYPE 0x02 86 87 /* EPR information element flags */ 88 #define ERP_NON_ERP_PRESENT 0x01 89 #define ERP_USE_PROTECTION 0x02 90 #define ERP_LONG_PREAMBLE 0x04 91 92 #define QCA_OUI_WHC_AP_INFO_SUBTYPE 0x00 93 94 #define WLAN_MAX_IE_LEN 255 95 #define WLAN_RSN_IE_LEN 22 96 97 /* Individual element IEs length checks */ 98 99 #define WLAN_SUPPORTED_RATES_IE_MAX_LEN 8 100 #define WLAN_DS_PARAM_IE_MAX_LEN 1 101 #define WLAN_COUNTRY_IE_MIN_LEN 3 102 #define WLAN_QUIET_IE_MAX_LEN 6 103 #define WLAN_CSA_IE_MAX_LEN 3 104 #define WLAN_XCSA_IE_MAX_LEN 4 105 #define WLAN_SECCHANOFF_IE_MAX_LEN 1 106 #define WLAN_EXT_SUPPORTED_RATES_IE_MAX_LEN 12 107 #define WLAN_EXTCAP_IE_MAX_LEN 15 108 #define WLAN_FILS_INDICATION_IE_MIN_LEN 2 109 #define WLAN_MOBILITY_DOMAIN_IE_MAX_LEN 3 110 #define WLAN_OPMODE_IE_MAX_LEN 1 111 #define WLAN_IBSSDFS_IE_MIN_LEN 7 112 113 /* HT capability flags */ 114 #define WLAN_HTCAP_C_ADVCODING 0x0001 115 #define WLAN_HTCAP_C_CHWIDTH40 0x0002 116 /* Capable of SM Power Save (Static) */ 117 #define WLAN_HTCAP_C_SMPOWERSAVE_STATIC 0x0000 118 /* Capable of SM Power Save (Dynamic) */ 119 #define WLAN_HTCAP_C_SMPOWERSAVE_DYNAMIC 0x0004 120 /* Reserved */ 121 #define WLAN_HTCAP_C_SM_RESERVED 0x0008 122 /* SM enabled, no SM Power Save */ 123 #define WLAN_HTCAP_C_SMPOWERSAVE_DISABLED 0x000c 124 #define WLAN_HTCAP_C_GREENFIELD 0x0010 125 #define WLAN_HTCAP_C_SHORTGI20 0x0020 126 #define WLAN_HTCAP_C_SHORTGI40 0x0040 127 #define WLAN_HTCAP_C_TXSTBC 0x0080 128 #define WLAN_HTCAP_C_TXSTBC_S 7 129 /* 2 bits */ 130 #define WLAN_HTCAP_C_RXSTBC 0x0300 131 #define WLAN_HTCAP_C_RXSTBC_S 8 132 #define WLAN_HTCAP_C_DELAYEDBLKACK 0x0400 133 /* 1 = 8K, 0 = 3839B */ 134 #define WLAN_HTCAP_C_MAXAMSDUSIZE 0x0800 135 #define WLAN_HTCAP_C_DSSSCCK40 0x1000 136 #define WLAN_HTCAP_C_PSMP 0x2000 137 #define WLAN_HTCAP_C_INTOLERANT40 0x4000 138 #define WLAN_HTCAP_C_LSIGTXOPPROT 0x8000 139 /* Spatial Multiplexing (SM) capabitlity bitmask */ 140 #define WLAN_HTCAP_C_SM_MASK 0x000c 141 142 /* VHT Operation */ 143 /* 20/40 MHz Operating Channel */ 144 #define WLAN_VHTOP_CHWIDTH_2040 0 145 /* 80 MHz Operating Channel */ 146 #define WLAN_VHTOP_CHWIDTH_80 1 147 /* 160 MHz Operating Channel */ 148 #define WLAN_VHTOP_CHWIDTH_160 2 149 /* 80 + 80 MHz Operating Channel */ 150 #define WLAN_VHTOP_CHWIDTH_80_80 3 151 /* 160 MHz Operating Channel (revised signalling) */ 152 #define WLAN_VHTOP_CHWIDTH_REVSIG_160 1 153 /* 80 + 80 MHz Operating Channel (revised signalling) */ 154 #define WLAN_VHTOP_CHWIDTH_REVSIG_80_80 1 155 156 #define WLAN_RATE_VAL 0x7f 157 158 #define WLAN_RV(v) ((v) & WLAN_RATE_VAL) 159 160 #define WLAN_CHAN_IS_5GHZ(chanidx) \ 161 ((chanidx > 30) ? true : false) 162 #define WLAN_CHAN_IS_2GHZ(chanidx) \ 163 (((chanidx > 0) && (chanidx < 15)) ? true : false) 164 165 /* Check if revised signalling is being used for VHT160 in vhtop */ 166 #define WLAN_IS_REVSIG_VHT160(vhtop) (((vhtop)->vht_op_chwidth == \ 167 WLAN_VHTOP_CHWIDTH_REVSIG_160) && \ 168 ((vhtop)->vht_op_ch_freq_seg2 != 0) && \ 169 (abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) == 8)) 170 171 /* Check if revised signalling is being used for VHT80p80 in vhtop */ 172 #define WLAN_IS_REVSIG_VHT80_80(vhtop) (((vhtop)->vht_op_chwidth == \ 173 WLAN_VHTOP_CHWIDTH_REVSIG_80_80) && \ 174 ((vhtop)->vht_op_ch_freq_seg2 != 0) && \ 175 (abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) > 8)) 176 177 #define LE_READ_2(p) \ 178 ((uint16_t)\ 179 ((((const uint8_t *)(p))[0]) |\ 180 (((const uint8_t *)(p))[1] << 8))) 181 182 #define LE_READ_4(p) \ 183 ((uint32_t)\ 184 ((((const uint8_t *)(p))[0]) |\ 185 (((const uint8_t *)(p))[1] << 8) | \ 186 (((const uint8_t *)(p))[2] << 16) |\ 187 (((const uint8_t *)(p))[3] << 24))) 188 189 #define BE_READ_4(p) \ 190 ((uint32_t)\ 191 ((((const uint8_t *)(p))[0] << 24) |\ 192 (((const uint8_t *)(p))[1] << 16) |\ 193 (((const uint8_t *)(p))[2] << 8) |\ 194 (((const uint8_t *)(p))[3]))) 195 196 /** 197 * enum ext_chan_offset: extension channel offset 198 * @WLAN_HTINFO_EXTOFFSET_NA: no extension channel is present 199 * @WLAN_HTINFO_EXTOFFSET_ABOVE: above control channel 200 * @WLAN_HTINFO_EXTOFFSET_UNDEF: undefined 201 * @WLAN_HTINFO_EXTOFFSET_BELOW: below control channel 202 */ 203 enum ext_chan_offset { 204 WLAN_HTINFO_EXTOFFSET_NA = 0, 205 WLAN_HTINFO_EXTOFFSET_ABOVE = 1, 206 WLAN_HTINFO_EXTOFFSET_UNDEF = 2, 207 WLAN_HTINFO_EXTOFFSET_BELOW = 3 208 }; 209 210 /** 211 * enum element_ie :- Management information element 212 * @WLAN_ELEMID_SSID: ssid IE 213 * @WLAN_ELEMID_RATES: Rates IE 214 * @WLAN_ELEMID_FHPARMS: FH param IE 215 * @WLAN_ELEMID_DSPARMS: DS Param IE 216 * @WLAN_ELEMID_CFPARMS : CF Param IE 217 * @WLAN_ELEMID_TIM: TIM IE 218 * @WLAN_ELEMID_IBSSPARMS: Ibss params IE 219 * @WLAN_ELEMID_COUNTRY: Country code IE 220 * @WLAN_ELEMID_REQINFO: Req Info IE 221 * @WLAN_ELEMID_QBSS_LOAD: Qbss load IE 222 * @WLAN_ELEMID_TCLAS: TCLAS IE 223 * @WLAN_ELEMID_CHALLENGE: Challenge IE 224 * @WLAN_ELEMID_PWRCNSTR: Power cn IE 225 * @WLAN_ELEMID_PWRCAP: power cap IE 226 * @WLAN_ELEMID_TPCREQ: TPC req IE 227 * @WLAN_ELEMID_TPCREP: TPC rsp IE 228 * @WLAN_ELEMID_SUPPCHAN: Supported channel IE 229 * @WLAN_ELEMID_CHANSWITCHANN: Channel switch IE 230 * @WLAN_ELEMID_MEASREQ: Measurement request IE 231 * @WLAN_ELEMID_MEASREP: Measurement Resp IE 232 * @WLAN_ELEMID_QUIET: Quiet IE 233 * @WLAN_ELEMID_IBSSDFS: IBSS DFS IE 234 * @WLAN_ELEMID_ERP: ERP IE 235 * @WLAN_ELEMID_TCLAS_PROCESS: TCLAS process IE 236 * @WLAN_ELEMID_HTCAP_ANA: HTT Capability IE 237 * @WLAN_ELEMID_RSN: RSN IE 238 * @WLAN_ELEMID_XRATES: Extended rate IE 239 * @WLAN_ELEMID_HTCAP_VENDOR: HT cap vendor IE 240 * @WLAN_ELEMID_HTINFO_VENDOR: HT info vendor IE 241 * @WLAN_ELEMID_MOBILITY_DOMAIN: MD IE 242 * @WLAN_ELEMID_FT: FT IE 243 * @WLAN_ELEMID_TIMEOUT_INTERVAL: Timeout interval IE 244 * @WLAN_ELEMID_SUPP_OP_CLASS: OP class IE 245 * @WLAN_ELEMID_EXTCHANSWITCHANN: Extended Channel switch IE 246 * @WLAN_ELEMID_HTINFO_ANA: HT info IE 247 * @WLAN_ELEMID_SECCHANOFFSET: Sec channel Offset IE 248 * @WLAN_ELEMID_WAPI: WAPI IE 249 * @WLAN_ELEMID_TIME_ADVERTISEMENT: Time IE 250 * @WLAN_ELEMID_RRM: Radio resource measurement IE 251 * @WLAN_ELEMID_MULTIPLE_BSSID: Multiple BSSID IE 252 * @WLAN_ELEMID_2040_COEXT: 20-40 COext ext IE 253 * @WLAN_ELEMID_2040_INTOL:20-40 INT OL IE 254 * @WLAN_ELEMID_OBSS_SCAN: OBSS scan IE 255 * @WLAN_ELEMID_MMIE: 802.11w Management MIC IE 256 * @WLAN_ELEMID_NONTX_BSSID_CAP: Nontransmitted BSSID Capability IE 257 * @WLAN_ELEMID_MULTI_BSSID_IDX: Multiple BSSID index 258 * @WLAN_ELEMID_FMS_DESCRIPTOR: 802.11v FMS descriptor IE 259 * @WLAN_ELEMID_FMS_REQUEST: 802.11v FMS request IE 260 * @WLAN_ELEMID_FMS_RESPONSE: 802.11v FMS response IE 261 * @WLAN_ELEMID_BSSMAX_IDLE_PERIOD = 90: BSS MAX IDLE PERIOD 262 * @WLAN_ELEMID_TFS_REQUEST: TFS req IE 263 * @WLAN_ELEMID_TFS_RESPONSE: TFS resp IE 264 * @WLAN_ELEMID_TIM_BCAST_REQUEST: TIM bcast req IE 265 * @WLAN_ELEMID_TIM_BCAST_RESPONSE: TIM bcast resp IE 266 * @WLAN_ELEMID_INTERWORKING: Interworking IE 267 * @WLAN_ELEMID_QOS_MAP: QOS MAP IE 268 * @WLAN_ELEMID_XCAPS: Extended capability IE 269 * @WLAN_ELEMID_TPC: TPC IE 270 * @WLAN_ELEMID_CCKM: CCKM IE 271 * @WLAN_ELEMID_VHTCAP: VHT Capabilities 272 * @WLAN_ELEMID_VHTOP: VHT Operation 273 * @WLAN_ELEMID_EXT_BSS_LOAD: Extended BSS Load 274 * @WLAN_ELEMID_WIDE_BAND_CHAN_SWITCH: Wide Band Channel Switch 275 * @WLAN_ELEMID_VHT_TX_PWR_ENVLP: VHT Transmit Power Envelope 276 * @WLAN_ELEMID_CHAN_SWITCH_WRAP: Channel Switch Wrapper 277 * @WLAN_ELEMID_AID: AID 278 * @WLAN_ELEMID_QUIET_CHANNEL: Quiet Channel 279 * @WLAN_ELEMID_OP_MODE_NOTIFY: Operating Mode Notification 280 * @WLAN_ELEMID_VENDOR: vendor private 281 * @WLAN_ELEMID_EXTN_ELEM: extended IE 282 */ 283 enum element_ie { 284 WLAN_ELEMID_SSID = 0, 285 WLAN_ELEMID_RATES = 1, 286 WLAN_ELEMID_FHPARMS = 2, 287 WLAN_ELEMID_DSPARMS = 3, 288 WLAN_ELEMID_CFPARMS = 4, 289 WLAN_ELEMID_TIM = 5, 290 WLAN_ELEMID_IBSSPARMS = 6, 291 WLAN_ELEMID_COUNTRY = 7, 292 WLAN_ELEMID_REQINFO = 10, 293 WLAN_ELEMID_QBSS_LOAD = 11, 294 WLAN_ELEMID_TCLAS = 14, 295 WLAN_ELEMID_CHALLENGE = 16, 296 /* 17-31 reserved for challenge text extension */ 297 WLAN_ELEMID_PWRCNSTR = 32, 298 WLAN_ELEMID_PWRCAP = 33, 299 WLAN_ELEMID_TPCREQ = 34, 300 WLAN_ELEMID_TPCREP = 35, 301 WLAN_ELEMID_SUPPCHAN = 36, 302 WLAN_ELEMID_CHANSWITCHANN = 37, 303 WLAN_ELEMID_MEASREQ = 38, 304 WLAN_ELEMID_MEASREP = 39, 305 WLAN_ELEMID_QUIET = 40, 306 WLAN_ELEMID_IBSSDFS = 41, 307 WLAN_ELEMID_ERP = 42, 308 WLAN_ELEMID_TCLAS_PROCESS = 44, 309 WLAN_ELEMID_HTCAP_ANA = 45, 310 WLAN_ELEMID_RSN = 48, 311 WLAN_ELEMID_XRATES = 50, 312 WLAN_ELEMID_HTCAP_VENDOR = 51, 313 WLAN_ELEMID_HTINFO_VENDOR = 52, 314 WLAN_ELEMID_MOBILITY_DOMAIN = 54, 315 WLAN_ELEMID_FT = 55, 316 WLAN_ELEMID_TIMEOUT_INTERVAL = 56, 317 WLAN_ELEMID_SUPP_OP_CLASS = 59, 318 WLAN_ELEMID_EXTCHANSWITCHANN = 60, 319 WLAN_ELEMID_HTINFO_ANA = 61, 320 WLAN_ELEMID_SECCHANOFFSET = 62, 321 WLAN_ELEMID_WAPI = 68, 322 WLAN_ELEMID_TIME_ADVERTISEMENT = 69, 323 WLAN_ELEMID_RRM = 70, 324 WLAN_ELEMID_MULTIPLE_BSSID = 71, 325 WLAN_ELEMID_2040_COEXT = 72, 326 WLAN_ELEMID_2040_INTOL = 73, 327 WLAN_ELEMID_OBSS_SCAN = 74, 328 WLAN_ELEMID_MMIE = 76, 329 WLAN_ELEMID_NONTX_BSSID_CAP = 83, 330 WLAN_ELEMID_MULTI_BSSID_IDX = 85, 331 WLAN_ELEMID_FMS_DESCRIPTOR = 86, 332 WLAN_ELEMID_FMS_REQUEST = 87, 333 WLAN_ELEMID_FMS_RESPONSE = 88, 334 WLAN_ELEMID_BSSMAX_IDLE_PERIOD = 90, 335 WLAN_ELEMID_TFS_REQUEST = 91, 336 WLAN_ELEMID_TFS_RESPONSE = 92, 337 WLAN_ELEMID_TIM_BCAST_REQUEST = 94, 338 WLAN_ELEMID_TIM_BCAST_RESPONSE = 95, 339 WLAN_ELEMID_INTERWORKING = 107, 340 WLAN_ELEMID_QOS_MAP = 110, 341 WLAN_ELEMID_XCAPS = 127, 342 WLAN_ELEMID_TPC = 150, 343 WLAN_ELEMID_CCKM = 156, 344 WLAN_ELEMID_VHTCAP = 191, 345 WLAN_ELEMID_VHTOP = 192, 346 WLAN_ELEMID_EXT_BSS_LOAD = 193, 347 WLAN_ELEMID_WIDE_BAND_CHAN_SWITCH = 194, 348 WLAN_ELEMID_VHT_TX_PWR_ENVLP = 195, 349 WLAN_ELEMID_CHAN_SWITCH_WRAP = 196, 350 WLAN_ELEMID_AID = 197, 351 WLAN_ELEMID_QUIET_CHANNEL = 198, 352 WLAN_ELEMID_OP_MODE_NOTIFY = 199, 353 WLAN_ELEMID_VENDOR = 221, 354 WLAN_ELEMID_FILS_INDICATION = 240, 355 WLAN_ELEMID_EXTN_ELEM = 255, 356 }; 357 358 /** 359 * enum extn_element_ie :- extended management information element 360 * @WLAN_EXTN_ELEMID_HECAP: HE capabilities IE 361 * @WLAN_EXTN_ELEMID_HEOP: HE Operation IE 362 * @WLAN_EXTN_ELEMID_MUEDCA: MU-EDCA IE 363 * @WLAN_EXTN_ELEMID_SRP: spatial reuse parameter IE 364 */ 365 enum extn_element_ie { 366 WLAN_EXTN_ELEMID_HECAP = 35, 367 WLAN_EXTN_ELEMID_HEOP = 36, 368 WLAN_EXTN_ELEMID_MUEDCA = 38, 369 WLAN_EXTN_ELEMID_SRP = 39, 370 WLAN_EXTN_ELEMID_ESP = 11, 371 }; 372 373 #define WLAN_OUI_SIZE 4 374 #define WLAN_MAX_CIPHER 6 375 #define WLAN_RSN_SELECTOR_LEN 4 376 #define WLAN_WPA_SELECTOR_LEN 4 377 #define PMKID_LEN 16 378 #define MAX_PMKID 4 379 380 #define WLAN_WPA_OUI 0xf25000 381 #define WLAN_WPA_OUI_TYPE 0x01 382 #define WPA_VERSION 1 383 #define WLAN_WPA_SEL(x) (((x) << 24) | WLAN_WPA_OUI) 384 385 #define WLAN_RSN_OUI 0xac0f00 386 #define WLAN_CCKM_OUI 0x964000 387 #define WLAN_CCKM_ASE_UNSPEC 0 388 #define WLAN_WPA_CCKM_AKM 0x00964000 389 #define WLAN_RSN_CCKM_AKM 0x00964000 390 #define WLAN_RSN_DPP_AKM 0x029A6F50 391 392 #define RSN_VERSION 1 393 #define WLAN_RSN_SEL(x) (((x) << 24) | WLAN_RSN_OUI) 394 #define WLAN_CCKM_SEL(x) (((x) << 24) | WLAN_CCKM_OUI) 395 396 #define WLAN_CSE_NONE 0x00 397 #define WLAN_CSE_WEP40 0x01 398 #define WLAN_CSE_TKIP 0x02 399 #define WLAN_CSE_RESERVED 0x03 400 #define WLAN_CSE_CCMP 0x04 401 #define WLAN_CSE_WEP104 0x05 402 #define WLAN_CSE_AES_CMAC 0x06 403 #define WLAN_CSE_GCMP_128 0x08 404 #define WLAN_CSE_GCMP_256 0x09 405 #define WLAN_CSE_CCMP_256 0x0A 406 #define WLAN_CSE_BIP_GMAC_128 0x0B 407 #define WLAN_CSE_BIP_GMAC_256 0x0C 408 #define WLAN_CSE_BIP_CMAC_256 0x0D 409 410 #define WLAN_AKM_IEEE8021X 0x01 411 #define WLAN_AKM_PSK 0x02 412 #define WLAN_AKM_FT_IEEE8021X 0x03 413 #define WLAN_AKM_FT_PSK 0x04 414 #define WLAN_AKM_SHA256_IEEE8021X 0x05 415 #define WLAN_AKM_SHA256_PSK 0x06 416 #define WLAN_AKM_SAE 0x08 417 #define WLAN_AKM_SUITEB_EAP_SHA256 0x0B 418 #define WLAN_AKM_SUITEB_EAP_SHA384 0x0C 419 #define WLAN_AKM_FILS_SHA256 0x0E 420 #define WLAN_AKM_FILS_SHA384 0x0F 421 #define WLAN_AKM_FILS_FT_SHA256 0x10 422 #define WLAN_AKM_FILS_FT_SHA384 0x11 423 #define WLAN_AKM_OWE 0x12 424 425 #define WLAN_ASE_NONE 0x00 426 #define WLAN_ASE_8021X_UNSPEC 0x01 427 #define WLAN_ASE_8021X_PSK 0x02 428 #define WLAN_ASE_FT_IEEE8021X 0x20 429 #define WLAN_ASE_FT_PSK 0x40 430 #define WLAN_ASE_SHA256_IEEE8021X 0x80 431 #define WLAN_ASE_SHA256_PSK 0x100 432 #define WLAN_ASE_WPS 0x200 433 434 #define RSN_CAP_MFP_CAPABLE 0x80 435 #define RSN_CAP_MFP_REQUIRED 0x40 436 437 /** 438 * struct wlan_rsn_ie_hdr: rsn ie header 439 * @elem_id: RSN element id WLAN_ELEMID_RSN. 440 * @len: rsn ie length 441 * @version: RSN ver 442 */ 443 struct wlan_rsn_ie_hdr { 444 u8 elem_id; 445 u8 len; 446 u8 version[2]; 447 }; 448 449 #define WLAN_RSN_IE_MIN_LEN 3 450 451 /** 452 * struct wlan_rsn_ie: rsn ie info 453 * @ver: RSN ver 454 * @gp_cipher_suite: group cipher 455 * @pwise_cipher_count: number of pw cipher 456 * @pwise_cipher_suites: pair wise cipher list 457 * @akm_suite_count: Number of akm suite 458 * @akm_suites: akm suites list 459 * @cap: RSN capability 460 * @pmkid_count: number of PMKID 461 * @pmkid: PMKID list 462 * @mgmt_cipher_suite: management (11w) cipher suite 463 */ 464 struct wlan_rsn_ie { 465 uint16_t ver; 466 uint32_t gp_cipher_suite; 467 uint16_t pwise_cipher_count; 468 uint32_t pwise_cipher_suites[WLAN_MAX_CIPHER]; 469 uint16_t akm_suite_count; 470 uint32_t akm_suites[WLAN_MAX_CIPHER]; 471 uint16_t cap; 472 uint16_t pmkid_count; 473 uint8_t pmkid[MAX_PMKID][PMKID_LEN]; 474 uint32_t mgmt_cipher_suite; 475 }; 476 477 #define WLAN_WAPI_IE_MIN_LEN 20 478 479 /** 480 * struct wlan_wpa_ie_hdr: wpa ie header 481 * @elem_id: Wpa element id, vender specific. 482 * @len: wpa ie length 483 * @oui: 24-bit OUI followed by 8-bit OUI type 484 * @version: wpa ver 485 */ 486 struct wlan_wpa_ie_hdr { 487 u8 elem_id; 488 u8 len; 489 u8 oui[4]; 490 u8 version[2]; 491 }; 492 493 /** 494 * struct wlan_wpa_ie: WPA ie info 495 * @ver: WPA ver 496 * @mc_cipher: multicast cipher 497 * @uc_cipher_count: number of unicast cipher 498 * @uc_ciphers: unicast cipher list 499 * @auth_suite_count: Number of akm suite 500 * @auth_suites: akm suites list 501 * @cap: WPA capability 502 */ 503 struct wlan_wpa_ie { 504 uint16_t ver; 505 uint32_t mc_cipher; 506 uint16_t uc_cipher_count; 507 uint32_t uc_ciphers[WLAN_MAX_CIPHER]; 508 uint16_t auth_suite_count; 509 uint32_t auth_suites[WLAN_MAX_CIPHER]; 510 uint16_t cap; 511 }; 512 513 #define WAPI_VERSION 1 514 #define WLAN_WAPI_OUI 0x721400 515 516 #define WLAN_WAPI_SEL(x) (((x) << 24) | WLAN_WAPI_OUI) 517 518 #define WLAN_WAI_CERT_OR_SMS4 0x01 519 #define WLAN_WAI_PSK 0x02 520 521 /** 522 * struct wlan_wapi_ie: WAPI ie info 523 * @ver: WAPI ver 524 * @akm_suite_count: Number of akm suite 525 * @akm_suites: akm suites list 526 * @uc_cipher_suites:unicast cipher count 527 * @uc_cipher_suites: unicast cipher suite 528 * @mc_cipher_suite: mc cipher suite 529 */ 530 struct wlan_wapi_ie { 531 uint16_t ver; 532 uint16_t akm_suite_count; 533 uint32_t akm_suites[WLAN_MAX_CIPHER]; 534 uint16_t uc_cipher_count; 535 uint32_t uc_cipher_suites[WLAN_MAX_CIPHER]; 536 uint32_t mc_cipher_suite; 537 }; 538 539 /** 540 * struct wlan_frame_hdr: generic IEEE 802.11 frames 541 * @i_fc: frame control 542 * @i_dur: duration field 543 * @i_addr1: mac address 1 544 * @i_addr2: mac address 2 545 * @i_addr3: mac address 3 546 * @i_seq: seq info 547 */ 548 struct wlan_frame_hdr { 549 uint8_t i_fc[2]; 550 uint8_t i_dur[2]; 551 union { 552 struct { 553 uint8_t i_addr1[QDF_MAC_ADDR_SIZE]; 554 uint8_t i_addr2[QDF_MAC_ADDR_SIZE]; 555 uint8_t i_addr3[QDF_MAC_ADDR_SIZE]; 556 }; 557 uint8_t i_addr_all[3 * QDF_MAC_ADDR_SIZE]; 558 }; 559 uint8_t i_seq[2]; 560 } qdf_packed; 561 562 /* sequence number offset base on begin of mac header */ 563 #define WLAN_SEQ_CTL_OFFSET 22 564 #define WLAN_LOW_SEQ_NUM_MASK 0x000F 565 #define WLAN_HIGH_SEQ_NUM_MASK 0x0FF0 566 #define WLAN_HIGH_SEQ_NUM_OFFSET 4 567 568 /** 569 * struct wlan_seq_ctl: sequence number control 570 * @frag_num: frag number 571 * @seq_num_lo: sequence number low byte 572 * @seq_num_hi: sequence number high byte 573 */ 574 struct wlan_seq_ctl { 575 uint8_t frag_num:4; 576 uint8_t seq_num_lo:4; 577 uint8_t seq_num_hi:8; 578 } qdf_packed; 579 580 /** 581 * union wlan_capability : wlan_capability info 582 * @value: capability value 583 */ 584 union wlan_capability { 585 struct caps { 586 uint16_t ess:1; 587 uint16_t ibss:1; 588 uint16_t cf_pollable:1; 589 uint16_t cf_poll_request:1; 590 uint16_t privacy:1; 591 uint16_t short_preamble:1; 592 uint16_t pbcc:1; 593 uint16_t channel_agility:1; 594 uint16_t spectrum_management:1; 595 uint16_t qos:1; 596 uint16_t short_slot_time:1; 597 uint16_t apsd:1; 598 uint16_t reserved2:1; 599 uint16_t dsss_ofdm:1; 600 uint16_t del_block_ack:1; 601 uint16_t immed_block_ack:1; 602 } wlan_caps; 603 uint16_t value; 604 } qdf_packed; 605 606 /** 607 * struct ie_header : IE header 608 * @ie_id: Element Id 609 * @ie_len: IE Length 610 */ 611 struct ie_header { 612 uint8_t ie_id; 613 uint8_t ie_len; 614 } qdf_packed; 615 616 /** 617 * struct extn_ie_header : Extension IE header 618 * @ie_id: Element Id 619 * @ie_len: IE Length 620 * @ie_extn_id: extension id 621 */ 622 struct extn_ie_header { 623 uint8_t ie_id; 624 uint8_t ie_len; 625 uint8_t ie_extn_id; 626 } qdf_packed; 627 628 629 /** 630 * struct ie_ssid : ssid IE 631 * @ssid_id: SSID Element Id 632 * @ssid_len: SSID IE Length 633 * @ssid: ssid value 634 */ 635 struct ie_ssid { 636 uint8_t ssid_id; 637 uint8_t ssid_len; 638 uint8_t ssid[WLAN_SSID_MAX_LEN]; 639 } qdf_packed; 640 641 /** 642 * struct ds_ie : ds IE 643 * @ie: DS Element Id 644 * @len: DS IE Length 645 * @cur_chan: channel info 646 */ 647 struct ds_ie { 648 uint8_t ie; 649 uint8_t len; 650 uint8_t cur_chan; 651 } qdf_packed; 652 653 /** 654 * struct erp_ie: ERP IE 655 * @ie: ERP Element Id 656 * @len: ERP IE Length 657 * @value: EP Info 658 */ 659 struct erp_ie { 660 uint8_t ie; 661 uint8_t len; 662 uint8_t value; 663 } qdf_packed; 664 665 /** 666 * struct htcap_cmn_ie: HT common IE info 667 * @hc_cap: HT capabilities 668 * @ampdu_param: ampdu params 669 * @mcsset: supported MCS set 670 * @extcap: extended HT capabilities 671 * @txbf_cap: txbf capabilities 672 * @antenna: antenna capabilities 673 */ 674 struct htcap_cmn_ie { 675 uint16_t hc_cap; 676 uint8_t ampdu_param; 677 uint8_t mcsset[16]; 678 uint16_t extcap; 679 uint32_t txbf_cap; 680 uint8_t antenna; 681 } qdf_packed; 682 683 /** 684 * struct htcap_ie: HT Capability IE 685 * @id: HT IE 686 * @len: HT IE LEN 687 * @ie: HT cap info 688 */ 689 struct htcap_ie { 690 uint8_t id; 691 uint8_t len; 692 struct htcap_cmn_ie ie; 693 } qdf_packed; 694 695 /** 696 * struct fils_indication_ie: FILS indication IE element 697 * @id: id 698 * @len: len 699 * @public_key_identifiers_cnt: public key identifiers count 700 * @realm_identifiers_cnt: realm identifiers count 701 * @is_ip_config_supported: whether ip config is supported in AP 702 * @is_cache_id_present: whether cache identifier is present 703 * @is_hessid_present: whether hessid is present 704 * @is_fils_sk_auth_supported: FILS shared key authentication is supported 705 * @is_fils_sk_auth_pfs_supported: FILS shared key auth with PFS is supported 706 * @is_pk_auth_supported: FILS public key authentication is supported 707 * @reserved: reserved 708 * @variable_data: pointer to data depends on initial variables 709 */ 710 struct fils_indication_ie { 711 uint8_t id; 712 uint8_t len; 713 uint16_t public_key_identifiers_cnt:3; 714 uint16_t realm_identifiers_cnt:3; 715 uint16_t is_ip_config_supported:1; 716 uint16_t is_cache_id_present:1; 717 uint16_t is_hessid_present:1; 718 uint16_t is_fils_sk_auth_supported:1; 719 uint16_t is_fils_sk_auth_pfs_supported:1; 720 uint16_t is_pk_auth_supported:1; 721 uint16_t reserved:4; 722 uint8_t variable_data[253]; 723 } qdf_packed; 724 725 #define WLAN_VENDOR_HT_IE_OFFSET_LEN 4 726 727 /** 728 * struct wlan_vendor_ie_htcap: vendor private HT Capability IE 729 * @id: HT IE 730 * @hlen: HT IE len 731 * @oui: vendor OUI 732 * @oui_type: Oui type 733 * @ie: HT cap info 734 */ 735 struct wlan_vendor_ie_htcap { 736 uint8_t id; 737 uint8_t hlen; 738 uint8_t oui[3]; 739 uint8_t oui_type; 740 struct htcap_cmn_ie ie; 741 } qdf_packed; 742 743 /** 744 * struct wlan_ie_htinfo_cmn: ht info comman 745 * @hi_ctrlchannel: control channel 746 * @hi_extchoff: B0-1 extension channel offset 747 * @hi_txchwidth: B2 recommended xmiss width set 748 * @hi_rifsmode: rifs mode 749 * @hi_ctrlaccess: controlled access only 750 * @hi_serviceinterval: B5-7 svc interval granularity 751 * @uhi_opmode: B0-1 operating mode 752 * @hi_nongfpresent: B2 non greenfield devices present 753 * @hi_txburstlimit: B3 transmit burst limit 754 * @hi_obssnonhtpresent: B4 OBSS non-HT STA present 755 * @hi_reserved0: B5-15 reserved 756 * @hi_reserved2: B0-5 reserved 757 * @hi_dualbeacon: B6 dual beacon 758 * @hi_dualctsprot: B7 dual CTS protection 759 * @hi_stbcbeacon: B8 STBC beacon 760 * @hi_lsigtxopprot: B9 l-sig txop protection full support 761 * @hi_pcoactive: B10 pco active 762 * @hi_pcophase: B11 pco phase 763 * @hi_reserved1: B12-15 reserved 764 * @hi_basicmcsset[16]: basic MCS set 765 */ 766 struct wlan_ie_htinfo_cmn { 767 uint8_t hi_ctrlchannel; 768 uint8_t hi_extchoff:2, 769 hi_txchwidth:1, 770 hi_rifsmode:1, 771 hi_ctrlaccess:1, 772 hi_serviceinterval:3; 773 uint16_t hi_opmode:2, 774 hi_nongfpresent:1, 775 hi_txburstlimit:1, 776 hi_obssnonhtpresent:1, 777 hi_reserved0:11; 778 uint16_t hi_reserved2:6, 779 hi_dualbeacon:1, 780 hi_dualctsprot:1, 781 hi_stbcbeacon:1, 782 hi_lsigtxopprot:1, 783 hi_pcoactive:1, 784 hi_pcophase:1, 785 hi_reserved1:4; 786 uint8_t hi_basicmcsset[16]; 787 } qdf_packed; 788 789 /** 790 * struct wlan_ie_htinfo: HT info IE 791 * @hi_id: HT info IE 792 * @hi_len: HT info IE len 793 * @hi_ie: HT info info 794 */ 795 struct wlan_ie_htinfo { 796 uint8_t hi_id; 797 uint8_t hi_len; 798 struct wlan_ie_htinfo_cmn hi_ie; 799 } qdf_packed; 800 801 /** 802 * struct wlan_ie_htinfo: vendor private HT info IE 803 * @hi_id: HT info IE 804 * @hi_len: HT info IE len 805 * @hi_oui: vendor OUI 806 * @hi_ouitype: Oui type 807 * @hi_ie: HT info info 808 */ 809 struct wlan_vendor_ie_htinfo { 810 uint8_t hi_id; 811 uint8_t hi_len; 812 uint8_t hi_oui[3]; 813 uint8_t hi_ouitype; 814 struct wlan_ie_htinfo_cmn hi_ie; 815 } qdf_packed; 816 817 #define WLAN_VENDOR_VHTCAP_IE_OFFSET 7 818 #define WLAN_VENDOR_VHTOP_IE_OFFSET 21 819 820 /** 821 * struct wlan_ie_vhtcaps - VHT capabilities 822 * @elem_id: VHT caps IE 823 * @elem_len: VHT caps IE len 824 * @max_mpdu_len: MPDU length 825 * @supported_channel_widthset: channel width set 826 * @ldpc_coding: LDPC coding capability 827 * @shortgi80: short GI 80 support 828 * @shortgi160and80plus80: short Gi 160 & 80+80 support 829 * @tx_stbc; Tx STBC cap 830 * @tx_stbc: Rx STBC cap 831 * @su_beam_former: SU beam former cap 832 * @su_beam_formee: SU beam formee cap 833 * @csnof_beamformer_antSup: Antenna support for beamforming 834 * @num_soundingdim: Sound dimensions 835 * @mu_beam_former: MU beam former cap 836 * @mu_beam_formee: MU beam formee cap 837 * @vht_txops: TXOP power save 838 * @htc_vhtcap: HTC VHT capability 839 * @max_ampdu_lenexp: AMPDU length 840 * @vht_link_adapt: VHT link adapatation capable 841 * @rx_antpattern: Rx Antenna pattern 842 * @tx_antpattern: Tx Antenna pattern 843 * @rx_mcs_map: RX MCS map 844 * @rx_high_sup_data_rate : highest RX supported data rate 845 * @tx_mcs_map: TX MCS map 846 * @tx_sup_data_rate: highest TX supported data rate 847 */ 848 struct wlan_ie_vhtcaps { 849 uint8_t elem_id; 850 uint8_t elem_len; 851 uint32_t max_mpdu_len:2; 852 uint32_t supported_channel_widthset:2; 853 uint32_t ldpc_coding:1; 854 uint32_t shortgi80:1; 855 uint32_t shortgi160and80plus80:1; 856 uint32_t tx_stbc:1; 857 uint32_t rx_stbc:3; 858 uint32_t su_beam_former:1; 859 uint32_t su_beam_formee:1; 860 uint32_t csnof_beamformer_antSup:3; 861 uint32_t num_soundingdim:3; 862 uint32_t mu_beam_former:1; 863 uint32_t mu_beam_formee:1; 864 uint32_t vht_txops:1; 865 uint32_t htc_vhtcap:1; 866 uint32_t max_ampdu_lenexp:3; 867 uint32_t vht_link_adapt:2; 868 uint32_t rx_antpattern:1; 869 uint32_t tx_antpattern:1; 870 uint32_t unused:2; 871 uint16_t rx_mcs_map; 872 uint16_t rx_high_sup_data_rate:13; 873 uint16_t reserved2:3; 874 uint16_t tx_mcs_map; 875 uint16_t tx_sup_data_rate:13; 876 uint16_t reserved3:3; 877 } qdf_packed; 878 879 /** 880 * struct wlan_ie_vhtop: VHT op IE 881 * @elem_id: VHT op IE 882 * @elem_len: VHT op IE len 883 * @vht_op_chwidth: BSS Operational Channel width 884 * @vht_op_ch_freq_seg1: Channel Center frequency 885 * @vht_op_ch_freq_seg2: Channel Center frequency for 80+80MHz 886 * @vhtop_basic_mcs_set: Basic MCS set 887 */ 888 struct wlan_ie_vhtop { 889 uint8_t elem_id; 890 uint8_t elem_len; 891 uint8_t vht_op_chwidth; 892 uint8_t vht_op_ch_freq_seg1; 893 uint8_t vht_op_ch_freq_seg2; 894 uint16_t vhtop_basic_mcs_set; 895 } qdf_packed; 896 897 /** 898 * struct wlan_country_ie: country IE 899 * @ie: country IE 900 * @len: IE len 901 * @cc: country code 902 */ 903 struct wlan_country_ie { 904 uint8_t ie; 905 uint8_t len; 906 uint8_t cc[3]; 907 } qdf_packed; 908 909 /** 910 * struct wlan_country_ie: country IE 911 * @ie: QBSS IE 912 * @len: IE len 913 * @station_count: number of station associated 914 * @qbss_chan_load: qbss channel load 915 * @qbss_load_avail: qbss_load_avail 916 */ 917 struct qbss_load_ie { 918 uint8_t ie; 919 uint8_t len; 920 uint16_t station_count; 921 uint8_t qbss_chan_load; 922 uint16_t qbss_load_avail; 923 } qdf_packed; 924 925 /** 926 * struct wlan_bcn_frame: beacon frame fixed params 927 * @timestamp: the value of sender's TSFTIMER 928 * @beacon_interval: beacon interval 929 * @capability: capability 930 * @ie: variable IE 931 */ 932 struct wlan_bcn_frame { 933 uint8_t timestamp[8]; 934 uint16_t beacon_interval; 935 union wlan_capability capability; 936 struct ie_header ie; 937 } qdf_packed; 938 939 #define WLAN_TIM_IE_MIN_LENGTH 4 940 941 /** 942 * struct wlan_tim_ie: tim IE 943 * @tim_ie: Time IE 944 * @tim_len: TIM IE len 945 * @tim_count: dtim count 946 * @tim_period: dtim period 947 * @tim_bitctl: bitmap control 948 * @tim_bitmap: variable length bitmap 949 */ 950 struct wlan_tim_ie { 951 uint8_t tim_ie; /* WLAN_ELEMID_TIM */ 952 uint8_t tim_len; 953 uint8_t tim_count; /* DTIM count */ 954 uint8_t tim_period; /* DTIM period */ 955 uint8_t tim_bitctl; /* bitmap control */ 956 uint8_t tim_bitmap[251]; /* variable-length bitmap */ 957 } qdf_packed; 958 959 /** 960 * struct rsn_mdie: mobility domain IE 961 * @rsn_id: RSN IE id 962 * @rsn_len: RSN IE len 963 * @mobility_domain: mobility domain info 964 * @ft_capab: ft capability 965 * 966 * Reference 9.4.2.47 Mobility Domain element (MDE) of 802.11-2016 967 */ 968 struct rsn_mdie { 969 uint8_t rsn_id; 970 uint8_t rsn_len; 971 uint8_t mobility_domain[2]; 972 uint8_t ft_capab; 973 } qdf_packed; 974 975 /** 976 * struct srp_ie: Spatial reuse parameter IE 977 * @srp_id: SRP IE id 978 * @srp_len: SRP IE len 979 * @srp_id_extn: SRP Extension ID 980 * @sr_control: sr control 981 * @non_srg_obsspd_max_offset: non srg obsspd max offset 982 * @srg_obss_pd_min_offset: srg obss pd min offset 983 * @srg_obss_pd_max_offset: srg obss pd max offset 984 * @srg_bss_color_bitmap: srg bss color bitmap 985 * @srg_partial_bssid_bitmap: srg partial bssid bitmap 986 */ 987 struct wlan_srp_ie { 988 uint8_t srp_id; 989 uint8_t srp_len; 990 uint8_t srp_id_extn; 991 uint8_t sr_control; 992 union { 993 struct { 994 uint8_t non_srg_obsspd_max_offset; 995 uint8_t srg_obss_pd_min_offset; 996 uint8_t srg_obss_pd_max_offset; 997 uint8_t srg_bss_color_bitmap[8]; 998 uint8_t srg_partial_bssid_bitmap[8]; 999 } qdf_packed nonsrg_srg_info; 1000 struct { 1001 uint8_t non_srg_obsspd_max_offset; 1002 } qdf_packed nonsrg_info; 1003 struct { 1004 uint8_t srg_obss_pd_min_offset; 1005 uint8_t srg_obss_pd_max_offset; 1006 uint8_t srg_bss_color_bitmap[8]; 1007 uint8_t srg_partial_bssid_bitmap[8]; 1008 } qdf_packed srg_info; 1009 }; 1010 } qdf_packed; 1011 1012 #define ESP_INFORMATION_LIST_LENGTH 3 1013 #define MAX_ESP_INFORMATION_FIELD 4 1014 /* 1015 * enum access_category: tells about access category in ESP paramameter 1016 * @ESP_AC_BK: ESP access category for background 1017 * @ESP_AC_BE: ESP access category for best effort 1018 * @ESP_AC_VI: ESP access category for video 1019 * @ESP_AC_VO: ESP access category for Voice 1020 */ 1021 enum access_category { 1022 ESP_AC_BK, 1023 ESP_AC_BE, 1024 ESP_AC_VI, 1025 ESP_AC_VO, 1026 1027 }; 1028 /* 1029 * struct wlan_esp_info: structure for Esp information parameter 1030 * @access_category: access category info 1031 * @reserved: reserved 1032 * @data_format: two bits in length and tells about data format 1033 * i.e. 0 = No aggregation is expected to be performed for MSDUs or MPDUs with 1034 * the Type subfield equal to Data for the corresponding AC 1035 * 1 = A-MSDU aggregation is expected to be performed for MSDUs for the 1036 * corresponding AC, but A-MPDU aggregation is not expected to be performed 1037 * for MPDUs with the Type subfield equal to Data for the corresponding AC 1038 * 2 = A-MPDU aggregation is expected to be performed for MPDUs with the Type 1039 * subfield equal to Data for the corresponding AC, but A-MSDU aggregation is 1040 * not expected to be performed for MSDUs for the corresponding AC 1041 * 3 = A-MSDU aggregation is expected to be performed for MSDUs for the 1042 * corresponding AC and A-MPDU aggregation is expected to be performed for 1043 * MPDUs with the Type subfield equal to Data for the corresponding AC 1044 * @ba_window_size: BA Window Size subfield is three bits in length and 1045 * indicates the size of the Block Ack window that is 1046 * expected for the corresponding access category 1047 * @estimated_air_fraction: Estimated Air Time Fraction subfield is 8 bits in 1048 * length and contains an unsigned integer that represents 1049 * the predicted percentage of time, linearly scaled with 255 representing 1050 * 100%, that a new STA joining the 1051 * BSS will be allocated for PPDUs that contain only 1052 * MPDUs with the Type 1053 * subfield equal to Data of the 1054 * corresponding access category for that STA. 1055 * @ppdu_duration: Data PPDU Duration Target field 1056 * is 8 bits in length and is 1057 * an unsigned integer that indicates the 1058 * expected target duration of PPDUs that contain only MPDUs with the Type 1059 * subfield equal to Data for the 1060 * corresponding access category in units of 50 μs 1061 */ 1062 struct wlan_esp_info { 1063 uint8_t access_category:2; 1064 uint8_t reserved:1; 1065 uint8_t data_format:2; 1066 uint8_t ba_window_size:3; 1067 uint8_t estimated_air_fraction; 1068 uint8_t ppdu_duration; 1069 }; 1070 1071 /** 1072 * struct wlan_esp_ie: struct for ESP information 1073 * @esp_id: ESP IE id 1074 * @esp_len: ESP IE len 1075 * @esp_id_extn: ESP Extension ID 1076 * @esp_info_AC_BK: ESP information related to BK category 1077 * @esp_info_AC_BE: ESP information related to BE category 1078 * @esp_info_AC_VI: ESP information related to VI category 1079 * @esp_info_AC_VO: ESP information related to VO category 1080 */ 1081 struct wlan_esp_ie { 1082 uint8_t esp_id; 1083 uint8_t esp_len; 1084 uint8_t esp_id_extn; 1085 struct wlan_esp_info esp_info_AC_BK; 1086 struct wlan_esp_info esp_info_AC_BE; 1087 struct wlan_esp_info esp_info_AC_VI; 1088 struct wlan_esp_info esp_info_AC_VO; 1089 } qdf_packed; 1090 1091 /** 1092 * struct oce_reduced_wan_metrics: struct for oce wan metrics 1093 * @downlink_av_cap: Download available capacity 1094 * @uplink_av_cap: Upload available capacity 1095 */ 1096 struct oce_reduced_wan_metrics { 1097 uint8_t downlink_av_cap:4; 1098 uint8_t uplink_av_cap:4; 1099 }; 1100 1101 /** 1102 * is_wpa_oui() - If vendor IE is WPA type 1103 * @frm: vendor IE pointer 1104 * 1105 * API to check if vendor IE is WPA 1106 * 1107 * Return: true if its WPA IE 1108 */ 1109 static inline bool 1110 is_wpa_oui(uint8_t *frm) 1111 { 1112 return (frm[1] > 3) && (LE_READ_4(frm + 2) == 1113 ((WLAN_WPA_OUI_TYPE << 24) | WLAN_WPA_OUI)); 1114 } 1115 1116 /** 1117 * is_wps_oui() - If vendor IE is WPS type 1118 * @frm: vendor IE pointer 1119 * 1120 * API to check if vendor IE is WPS 1121 * 1122 * Return: true if its WPS IE 1123 */ 1124 static inline bool 1125 is_wps_oui(const uint8_t *frm) 1126 { 1127 return frm[1] > 3 && BE_READ_4(frm + 2) == WSC_OUI; 1128 } 1129 1130 /** 1131 * is_mbo_oce_oui() - If vendor IE is MBO/OCE type 1132 * @frm: vendor IE pointer 1133 * 1134 * API to check if vendor IE is MBO/OCE 1135 * 1136 * Return: true if its MBO/OCE IE 1137 */ 1138 static inline bool 1139 is_mbo_oce_oui(const uint8_t *frm) 1140 { 1141 return frm[1] > 3 && BE_READ_4(frm + 2) == MBO_OCE_OUI; 1142 } 1143 1144 /** 1145 * is_wcn_oui() - If vendor IE is WCN type 1146 * @frm: vendor IE pointer 1147 * 1148 * API to check if vendor IE is WCN 1149 * 1150 * Return: true if its WCN IE 1151 */ 1152 static inline bool 1153 is_wcn_oui(uint8_t *frm) 1154 { 1155 return (frm[1] > 4) && (LE_READ_4(frm + 2) == 1156 ((WCN_OUI_TYPE << 24) | WCN_OUI)); 1157 } 1158 1159 /** 1160 * is_wme_param() - If vendor IE is WME param type 1161 * @frm: vendor IE pointer 1162 * 1163 * API to check if vendor IE is WME param 1164 * 1165 * Return: true if its WME param IE 1166 */ 1167 static inline bool 1168 is_wme_param(const uint8_t *frm) 1169 { 1170 return (frm[1] > 5) && (LE_READ_4(frm + 2) == 1171 ((WME_OUI_TYPE << 24) | WME_OUI)) && 1172 (frm[6] == WME_PARAM_OUI_SUBTYPE); 1173 } 1174 1175 /** 1176 * is_wme_info() - If vendor IE is WME info type 1177 * @frm: vendor IE pointer 1178 * 1179 * API to check if vendor IE is WME info 1180 * 1181 * Return: true if its WME info IE 1182 */ 1183 static inline bool 1184 is_wme_info(const uint8_t *frm) 1185 { 1186 return (frm[1] > 5) && (LE_READ_4(frm + 2) == 1187 ((WME_OUI_TYPE << 24) | WME_OUI)) && 1188 (frm[6] == WME_INFO_OUI_SUBTYPE); 1189 } 1190 1191 /** 1192 * is_atheros_oui() - If vendor IE is Atheros type 1193 * @frm: vendor IE pointer 1194 * 1195 * API to check if vendor IE is Atheros 1196 * 1197 * Return: true if its Atheros IE 1198 */ 1199 static inline bool 1200 is_atheros_oui(const uint8_t *frm) 1201 { 1202 return (frm[1] > 3) && LE_READ_4(frm + 2) == 1203 ((ATH_OUI_TYPE << 24) | ATH_OUI); 1204 } 1205 1206 /** 1207 * is_atheros_extcap_oui() - If vendor IE is Atheros ext cap 1208 * @frm: vendor IE pointer 1209 * 1210 * API to check if vendor IE is Atheros ext cap 1211 * 1212 * Return: true if its Atheros ext cap IE 1213 */ 1214 static inline int 1215 is_atheros_extcap_oui(uint8_t *frm) 1216 { 1217 return (frm[1] > 3) && (LE_READ_4(frm + 2) == 1218 ((ATH_OUI_EXTCAP_TYPE << 24) | ATH_OUI)); 1219 } 1220 1221 /** 1222 * is_sfa_oui() - If vendor IE is SFA type 1223 * @frm: vendor IE pointer 1224 * 1225 * API to check if vendor IE is SFA 1226 * 1227 * Return: true if its SFA IE 1228 */ 1229 static inline bool 1230 is_sfa_oui(uint8_t *frm) 1231 { 1232 return (frm[1] > 4) && (LE_READ_4(frm + 2) == 1233 ((SFA_OUI_TYPE << 24) | SFA_OUI)); 1234 } 1235 1236 /** 1237 * is_p2p_oui() - If vendor IE is P2P type 1238 * @frm: vendor IE pointer 1239 * 1240 * API to check if vendor IE is P2P 1241 * 1242 * Return: true if its P2P IE 1243 */ 1244 static inline bool 1245 is_p2p_oui(const uint8_t *frm) 1246 { 1247 const uint8_t wfa_oui[3] = P2P_WFA_OUI; 1248 1249 return (frm[1] >= 4) && 1250 (frm[2] == wfa_oui[0]) && 1251 (frm[3] == wfa_oui[1]) && 1252 (frm[4] == wfa_oui[2]) && 1253 (frm[5] == P2P_WFA_VER); 1254 } 1255 1256 /** 1257 * is_qca_son_oui() - If vendor IE is QCA WHC type 1258 * @frm: vendor IE pointer 1259 * @whc_subtype: subtype 1260 * 1261 * API to check if vendor IE is QCA WHC 1262 * 1263 * Return: true if its QCA WHC IE 1264 */ 1265 static inline bool 1266 is_qca_son_oui(uint8_t *frm, uint8_t whc_subtype) 1267 { 1268 return (frm[1] > 4) && (LE_READ_4(frm + 2) == 1269 ((QCA_OUI_WHC_TYPE << 24) | QCA_OUI)) && 1270 (*(frm + 6) == whc_subtype); 1271 } 1272 1273 /** 1274 * is_ht_cap() - If vendor IE is vendor HT cap type 1275 * @frm: vendor IE pointer 1276 * 1277 * API to check if vendor IE is vendor HT cap 1278 * 1279 * Return: true if its vendor HT cap IE 1280 */ 1281 static inline bool 1282 is_ht_cap(uint8_t *frm) 1283 { 1284 return (frm[1] > 3) && (BE_READ_4(frm + 2) == 1285 ((VENDOR_HT_OUI << 8) | VENDOR_HT_CAP_ID)); 1286 } 1287 1288 /** 1289 * is_ht_info() - If vendor IE is vendor HT info type 1290 * @frm: vendor IE pointer 1291 * 1292 * API to check if vendor IE is vendor HT info 1293 * 1294 * Return: true if its vendor HT info IE 1295 */ 1296 static inline bool 1297 is_ht_info(uint8_t *frm) 1298 { 1299 return (frm[1] > 3) && (BE_READ_4(frm + 2) == 1300 ((VENDOR_HT_OUI << 8) | VENDOR_HT_INFO_ID)); 1301 } 1302 1303 /** 1304 * is_interop_vht() - If vendor IE is VHT interop 1305 * @frm: vendor IE pointer 1306 * 1307 * API to check if vendor IE is VHT interop 1308 * 1309 * Return: true if its VHT interop IE 1310 */ 1311 static inline bool 1312 is_interop_vht(uint8_t *frm) 1313 { 1314 return (frm[1] > 12) && (BE_READ_4(frm + 2) == 1315 ((VHT_INTEROP_OUI << 8) | VHT_INTEROP_TYPE)) && 1316 ((*(frm + 6) == VHT_INTEROP_OUI_SUBTYPE) || 1317 (*(frm + 6) == VHT_INTEROP_OUI_SUBTYPE_VENDORSPEC)); 1318 } 1319 1320 /** 1321 * is_bwnss_oui() - If vendor IE is BW NSS type 1322 * @frm: vendor IE pointer 1323 * 1324 * API to check if vendor IE is BW NSS 1325 * 1326 * Return: true if its BW NSS IE 1327 */ 1328 static inline bool 1329 is_bwnss_oui(uint8_t *frm) 1330 { 1331 return (frm[1] > 3) && (LE_READ_4(frm + 2) == 1332 ((ATH_OUI_BW_NSS_MAP_TYPE << 24) | ATH_OUI)); 1333 } 1334 1335 /** 1336 * is_he_cap_oui() - If vendor IE is HE CAP OUI 1337 * @frm: vendor IE pointer 1338 * 1339 * API to check if vendor IE is HE CAP 1340 * 1341 * Return: true if its HE CAP IE 1342 */ 1343 static inline bool 1344 is_he_cap_oui(uint8_t *frm) 1345 { 1346 return (frm[1] > 4) && (LE_READ_4(frm + 2) == 1347 ((ATH_HE_CAP_SUBTYPE << 24) | ATH_HE_OUI)); 1348 } 1349 1350 /** 1351 * is_he_op_oui() - If vendor IE is HE OP OUI 1352 * @frm: vendor IE pointer 1353 * 1354 * API to check if vendor IE is HE OP OUT 1355 * 1356 * Return: true if its HE OP OUI 1357 */ 1358 static inline bool 1359 is_he_op_oui(uint8_t *frm) 1360 { 1361 return (frm[1] > 4) && (LE_READ_4(frm + 2) == 1362 ((ATH_HE_OP_SUBTYPE << 24) | ATH_HE_OUI)); 1363 } 1364 1365 /** 1366 * is_extender_oui() - If vendor IE is EXTENDER OUI 1367 * @frm: vendor IE pointer 1368 * 1369 * API to check if vendor IE is EXTENDER OUI 1370 * 1371 * Return: true if its EXTENDER OUI 1372 */ 1373 static inline bool 1374 is_extender_oui(uint8_t *frm) 1375 { 1376 return (frm[1] > 4) && (LE_READ_4(frm + 2) == 1377 ((QCA_OUI_EXTENDER_TYPE << 24) | QCA_OUI)); 1378 } 1379 1380 /** 1381 * wlan_parse_rsn_ie() - parse rsn ie 1382 * @rsn_ie: rsn ie ptr 1383 * @rsn: out structure for the parsed ie 1384 * 1385 * API, function to parse rsn ie, if optional fields are not present use the 1386 * default values defined by standard. 1387 * 1388 * Return: QDF_STATUS 1389 */ 1390 static inline QDF_STATUS wlan_parse_rsn_ie(uint8_t *rsn_ie, 1391 struct wlan_rsn_ie *rsn) 1392 { 1393 uint8_t rsn_ie_len, i; 1394 uint8_t *ie; 1395 int rem_len; 1396 const struct wlan_rsn_ie_hdr *hdr; 1397 1398 if (!rsn_ie) 1399 return QDF_STATUS_E_NULL_VALUE; 1400 1401 ie = rsn_ie; 1402 rsn_ie_len = ie[1] + 2; 1403 1404 /* 1405 * Check the length once for fixed parts: 1406 * element id, len and version. Other, variable-length data, 1407 * must be checked separately. 1408 */ 1409 if (rsn_ie_len < sizeof(struct wlan_rsn_ie_hdr)) 1410 return QDF_STATUS_E_INVAL; 1411 1412 hdr = (struct wlan_rsn_ie_hdr *) rsn_ie; 1413 1414 if (hdr->elem_id != WLAN_ELEMID_RSN || 1415 LE_READ_2(hdr->version) != RSN_VERSION) 1416 return QDF_STATUS_E_INVAL; 1417 1418 /* Set default values for optional field. */ 1419 rsn->gp_cipher_suite = WLAN_RSN_SEL(WLAN_CSE_CCMP); 1420 rsn->pwise_cipher_count = 1; 1421 rsn->pwise_cipher_suites[0] = WLAN_RSN_SEL(WLAN_CSE_CCMP); 1422 rsn->akm_suite_count = 1; 1423 rsn->akm_suites[0] = WLAN_RSN_SEL(WLAN_AKM_IEEE8021X); 1424 1425 rsn->ver = LE_READ_2(hdr->version); 1426 1427 ie = (uint8_t *) (hdr + 1); 1428 rem_len = rsn_ie_len - sizeof(*hdr); 1429 1430 /* Check if optional group cipher is present */ 1431 if (rem_len >= WLAN_RSN_SELECTOR_LEN) { 1432 rsn->gp_cipher_suite = LE_READ_4(ie); 1433 ie += WLAN_RSN_SELECTOR_LEN; 1434 rem_len -= WLAN_RSN_SELECTOR_LEN; 1435 } else if (rem_len > 0) { 1436 /* RSN IE is invalid as group cipher is of invalid length */ 1437 return QDF_STATUS_E_INVAL; 1438 } 1439 1440 /* Check if optional pairwise cipher is present */ 1441 if (rem_len >= 2) { 1442 rsn->pwise_cipher_count = LE_READ_2(ie); 1443 ie += 2; 1444 rem_len -= 2; 1445 if (rsn->pwise_cipher_count == 0 || 1446 rsn->pwise_cipher_count > WLAN_MAX_CIPHER || 1447 rsn->pwise_cipher_count > rem_len / WLAN_RSN_SELECTOR_LEN) 1448 return QDF_STATUS_E_INVAL; 1449 for (i = 0; i < rsn->pwise_cipher_count; i++) { 1450 rsn->pwise_cipher_suites[i] = LE_READ_4(ie); 1451 ie += WLAN_RSN_SELECTOR_LEN; 1452 rem_len -= WLAN_RSN_SELECTOR_LEN; 1453 } 1454 } else if (rem_len == 1) { 1455 /* RSN IE is invalid as pairwise cipher is of invalid length */ 1456 return QDF_STATUS_E_INVAL; 1457 } 1458 1459 /* Check if optional akm suite is present */ 1460 if (rem_len >= 2) { 1461 rsn->akm_suite_count = LE_READ_2(ie); 1462 ie += 2; 1463 rem_len -= 2; 1464 if (rsn->akm_suite_count == 0 || 1465 rsn->akm_suite_count > WLAN_MAX_CIPHER || 1466 rsn->akm_suite_count > rem_len / WLAN_RSN_SELECTOR_LEN) 1467 return QDF_STATUS_E_INVAL; 1468 for (i = 0; i < rsn->akm_suite_count; i++) { 1469 rsn->akm_suites[i] = LE_READ_4(ie); 1470 ie += WLAN_RSN_SELECTOR_LEN; 1471 rem_len -= WLAN_RSN_SELECTOR_LEN; 1472 } 1473 } else if (rem_len == 1) { 1474 /* RSN IE is invalid as akm suite is of invalid length */ 1475 return QDF_STATUS_E_INVAL; 1476 } 1477 1478 /* Update capabilty if present */ 1479 if (rem_len >= 2) { 1480 rsn->cap = LE_READ_2(ie); 1481 ie += 2; 1482 rem_len -= 2; 1483 } else if (rem_len == 1) { 1484 /* RSN IE is invalid as cap field is truncated */ 1485 return QDF_STATUS_E_INVAL; 1486 } 1487 1488 /* Update PMKID if present */ 1489 if (rem_len >= 2) { 1490 rsn->pmkid_count = LE_READ_2(ie); 1491 ie += 2; 1492 rem_len -= 2; 1493 if (rsn->pmkid_count > (unsigned int) rem_len / PMKID_LEN) { 1494 rsn->pmkid_count = 0; 1495 return QDF_STATUS_E_INVAL; 1496 } 1497 1498 qdf_mem_copy(rsn->pmkid, ie, 1499 rsn->pmkid_count * PMKID_LEN); 1500 ie += rsn->pmkid_count * PMKID_LEN; 1501 rem_len -= rsn->pmkid_count * PMKID_LEN; 1502 } else if (rem_len == 1) { 1503 /* RSN IE is invalid as pmkid count field is truncated */ 1504 return QDF_STATUS_E_INVAL; 1505 } 1506 1507 /* Update mgmt cipher if present */ 1508 if (rem_len >= WLAN_RSN_SELECTOR_LEN) { 1509 rsn->mgmt_cipher_suite = LE_READ_4(ie); 1510 ie += WLAN_RSN_SELECTOR_LEN; 1511 rem_len -= WLAN_RSN_SELECTOR_LEN; 1512 } else if (rem_len > 0) { 1513 /* RSN IE is invalid as mgmt cipher is truncated */ 1514 return QDF_STATUS_E_INVAL; 1515 } 1516 1517 return QDF_STATUS_SUCCESS; 1518 } 1519 1520 /** 1521 * wlan_parse_wpa_ie() - parse wpa ie 1522 * @wpa_ie: wpa ie ptr 1523 * @wpa: out structure for the parsed ie 1524 * 1525 * API, function to parse wpa ie, if optional fields are not present use the 1526 * default values defined by standard. 1527 * 1528 * Return: QDF_STATUS 1529 */ 1530 static inline QDF_STATUS wlan_parse_wpa_ie(uint8_t *wpa_ie, 1531 struct wlan_wpa_ie *wpa) 1532 { 1533 uint8_t wpa_ie_len, i; 1534 uint8_t *ie; 1535 int rem_len; 1536 struct wlan_wpa_ie_hdr *hdr; 1537 1538 if (!wpa_ie) 1539 return QDF_STATUS_E_NULL_VALUE; 1540 1541 ie = wpa_ie; 1542 wpa_ie_len = ie[1] + 2; 1543 1544 /* 1545 * Check the length once for fixed parts: 1546 * element id, len, oui and version. Other, variable-length data, 1547 * must be checked separately. 1548 */ 1549 if (wpa_ie_len < sizeof(struct wlan_wpa_ie_hdr)) 1550 return QDF_STATUS_E_INVAL; 1551 1552 hdr = (struct wlan_wpa_ie_hdr *) wpa_ie; 1553 1554 if (hdr->elem_id != WLAN_ELEMID_VENDOR || 1555 !is_wpa_oui(wpa_ie) || 1556 LE_READ_2(hdr->version) != WPA_VERSION) 1557 return QDF_STATUS_E_INVAL; 1558 1559 /* Set default values for optional field. */ 1560 wpa->mc_cipher = WLAN_WPA_SEL(WLAN_CSE_TKIP); 1561 wpa->uc_cipher_count = 1; 1562 wpa->uc_ciphers[0] = WLAN_WPA_SEL(WLAN_CSE_TKIP); 1563 wpa->auth_suite_count = 1; 1564 wpa->auth_suites[0] = WLAN_WPA_SEL(WLAN_ASE_8021X_UNSPEC); 1565 1566 wpa->ver = LE_READ_2(hdr->version); 1567 ie = (uint8_t *) (hdr + 1); 1568 rem_len = wpa_ie_len - sizeof(*hdr); 1569 1570 /* Check if optional group cipher is present */ 1571 if (rem_len >= WLAN_WPA_SELECTOR_LEN) { 1572 wpa->mc_cipher = LE_READ_4(ie); 1573 ie += WLAN_WPA_SELECTOR_LEN; 1574 rem_len -= WLAN_WPA_SELECTOR_LEN; 1575 } else if (rem_len > 0) { 1576 /* WPA IE is invalid as group cipher is of invalid length */ 1577 return QDF_STATUS_E_INVAL; 1578 } 1579 1580 /* Check if optional pairwise cipher is present */ 1581 if (rem_len >= 2) { 1582 wpa->uc_cipher_count = LE_READ_2(ie); 1583 ie += 2; 1584 rem_len -= 2; 1585 if (wpa->uc_cipher_count == 0 || 1586 wpa->uc_cipher_count > WLAN_MAX_CIPHER || 1587 wpa->uc_cipher_count > rem_len / WLAN_WPA_SELECTOR_LEN) 1588 return QDF_STATUS_E_INVAL; 1589 for (i = 0; i < wpa->uc_cipher_count; i++) { 1590 wpa->uc_ciphers[i] = LE_READ_4(ie); 1591 ie += WLAN_WPA_SELECTOR_LEN; 1592 rem_len -= WLAN_WPA_SELECTOR_LEN; 1593 } 1594 } else if (rem_len == 1) { 1595 /* WPA IE is invalid as pairwise cipher is of invalid length */ 1596 return QDF_STATUS_E_INVAL; 1597 } 1598 1599 /* Check if optional akm suite is present */ 1600 if (rem_len >= 2) { 1601 wpa->auth_suite_count = LE_READ_2(ie); 1602 ie += 2; 1603 rem_len -= 2; 1604 if (wpa->auth_suite_count == 0 || 1605 wpa->auth_suite_count > WLAN_MAX_CIPHER || 1606 wpa->auth_suite_count > rem_len / WLAN_WPA_SELECTOR_LEN) 1607 return QDF_STATUS_E_INVAL; 1608 for (i = 0; i < wpa->auth_suite_count; i++) { 1609 wpa->auth_suites[i] = LE_READ_4(ie); 1610 ie += WLAN_WPA_SELECTOR_LEN; 1611 rem_len -= WLAN_WPA_SELECTOR_LEN; 1612 } 1613 } else if (rem_len == 1) { 1614 /* WPA IE is invalid as akm suite is of invalid length */ 1615 return QDF_STATUS_E_INVAL; 1616 } 1617 1618 /* Update capabilty if optional capabilty is present */ 1619 if (rem_len >= 2) { 1620 wpa->cap = LE_READ_2(ie); 1621 ie += 2; 1622 rem_len -= 2; 1623 } 1624 1625 return QDF_STATUS_SUCCESS; 1626 } 1627 1628 /** 1629 * wlan_parse_wapi_ie() - parse wapi ie 1630 * @wapi_ie: wpa ie ptr 1631 * @wapi: out structure for the parsed IE 1632 * 1633 * API, function to parse wapi ie 1634 * 1635 * Return: void 1636 */ 1637 static inline void wlan_parse_wapi_ie(uint8_t *wapi_ie, 1638 struct wlan_wapi_ie *wapi) 1639 { 1640 uint8_t len, i; 1641 uint8_t *ie; 1642 1643 if (!wapi_ie) 1644 return; 1645 1646 ie = wapi_ie; 1647 len = ie[1]; 1648 /* 1649 * Check the length once for fixed parts: OUI, type, 1650 * version, mcast cipher, and 2 selector counts. 1651 * Other, variable-length data, must be checked separately. 1652 */ 1653 if (len < 20) 1654 return; 1655 1656 ie += 2; 1657 1658 wapi->ver = LE_READ_2(ie); 1659 if (wapi->ver != WAPI_VERSION) 1660 return; 1661 1662 ie += 2; 1663 len -= 2; 1664 1665 /* akm */ 1666 wapi->akm_suite_count = LE_READ_2(ie); 1667 1668 ie += 2; 1669 len -= 2; 1670 1671 if ((wapi->akm_suite_count > WLAN_MAX_CIPHER) || 1672 len < (wapi->akm_suite_count * WLAN_OUI_SIZE)) 1673 return; 1674 for (i = 0 ; i < wapi->akm_suite_count; i++) { 1675 wapi->akm_suites[i] = LE_READ_4(ie); 1676 ie += WLAN_OUI_SIZE; 1677 len -= WLAN_OUI_SIZE; 1678 } 1679 1680 wapi->uc_cipher_count = LE_READ_2(ie); 1681 ie += 2; 1682 len -= 2; 1683 if ((wapi->uc_cipher_count > WLAN_MAX_CIPHER) || 1684 len < (wapi->uc_cipher_count * WLAN_OUI_SIZE + 2)) 1685 return; 1686 for (i = 0 ; i < wapi->uc_cipher_count; i++) { 1687 wapi->uc_cipher_suites[i] = LE_READ_4(ie); 1688 ie += WLAN_OUI_SIZE; 1689 len -= WLAN_OUI_SIZE; 1690 } 1691 1692 if (len >= WLAN_OUI_SIZE) 1693 wapi->mc_cipher_suite = LE_READ_4(ie); 1694 } 1695 1696 /** 1697 * wlan_parse_oce_reduced_wan_metrics_ie() - parse oce wan metrics 1698 * @mbo_oce_ie: MBO/OCE ie ptr 1699 * @wan_metrics: out structure for the reduced wan metric 1700 * 1701 * API, function to parse reduced wan metric 1702 * 1703 * Return: true if oce wan metrics is present 1704 */ 1705 static inline bool 1706 wlan_parse_oce_reduced_wan_metrics_ie(uint8_t *mbo_oce_ie, 1707 struct oce_reduced_wan_metrics *wan_metrics) 1708 { 1709 uint8_t len, attribute_len, attribute_id; 1710 uint8_t *ie; 1711 1712 if (!mbo_oce_ie) 1713 return false; 1714 1715 ie = mbo_oce_ie; 1716 len = ie[1]; 1717 ie += 2; 1718 1719 if (len <= MBO_OCE_OUI_SIZE) 1720 return false; 1721 1722 ie += MBO_OCE_OUI_SIZE; 1723 len -= MBO_OCE_OUI_SIZE; 1724 1725 while (len > 2) { 1726 attribute_id = ie[0]; 1727 attribute_len = ie[1]; 1728 len -= 2; 1729 if (attribute_len > len) 1730 return false; 1731 1732 if (attribute_id == REDUCED_WAN_METRICS_ATTR) { 1733 wan_metrics->downlink_av_cap = ie[2] & 0xff; 1734 wan_metrics->uplink_av_cap = ie[2] >> 4; 1735 return true; 1736 } 1737 1738 ie += (attribute_len + 2); 1739 len -= attribute_len; 1740 } 1741 1742 return false; 1743 } 1744 1745 #endif /* _WLAN_CMN_IEEE80211_DEFS_H_ */ 1746