18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __WL12XX_80211_H__ 38c2ecf20Sopenharmony_ci#define __WL12XX_80211_H__ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/if_ether.h> /* ETH_ALEN */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/* RATES */ 88c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATE_1MB 0x02 98c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATE_2MB 0x04 108c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATE_5MB 0x0B 118c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATE_11MB 0x16 128c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_6MB 0x0C 138c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_9MB 0x12 148c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_12MB 0x18 158c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_18MB 0x24 168c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_24MB 0x30 178c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_36MB 0x48 188c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_48MB 0x60 198c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_54MB 0x6C 208c2ecf20Sopenharmony_ci#define IEEE80211_BASIC_RATE_MASK 0x80 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATE_1MB_MASK (1<<0) 238c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATE_2MB_MASK (1<<1) 248c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATE_5MB_MASK (1<<2) 258c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATE_11MB_MASK (1<<3) 268c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) 278c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) 288c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) 298c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) 308c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) 318c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) 328c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) 338c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define IEEE80211_CCK_RATES_MASK 0x0000000F 368c2ecf20Sopenharmony_ci#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ 378c2ecf20Sopenharmony_ci IEEE80211_CCK_RATE_2MB_MASK) 388c2ecf20Sopenharmony_ci#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ 398c2ecf20Sopenharmony_ci IEEE80211_CCK_RATE_5MB_MASK | \ 408c2ecf20Sopenharmony_ci IEEE80211_CCK_RATE_11MB_MASK) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_RATES_MASK 0x00000FF0 438c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ 448c2ecf20Sopenharmony_ci IEEE80211_OFDM_RATE_12MB_MASK | \ 458c2ecf20Sopenharmony_ci IEEE80211_OFDM_RATE_24MB_MASK) 468c2ecf20Sopenharmony_ci#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ 478c2ecf20Sopenharmony_ci IEEE80211_OFDM_RATE_9MB_MASK | \ 488c2ecf20Sopenharmony_ci IEEE80211_OFDM_RATE_18MB_MASK | \ 498c2ecf20Sopenharmony_ci IEEE80211_OFDM_RATE_36MB_MASK | \ 508c2ecf20Sopenharmony_ci IEEE80211_OFDM_RATE_48MB_MASK | \ 518c2ecf20Sopenharmony_ci IEEE80211_OFDM_RATE_54MB_MASK) 528c2ecf20Sopenharmony_ci#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ 538c2ecf20Sopenharmony_ci IEEE80211_CCK_DEFAULT_RATES_MASK) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* This really should be 8, but not for our firmware */ 578c2ecf20Sopenharmony_ci#define MAX_SUPPORTED_RATES 32 588c2ecf20Sopenharmony_ci#define MAX_COUNTRY_TRIPLETS 32 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/* Headers */ 618c2ecf20Sopenharmony_cistruct ieee80211_header { 628c2ecf20Sopenharmony_ci __le16 frame_ctl; 638c2ecf20Sopenharmony_ci __le16 duration_id; 648c2ecf20Sopenharmony_ci u8 da[ETH_ALEN]; 658c2ecf20Sopenharmony_ci u8 sa[ETH_ALEN]; 668c2ecf20Sopenharmony_ci u8 bssid[ETH_ALEN]; 678c2ecf20Sopenharmony_ci __le16 seq_ctl; 688c2ecf20Sopenharmony_ci u8 payload[]; 698c2ecf20Sopenharmony_ci} __packed; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cistruct wl12xx_ie_header { 728c2ecf20Sopenharmony_ci u8 id; 738c2ecf20Sopenharmony_ci u8 len; 748c2ecf20Sopenharmony_ci} __packed; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci/* IEs */ 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_cistruct wl12xx_ie_ssid { 798c2ecf20Sopenharmony_ci struct wl12xx_ie_header header; 808c2ecf20Sopenharmony_ci char ssid[IEEE80211_MAX_SSID_LEN]; 818c2ecf20Sopenharmony_ci} __packed; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_cistruct wl12xx_ie_rates { 848c2ecf20Sopenharmony_ci struct wl12xx_ie_header header; 858c2ecf20Sopenharmony_ci u8 rates[MAX_SUPPORTED_RATES]; 868c2ecf20Sopenharmony_ci} __packed; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistruct wl12xx_ie_ds_params { 898c2ecf20Sopenharmony_ci struct wl12xx_ie_header header; 908c2ecf20Sopenharmony_ci u8 channel; 918c2ecf20Sopenharmony_ci} __packed; 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cistruct country_triplet { 948c2ecf20Sopenharmony_ci u8 channel; 958c2ecf20Sopenharmony_ci u8 num_channels; 968c2ecf20Sopenharmony_ci u8 max_tx_power; 978c2ecf20Sopenharmony_ci} __packed; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_cistruct wl12xx_ie_country { 1008c2ecf20Sopenharmony_ci struct wl12xx_ie_header header; 1018c2ecf20Sopenharmony_ci u8 country_string[IEEE80211_COUNTRY_STRING_LEN]; 1028c2ecf20Sopenharmony_ci struct country_triplet triplets[MAX_COUNTRY_TRIPLETS]; 1038c2ecf20Sopenharmony_ci} __packed; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/* Templates */ 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_cistruct wl12xx_beacon_template { 1098c2ecf20Sopenharmony_ci struct ieee80211_header header; 1108c2ecf20Sopenharmony_ci __le32 time_stamp[2]; 1118c2ecf20Sopenharmony_ci __le16 beacon_interval; 1128c2ecf20Sopenharmony_ci __le16 capability; 1138c2ecf20Sopenharmony_ci struct wl12xx_ie_ssid ssid; 1148c2ecf20Sopenharmony_ci struct wl12xx_ie_rates rates; 1158c2ecf20Sopenharmony_ci struct wl12xx_ie_rates ext_rates; 1168c2ecf20Sopenharmony_ci struct wl12xx_ie_ds_params ds_params; 1178c2ecf20Sopenharmony_ci struct wl12xx_ie_country country; 1188c2ecf20Sopenharmony_ci} __packed; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_cistruct wl12xx_null_data_template { 1218c2ecf20Sopenharmony_ci struct ieee80211_header header; 1228c2ecf20Sopenharmony_ci} __packed; 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_cistruct wl12xx_ps_poll_template { 1258c2ecf20Sopenharmony_ci __le16 fc; 1268c2ecf20Sopenharmony_ci __le16 aid; 1278c2ecf20Sopenharmony_ci u8 bssid[ETH_ALEN]; 1288c2ecf20Sopenharmony_ci u8 ta[ETH_ALEN]; 1298c2ecf20Sopenharmony_ci} __packed; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_cistruct wl12xx_qos_null_data_template { 1328c2ecf20Sopenharmony_ci struct ieee80211_header header; 1338c2ecf20Sopenharmony_ci __le16 qos_ctl; 1348c2ecf20Sopenharmony_ci} __packed; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_cistruct wl12xx_probe_req_template { 1378c2ecf20Sopenharmony_ci struct ieee80211_header header; 1388c2ecf20Sopenharmony_ci struct wl12xx_ie_ssid ssid; 1398c2ecf20Sopenharmony_ci struct wl12xx_ie_rates rates; 1408c2ecf20Sopenharmony_ci struct wl12xx_ie_rates ext_rates; 1418c2ecf20Sopenharmony_ci} __packed; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_cistruct wl12xx_probe_resp_template { 1458c2ecf20Sopenharmony_ci struct ieee80211_header header; 1468c2ecf20Sopenharmony_ci __le32 time_stamp[2]; 1478c2ecf20Sopenharmony_ci __le16 beacon_interval; 1488c2ecf20Sopenharmony_ci __le16 capability; 1498c2ecf20Sopenharmony_ci struct wl12xx_ie_ssid ssid; 1508c2ecf20Sopenharmony_ci struct wl12xx_ie_rates rates; 1518c2ecf20Sopenharmony_ci struct wl12xx_ie_rates ext_rates; 1528c2ecf20Sopenharmony_ci struct wl12xx_ie_ds_params ds_params; 1538c2ecf20Sopenharmony_ci struct wl12xx_ie_country country; 1548c2ecf20Sopenharmony_ci} __packed; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci#endif 157