]> err.no Git - linux-2.6/blob - drivers/net/wireless/libertas/hostcmd.h
libertas: kill unused wait_option field in struct cmd_ctrl_node
[linux-2.6] / drivers / net / wireless / libertas / hostcmd.h
1 /*
2  * This file contains the function prototypes, data structure
3  * and defines for all the host/station commands
4  */
5 #ifndef _LBS_HOSTCMD_H
6 #define _LBS_HOSTCMD_H
7
8 #include <linux/wireless.h>
9 #include "11d.h"
10 #include "types.h"
11
12 /* 802.11-related definitions */
13
14 /* TxPD descriptor */
15 struct txpd {
16         /* Current Tx packet status */
17         __le32 tx_status;
18         /* Tx control */
19         __le32 tx_control;
20         __le32 tx_packet_location;
21         /* Tx packet length */
22         __le16 tx_packet_length;
23         /* First 2 byte of destination MAC address */
24         u8 tx_dest_addr_high[2];
25         /* Last 4 byte of destination MAC address */
26         u8 tx_dest_addr_low[4];
27         /* Pkt Priority */
28         u8 priority;
29         /* Pkt Trasnit Power control */
30         u8 powermgmt;
31         /* Amount of time the packet has been queued in the driver (units = 2ms) */
32         u8 pktdelay_2ms;
33         /* reserved */
34         u8 reserved1;
35 };
36
37 /* RxPD Descriptor */
38 struct rxpd {
39         /* Current Rx packet status */
40         __le16 status;
41
42         /* SNR */
43         u8 snr;
44
45         /* Tx control */
46         u8 rx_control;
47
48         /* Pkt length */
49         __le16 pkt_len;
50
51         /* Noise Floor */
52         u8 nf;
53
54         /* Rx Packet Rate */
55         u8 rx_rate;
56
57         /* Pkt addr */
58         __le32 pkt_ptr;
59
60         /* Next Rx RxPD addr */
61         __le32 next_rxpd_ptr;
62
63         /* Pkt Priority */
64         u8 priority;
65         u8 reserved[3];
66 };
67
68 struct cmd_header {
69         __le16 command;
70         __le16 size;
71         __le16 seqnum;
72         __le16 result;
73 } __attribute__ ((packed));
74
75 struct cmd_ctrl_node {
76         struct list_head list;
77         /* command response */
78         void *pdata_buf;
79         int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *);
80         unsigned long callback_arg;
81         /* command data */
82         struct cmd_header *cmdbuf;
83         /* wait queue */
84         u16 cmdwaitqwoken;
85         wait_queue_head_t cmdwait_q;
86 };
87
88 /* Generic structure to hold all key types. */
89 struct enc_key {
90         u16 len;
91         u16 flags;  /* KEY_INFO_* from defs.h */
92         u16 type; /* KEY_TYPE_* from defs.h */
93         u8 key[32];
94 };
95
96 /* lbs_offset_value */
97 struct lbs_offset_value {
98         u32 offset;
99         u32 value;
100 };
101
102 /* Define general data structure */
103 /* cmd_DS_GEN */
104 struct cmd_ds_gen {
105         __le16 command;
106         __le16 size;
107         __le16 seqnum;
108         __le16 result;
109         void *cmdresp[0];
110 };
111
112 #define S_DS_GEN sizeof(struct cmd_ds_gen)
113
114
115 /*
116  * Define data structure for CMD_GET_HW_SPEC
117  * This structure defines the response for the GET_HW_SPEC command
118  */
119 struct cmd_ds_get_hw_spec {
120         struct cmd_header hdr;
121
122         /* HW Interface version number */
123         __le16 hwifversion;
124         /* HW version number */
125         __le16 version;
126         /* Max number of TxPD FW can handle */
127         __le16 nr_txpd;
128         /* Max no of Multicast address */
129         __le16 nr_mcast_adr;
130         /* MAC address */
131         u8 permanentaddr[6];
132
133         /* region Code */
134         __le16 regioncode;
135
136         /* Number of antenna used */
137         __le16 nr_antenna;
138
139         /* FW release number, example 1,2,3,4 = 3.2.1p4 */
140         u8 fwreleasenumber[4];
141
142         /* Base Address of TxPD queue */
143         __le32 wcb_base;
144         /* Read Pointer of RxPd queue */
145         __le32 rxpd_rdptr;
146
147         /* Write Pointer of RxPd queue */
148         __le32 rxpd_wrptr;
149
150         /*FW/HW capability */
151         __le32 fwcapinfo;
152 } __attribute__ ((packed));
153
154 struct cmd_ds_802_11_reset {
155         __le16 action;
156 };
157
158 struct cmd_ds_802_11_subscribe_event {
159         __le16 action;
160         __le16 events;
161
162         /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
163          * number of TLVs. From the v5.1 manual, those TLVs would add up to
164          * 40 bytes. However, future firmware might add additional TLVs, so I
165          * bump this up a bit.
166          */
167         u8 tlv[128];
168 };
169
170 /*
171  * This scan handle Country Information IE(802.11d compliant)
172  * Define data structure for CMD_802_11_SCAN
173  */
174 struct cmd_ds_802_11_scan {
175         u8 bsstype;
176         u8 bssid[ETH_ALEN];
177         u8 tlvbuffer[1];
178 #if 0
179         mrvlietypes_ssidparamset_t ssidParamSet;
180         mrvlietypes_chanlistparamset_t ChanListParamSet;
181         mrvlietypes_ratesparamset_t OpRateSet;
182 #endif
183 };
184
185 struct cmd_ds_802_11_scan_rsp {
186         __le16 bssdescriptsize;
187         u8 nr_sets;
188         u8 bssdesc_and_tlvbuffer[1];
189 };
190
191 struct cmd_ds_802_11_get_log {
192         __le32 mcasttxframe;
193         __le32 failed;
194         __le32 retry;
195         __le32 multiretry;
196         __le32 framedup;
197         __le32 rtssuccess;
198         __le32 rtsfailure;
199         __le32 ackfailure;
200         __le32 rxfrag;
201         __le32 mcastrxframe;
202         __le32 fcserror;
203         __le32 txframe;
204         __le32 wepundecryptable;
205 };
206
207 struct cmd_ds_mac_control {
208         __le16 action;
209         __le16 reserved;
210 };
211
212 struct cmd_ds_mac_multicast_adr {
213         __le16 action;
214         __le16 nr_of_adrs;
215         u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
216 };
217
218 struct cmd_ds_802_11_authenticate {
219         u8 macaddr[ETH_ALEN];
220         u8 authtype;
221         u8 reserved[10];
222 };
223
224 struct cmd_ds_802_11_deauthenticate {
225         u8 macaddr[6];
226         __le16 reasoncode;
227 };
228
229 struct cmd_ds_802_11_associate {
230         u8 peerstaaddr[6];
231         __le16 capability;
232         __le16 listeninterval;
233         __le16 bcnperiod;
234         u8 dtimperiod;
235
236 #if 0
237         mrvlietypes_ssidparamset_t ssidParamSet;
238         mrvlietypes_phyparamset_t phyparamset;
239         mrvlietypes_ssparamset_t ssparamset;
240         mrvlietypes_ratesparamset_t ratesParamSet;
241 #endif
242 } __attribute__ ((packed));
243
244 struct cmd_ds_802_11_disassociate {
245         u8 destmacaddr[6];
246         __le16 reasoncode;
247 };
248
249 struct cmd_ds_802_11_associate_rsp {
250         struct ieeetypes_assocrsp assocRsp;
251 };
252
253 struct cmd_ds_802_11_ad_hoc_result {
254         u8 pad[3];
255         u8 bssid[ETH_ALEN];
256 };
257
258 struct cmd_ds_802_11_set_wep {
259         /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
260         __le16 action;
261
262         /* key Index selected for Tx */
263         __le16 keyindex;
264
265         /* 40, 128bit or TXWEP */
266         u8 keytype[4];
267         u8 keymaterial[4][16];
268 };
269
270 struct cmd_ds_802_3_get_stat {
271         __le32 xmitok;
272         __le32 rcvok;
273         __le32 xmiterror;
274         __le32 rcverror;
275         __le32 rcvnobuffer;
276         __le32 rcvcrcerror;
277 };
278
279 struct cmd_ds_802_11_get_stat {
280         __le32 txfragmentcnt;
281         __le32 mcasttxframecnt;
282         __le32 failedcnt;
283         __le32 retrycnt;
284         __le32 Multipleretrycnt;
285         __le32 rtssuccesscnt;
286         __le32 rtsfailurecnt;
287         __le32 ackfailurecnt;
288         __le32 frameduplicatecnt;
289         __le32 rxfragmentcnt;
290         __le32 mcastrxframecnt;
291         __le32 fcserrorcnt;
292         __le32 bcasttxframecnt;
293         __le32 bcastrxframecnt;
294         __le32 txbeacon;
295         __le32 rxbeacon;
296         __le32 wepundecryptable;
297 };
298
299 struct cmd_ds_802_11_snmp_mib {
300         __le16 querytype;
301         __le16 oid;
302         __le16 bufsize;
303         u8 value[128];
304 };
305
306 struct cmd_ds_mac_reg_map {
307         __le16 buffersize;
308         u8 regmap[128];
309         __le16 reserved;
310 };
311
312 struct cmd_ds_bbp_reg_map {
313         __le16 buffersize;
314         u8 regmap[128];
315         __le16 reserved;
316 };
317
318 struct cmd_ds_rf_reg_map {
319         __le16 buffersize;
320         u8 regmap[64];
321         __le16 reserved;
322 };
323
324 struct cmd_ds_mac_reg_access {
325         __le16 action;
326         __le16 offset;
327         __le32 value;
328 };
329
330 struct cmd_ds_bbp_reg_access {
331         __le16 action;
332         __le16 offset;
333         u8 value;
334         u8 reserved[3];
335 };
336
337 struct cmd_ds_rf_reg_access {
338         __le16 action;
339         __le16 offset;
340         u8 value;
341         u8 reserved[3];
342 };
343
344 struct cmd_ds_802_11_radio_control {
345         __le16 action;
346         __le16 control;
347 };
348
349 struct cmd_ds_802_11_beacon_control {
350         __le16 action;
351         __le16 beacon_enable;
352         __le16 beacon_period;
353 };
354
355 struct cmd_ds_802_11_sleep_params {
356         /* ACT_GET/ACT_SET */
357         __le16 action;
358
359         /* Sleep clock error in ppm */
360         __le16 error;
361
362         /* Wakeup offset in usec */
363         __le16 offset;
364
365         /* Clock stabilization time in usec */
366         __le16 stabletime;
367
368         /* control periodic calibration */
369         u8 calcontrol;
370
371         /* control the use of external sleep clock */
372         u8 externalsleepclk;
373
374         /* reserved field, should be set to zero */
375         __le16 reserved;
376 };
377
378 struct cmd_ds_802_11_inactivity_timeout {
379         /* ACT_GET/ACT_SET */
380         __le16 action;
381
382         /* Inactivity timeout in msec */
383         __le16 timeout;
384 };
385
386 struct cmd_ds_802_11_rf_channel {
387         struct cmd_header hdr;
388
389         __le16 action;
390         __le16 channel;
391         __le16 rftype;      /* unused */
392         __le16 reserved;    /* unused */
393         u8 channellist[32]; /* unused */
394 };
395
396 struct cmd_ds_802_11_rssi {
397         /* weighting factor */
398         __le16 N;
399
400         __le16 reserved_0;
401         __le16 reserved_1;
402         __le16 reserved_2;
403 };
404
405 struct cmd_ds_802_11_rssi_rsp {
406         __le16 SNR;
407         __le16 noisefloor;
408         __le16 avgSNR;
409         __le16 avgnoisefloor;
410 };
411
412 struct cmd_ds_802_11_mac_address {
413         __le16 action;
414         u8 macadd[ETH_ALEN];
415 };
416
417 struct cmd_ds_802_11_rf_tx_power {
418         __le16 action;
419         __le16 currentlevel;
420 };
421
422 struct cmd_ds_802_11_rf_antenna {
423         __le16 action;
424
425         /* Number of antennas or 0xffff(diversity) */
426         __le16 antennamode;
427
428 };
429
430 struct cmd_ds_802_11_monitor_mode {
431         __le16 action;
432         __le16 mode;
433 };
434
435 struct cmd_ds_set_boot2_ver {
436         struct cmd_header hdr;
437
438         __le16 action;
439         __le16 version;
440 };
441
442 struct cmd_ds_802_11_ps_mode {
443         __le16 action;
444         __le16 nullpktinterval;
445         __le16 multipledtim;
446         __le16 reserved;
447         __le16 locallisteninterval;
448 };
449
450 struct PS_CMD_ConfirmSleep {
451         __le16 command;
452         __le16 size;
453         __le16 seqnum;
454         __le16 result;
455
456         __le16 action;
457         __le16 reserved1;
458         __le16 multipledtim;
459         __le16 reserved;
460         __le16 locallisteninterval;
461 };
462
463 struct cmd_ds_802_11_data_rate {
464         struct cmd_header hdr;
465
466         __le16 action;
467         __le16 reserved;
468         u8 rates[MAX_RATES];
469 };
470
471 struct cmd_ds_802_11_rate_adapt_rateset {
472         __le16 action;
473         __le16 enablehwauto;
474         __le16 bitmap;
475 };
476
477 struct cmd_ds_802_11_ad_hoc_start {
478         u8 ssid[IW_ESSID_MAX_SIZE];
479         u8 bsstype;
480         __le16 beaconperiod;
481         u8 dtimperiod;
482         union IEEEtypes_ssparamset ssparamset;
483         union ieeetypes_phyparamset phyparamset;
484         __le16 probedelay;
485         __le16 capability;
486         u8 rates[MAX_RATES];
487         u8 tlv_memory_size_pad[100];
488 } __attribute__ ((packed));
489
490 struct adhoc_bssdesc {
491         u8 bssid[6];
492         u8 ssid[32];
493         u8 type;
494         __le16 beaconperiod;
495         u8 dtimperiod;
496         __le64 timestamp;
497         __le64 localtime;
498         union ieeetypes_phyparamset phyparamset;
499         union IEEEtypes_ssparamset ssparamset;
500         __le16 capability;
501         u8 rates[MAX_RATES];
502
503         /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
504          * Adhoc join command and will cause a binary layout mismatch with
505          * the firmware
506          */
507 } __attribute__ ((packed));
508
509 struct cmd_ds_802_11_ad_hoc_join {
510         struct adhoc_bssdesc bss;
511         __le16 failtimeout;
512         __le16 probedelay;
513
514 } __attribute__ ((packed));
515
516 struct cmd_ds_802_11_enable_rsn {
517         __le16 action;
518         __le16 enable;
519 } __attribute__ ((packed));
520
521 struct MrvlIEtype_keyParamSet {
522         /* type ID */
523         __le16 type;
524
525         /* length of Payload */
526         __le16 length;
527
528         /* type of key: WEP=0, TKIP=1, AES=2 */
529         __le16 keytypeid;
530
531         /* key control Info specific to a keytypeid */
532         __le16 keyinfo;
533
534         /* length of key */
535         __le16 keylen;
536
537         /* key material of size keylen */
538         u8 key[32];
539 };
540
541 struct cmd_ds_host_sleep {
542         struct cmd_header hdr;
543         __le32 criteria;
544         uint8_t gpio;
545         uint8_t gap;
546 } __attribute__ ((packed));
547
548 struct cmd_ds_802_11_key_material {
549         __le16 action;
550         struct MrvlIEtype_keyParamSet keyParamSet[2];
551 } __attribute__ ((packed));
552
553 struct cmd_ds_802_11_eeprom_access {
554         __le16 action;
555
556         /* multiple 4 */
557         __le16 offset;
558         __le16 bytecount;
559         u8 value;
560 } __attribute__ ((packed));
561
562 struct cmd_ds_802_11_tpc_cfg {
563         __le16 action;
564         u8 enable;
565         s8 P0;
566         s8 P1;
567         s8 P2;
568         u8 usesnr;
569 } __attribute__ ((packed));
570
571 struct cmd_ds_802_11_led_ctrl {
572         __le16 action;
573         __le16 numled;
574         u8 data[256];
575 } __attribute__ ((packed));
576
577 struct cmd_ds_802_11_pwr_cfg {
578         __le16 action;
579         u8 enable;
580         s8 PA_P0;
581         s8 PA_P1;
582         s8 PA_P2;
583 } __attribute__ ((packed));
584
585 struct cmd_ds_802_11_afc {
586         __le16 afc_auto;
587         union {
588                 struct {
589                         __le16 threshold;
590                         __le16 period;
591                 };
592                 struct {
593                         __le16 timing_offset; /* signed */
594                         __le16 carrier_offset; /* signed */
595                 };
596         };
597 } __attribute__ ((packed));
598
599 struct cmd_tx_rate_query {
600         __le16 txrate;
601 } __attribute__ ((packed));
602
603 struct cmd_ds_get_tsf {
604         __le64 tsfvalue;
605 } __attribute__ ((packed));
606
607 struct cmd_ds_bt_access {
608         __le16 action;
609         __le32 id;
610         u8 addr1[ETH_ALEN];
611         u8 addr2[ETH_ALEN];
612 } __attribute__ ((packed));
613
614 struct cmd_ds_fwt_access {
615         __le16 action;
616         __le32 id;
617         u8 valid;
618         u8 da[ETH_ALEN];
619         u8 dir;
620         u8 ra[ETH_ALEN];
621         __le32 ssn;
622         __le32 dsn;
623         __le32 metric;
624         u8 rate;
625         u8 hopcount;
626         u8 ttl;
627         __le32 expiration;
628         u8 sleepmode;
629         __le32 snr;
630         __le32 references;
631         u8 prec[ETH_ALEN];
632 } __attribute__ ((packed));
633
634
635 struct cmd_ds_mesh_config {
636         struct cmd_header hdr;
637
638         __le16 action;
639         __le16 channel;
640         __le16 type;
641         __le16 length;
642         u8 data[128];   /* last position reserved */
643 } __attribute__ ((packed));
644
645
646 struct cmd_ds_mesh_access {
647         struct cmd_header hdr;
648
649         __le16 action;
650         __le32 data[32];        /* last position reserved */
651 } __attribute__ ((packed));
652
653 /* Number of stats counters returned by the firmware */
654 #define MESH_STATS_NUM 8
655
656 struct cmd_ds_command {
657         /* command header */
658         __le16 command;
659         __le16 size;
660         __le16 seqnum;
661         __le16 result;
662
663         /* command Body */
664         union {
665                 struct cmd_ds_802_11_ps_mode psmode;
666                 struct cmd_ds_802_11_scan scan;
667                 struct cmd_ds_802_11_scan_rsp scanresp;
668                 struct cmd_ds_mac_control macctrl;
669                 struct cmd_ds_802_11_associate associate;
670                 struct cmd_ds_802_11_deauthenticate deauth;
671                 struct cmd_ds_802_11_set_wep wep;
672                 struct cmd_ds_802_11_ad_hoc_start ads;
673                 struct cmd_ds_802_11_reset reset;
674                 struct cmd_ds_802_11_ad_hoc_result result;
675                 struct cmd_ds_802_11_get_log glog;
676                 struct cmd_ds_802_11_authenticate auth;
677                 struct cmd_ds_802_11_get_stat gstat;
678                 struct cmd_ds_802_3_get_stat gstat_8023;
679                 struct cmd_ds_802_11_snmp_mib smib;
680                 struct cmd_ds_802_11_rf_tx_power txp;
681                 struct cmd_ds_802_11_rf_antenna rant;
682                 struct cmd_ds_802_11_monitor_mode monitor;
683                 struct cmd_ds_802_11_rate_adapt_rateset rateset;
684                 struct cmd_ds_mac_multicast_adr madr;
685                 struct cmd_ds_802_11_ad_hoc_join adj;
686                 struct cmd_ds_802_11_radio_control radio;
687                 struct cmd_ds_802_11_rf_channel rfchannel;
688                 struct cmd_ds_802_11_rssi rssi;
689                 struct cmd_ds_802_11_rssi_rsp rssirsp;
690                 struct cmd_ds_802_11_disassociate dassociate;
691                 struct cmd_ds_802_11_mac_address macadd;
692                 struct cmd_ds_802_11_enable_rsn enbrsn;
693                 struct cmd_ds_802_11_key_material keymaterial;
694                 struct cmd_ds_mac_reg_access macreg;
695                 struct cmd_ds_bbp_reg_access bbpreg;
696                 struct cmd_ds_rf_reg_access rfreg;
697                 struct cmd_ds_802_11_eeprom_access rdeeprom;
698
699                 struct cmd_ds_802_11d_domain_info domaininfo;
700                 struct cmd_ds_802_11d_domain_info domaininforesp;
701
702                 struct cmd_ds_802_11_sleep_params sleep_params;
703                 struct cmd_ds_802_11_inactivity_timeout inactivity_timeout;
704                 struct cmd_ds_802_11_tpc_cfg tpccfg;
705                 struct cmd_ds_802_11_pwr_cfg pwrcfg;
706                 struct cmd_ds_802_11_afc afc;
707                 struct cmd_ds_802_11_led_ctrl ledgpio;
708
709                 struct cmd_tx_rate_query txrate;
710                 struct cmd_ds_bt_access bt;
711                 struct cmd_ds_fwt_access fwt;
712                 struct cmd_ds_get_tsf gettsf;
713                 struct cmd_ds_802_11_subscribe_event subscribe_event;
714                 struct cmd_ds_802_11_beacon_control bcn_ctrl;
715         } params;
716 } __attribute__ ((packed));
717
718 #endif