1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef __WL12XX_80211_H__ |
3 | #define __WL12XX_80211_H__ |
4 | |
5 | #include <linux/if_ether.h> /* ETH_ALEN */ |
6 | #include <linux/if_arp.h> |
7 | |
8 | /* RATES */ |
9 | #define IEEE80211_CCK_RATE_1MB 0x02 |
10 | #define IEEE80211_CCK_RATE_2MB 0x04 |
11 | #define IEEE80211_CCK_RATE_5MB 0x0B |
12 | #define IEEE80211_CCK_RATE_11MB 0x16 |
13 | #define IEEE80211_OFDM_RATE_6MB 0x0C |
14 | #define IEEE80211_OFDM_RATE_9MB 0x12 |
15 | #define IEEE80211_OFDM_RATE_12MB 0x18 |
16 | #define IEEE80211_OFDM_RATE_18MB 0x24 |
17 | #define IEEE80211_OFDM_RATE_24MB 0x30 |
18 | #define IEEE80211_OFDM_RATE_36MB 0x48 |
19 | #define IEEE80211_OFDM_RATE_48MB 0x60 |
20 | #define IEEE80211_OFDM_RATE_54MB 0x6C |
21 | #define IEEE80211_BASIC_RATE_MASK 0x80 |
22 | |
23 | #define IEEE80211_CCK_RATE_1MB_MASK (1<<0) |
24 | #define IEEE80211_CCK_RATE_2MB_MASK (1<<1) |
25 | #define IEEE80211_CCK_RATE_5MB_MASK (1<<2) |
26 | #define IEEE80211_CCK_RATE_11MB_MASK (1<<3) |
27 | #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) |
28 | #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) |
29 | #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) |
30 | #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) |
31 | #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) |
32 | #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) |
33 | #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) |
34 | #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) |
35 | |
36 | #define IEEE80211_CCK_RATES_MASK 0x0000000F |
37 | #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ |
38 | IEEE80211_CCK_RATE_2MB_MASK) |
39 | #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ |
40 | IEEE80211_CCK_RATE_5MB_MASK | \ |
41 | IEEE80211_CCK_RATE_11MB_MASK) |
42 | |
43 | #define IEEE80211_OFDM_RATES_MASK 0x00000FF0 |
44 | #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ |
45 | IEEE80211_OFDM_RATE_12MB_MASK | \ |
46 | IEEE80211_OFDM_RATE_24MB_MASK) |
47 | #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ |
48 | IEEE80211_OFDM_RATE_9MB_MASK | \ |
49 | IEEE80211_OFDM_RATE_18MB_MASK | \ |
50 | IEEE80211_OFDM_RATE_36MB_MASK | \ |
51 | IEEE80211_OFDM_RATE_48MB_MASK | \ |
52 | IEEE80211_OFDM_RATE_54MB_MASK) |
53 | #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ |
54 | IEEE80211_CCK_DEFAULT_RATES_MASK) |
55 | |
56 | |
57 | /* This really should be 8, but not for our firmware */ |
58 | #define MAX_SUPPORTED_RATES 32 |
59 | #define MAX_COUNTRY_TRIPLETS 32 |
60 | |
61 | /* Headers */ |
62 | struct { |
63 | __le16 ; |
64 | __le16 ; |
65 | u8 [ETH_ALEN]; |
66 | u8 [ETH_ALEN]; |
67 | u8 [ETH_ALEN]; |
68 | __le16 ; |
69 | u8 []; |
70 | } __packed; |
71 | |
72 | struct { |
73 | u8 ; |
74 | u8 ; |
75 | } __packed; |
76 | |
77 | /* IEs */ |
78 | |
79 | struct wl12xx_ie_ssid { |
80 | struct wl12xx_ie_header ; |
81 | char ssid[IEEE80211_MAX_SSID_LEN]; |
82 | } __packed; |
83 | |
84 | struct wl12xx_ie_rates { |
85 | struct wl12xx_ie_header ; |
86 | u8 rates[MAX_SUPPORTED_RATES]; |
87 | } __packed; |
88 | |
89 | struct wl12xx_ie_ds_params { |
90 | struct wl12xx_ie_header ; |
91 | u8 channel; |
92 | } __packed; |
93 | |
94 | struct country_triplet { |
95 | u8 channel; |
96 | u8 num_channels; |
97 | u8 max_tx_power; |
98 | } __packed; |
99 | |
100 | struct wl12xx_ie_country { |
101 | struct wl12xx_ie_header ; |
102 | u8 country_string[IEEE80211_COUNTRY_STRING_LEN]; |
103 | struct country_triplet triplets[MAX_COUNTRY_TRIPLETS]; |
104 | } __packed; |
105 | |
106 | |
107 | /* Templates */ |
108 | |
109 | struct wl12xx_null_data_template { |
110 | struct ieee80211_header ; |
111 | } __packed; |
112 | |
113 | struct wl12xx_ps_poll_template { |
114 | __le16 fc; |
115 | __le16 aid; |
116 | u8 bssid[ETH_ALEN]; |
117 | u8 ta[ETH_ALEN]; |
118 | } __packed; |
119 | |
120 | struct wl12xx_arp_rsp_template { |
121 | /* not including ieee80211 header */ |
122 | |
123 | u8 llc_hdr[sizeof(rfc1042_header)]; |
124 | __be16 llc_type; |
125 | |
126 | struct arphdr arp_hdr; |
127 | u8 sender_hw[ETH_ALEN]; |
128 | __be32 sender_ip; |
129 | u8 target_hw[ETH_ALEN]; |
130 | __be32 target_ip; |
131 | } __packed; |
132 | |
133 | struct wl12xx_disconn_template { |
134 | struct ieee80211_header ; |
135 | __le16 disconn_reason; |
136 | } __packed; |
137 | |
138 | #endif |
139 | |