b8d2ce936046afa140dcbdc05d86642e52c4d1bf
[firefly-linux-kernel-4.4.55.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 ieee_ie_cf_param_set {
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 ieee_ie_ibss_param_set {
22         u8 elementid;
23         u8 len;
24         __le16 atimwindow;
25 } __attribute__ ((packed));
26
27 union ieee_ss_param_set {
28         struct ieee_ie_cf_param_set cf;
29         struct ieee_ie_ibss_param_set ibss;
30 } __attribute__ ((packed));
31
32 struct ieee_ie_fh_param_set {
33         u8 elementid;
34         u8 len;
35         __le16 dwelltime;
36         u8 hopset;
37         u8 hoppattern;
38         u8 hopindex;
39 } __attribute__ ((packed));
40
41 struct ieee_ie_ds_param_set {
42         u8 elementid;
43         u8 len;
44         u8 channel;
45 } __attribute__ ((packed));
46
47 union ieee_phy_param_set {
48         struct ieee_ie_fh_param_set fh;
49         struct ieee_ie_ds_param_set ds;
50 } __attribute__ ((packed));
51
52 struct ieee_assoc_response {
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 mrvlietypes_cfparamset {
153         struct mrvlietypesheader header;
154         u8 cfpcnt;
155         u8 cfpperiod;
156         __le16 cfpmaxduration;
157         __le16 cfpdurationremaining;
158 } __attribute__ ((packed));
159
160 struct mrvlietypes_dsparamset {
161         struct mrvlietypesheader header;
162         u8 channel;
163 } __attribute__ ((packed));
164
165 struct mrvlietypes_rsnparamset {
166         struct mrvlietypesheader header;
167         u8 rsnie[1];
168 } __attribute__ ((packed));
169
170 struct mrvlietypes_tsftimestamp {
171         struct mrvlietypesheader header;
172         __le64 tsftable[1];
173 } __attribute__ ((packed));
174
175 /**  Local Power capability */
176 struct mrvlietypes_powercapability {
177         struct mrvlietypesheader header;
178         s8 minpower;
179         s8 maxpower;
180 } __attribute__ ((packed));
181
182 /* used in CMD_802_11_SUBSCRIBE_EVENT for SNR, RSSI and Failure */
183 struct mrvlietypes_thresholds {
184         struct mrvlietypesheader header;
185         u8 value;
186         u8 freq;
187 } __attribute__ ((packed));
188
189 struct mrvlietypes_beaconsmissed {
190         struct mrvlietypesheader header;
191         u8 beaconmissed;
192         u8 reserved;
193 } __attribute__ ((packed));
194
195 struct mrvlietypes_numprobes {
196         struct mrvlietypesheader header;
197         __le16 numprobes;
198 } __attribute__ ((packed));
199
200 struct mrvlietypes_bcastprobe {
201         struct mrvlietypesheader header;
202         __le16 bcastprobe;
203 } __attribute__ ((packed));
204
205 struct mrvlietypes_numssidprobe {
206         struct mrvlietypesheader header;
207         __le16 numssidprobe;
208 } __attribute__ ((packed));
209
210 struct led_pin {
211         u8 led;
212         u8 pin;
213 } __attribute__ ((packed));
214
215 struct mrvlietypes_ledgpio {
216         struct mrvlietypesheader header;
217         struct led_pin ledpin[1];
218 } __attribute__ ((packed));
219
220 struct led_bhv {
221         uint8_t firmwarestate;
222         uint8_t led;
223         uint8_t ledstate;
224         uint8_t ledarg;
225 } __attribute__ ((packed));
226
227
228 struct mrvlietypes_ledbhv {
229         struct mrvlietypesheader header;
230         struct led_bhv ledbhv[1];
231 } __attribute__ ((packed));
232
233 /* Meant to be packed as the value member of a struct ieee80211_info_element.
234  * Note that the len member of the ieee80211_info_element varies depending on
235  * the mesh_id_len */
236 struct mrvl_meshie_val {
237         uint8_t oui[3];
238         uint8_t type;
239         uint8_t subtype;
240         uint8_t version;
241         uint8_t active_protocol_id;
242         uint8_t active_metric_id;
243         uint8_t mesh_capability;
244         uint8_t mesh_id_len;
245         uint8_t mesh_id[IW_ESSID_MAX_SIZE];
246 } __attribute__ ((packed));
247
248 struct mrvl_meshie {
249         u8 id, len;
250         struct mrvl_meshie_val val;
251 } __attribute__ ((packed));
252
253 struct mrvl_mesh_defaults {
254         __le32 bootflag;
255         uint8_t boottime;
256         uint8_t reserved;
257         __le16 channel;
258         struct mrvl_meshie meshie;
259 } __attribute__ ((packed));
260
261 #endif