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