libertas: clean up direct command handling
[linux-2.6/sactl.git] / drivers / net / wireless / libertas / hostcmd.h
blob93ac46a05c54db724e5a5e3330823cacf35eac45
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
8 #include <linux/wireless.h>
9 #include "11d.h"
10 #include "types.h"
12 /* 802.11-related definitions */
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;
37 /* RxPD Descriptor */
38 struct rxpd {
39 /* Current Rx packet status */
40 __le16 status;
42 /* SNR */
43 u8 snr;
45 /* Tx control */
46 u8 rx_control;
48 /* Pkt length */
49 __le16 pkt_len;
51 /* Noise Floor */
52 u8 nf;
54 /* Rx Packet Rate */
55 u8 rx_rate;
57 /* Pkt addr */
58 __le32 pkt_ptr;
60 /* Next Rx RxPD addr */
61 __le32 next_rxpd_ptr;
63 /* Pkt Priority */
64 u8 priority;
65 u8 reserved[3];
68 struct cmd_header {
69 __le16 command;
70 __le16 size;
71 __le16 seqnum;
72 __le16 result;
73 } __attribute__ ((packed));
75 struct cmd_ctrl_node {
76 struct list_head list;
77 /* wait for finish or not */
78 u16 wait_option;
79 /* command response */
80 void *pdata_buf;
81 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *);
82 unsigned long callback_arg;
83 /* command data */
84 u8 *bufvirtualaddr;
85 /* wait queue */
86 u16 cmdwaitqwoken;
87 wait_queue_head_t cmdwait_q;
90 /* Generic structure to hold all key types. */
91 struct enc_key {
92 u16 len;
93 u16 flags; /* KEY_INFO_* from defs.h */
94 u16 type; /* KEY_TYPE_* from defs.h */
95 u8 key[32];
98 /* lbs_offset_value */
99 struct lbs_offset_value {
100 u32 offset;
101 u32 value;
104 /* Define general data structure */
105 /* cmd_DS_GEN */
106 struct cmd_ds_gen {
107 __le16 command;
108 __le16 size;
109 __le16 seqnum;
110 __le16 result;
111 void *cmdresp[0];
114 #define S_DS_GEN sizeof(struct cmd_ds_gen)
118 * Define data structure for CMD_GET_HW_SPEC
119 * This structure defines the response for the GET_HW_SPEC command
121 struct cmd_ds_get_hw_spec {
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];
133 /* region Code */
134 __le16 regioncode;
136 /* Number of antenna used */
137 __le16 nr_antenna;
139 /* FW release number, example 1,2,3,4 = 3.2.1p4 */
140 u8 fwreleasenumber[4];
142 /* Base Address of TxPD queue */
143 __le32 wcb_base;
144 /* Read Pointer of RxPd queue */
145 __le32 rxpd_rdptr;
147 /* Write Pointer of RxPd queue */
148 __le32 rxpd_wrptr;
150 /*FW/HW capability */
151 __le32 fwcapinfo;
152 } __attribute__ ((packed));
154 struct cmd_ds_802_11_reset {
155 __le16 action;
158 struct cmd_ds_802_11_subscribe_event {
159 __le16 action;
160 __le16 events;
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.
167 u8 tlv[128];
171 * This scan handle Country Information IE(802.11d compliant)
172 * Define data structure for CMD_802_11_SCAN
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
185 struct cmd_ds_802_11_scan_rsp {
186 __le16 bssdescriptsize;
187 u8 nr_sets;
188 u8 bssdesc_and_tlvbuffer[1];
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;
207 struct cmd_ds_mac_control {
208 __le16 action;
209 __le16 reserved;
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];
218 struct cmd_ds_802_11_authenticate {
219 u8 macaddr[ETH_ALEN];
220 u8 authtype;
221 u8 reserved[10];
224 struct cmd_ds_802_11_deauthenticate {
225 u8 macaddr[6];
226 __le16 reasoncode;
229 struct cmd_ds_802_11_associate {
230 u8 peerstaaddr[6];
231 __le16 capability;
232 __le16 listeninterval;
233 __le16 bcnperiod;
234 u8 dtimperiod;
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));
244 struct cmd_ds_802_11_disassociate {
245 u8 destmacaddr[6];
246 __le16 reasoncode;
249 struct cmd_ds_802_11_associate_rsp {
250 struct ieeetypes_assocrsp assocRsp;
253 struct cmd_ds_802_11_ad_hoc_result {
254 u8 pad[3];
255 u8 bssid[ETH_ALEN];
258 struct cmd_ds_802_11_set_wep {
259 /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
260 __le16 action;
262 /* key Index selected for Tx */
263 __le16 keyindex;
265 /* 40, 128bit or TXWEP */
266 u8 keytype[4];
267 u8 keymaterial[4][16];
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;
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;
299 struct cmd_ds_802_11_snmp_mib {
300 __le16 querytype;
301 __le16 oid;
302 __le16 bufsize;
303 u8 value[128];
306 struct cmd_ds_mac_reg_map {
307 __le16 buffersize;
308 u8 regmap[128];
309 __le16 reserved;
312 struct cmd_ds_bbp_reg_map {
313 __le16 buffersize;
314 u8 regmap[128];
315 __le16 reserved;
318 struct cmd_ds_rf_reg_map {
319 __le16 buffersize;
320 u8 regmap[64];
321 __le16 reserved;
324 struct cmd_ds_mac_reg_access {
325 __le16 action;
326 __le16 offset;
327 __le32 value;
330 struct cmd_ds_bbp_reg_access {
331 __le16 action;
332 __le16 offset;
333 u8 value;
334 u8 reserved[3];
337 struct cmd_ds_rf_reg_access {
338 __le16 action;
339 __le16 offset;
340 u8 value;
341 u8 reserved[3];
344 struct cmd_ds_802_11_radio_control {
345 __le16 action;
346 __le16 control;
349 struct cmd_ds_802_11_beacon_control {
350 __le16 action;
351 __le16 beacon_enable;
352 __le16 beacon_period;
355 struct cmd_ds_802_11_sleep_params {
356 /* ACT_GET/ACT_SET */
357 __le16 action;
359 /* Sleep clock error in ppm */
360 __le16 error;
362 /* Wakeup offset in usec */
363 __le16 offset;
365 /* Clock stabilization time in usec */
366 __le16 stabletime;
368 /* control periodic calibration */
369 u8 calcontrol;
371 /* control the use of external sleep clock */
372 u8 externalsleepclk;
374 /* reserved field, should be set to zero */
375 __le16 reserved;
378 struct cmd_ds_802_11_inactivity_timeout {
379 /* ACT_GET/ACT_SET */
380 __le16 action;
382 /* Inactivity timeout in msec */
383 __le16 timeout;
386 struct cmd_ds_802_11_rf_channel {
387 __le16 action;
388 __le16 currentchannel;
389 __le16 rftype;
390 __le16 reserved;
391 u8 channellist[32];
394 struct cmd_ds_802_11_rssi {
395 /* weighting factor */
396 __le16 N;
398 __le16 reserved_0;
399 __le16 reserved_1;
400 __le16 reserved_2;
403 struct cmd_ds_802_11_rssi_rsp {
404 __le16 SNR;
405 __le16 noisefloor;
406 __le16 avgSNR;
407 __le16 avgnoisefloor;
410 struct cmd_ds_802_11_mac_address {
411 __le16 action;
412 u8 macadd[ETH_ALEN];
415 struct cmd_ds_802_11_rf_tx_power {
416 __le16 action;
417 __le16 currentlevel;
420 struct cmd_ds_802_11_rf_antenna {
421 __le16 action;
423 /* Number of antennas or 0xffff(diversity) */
424 __le16 antennamode;
428 struct cmd_ds_802_11_monitor_mode {
429 __le16 action;
430 __le16 mode;
433 struct cmd_ds_set_boot2_ver {
434 struct cmd_header hdr;
436 __le16 action;
437 __le16 version;
440 struct cmd_ds_802_11_ps_mode {
441 __le16 action;
442 __le16 nullpktinterval;
443 __le16 multipledtim;
444 __le16 reserved;
445 __le16 locallisteninterval;
448 struct PS_CMD_ConfirmSleep {
449 __le16 command;
450 __le16 size;
451 __le16 seqnum;
452 __le16 result;
454 __le16 action;
455 __le16 reserved1;
456 __le16 multipledtim;
457 __le16 reserved;
458 __le16 locallisteninterval;
461 struct cmd_ds_802_11_data_rate {
462 __le16 action;
463 __le16 reserved;
464 u8 rates[MAX_RATES];
467 struct cmd_ds_802_11_rate_adapt_rateset {
468 __le16 action;
469 __le16 enablehwauto;
470 __le16 bitmap;
473 struct cmd_ds_802_11_ad_hoc_start {
474 u8 ssid[IW_ESSID_MAX_SIZE];
475 u8 bsstype;
476 __le16 beaconperiod;
477 u8 dtimperiod;
478 union IEEEtypes_ssparamset ssparamset;
479 union ieeetypes_phyparamset phyparamset;
480 __le16 probedelay;
481 __le16 capability;
482 u8 rates[MAX_RATES];
483 u8 tlv_memory_size_pad[100];
484 } __attribute__ ((packed));
486 struct adhoc_bssdesc {
487 u8 bssid[6];
488 u8 ssid[32];
489 u8 type;
490 __le16 beaconperiod;
491 u8 dtimperiod;
492 __le64 timestamp;
493 __le64 localtime;
494 union ieeetypes_phyparamset phyparamset;
495 union IEEEtypes_ssparamset ssparamset;
496 __le16 capability;
497 u8 rates[MAX_RATES];
499 /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
500 * Adhoc join command and will cause a binary layout mismatch with
501 * the firmware
503 } __attribute__ ((packed));
505 struct cmd_ds_802_11_ad_hoc_join {
506 struct adhoc_bssdesc bss;
507 __le16 failtimeout;
508 __le16 probedelay;
510 } __attribute__ ((packed));
512 struct cmd_ds_802_11_enable_rsn {
513 __le16 action;
514 __le16 enable;
515 } __attribute__ ((packed));
517 struct MrvlIEtype_keyParamSet {
518 /* type ID */
519 __le16 type;
521 /* length of Payload */
522 __le16 length;
524 /* type of key: WEP=0, TKIP=1, AES=2 */
525 __le16 keytypeid;
527 /* key control Info specific to a keytypeid */
528 __le16 keyinfo;
530 /* length of key */
531 __le16 keylen;
533 /* key material of size keylen */
534 u8 key[32];
537 struct cmd_ds_802_11_key_material {
538 __le16 action;
539 struct MrvlIEtype_keyParamSet keyParamSet[2];
540 } __attribute__ ((packed));
542 struct cmd_ds_802_11_eeprom_access {
543 __le16 action;
545 /* multiple 4 */
546 __le16 offset;
547 __le16 bytecount;
548 u8 value;
549 } __attribute__ ((packed));
551 struct cmd_ds_802_11_tpc_cfg {
552 __le16 action;
553 u8 enable;
554 s8 P0;
555 s8 P1;
556 s8 P2;
557 u8 usesnr;
558 } __attribute__ ((packed));
560 struct cmd_ds_802_11_led_ctrl {
561 __le16 action;
562 __le16 numled;
563 u8 data[256];
564 } __attribute__ ((packed));
566 struct cmd_ds_802_11_pwr_cfg {
567 __le16 action;
568 u8 enable;
569 s8 PA_P0;
570 s8 PA_P1;
571 s8 PA_P2;
572 } __attribute__ ((packed));
574 struct cmd_ds_802_11_afc {
575 __le16 afc_auto;
576 union {
577 struct {
578 __le16 threshold;
579 __le16 period;
581 struct {
582 __le16 timing_offset; /* signed */
583 __le16 carrier_offset; /* signed */
586 } __attribute__ ((packed));
588 struct cmd_tx_rate_query {
589 __le16 txrate;
590 } __attribute__ ((packed));
592 struct cmd_ds_get_tsf {
593 __le64 tsfvalue;
594 } __attribute__ ((packed));
596 struct cmd_ds_bt_access {
597 __le16 action;
598 __le32 id;
599 u8 addr1[ETH_ALEN];
600 u8 addr2[ETH_ALEN];
601 } __attribute__ ((packed));
603 struct cmd_ds_fwt_access {
604 __le16 action;
605 __le32 id;
606 u8 valid;
607 u8 da[ETH_ALEN];
608 u8 dir;
609 u8 ra[ETH_ALEN];
610 __le32 ssn;
611 __le32 dsn;
612 __le32 metric;
613 u8 rate;
614 u8 hopcount;
615 u8 ttl;
616 __le32 expiration;
617 u8 sleepmode;
618 __le32 snr;
619 __le32 references;
620 u8 prec[ETH_ALEN];
621 } __attribute__ ((packed));
623 struct cmd_ds_mesh_access {
624 __le16 action;
625 __le32 data[32]; /* last position reserved */
626 } __attribute__ ((packed));
628 /* Number of stats counters returned by the firmware */
629 #define MESH_STATS_NUM 8
631 struct cmd_ds_command {
632 /* command header */
633 __le16 command;
634 __le16 size;
635 __le16 seqnum;
636 __le16 result;
638 /* command Body */
639 union {
640 struct cmd_ds_get_hw_spec hwspec;
641 struct cmd_ds_802_11_ps_mode psmode;
642 struct cmd_ds_802_11_scan scan;
643 struct cmd_ds_802_11_scan_rsp scanresp;
644 struct cmd_ds_mac_control macctrl;
645 struct cmd_ds_802_11_associate associate;
646 struct cmd_ds_802_11_deauthenticate deauth;
647 struct cmd_ds_802_11_set_wep wep;
648 struct cmd_ds_802_11_ad_hoc_start ads;
649 struct cmd_ds_802_11_reset reset;
650 struct cmd_ds_802_11_ad_hoc_result result;
651 struct cmd_ds_802_11_get_log glog;
652 struct cmd_ds_802_11_authenticate auth;
653 struct cmd_ds_802_11_get_stat gstat;
654 struct cmd_ds_802_3_get_stat gstat_8023;
655 struct cmd_ds_802_11_snmp_mib smib;
656 struct cmd_ds_802_11_rf_tx_power txp;
657 struct cmd_ds_802_11_rf_antenna rant;
658 struct cmd_ds_802_11_monitor_mode monitor;
659 struct cmd_ds_802_11_data_rate drate;
660 struct cmd_ds_802_11_rate_adapt_rateset rateset;
661 struct cmd_ds_mac_multicast_adr madr;
662 struct cmd_ds_802_11_ad_hoc_join adj;
663 struct cmd_ds_802_11_radio_control radio;
664 struct cmd_ds_802_11_rf_channel rfchannel;
665 struct cmd_ds_802_11_rssi rssi;
666 struct cmd_ds_802_11_rssi_rsp rssirsp;
667 struct cmd_ds_802_11_disassociate dassociate;
668 struct cmd_ds_802_11_mac_address macadd;
669 struct cmd_ds_802_11_enable_rsn enbrsn;
670 struct cmd_ds_802_11_key_material keymaterial;
671 struct cmd_ds_mac_reg_access macreg;
672 struct cmd_ds_bbp_reg_access bbpreg;
673 struct cmd_ds_rf_reg_access rfreg;
674 struct cmd_ds_802_11_eeprom_access rdeeprom;
676 struct cmd_ds_802_11d_domain_info domaininfo;
677 struct cmd_ds_802_11d_domain_info domaininforesp;
679 struct cmd_ds_802_11_sleep_params sleep_params;
680 struct cmd_ds_802_11_inactivity_timeout inactivity_timeout;
681 struct cmd_ds_802_11_tpc_cfg tpccfg;
682 struct cmd_ds_802_11_pwr_cfg pwrcfg;
683 struct cmd_ds_802_11_afc afc;
684 struct cmd_ds_802_11_led_ctrl ledgpio;
686 struct cmd_tx_rate_query txrate;
687 struct cmd_ds_bt_access bt;
688 struct cmd_ds_fwt_access fwt;
689 struct cmd_ds_mesh_access mesh;
690 struct cmd_ds_get_tsf gettsf;
691 struct cmd_ds_802_11_subscribe_event subscribe_event;
692 struct cmd_ds_802_11_beacon_control bcn_ctrl;
693 } params;
694 } __attribute__ ((packed));
696 #endif