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