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