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