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