]> err.no Git - linux-2.6/blob - drivers/net/wireless/libertas/hostcmd.h
libertas: convert SET_WEP to a direct command
[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         int result;
78         /* command response */
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         struct cmd_header hdr;
260
261         /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
262         __le16 action;
263
264         /* key Index selected for Tx */
265         __le16 keyindex;
266
267         /* 40, 128bit or TXWEP */
268         uint8_t keytype[4];
269         uint8_t keymaterial[4][16];
270 };
271
272 struct cmd_ds_802_3_get_stat {
273         __le32 xmitok;
274         __le32 rcvok;
275         __le32 xmiterror;
276         __le32 rcverror;
277         __le32 rcvnobuffer;
278         __le32 rcvcrcerror;
279 };
280
281 struct cmd_ds_802_11_get_stat {
282         __le32 txfragmentcnt;
283         __le32 mcasttxframecnt;
284         __le32 failedcnt;
285         __le32 retrycnt;
286         __le32 Multipleretrycnt;
287         __le32 rtssuccesscnt;
288         __le32 rtsfailurecnt;
289         __le32 ackfailurecnt;
290         __le32 frameduplicatecnt;
291         __le32 rxfragmentcnt;
292         __le32 mcastrxframecnt;
293         __le32 fcserrorcnt;
294         __le32 bcasttxframecnt;
295         __le32 bcastrxframecnt;
296         __le32 txbeacon;
297         __le32 rxbeacon;
298         __le32 wepundecryptable;
299 };
300
301 struct cmd_ds_802_11_snmp_mib {
302         __le16 querytype;
303         __le16 oid;
304         __le16 bufsize;
305         u8 value[128];
306 };
307
308 struct cmd_ds_mac_reg_map {
309         __le16 buffersize;
310         u8 regmap[128];
311         __le16 reserved;
312 };
313
314 struct cmd_ds_bbp_reg_map {
315         __le16 buffersize;
316         u8 regmap[128];
317         __le16 reserved;
318 };
319
320 struct cmd_ds_rf_reg_map {
321         __le16 buffersize;
322         u8 regmap[64];
323         __le16 reserved;
324 };
325
326 struct cmd_ds_mac_reg_access {
327         __le16 action;
328         __le16 offset;
329         __le32 value;
330 };
331
332 struct cmd_ds_bbp_reg_access {
333         __le16 action;
334         __le16 offset;
335         u8 value;
336         u8 reserved[3];
337 };
338
339 struct cmd_ds_rf_reg_access {
340         __le16 action;
341         __le16 offset;
342         u8 value;
343         u8 reserved[3];
344 };
345
346 struct cmd_ds_802_11_radio_control {
347         struct cmd_header hdr;
348
349         __le16 action;
350         __le16 control;
351 };
352
353 struct cmd_ds_802_11_beacon_control {
354         __le16 action;
355         __le16 beacon_enable;
356         __le16 beacon_period;
357 };
358
359 struct cmd_ds_802_11_sleep_params {
360         struct cmd_header hdr;
361
362         /* ACT_GET/ACT_SET */
363         __le16 action;
364
365         /* Sleep clock error in ppm */
366         __le16 error;
367
368         /* Wakeup offset in usec */
369         __le16 offset;
370
371         /* Clock stabilization time in usec */
372         __le16 stabletime;
373
374         /* control periodic calibration */
375         uint8_t calcontrol;
376
377         /* control the use of external sleep clock */
378         uint8_t externalsleepclk;
379
380         /* reserved field, should be set to zero */
381         __le16 reserved;
382 };
383
384 struct cmd_ds_802_11_inactivity_timeout {
385         struct cmd_header hdr;
386
387         /* ACT_GET/ACT_SET */
388         __le16 action;
389
390         /* Inactivity timeout in msec */
391         __le16 timeout;
392 };
393
394 struct cmd_ds_802_11_rf_channel {
395         struct cmd_header hdr;
396
397         __le16 action;
398         __le16 channel;
399         __le16 rftype;      /* unused */
400         __le16 reserved;    /* unused */
401         u8 channellist[32]; /* unused */
402 };
403
404 struct cmd_ds_802_11_rssi {
405         /* weighting factor */
406         __le16 N;
407
408         __le16 reserved_0;
409         __le16 reserved_1;
410         __le16 reserved_2;
411 };
412
413 struct cmd_ds_802_11_rssi_rsp {
414         __le16 SNR;
415         __le16 noisefloor;
416         __le16 avgSNR;
417         __le16 avgnoisefloor;
418 };
419
420 struct cmd_ds_802_11_mac_address {
421         __le16 action;
422         u8 macadd[ETH_ALEN];
423 };
424
425 struct cmd_ds_802_11_rf_tx_power {
426         __le16 action;
427         __le16 currentlevel;
428 };
429
430 struct cmd_ds_802_11_rf_antenna {
431         __le16 action;
432
433         /* Number of antennas or 0xffff(diversity) */
434         __le16 antennamode;
435
436 };
437
438 struct cmd_ds_802_11_monitor_mode {
439         __le16 action;
440         __le16 mode;
441 };
442
443 struct cmd_ds_set_boot2_ver {
444         struct cmd_header hdr;
445
446         __le16 action;
447         __le16 version;
448 };
449
450 struct cmd_ds_802_11_fw_wake_method {
451         struct cmd_header hdr;
452
453         __le16 action;
454         __le16 method;
455 };
456
457 struct cmd_ds_802_11_sleep_period {
458         struct cmd_header hdr;
459
460         __le16 action;
461         __le16 period;
462 };
463
464 struct cmd_ds_802_11_ps_mode {
465         __le16 action;
466         __le16 nullpktinterval;
467         __le16 multipledtim;
468         __le16 reserved;
469         __le16 locallisteninterval;
470 };
471
472 struct PS_CMD_ConfirmSleep {
473         __le16 command;
474         __le16 size;
475         __le16 seqnum;
476         __le16 result;
477
478         __le16 action;
479         __le16 reserved1;
480         __le16 multipledtim;
481         __le16 reserved;
482         __le16 locallisteninterval;
483 };
484
485 struct cmd_ds_802_11_data_rate {
486         struct cmd_header hdr;
487
488         __le16 action;
489         __le16 reserved;
490         u8 rates[MAX_RATES];
491 };
492
493 struct cmd_ds_802_11_rate_adapt_rateset {
494         __le16 action;
495         __le16 enablehwauto;
496         __le16 bitmap;
497 };
498
499 struct cmd_ds_802_11_ad_hoc_start {
500         u8 ssid[IW_ESSID_MAX_SIZE];
501         u8 bsstype;
502         __le16 beaconperiod;
503         u8 dtimperiod;
504         union IEEEtypes_ssparamset ssparamset;
505         union ieeetypes_phyparamset phyparamset;
506         __le16 probedelay;
507         __le16 capability;
508         u8 rates[MAX_RATES];
509         u8 tlv_memory_size_pad[100];
510 } __attribute__ ((packed));
511
512 struct adhoc_bssdesc {
513         u8 bssid[6];
514         u8 ssid[32];
515         u8 type;
516         __le16 beaconperiod;
517         u8 dtimperiod;
518         __le64 timestamp;
519         __le64 localtime;
520         union ieeetypes_phyparamset phyparamset;
521         union IEEEtypes_ssparamset ssparamset;
522         __le16 capability;
523         u8 rates[MAX_RATES];
524
525         /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
526          * Adhoc join command and will cause a binary layout mismatch with
527          * the firmware
528          */
529 } __attribute__ ((packed));
530
531 struct cmd_ds_802_11_ad_hoc_join {
532         struct adhoc_bssdesc bss;
533         __le16 failtimeout;
534         __le16 probedelay;
535
536 } __attribute__ ((packed));
537
538 struct cmd_ds_802_11_enable_rsn {
539         __le16 action;
540         __le16 enable;
541 } __attribute__ ((packed));
542
543 struct MrvlIEtype_keyParamSet {
544         /* type ID */
545         __le16 type;
546
547         /* length of Payload */
548         __le16 length;
549
550         /* type of key: WEP=0, TKIP=1, AES=2 */
551         __le16 keytypeid;
552
553         /* key control Info specific to a keytypeid */
554         __le16 keyinfo;
555
556         /* length of key */
557         __le16 keylen;
558
559         /* key material of size keylen */
560         u8 key[32];
561 };
562
563 struct cmd_ds_host_sleep {
564         struct cmd_header hdr;
565         __le32 criteria;
566         uint8_t gpio;
567         uint8_t gap;
568 } __attribute__ ((packed));
569
570 struct cmd_ds_802_11_key_material {
571         __le16 action;
572         struct MrvlIEtype_keyParamSet keyParamSet[2];
573 } __attribute__ ((packed));
574
575 struct cmd_ds_802_11_eeprom_access {
576         __le16 action;
577
578         /* multiple 4 */
579         __le16 offset;
580         __le16 bytecount;
581         u8 value;
582 } __attribute__ ((packed));
583
584 struct cmd_ds_802_11_tpc_cfg {
585         __le16 action;
586         u8 enable;
587         s8 P0;
588         s8 P1;
589         s8 P2;
590         u8 usesnr;
591 } __attribute__ ((packed));
592
593 struct cmd_ds_802_11_led_ctrl {
594         __le16 action;
595         __le16 numled;
596         u8 data[256];
597 } __attribute__ ((packed));
598
599 struct cmd_ds_802_11_pwr_cfg {
600         __le16 action;
601         u8 enable;
602         s8 PA_P0;
603         s8 PA_P1;
604         s8 PA_P2;
605 } __attribute__ ((packed));
606
607 struct cmd_ds_802_11_afc {
608         __le16 afc_auto;
609         union {
610                 struct {
611                         __le16 threshold;
612                         __le16 period;
613                 };
614                 struct {
615                         __le16 timing_offset; /* signed */
616                         __le16 carrier_offset; /* signed */
617                 };
618         };
619 } __attribute__ ((packed));
620
621 struct cmd_tx_rate_query {
622         __le16 txrate;
623 } __attribute__ ((packed));
624
625 struct cmd_ds_get_tsf {
626         __le64 tsfvalue;
627 } __attribute__ ((packed));
628
629 struct cmd_ds_bt_access {
630         __le16 action;
631         __le32 id;
632         u8 addr1[ETH_ALEN];
633         u8 addr2[ETH_ALEN];
634 } __attribute__ ((packed));
635
636 struct cmd_ds_fwt_access {
637         __le16 action;
638         __le32 id;
639         u8 valid;
640         u8 da[ETH_ALEN];
641         u8 dir;
642         u8 ra[ETH_ALEN];
643         __le32 ssn;
644         __le32 dsn;
645         __le32 metric;
646         u8 rate;
647         u8 hopcount;
648         u8 ttl;
649         __le32 expiration;
650         u8 sleepmode;
651         __le32 snr;
652         __le32 references;
653         u8 prec[ETH_ALEN];
654 } __attribute__ ((packed));
655
656
657 struct cmd_ds_mesh_config {
658         struct cmd_header hdr;
659
660         __le16 action;
661         __le16 channel;
662         __le16 type;
663         __le16 length;
664         u8 data[128];   /* last position reserved */
665 } __attribute__ ((packed));
666
667
668 struct cmd_ds_mesh_access {
669         struct cmd_header hdr;
670
671         __le16 action;
672         __le32 data[32];        /* last position reserved */
673 } __attribute__ ((packed));
674
675 /* Number of stats counters returned by the firmware */
676 #define MESH_STATS_NUM 8
677
678 struct cmd_ds_command {
679         /* command header */
680         __le16 command;
681         __le16 size;
682         __le16 seqnum;
683         __le16 result;
684
685         /* command Body */
686         union {
687                 struct cmd_ds_802_11_ps_mode psmode;
688                 struct cmd_ds_802_11_scan scan;
689                 struct cmd_ds_802_11_scan_rsp scanresp;
690                 struct cmd_ds_mac_control macctrl;
691                 struct cmd_ds_802_11_associate associate;
692                 struct cmd_ds_802_11_deauthenticate deauth;
693                 struct cmd_ds_802_11_ad_hoc_start ads;
694                 struct cmd_ds_802_11_reset reset;
695                 struct cmd_ds_802_11_ad_hoc_result result;
696                 struct cmd_ds_802_11_get_log glog;
697                 struct cmd_ds_802_11_authenticate auth;
698                 struct cmd_ds_802_11_get_stat gstat;
699                 struct cmd_ds_802_3_get_stat gstat_8023;
700                 struct cmd_ds_802_11_snmp_mib smib;
701                 struct cmd_ds_802_11_rf_tx_power txp;
702                 struct cmd_ds_802_11_rf_antenna rant;
703                 struct cmd_ds_802_11_monitor_mode monitor;
704                 struct cmd_ds_802_11_rate_adapt_rateset rateset;
705                 struct cmd_ds_mac_multicast_adr madr;
706                 struct cmd_ds_802_11_ad_hoc_join adj;
707                 struct cmd_ds_802_11_rssi rssi;
708                 struct cmd_ds_802_11_rssi_rsp rssirsp;
709                 struct cmd_ds_802_11_disassociate dassociate;
710                 struct cmd_ds_802_11_mac_address macadd;
711                 struct cmd_ds_802_11_enable_rsn enbrsn;
712                 struct cmd_ds_802_11_key_material keymaterial;
713                 struct cmd_ds_mac_reg_access macreg;
714                 struct cmd_ds_bbp_reg_access bbpreg;
715                 struct cmd_ds_rf_reg_access rfreg;
716                 struct cmd_ds_802_11_eeprom_access rdeeprom;
717
718                 struct cmd_ds_802_11d_domain_info domaininfo;
719                 struct cmd_ds_802_11d_domain_info domaininforesp;
720
721                 struct cmd_ds_802_11_tpc_cfg tpccfg;
722                 struct cmd_ds_802_11_pwr_cfg pwrcfg;
723                 struct cmd_ds_802_11_afc afc;
724                 struct cmd_ds_802_11_led_ctrl ledgpio;
725
726                 struct cmd_tx_rate_query txrate;
727                 struct cmd_ds_bt_access bt;
728                 struct cmd_ds_fwt_access fwt;
729                 struct cmd_ds_get_tsf gettsf;
730                 struct cmd_ds_802_11_subscribe_event subscribe_event;
731                 struct cmd_ds_802_11_beacon_control bcn_ctrl;
732         } params;
733 } __attribute__ ((packed));
734
735 #endif