]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/net/wireless/libertas/host.h
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[mv-sheeva.git] / drivers / net / wireless / libertas / host.h
1 /**
2   * This file function prototypes, data structure
3   * and  definitions for all the host/station commands
4   */
5
6 #ifndef _LBS_HOST_H_
7 #define _LBS_HOST_H_
8
9 #include "types.h"
10 #include "defs.h"
11
12 #define DEFAULT_AD_HOC_CHANNEL                  6
13
14 #define CMD_OPTION_WAITFORRSP                   0x0002
15
16 /** Host command IDs */
17
18 /* Return command are almost always the same as the host command, but with
19  * bit 15 set high.  There are a few exceptions, though...
20  */
21 #define CMD_RET(cmd)                            (0x8000 | cmd)
22
23 /* Return command convention exceptions: */
24 #define CMD_RET_802_11_ASSOCIATE                0x8012
25
26 /* Command codes */
27 #define CMD_GET_HW_SPEC                         0x0003
28 #define CMD_EEPROM_UPDATE                       0x0004
29 #define CMD_802_11_RESET                        0x0005
30 #define CMD_802_11_SCAN                         0x0006
31 #define CMD_802_11_GET_LOG                      0x000b
32 #define CMD_MAC_MULTICAST_ADR                   0x0010
33 #define CMD_802_11_AUTHENTICATE                 0x0011
34 #define CMD_802_11_EEPROM_ACCESS                0x0059
35 #define CMD_802_11_ASSOCIATE                    0x0050
36 #define CMD_802_11_SET_WEP                      0x0013
37 #define CMD_802_11_GET_STAT                     0x0014
38 #define CMD_802_3_GET_STAT                      0x0015
39 #define CMD_802_11_SNMP_MIB                     0x0016
40 #define CMD_MAC_REG_MAP                         0x0017
41 #define CMD_BBP_REG_MAP                         0x0018
42 #define CMD_MAC_REG_ACCESS                      0x0019
43 #define CMD_BBP_REG_ACCESS                      0x001a
44 #define CMD_RF_REG_ACCESS                       0x001b
45 #define CMD_802_11_RADIO_CONTROL                0x001c
46 #define CMD_802_11_RF_CHANNEL                   0x001d
47 #define CMD_802_11_RF_TX_POWER                  0x001e
48 #define CMD_802_11_RSSI                         0x001f
49 #define CMD_802_11_RF_ANTENNA                   0x0020
50 #define CMD_802_11_PS_MODE                      0x0021
51 #define CMD_802_11_DATA_RATE                    0x0022
52 #define CMD_RF_REG_MAP                          0x0023
53 #define CMD_802_11_DEAUTHENTICATE               0x0024
54 #define CMD_802_11_REASSOCIATE                  0x0025
55 #define CMD_MAC_CONTROL                         0x0028
56 #define CMD_802_11_AD_HOC_START                 0x002b
57 #define CMD_802_11_AD_HOC_JOIN                  0x002c
58 #define CMD_802_11_QUERY_TKIP_REPLY_CNTRS       0x002e
59 #define CMD_802_11_ENABLE_RSN                   0x002f
60 #define CMD_802_11_SET_AFC                      0x003c
61 #define CMD_802_11_GET_AFC                      0x003d
62 #define CMD_802_11_DEEP_SLEEP                   0x003e
63 #define CMD_802_11_AD_HOC_STOP                  0x0040
64 #define CMD_802_11_HOST_SLEEP_CFG               0x0043
65 #define CMD_802_11_WAKEUP_CONFIRM               0x0044
66 #define CMD_802_11_HOST_SLEEP_ACTIVATE          0x0045
67 #define CMD_802_11_BEACON_STOP                  0x0049
68 #define CMD_802_11_MAC_ADDRESS                  0x004d
69 #define CMD_802_11_LED_GPIO_CTRL                0x004e
70 #define CMD_802_11_EEPROM_ACCESS                0x0059
71 #define CMD_802_11_BAND_CONFIG                  0x0058
72 #define CMD_GSPI_BUS_CONFIG                     0x005a
73 #define CMD_802_11D_DOMAIN_INFO                 0x005b
74 #define CMD_802_11_KEY_MATERIAL                 0x005e
75 #define CMD_802_11_SLEEP_PARAMS                 0x0066
76 #define CMD_802_11_INACTIVITY_TIMEOUT           0x0067
77 #define CMD_802_11_SLEEP_PERIOD                 0x0068
78 #define CMD_802_11_TPC_CFG                      0x0072
79 #define CMD_802_11_PA_CFG                       0x0073
80 #define CMD_802_11_FW_WAKE_METHOD               0x0074
81 #define CMD_802_11_SUBSCRIBE_EVENT              0x0075
82 #define CMD_802_11_RATE_ADAPT_RATESET           0x0076
83 #define CMD_802_11_TX_RATE_QUERY                0x007f
84 #define CMD_GET_TSF                             0x0080
85 #define CMD_BT_ACCESS                           0x0087
86 #define CMD_FWT_ACCESS                          0x0095
87 #define CMD_802_11_MONITOR_MODE                 0x0098
88 #define CMD_MESH_ACCESS                         0x009b
89 #define CMD_MESH_CONFIG_OLD                     0x00a3
90 #define CMD_MESH_CONFIG                         0x00ac
91 #define CMD_SET_BOOT2_VER                       0x00a5
92 #define CMD_FUNC_INIT                           0x00a9
93 #define CMD_FUNC_SHUTDOWN                       0x00aa
94 #define CMD_802_11_BEACON_CTRL                  0x00b0
95
96 /* For the IEEE Power Save */
97 #define CMD_SUBCMD_ENTER_PS                     0x0030
98 #define CMD_SUBCMD_EXIT_PS                      0x0031
99 #define CMD_SUBCMD_SLEEP_CONFIRMED              0x0034
100 #define CMD_SUBCMD_FULL_POWERDOWN               0x0035
101 #define CMD_SUBCMD_FULL_POWERUP                 0x0036
102
103 #define CMD_ENABLE_RSN                          0x0001
104 #define CMD_DISABLE_RSN                         0x0000
105
106 #define CMD_ACT_GET                             0x0000
107 #define CMD_ACT_SET                             0x0001
108
109 /* Define action or option for CMD_802_11_SET_WEP */
110 #define CMD_ACT_ADD                             0x0002
111 #define CMD_ACT_REMOVE                          0x0004
112
113 #define CMD_TYPE_WEP_40_BIT                     0x01
114 #define CMD_TYPE_WEP_104_BIT                    0x02
115
116 #define CMD_NUM_OF_WEP_KEYS                     4
117
118 #define CMD_WEP_KEY_INDEX_MASK                  0x3fff
119
120 /* Define action or option for CMD_802_11_SCAN */
121 #define CMD_BSS_TYPE_BSS                        0x0001
122 #define CMD_BSS_TYPE_IBSS                       0x0002
123 #define CMD_BSS_TYPE_ANY                        0x0003
124
125 /* Define action or option for CMD_802_11_SCAN */
126 #define CMD_SCAN_TYPE_ACTIVE                    0x0000
127 #define CMD_SCAN_TYPE_PASSIVE                   0x0001
128
129 #define CMD_SCAN_RADIO_TYPE_BG                  0
130
131 #define CMD_SCAN_PROBE_DELAY_TIME               0
132
133 /* Define action or option for CMD_MAC_CONTROL */
134 #define CMD_ACT_MAC_RX_ON                       0x0001
135 #define CMD_ACT_MAC_TX_ON                       0x0002
136 #define CMD_ACT_MAC_LOOPBACK_ON                 0x0004
137 #define CMD_ACT_MAC_WEP_ENABLE                  0x0008
138 #define CMD_ACT_MAC_INT_ENABLE                  0x0010
139 #define CMD_ACT_MAC_MULTICAST_ENABLE            0x0020
140 #define CMD_ACT_MAC_BROADCAST_ENABLE            0x0040
141 #define CMD_ACT_MAC_PROMISCUOUS_ENABLE          0x0080
142 #define CMD_ACT_MAC_ALL_MULTICAST_ENABLE        0x0100
143 #define CMD_ACT_MAC_STRICT_PROTECTION_ENABLE    0x0400
144
145 /* Event flags for CMD_802_11_SUBSCRIBE_EVENT */
146 #define CMD_SUBSCRIBE_RSSI_LOW                  0x0001
147 #define CMD_SUBSCRIBE_SNR_LOW                   0x0002
148 #define CMD_SUBSCRIBE_FAILCOUNT                 0x0004
149 #define CMD_SUBSCRIBE_BCNMISS                   0x0008
150 #define CMD_SUBSCRIBE_RSSI_HIGH                 0x0010
151 #define CMD_SUBSCRIBE_SNR_HIGH                  0x0020
152
153 #define RADIO_PREAMBLE_LONG                     0x00
154 #define RADIO_PREAMBLE_SHORT                    0x02
155 #define RADIO_PREAMBLE_AUTO                     0x04
156
157 /* Define action or option for CMD_802_11_RF_CHANNEL */
158 #define CMD_OPT_802_11_RF_CHANNEL_GET           0x00
159 #define CMD_OPT_802_11_RF_CHANNEL_SET           0x01
160
161 /* Define action or option for CMD_802_11_DATA_RATE */
162 #define CMD_ACT_SET_TX_AUTO                     0x0000
163 #define CMD_ACT_SET_TX_FIX_RATE                 0x0001
164 #define CMD_ACT_GET_TX_RATE                     0x0002
165
166 /* Define action or option for CMD_802_11_PS_MODE */
167 #define CMD_TYPE_CAM                            0x0000
168 #define CMD_TYPE_MAX_PSP                        0x0001
169 #define CMD_TYPE_FAST_PSP                       0x0002
170
171 /* Options for CMD_802_11_FW_WAKE_METHOD */
172 #define CMD_WAKE_METHOD_UNCHANGED               0x0000
173 #define CMD_WAKE_METHOD_COMMAND_INT             0x0001
174 #define CMD_WAKE_METHOD_GPIO                    0x0002
175
176 /* Object IDs for CMD_802_11_SNMP_MIB */
177 #define SNMP_MIB_OID_BSS_TYPE                   0x0000
178 #define SNMP_MIB_OID_OP_RATE_SET                0x0001
179 #define SNMP_MIB_OID_BEACON_PERIOD              0x0002  /* Reserved on v9+ */
180 #define SNMP_MIB_OID_DTIM_PERIOD                0x0003  /* Reserved on v9+ */
181 #define SNMP_MIB_OID_ASSOC_TIMEOUT              0x0004  /* Reserved on v9+ */
182 #define SNMP_MIB_OID_RTS_THRESHOLD              0x0005
183 #define SNMP_MIB_OID_SHORT_RETRY_LIMIT          0x0006
184 #define SNMP_MIB_OID_LONG_RETRY_LIMIT           0x0007
185 #define SNMP_MIB_OID_FRAG_THRESHOLD             0x0008
186 #define SNMP_MIB_OID_11D_ENABLE                 0x0009
187 #define SNMP_MIB_OID_11H_ENABLE                 0x000A
188
189 /* Define action or option for CMD_BT_ACCESS */
190 enum cmd_bt_access_opts {
191         /* The bt commands start at 5 instead of 1 because the old dft commands
192          * are mapped to 1-4.  These old commands are no longer maintained and
193          * should not be called.
194          */
195         CMD_ACT_BT_ACCESS_ADD = 5,
196         CMD_ACT_BT_ACCESS_DEL,
197         CMD_ACT_BT_ACCESS_LIST,
198         CMD_ACT_BT_ACCESS_RESET,
199         CMD_ACT_BT_ACCESS_SET_INVERT,
200         CMD_ACT_BT_ACCESS_GET_INVERT
201 };
202
203 /* Define action or option for CMD_FWT_ACCESS */
204 enum cmd_fwt_access_opts {
205         CMD_ACT_FWT_ACCESS_ADD = 1,
206         CMD_ACT_FWT_ACCESS_DEL,
207         CMD_ACT_FWT_ACCESS_LOOKUP,
208         CMD_ACT_FWT_ACCESS_LIST,
209         CMD_ACT_FWT_ACCESS_LIST_ROUTE,
210         CMD_ACT_FWT_ACCESS_LIST_NEIGHBOR,
211         CMD_ACT_FWT_ACCESS_RESET,
212         CMD_ACT_FWT_ACCESS_CLEANUP,
213         CMD_ACT_FWT_ACCESS_TIME,
214 };
215
216 /* Define action or option for CMD_802_11_HOST_SLEEP_CFG */
217 enum cmd_wol_cfg_opts {
218         CMD_ACT_ACTION_NONE = 0,
219         CMD_ACT_SET_WOL_RULE,
220         CMD_ACT_GET_WOL_RULE,
221         CMD_ACT_RESET_WOL_RULE,
222 };
223
224 /* Define action or option for CMD_MESH_ACCESS */
225 enum cmd_mesh_access_opts {
226         CMD_ACT_MESH_GET_TTL = 1,
227         CMD_ACT_MESH_SET_TTL,
228         CMD_ACT_MESH_GET_STATS,
229         CMD_ACT_MESH_GET_ANYCAST,
230         CMD_ACT_MESH_SET_ANYCAST,
231         CMD_ACT_MESH_SET_LINK_COSTS,
232         CMD_ACT_MESH_GET_LINK_COSTS,
233         CMD_ACT_MESH_SET_BCAST_RATE,
234         CMD_ACT_MESH_GET_BCAST_RATE,
235         CMD_ACT_MESH_SET_RREQ_DELAY,
236         CMD_ACT_MESH_GET_RREQ_DELAY,
237         CMD_ACT_MESH_SET_ROUTE_EXP,
238         CMD_ACT_MESH_GET_ROUTE_EXP,
239         CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
240         CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
241         CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT = 17,
242 };
243
244 /* Define actions and types for CMD_MESH_CONFIG */
245 enum cmd_mesh_config_actions {
246         CMD_ACT_MESH_CONFIG_STOP = 0,
247         CMD_ACT_MESH_CONFIG_START,
248         CMD_ACT_MESH_CONFIG_SET,
249         CMD_ACT_MESH_CONFIG_GET,
250 };
251
252 enum cmd_mesh_config_types {
253         CMD_TYPE_MESH_SET_BOOTFLAG = 1,
254         CMD_TYPE_MESH_SET_BOOTTIME,
255         CMD_TYPE_MESH_SET_DEF_CHANNEL,
256         CMD_TYPE_MESH_SET_MESH_IE,
257         CMD_TYPE_MESH_GET_DEFAULTS,
258         CMD_TYPE_MESH_GET_MESH_IE, /* GET_DEFAULTS is superset of GET_MESHIE */
259 };
260
261 /** Card Event definition */
262 #define MACREG_INT_CODE_TX_PPA_FREE             0
263 #define MACREG_INT_CODE_TX_DMA_DONE             1
264 #define MACREG_INT_CODE_LINK_LOST_W_SCAN        2
265 #define MACREG_INT_CODE_LINK_LOST_NO_SCAN       3
266 #define MACREG_INT_CODE_LINK_SENSED             4
267 #define MACREG_INT_CODE_CMD_FINISHED            5
268 #define MACREG_INT_CODE_MIB_CHANGED             6
269 #define MACREG_INT_CODE_INIT_DONE               7
270 #define MACREG_INT_CODE_DEAUTHENTICATED         8
271 #define MACREG_INT_CODE_DISASSOCIATED           9
272 #define MACREG_INT_CODE_PS_AWAKE                10
273 #define MACREG_INT_CODE_PS_SLEEP                11
274 #define MACREG_INT_CODE_MIC_ERR_MULTICAST       13
275 #define MACREG_INT_CODE_MIC_ERR_UNICAST         14
276 #define MACREG_INT_CODE_WM_AWAKE                15
277 #define MACREG_INT_CODE_DEEP_SLEEP_AWAKE        16
278 #define MACREG_INT_CODE_ADHOC_BCN_LOST          17
279 #define MACREG_INT_CODE_HOST_AWAKE              18
280 #define MACREG_INT_CODE_STOP_TX                 19
281 #define MACREG_INT_CODE_START_TX                20
282 #define MACREG_INT_CODE_CHANNEL_SWITCH          21
283 #define MACREG_INT_CODE_MEASUREMENT_RDY         22
284 #define MACREG_INT_CODE_WMM_CHANGE              23
285 #define MACREG_INT_CODE_BG_SCAN_REPORT          24
286 #define MACREG_INT_CODE_RSSI_LOW                25
287 #define MACREG_INT_CODE_SNR_LOW                 26
288 #define MACREG_INT_CODE_MAX_FAIL                27
289 #define MACREG_INT_CODE_RSSI_HIGH               28
290 #define MACREG_INT_CODE_SNR_HIGH                29
291 #define MACREG_INT_CODE_MESH_AUTO_STARTED       35
292 #define MACREG_INT_CODE_FIRMWARE_READY          48
293
294
295 /* 802.11-related definitions */
296
297 /* TxPD descriptor */
298 struct txpd {
299         /* union to cope up with later FW revisions */
300         union {
301                 /* Current Tx packet status */
302                 __le32 tx_status;
303                 struct {
304                         /* BSS type: client, AP, etc. */
305                         u8 bss_type;
306                         /* BSS number */
307                         u8 bss_num;
308                         /* Reserved */
309                         __le16 reserved;
310                 } bss;
311         } u;
312         /* Tx control */
313         __le32 tx_control;
314         __le32 tx_packet_location;
315         /* Tx packet length */
316         __le16 tx_packet_length;
317         /* First 2 byte of destination MAC address */
318         u8 tx_dest_addr_high[2];
319         /* Last 4 byte of destination MAC address */
320         u8 tx_dest_addr_low[4];
321         /* Pkt Priority */
322         u8 priority;
323         /* Pkt Trasnit Power control */
324         u8 powermgmt;
325         /* Amount of time the packet has been queued (units = 2ms) */
326         u8 pktdelay_2ms;
327         /* reserved */
328         u8 reserved1;
329 } __packed;
330
331 /* RxPD Descriptor */
332 struct rxpd {
333         /* union to cope up with later FW revisions */
334         union {
335                 /* Current Rx packet status */
336                 __le16 status;
337                 struct {
338                         /* BSS type: client, AP, etc. */
339                         u8 bss_type;
340                         /* BSS number */
341                         u8 bss_num;
342                 } __packed bss;
343         } __packed u;
344
345         /* SNR */
346         u8 snr;
347
348         /* Tx control */
349         u8 rx_control;
350
351         /* Pkt length */
352         __le16 pkt_len;
353
354         /* Noise Floor */
355         u8 nf;
356
357         /* Rx Packet Rate */
358         u8 rx_rate;
359
360         /* Pkt addr */
361         __le32 pkt_ptr;
362
363         /* Next Rx RxPD addr */
364         __le32 next_rxpd_ptr;
365
366         /* Pkt Priority */
367         u8 priority;
368         u8 reserved[3];
369 } __packed;
370
371 struct cmd_header {
372         __le16 command;
373         __le16 size;
374         __le16 seqnum;
375         __le16 result;
376 } __packed;
377
378 /* Generic structure to hold all key types. */
379 struct enc_key {
380         u16 len;
381         u16 flags;  /* KEY_INFO_* from defs.h */
382         u16 type; /* KEY_TYPE_* from defs.h */
383         u8 key[32];
384 };
385
386 /* lbs_offset_value */
387 struct lbs_offset_value {
388         u32 offset;
389         u32 value;
390 } __packed;
391
392 #define MRVDRV_MAX_TRIPLET_802_11D              83
393
394 #define COUNTRY_CODE_LEN                        3
395
396 struct mrvl_ie_domain_param_set {
397         struct mrvl_ie_header header;
398
399         u8 countrycode[COUNTRY_CODE_LEN];
400         struct ieee80211_country_ie_triplet triplet[1];
401 } __attribute__ ((packed));
402
403 struct cmd_ds_802_11d_domain_info {
404         __le16 action;
405         struct mrvl_ie_domain_param_set domain;
406 } __attribute__ ((packed));
407
408 struct lbs_802_11d_domain_reg {
409         /** Country code*/
410         u8 country_code[COUNTRY_CODE_LEN];
411         /** No. of triplet*/
412         u8 no_triplet;
413         struct ieee80211_country_ie_triplet triplet[MRVDRV_MAX_TRIPLET_802_11D];
414 } __attribute__ ((packed));
415
416 /*
417  * Define data structure for CMD_GET_HW_SPEC
418  * This structure defines the response for the GET_HW_SPEC command
419  */
420 struct cmd_ds_get_hw_spec {
421         struct cmd_header hdr;
422
423         /* HW Interface version number */
424         __le16 hwifversion;
425         /* HW version number */
426         __le16 version;
427         /* Max number of TxPD FW can handle */
428         __le16 nr_txpd;
429         /* Max no of Multicast address */
430         __le16 nr_mcast_adr;
431         /* MAC address */
432         u8 permanentaddr[6];
433
434         /* region Code */
435         __le16 regioncode;
436
437         /* Number of antenna used */
438         __le16 nr_antenna;
439
440         /* FW release number, example 0x01030304 = 2.3.4p1 */
441         __le32 fwrelease;
442
443         /* Base Address of TxPD queue */
444         __le32 wcb_base;
445         /* Read Pointer of RxPd queue */
446         __le32 rxpd_rdptr;
447
448         /* Write Pointer of RxPd queue */
449         __le32 rxpd_wrptr;
450
451         /*FW/HW capability */
452         __le32 fwcapinfo;
453 } __packed;
454
455 struct cmd_ds_802_11_subscribe_event {
456         struct cmd_header hdr;
457
458         __le16 action;
459         __le16 events;
460
461         /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
462          * number of TLVs. From the v5.1 manual, those TLVs would add up to
463          * 40 bytes. However, future firmware might add additional TLVs, so I
464          * bump this up a bit.
465          */
466         uint8_t tlv[128];
467 } __packed;
468
469 /*
470  * This scan handle Country Information IE(802.11d compliant)
471  * Define data structure for CMD_802_11_SCAN
472  */
473 struct cmd_ds_802_11_scan {
474         struct cmd_header hdr;
475
476         uint8_t bsstype;
477         uint8_t bssid[ETH_ALEN];
478         uint8_t tlvbuffer[0];
479 } __packed;
480
481 struct cmd_ds_802_11_scan_rsp {
482         struct cmd_header hdr;
483
484         __le16 bssdescriptsize;
485         uint8_t nr_sets;
486         uint8_t bssdesc_and_tlvbuffer[0];
487 } __packed;
488
489 struct cmd_ds_802_11_get_log {
490         struct cmd_header hdr;
491
492         __le32 mcasttxframe;
493         __le32 failed;
494         __le32 retry;
495         __le32 multiretry;
496         __le32 framedup;
497         __le32 rtssuccess;
498         __le32 rtsfailure;
499         __le32 ackfailure;
500         __le32 rxfrag;
501         __le32 mcastrxframe;
502         __le32 fcserror;
503         __le32 txframe;
504         __le32 wepundecryptable;
505 } __packed;
506
507 struct cmd_ds_mac_control {
508         struct cmd_header hdr;
509         __le16 action;
510         u16 reserved;
511 } __packed;
512
513 struct cmd_ds_mac_multicast_adr {
514         struct cmd_header hdr;
515         __le16 action;
516         __le16 nr_of_adrs;
517         u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
518 } __packed;
519
520 struct cmd_ds_802_11_authenticate {
521         struct cmd_header hdr;
522
523         u8 bssid[ETH_ALEN];
524         u8 authtype;
525         u8 reserved[10];
526 } __packed;
527
528 struct cmd_ds_802_11_deauthenticate {
529         struct cmd_header hdr;
530
531         u8 macaddr[ETH_ALEN];
532         __le16 reasoncode;
533 } __packed;
534
535 struct cmd_ds_802_11_associate {
536         struct cmd_header hdr;
537
538         u8 bssid[6];
539         __le16 capability;
540         __le16 listeninterval;
541         __le16 bcnperiod;
542         u8 dtimperiod;
543         u8 iebuf[512];    /* Enough for required and most optional IEs */
544 } __packed;
545
546 struct cmd_ds_802_11_associate_response {
547         struct cmd_header hdr;
548
549         __le16 capability;
550         __le16 statuscode;
551         __le16 aid;
552         u8 iebuf[512];
553 } __packed;
554
555 struct cmd_ds_802_11_set_wep {
556         struct cmd_header hdr;
557
558         /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
559         __le16 action;
560
561         /* key Index selected for Tx */
562         __le16 keyindex;
563
564         /* 40, 128bit or TXWEP */
565         uint8_t keytype[4];
566         uint8_t keymaterial[4][16];
567 } __packed;
568
569 struct cmd_ds_802_11_snmp_mib {
570         struct cmd_header hdr;
571
572         __le16 action;
573         __le16 oid;
574         __le16 bufsize;
575         u8 value[128];
576 } __packed;
577
578 struct cmd_ds_mac_reg_access {
579         __le16 action;
580         __le16 offset;
581         __le32 value;
582 } __packed;
583
584 struct cmd_ds_bbp_reg_access {
585         __le16 action;
586         __le16 offset;
587         u8 value;
588         u8 reserved[3];
589 } __packed;
590
591 struct cmd_ds_rf_reg_access {
592         __le16 action;
593         __le16 offset;
594         u8 value;
595         u8 reserved[3];
596 } __packed;
597
598 struct cmd_ds_802_11_radio_control {
599         struct cmd_header hdr;
600
601         __le16 action;
602         __le16 control;
603 } __packed;
604
605 struct cmd_ds_802_11_beacon_control {
606         __le16 action;
607         __le16 beacon_enable;
608         __le16 beacon_period;
609 } __packed;
610
611 struct cmd_ds_802_11_sleep_params {
612         struct cmd_header hdr;
613
614         /* ACT_GET/ACT_SET */
615         __le16 action;
616
617         /* Sleep clock error in ppm */
618         __le16 error;
619
620         /* Wakeup offset in usec */
621         __le16 offset;
622
623         /* Clock stabilization time in usec */
624         __le16 stabletime;
625
626         /* control periodic calibration */
627         uint8_t calcontrol;
628
629         /* control the use of external sleep clock */
630         uint8_t externalsleepclk;
631
632         /* reserved field, should be set to zero */
633         __le16 reserved;
634 } __packed;
635
636 struct cmd_ds_802_11_rf_channel {
637         struct cmd_header hdr;
638
639         __le16 action;
640         __le16 channel;
641         __le16 rftype;      /* unused */
642         __le16 reserved;    /* unused */
643         u8 channellist[32]; /* unused */
644 } __packed;
645
646 struct cmd_ds_802_11_rssi {
647         /* weighting factor */
648         __le16 N;
649
650         __le16 reserved_0;
651         __le16 reserved_1;
652         __le16 reserved_2;
653 } __packed;
654
655 struct cmd_ds_802_11_rssi_rsp {
656         __le16 SNR;
657         __le16 noisefloor;
658         __le16 avgSNR;
659         __le16 avgnoisefloor;
660 } __packed;
661
662 struct cmd_ds_802_11_mac_address {
663         struct cmd_header hdr;
664
665         __le16 action;
666         u8 macadd[ETH_ALEN];
667 } __packed;
668
669 struct cmd_ds_802_11_rf_tx_power {
670         struct cmd_header hdr;
671
672         __le16 action;
673         __le16 curlevel;
674         s8 maxlevel;
675         s8 minlevel;
676 } __packed;
677
678 struct cmd_ds_802_11_monitor_mode {
679         __le16 action;
680         __le16 mode;
681 } __packed;
682
683 struct cmd_ds_set_boot2_ver {
684         struct cmd_header hdr;
685
686         __le16 action;
687         __le16 version;
688 } __packed;
689
690 struct cmd_ds_802_11_fw_wake_method {
691         struct cmd_header hdr;
692
693         __le16 action;
694         __le16 method;
695 } __packed;
696
697 struct cmd_ds_802_11_ps_mode {
698         __le16 action;
699         __le16 nullpktinterval;
700         __le16 multipledtim;
701         __le16 reserved;
702         __le16 locallisteninterval;
703 } __packed;
704
705 struct cmd_confirm_sleep {
706         struct cmd_header hdr;
707
708         __le16 action;
709         __le16 nullpktinterval;
710         __le16 multipledtim;
711         __le16 reserved;
712         __le16 locallisteninterval;
713 } __packed;
714
715 struct cmd_ds_802_11_data_rate {
716         struct cmd_header hdr;
717
718         __le16 action;
719         __le16 reserved;
720         u8 rates[MAX_RATES];
721 } __packed;
722
723 struct cmd_ds_802_11_rate_adapt_rateset {
724         struct cmd_header hdr;
725         __le16 action;
726         __le16 enablehwauto;
727         __le16 bitmap;
728 } __packed;
729
730 struct cmd_ds_802_11_ad_hoc_start {
731         struct cmd_header hdr;
732
733         u8 ssid[IEEE80211_MAX_SSID_LEN];
734         u8 bsstype;
735         __le16 beaconperiod;
736         u8 dtimperiod;   /* Reserved on v9 and later */
737         struct ieee_ie_ibss_param_set ibss;
738         u8 reserved1[4];
739         struct ieee_ie_ds_param_set ds;
740         u8 reserved2[4];
741         __le16 probedelay;  /* Reserved on v9 and later */
742         __le16 capability;
743         u8 rates[MAX_RATES];
744         u8 tlv_memory_size_pad[100];
745 } __packed;
746
747 struct cmd_ds_802_11_ad_hoc_result {
748         struct cmd_header hdr;
749
750         u8 pad[3];
751         u8 bssid[ETH_ALEN];
752 } __packed;
753
754 struct adhoc_bssdesc {
755         u8 bssid[ETH_ALEN];
756         u8 ssid[IEEE80211_MAX_SSID_LEN];
757         u8 type;
758         __le16 beaconperiod;
759         u8 dtimperiod;
760         __le64 timestamp;
761         __le64 localtime;
762         struct ieee_ie_ds_param_set ds;
763         u8 reserved1[4];
764         struct ieee_ie_ibss_param_set ibss;
765         u8 reserved2[4];
766         __le16 capability;
767         u8 rates[MAX_RATES];
768
769         /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
770          * Adhoc join command and will cause a binary layout mismatch with
771          * the firmware
772          */
773 } __packed;
774
775 struct cmd_ds_802_11_ad_hoc_join {
776         struct cmd_header hdr;
777
778         struct adhoc_bssdesc bss;
779         __le16 failtimeout;   /* Reserved on v9 and later */
780         __le16 probedelay;    /* Reserved on v9 and later */
781 } __packed;
782
783 struct cmd_ds_802_11_ad_hoc_stop {
784         struct cmd_header hdr;
785 } __packed;
786
787 struct cmd_ds_802_11_enable_rsn {
788         struct cmd_header hdr;
789
790         __le16 action;
791         __le16 enable;
792 } __packed;
793
794 struct MrvlIEtype_keyParamSet {
795         /* type ID */
796         __le16 type;
797
798         /* length of Payload */
799         __le16 length;
800
801         /* type of key: WEP=0, TKIP=1, AES=2 */
802         __le16 keytypeid;
803
804         /* key control Info specific to a keytypeid */
805         __le16 keyinfo;
806
807         /* length of key */
808         __le16 keylen;
809
810         /* key material of size keylen */
811         u8 key[32];
812 } __packed;
813
814 #define MAX_WOL_RULES           16
815
816 struct host_wol_rule {
817         uint8_t rule_no;
818         uint8_t rule_ops;
819         __le16 sig_offset;
820         __le16 sig_length;
821         __le16 reserve;
822         __be32 sig_mask;
823         __be32 signature;
824 } __packed;
825
826 struct wol_config {
827         uint8_t action;
828         uint8_t pattern;
829         uint8_t no_rules_in_cmd;
830         uint8_t result;
831         struct host_wol_rule rule[MAX_WOL_RULES];
832 } __packed;
833
834 struct cmd_ds_host_sleep {
835         struct cmd_header hdr;
836         __le32 criteria;
837         uint8_t gpio;
838         uint16_t gap;
839         struct wol_config wol_conf;
840 } __packed;
841
842
843
844 struct cmd_ds_802_11_key_material {
845         struct cmd_header hdr;
846
847         __le16 action;
848         struct MrvlIEtype_keyParamSet keyParamSet[2];
849 } __packed;
850
851 struct cmd_ds_802_11_eeprom_access {
852         struct cmd_header hdr;
853         __le16 action;
854         __le16 offset;
855         __le16 len;
856         /* firmware says it returns a maximum of 20 bytes */
857 #define LBS_EEPROM_READ_LEN 20
858         u8 value[LBS_EEPROM_READ_LEN];
859 } __packed;
860
861 struct cmd_ds_802_11_tpc_cfg {
862         struct cmd_header hdr;
863
864         __le16 action;
865         uint8_t enable;
866         int8_t P0;
867         int8_t P1;
868         int8_t P2;
869         uint8_t usesnr;
870 } __packed;
871
872
873 struct cmd_ds_802_11_pa_cfg {
874         struct cmd_header hdr;
875
876         __le16 action;
877         uint8_t enable;
878         int8_t P0;
879         int8_t P1;
880         int8_t P2;
881 } __packed;
882
883
884 struct cmd_ds_802_11_led_ctrl {
885         __le16 action;
886         __le16 numled;
887         u8 data[256];
888 } __packed;
889
890 struct cmd_ds_802_11_afc {
891         __le16 afc_auto;
892         union {
893                 struct {
894                         __le16 threshold;
895                         __le16 period;
896                 };
897                 struct {
898                         __le16 timing_offset; /* signed */
899                         __le16 carrier_offset; /* signed */
900                 };
901         };
902 } __packed;
903
904 struct cmd_tx_rate_query {
905         __le16 txrate;
906 } __packed;
907
908 struct cmd_ds_get_tsf {
909         __le64 tsfvalue;
910 } __packed;
911
912 struct cmd_ds_bt_access {
913         __le16 action;
914         __le32 id;
915         u8 addr1[ETH_ALEN];
916         u8 addr2[ETH_ALEN];
917 } __packed;
918
919 struct cmd_ds_fwt_access {
920         __le16 action;
921         __le32 id;
922         u8 valid;
923         u8 da[ETH_ALEN];
924         u8 dir;
925         u8 ra[ETH_ALEN];
926         __le32 ssn;
927         __le32 dsn;
928         __le32 metric;
929         u8 rate;
930         u8 hopcount;
931         u8 ttl;
932         __le32 expiration;
933         u8 sleepmode;
934         __le32 snr;
935         __le32 references;
936         u8 prec[ETH_ALEN];
937 } __packed;
938
939 struct cmd_ds_mesh_config {
940         struct cmd_header hdr;
941
942         __le16 action;
943         __le16 channel;
944         __le16 type;
945         __le16 length;
946         u8 data[128];   /* last position reserved */
947 } __packed;
948
949 struct cmd_ds_mesh_access {
950         struct cmd_header hdr;
951
952         __le16 action;
953         __le32 data[32];        /* last position reserved */
954 } __packed;
955
956 /* Number of stats counters returned by the firmware */
957 #define MESH_STATS_NUM 8
958
959 struct cmd_ds_command {
960         /* command header */
961         __le16 command;
962         __le16 size;
963         __le16 seqnum;
964         __le16 result;
965
966         /* command Body */
967         union {
968                 struct cmd_ds_802_11_ps_mode psmode;
969                 struct cmd_ds_802_11_monitor_mode monitor;
970                 struct cmd_ds_802_11_rssi rssi;
971                 struct cmd_ds_802_11_rssi_rsp rssirsp;
972                 struct cmd_ds_mac_reg_access macreg;
973                 struct cmd_ds_bbp_reg_access bbpreg;
974                 struct cmd_ds_rf_reg_access rfreg;
975
976                 struct cmd_ds_802_11d_domain_info domaininfo;
977                 struct cmd_ds_802_11d_domain_info domaininforesp;
978
979                 struct cmd_ds_802_11_tpc_cfg tpccfg;
980                 struct cmd_ds_802_11_afc afc;
981                 struct cmd_ds_802_11_led_ctrl ledgpio;
982
983                 struct cmd_ds_bt_access bt;
984                 struct cmd_ds_fwt_access fwt;
985                 struct cmd_ds_802_11_beacon_control bcn_ctrl;
986         } params;
987 } __packed;
988 #endif