libertas: support mesh for various firmware versions
[pandora-kernel.git] / drivers / net / wireless / libertas / types.h
1 /**
2   * This header file contains definition for global types
3   */
4 #ifndef _LBS_TYPES_H_
5 #define _LBS_TYPES_H_
6
7 #include <linux/if_ether.h>
8 #include <asm/byteorder.h>
9 #include <linux/wireless.h>
10
11 struct ieeetypes_cfparamset {
12         u8 elementid;
13         u8 len;
14         u8 cfpcnt;
15         u8 cfpperiod;
16         __le16 cfpmaxduration;
17         __le16 cfpdurationremaining;
18 } __attribute__ ((packed));
19
20
21 struct ieeetypes_ibssparamset {
22         u8 elementid;
23         u8 len;
24         __le16 atimwindow;
25 } __attribute__ ((packed));
26
27 union IEEEtypes_ssparamset {
28         struct ieeetypes_cfparamset cfparamset;
29         struct ieeetypes_ibssparamset ibssparamset;
30 } __attribute__ ((packed));
31
32 struct ieeetypes_fhparamset {
33         u8 elementid;
34         u8 len;
35         __le16 dwelltime;
36         u8 hopset;
37         u8 hoppattern;
38         u8 hopindex;
39 } __attribute__ ((packed));
40
41 struct ieeetypes_dsparamset {
42         u8 elementid;
43         u8 len;
44         u8 currentchan;
45 } __attribute__ ((packed));
46
47 union ieeetypes_phyparamset {
48         struct ieeetypes_fhparamset fhparamset;
49         struct ieeetypes_dsparamset dsparamset;
50 } __attribute__ ((packed));
51
52 struct ieeetypes_assocrsp {
53         __le16 capability;
54         __le16 statuscode;
55         __le16 aid;
56         u8 iebuffer[1];
57 } __attribute__ ((packed));
58
59 /** TLV  type ID definition */
60 #define PROPRIETARY_TLV_BASE_ID         0x0100
61
62 /* Terminating TLV type */
63 #define MRVL_TERMINATE_TLV_ID           0xffff
64
65 #define TLV_TYPE_SSID                           0x0000
66 #define TLV_TYPE_RATES                          0x0001
67 #define TLV_TYPE_PHY_FH                         0x0002
68 #define TLV_TYPE_PHY_DS                         0x0003
69 #define TLV_TYPE_CF                                 0x0004
70 #define TLV_TYPE_IBSS                           0x0006
71
72 #define TLV_TYPE_DOMAIN                         0x0007
73
74 #define TLV_TYPE_POWER_CAPABILITY       0x0021
75
76 #define TLV_TYPE_KEY_MATERIAL       (PROPRIETARY_TLV_BASE_ID + 0)
77 #define TLV_TYPE_CHANLIST           (PROPRIETARY_TLV_BASE_ID + 1)
78 #define TLV_TYPE_NUMPROBES          (PROPRIETARY_TLV_BASE_ID + 2)
79 #define TLV_TYPE_RSSI_LOW           (PROPRIETARY_TLV_BASE_ID + 4)
80 #define TLV_TYPE_SNR_LOW            (PROPRIETARY_TLV_BASE_ID + 5)
81 #define TLV_TYPE_FAILCOUNT          (PROPRIETARY_TLV_BASE_ID + 6)
82 #define TLV_TYPE_BCNMISS            (PROPRIETARY_TLV_BASE_ID + 7)
83 #define TLV_TYPE_LED_GPIO           (PROPRIETARY_TLV_BASE_ID + 8)
84 #define TLV_TYPE_LEDBEHAVIOR        (PROPRIETARY_TLV_BASE_ID + 9)
85 #define TLV_TYPE_PASSTHROUGH        (PROPRIETARY_TLV_BASE_ID + 10)
86 #define TLV_TYPE_REASSOCAP          (PROPRIETARY_TLV_BASE_ID + 11)
87 #define TLV_TYPE_POWER_TBL_2_4GHZ   (PROPRIETARY_TLV_BASE_ID + 12)
88 #define TLV_TYPE_POWER_TBL_5GHZ     (PROPRIETARY_TLV_BASE_ID + 13)
89 #define TLV_TYPE_BCASTPROBE         (PROPRIETARY_TLV_BASE_ID + 14)
90 #define TLV_TYPE_NUMSSID_PROBE      (PROPRIETARY_TLV_BASE_ID + 15)
91 #define TLV_TYPE_WMMQSTATUS         (PROPRIETARY_TLV_BASE_ID + 16)
92 #define TLV_TYPE_CRYPTO_DATA        (PROPRIETARY_TLV_BASE_ID + 17)
93 #define TLV_TYPE_WILDCARDSSID       (PROPRIETARY_TLV_BASE_ID + 18)
94 #define TLV_TYPE_TSFTIMESTAMP       (PROPRIETARY_TLV_BASE_ID + 19)
95 #define TLV_TYPE_RSSI_HIGH          (PROPRIETARY_TLV_BASE_ID + 22)
96 #define TLV_TYPE_SNR_HIGH           (PROPRIETARY_TLV_BASE_ID + 23)
97 #define TLV_TYPE_MESH_ID            (PROPRIETARY_TLV_BASE_ID + 37)
98 #define TLV_TYPE_OLD_MESH_ID        (PROPRIETARY_TLV_BASE_ID + 291)
99
100 /** TLV related data structures*/
101 struct mrvlietypesheader {
102         __le16 type;
103         __le16 len;
104 } __attribute__ ((packed));
105
106 struct mrvlietypes_data {
107         struct mrvlietypesheader header;
108         u8 Data[1];
109 } __attribute__ ((packed));
110
111 struct mrvlietypes_ratesparamset {
112         struct mrvlietypesheader header;
113         u8 rates[1];
114 } __attribute__ ((packed));
115
116 struct mrvlietypes_ssidparamset {
117         struct mrvlietypesheader header;
118         u8 ssid[1];
119 } __attribute__ ((packed));
120
121 struct mrvlietypes_wildcardssidparamset {
122         struct mrvlietypesheader header;
123         u8 MaxSsidlength;
124         u8 ssid[1];
125 } __attribute__ ((packed));
126
127 struct chanscanmode {
128 #ifdef __BIG_ENDIAN_BITFIELD
129         u8 reserved_2_7:6;
130         u8 disablechanfilt:1;
131         u8 passivescan:1;
132 #else
133         u8 passivescan:1;
134         u8 disablechanfilt:1;
135         u8 reserved_2_7:6;
136 #endif
137 } __attribute__ ((packed));
138
139 struct chanscanparamset {
140         u8 radiotype;
141         u8 channumber;
142         struct chanscanmode chanscanmode;
143         __le16 minscantime;
144         __le16 maxscantime;
145 } __attribute__ ((packed));
146
147 struct mrvlietypes_chanlistparamset {
148         struct mrvlietypesheader header;
149         struct chanscanparamset chanscanparam[1];
150 } __attribute__ ((packed));
151
152 struct cfparamset {
153         u8 cfpcnt;
154         u8 cfpperiod;
155         __le16 cfpmaxduration;
156         __le16 cfpdurationremaining;
157 } __attribute__ ((packed));
158
159 struct ibssparamset {
160         __le16 atimwindow;
161 } __attribute__ ((packed));
162
163 struct mrvlietypes_ssparamset {
164         struct mrvlietypesheader header;
165         union {
166                 struct cfparamset cfparamset[1];
167                 struct ibssparamset ibssparamset[1];
168         } cf_ibss;
169 } __attribute__ ((packed));
170
171 struct fhparamset {
172         __le16 dwelltime;
173         u8 hopset;
174         u8 hoppattern;
175         u8 hopindex;
176 } __attribute__ ((packed));
177
178 struct dsparamset {
179         u8 currentchan;
180 } __attribute__ ((packed));
181
182 struct mrvlietypes_phyparamset {
183         struct mrvlietypesheader header;
184         union {
185                 struct fhparamset fhparamset[1];
186                 struct dsparamset dsparamset[1];
187         } fh_ds;
188 } __attribute__ ((packed));
189
190 struct mrvlietypes_rsnparamset {
191         struct mrvlietypesheader header;
192         u8 rsnie[1];
193 } __attribute__ ((packed));
194
195 struct mrvlietypes_tsftimestamp {
196         struct mrvlietypesheader header;
197         __le64 tsftable[1];
198 } __attribute__ ((packed));
199
200 /**  Local Power capability */
201 struct mrvlietypes_powercapability {
202         struct mrvlietypesheader header;
203         s8 minpower;
204         s8 maxpower;
205 } __attribute__ ((packed));
206
207 /* used in CMD_802_11_SUBSCRIBE_EVENT for SNR, RSSI and Failure */
208 struct mrvlietypes_thresholds {
209         struct mrvlietypesheader header;
210         u8 value;
211         u8 freq;
212 } __attribute__ ((packed));
213
214 struct mrvlietypes_beaconsmissed {
215         struct mrvlietypesheader header;
216         u8 beaconmissed;
217         u8 reserved;
218 } __attribute__ ((packed));
219
220 struct mrvlietypes_numprobes {
221         struct mrvlietypesheader header;
222         __le16 numprobes;
223 } __attribute__ ((packed));
224
225 struct mrvlietypes_bcastprobe {
226         struct mrvlietypesheader header;
227         __le16 bcastprobe;
228 } __attribute__ ((packed));
229
230 struct mrvlietypes_numssidprobe {
231         struct mrvlietypesheader header;
232         __le16 numssidprobe;
233 } __attribute__ ((packed));
234
235 struct led_pin {
236         u8 led;
237         u8 pin;
238 } __attribute__ ((packed));
239
240 struct mrvlietypes_ledgpio {
241         struct mrvlietypesheader header;
242         struct led_pin ledpin[1];
243 } __attribute__ ((packed));
244
245 struct led_bhv {
246         uint8_t firmwarestate;
247         uint8_t led;
248         uint8_t ledstate;
249         uint8_t ledarg;
250 } __attribute__ ((packed));
251
252
253 struct mrvlietypes_ledbhv {
254         struct mrvlietypesheader header;
255         struct led_bhv ledbhv[1];
256 } __attribute__ ((packed));
257
258 /* Meant to be packed as the value member of a struct ieee80211_info_element.
259  * Note that the len member of the ieee80211_info_element varies depending on
260  * the mesh_id_len */
261 struct mrvl_meshie_val {
262         uint8_t oui[3];
263         uint8_t type;
264         uint8_t subtype;
265         uint8_t version;
266         uint8_t active_protocol_id;
267         uint8_t active_metric_id;
268         uint8_t mesh_capability;
269         uint8_t mesh_id_len;
270         uint8_t mesh_id[IW_ESSID_MAX_SIZE];
271 } __attribute__ ((packed));
272
273 struct mrvl_meshie {
274         u8 id, len;
275         struct mrvl_meshie_val val;
276 } __attribute__ ((packed));
277
278 struct mrvl_mesh_defaults {
279         __le32 bootflag;
280         uint8_t boottime;
281         uint8_t reserved;
282         __le16 channel;
283         struct mrvl_meshie meshie;
284 } __attribute__ ((packed));
285
286 #endif