libertas: convert KEY_MATERIAL to a direct command
[linux-2.6/kvm.git] / drivers / net / wireless / libertas / hostcmd.h
blob0a36748b8bfcd407c36736483499bf948ceb2dc4
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 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;
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];
96 /* lbs_offset_value */
97 struct lbs_offset_value {
98 u32 offset;
99 u32 value;
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];
112 #define S_DS_GEN sizeof(struct cmd_ds_gen)
116 * Define data structure for CMD_GET_HW_SPEC
117 * This structure defines the response for the GET_HW_SPEC command
119 struct cmd_ds_get_hw_spec {
120 struct cmd_header hdr;
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 0x01030304 = 2.3.4p1 */
140 __le32 fwrelease;
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 struct cmd_header hdr;
161 __le16 action;
162 __le16 events;
164 /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
165 * number of TLVs. From the v5.1 manual, those TLVs would add up to
166 * 40 bytes. However, future firmware might add additional TLVs, so I
167 * bump this up a bit.
169 uint8_t tlv[128];
173 * This scan handle Country Information IE(802.11d compliant)
174 * Define data structure for CMD_802_11_SCAN
176 struct cmd_ds_802_11_scan {
177 u8 bsstype;
178 u8 bssid[ETH_ALEN];
179 u8 tlvbuffer[1];
180 #if 0
181 mrvlietypes_ssidparamset_t ssidParamSet;
182 mrvlietypes_chanlistparamset_t ChanListParamSet;
183 mrvlietypes_ratesparamset_t OpRateSet;
184 #endif
187 struct cmd_ds_802_11_scan_rsp {
188 __le16 bssdescriptsize;
189 u8 nr_sets;
190 u8 bssdesc_and_tlvbuffer[1];
193 struct cmd_ds_802_11_get_log {
194 __le32 mcasttxframe;
195 __le32 failed;
196 __le32 retry;
197 __le32 multiretry;
198 __le32 framedup;
199 __le32 rtssuccess;
200 __le32 rtsfailure;
201 __le32 ackfailure;
202 __le32 rxfrag;
203 __le32 mcastrxframe;
204 __le32 fcserror;
205 __le32 txframe;
206 __le32 wepundecryptable;
209 struct cmd_ds_mac_control {
210 __le16 action;
211 __le16 reserved;
214 struct cmd_ds_mac_multicast_adr {
215 __le16 action;
216 __le16 nr_of_adrs;
217 u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
220 struct cmd_ds_802_11_authenticate {
221 u8 macaddr[ETH_ALEN];
222 u8 authtype;
223 u8 reserved[10];
226 struct cmd_ds_802_11_deauthenticate {
227 u8 macaddr[6];
228 __le16 reasoncode;
231 struct cmd_ds_802_11_associate {
232 u8 peerstaaddr[6];
233 __le16 capability;
234 __le16 listeninterval;
235 __le16 bcnperiod;
236 u8 dtimperiod;
238 #if 0
239 mrvlietypes_ssidparamset_t ssidParamSet;
240 mrvlietypes_phyparamset_t phyparamset;
241 mrvlietypes_ssparamset_t ssparamset;
242 mrvlietypes_ratesparamset_t ratesParamSet;
243 #endif
244 } __attribute__ ((packed));
246 struct cmd_ds_802_11_disassociate {
247 u8 destmacaddr[6];
248 __le16 reasoncode;
251 struct cmd_ds_802_11_associate_rsp {
252 struct ieeetypes_assocrsp assocRsp;
255 struct cmd_ds_802_11_ad_hoc_result {
256 u8 pad[3];
257 u8 bssid[ETH_ALEN];
260 struct cmd_ds_802_11_set_wep {
261 struct cmd_header hdr;
263 /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
264 __le16 action;
266 /* key Index selected for Tx */
267 __le16 keyindex;
269 /* 40, 128bit or TXWEP */
270 uint8_t keytype[4];
271 uint8_t keymaterial[4][16];
274 struct cmd_ds_802_3_get_stat {
275 __le32 xmitok;
276 __le32 rcvok;
277 __le32 xmiterror;
278 __le32 rcverror;
279 __le32 rcvnobuffer;
280 __le32 rcvcrcerror;
283 struct cmd_ds_802_11_get_stat {
284 __le32 txfragmentcnt;
285 __le32 mcasttxframecnt;
286 __le32 failedcnt;
287 __le32 retrycnt;
288 __le32 Multipleretrycnt;
289 __le32 rtssuccesscnt;
290 __le32 rtsfailurecnt;
291 __le32 ackfailurecnt;
292 __le32 frameduplicatecnt;
293 __le32 rxfragmentcnt;
294 __le32 mcastrxframecnt;
295 __le32 fcserrorcnt;
296 __le32 bcasttxframecnt;
297 __le32 bcastrxframecnt;
298 __le32 txbeacon;
299 __le32 rxbeacon;
300 __le32 wepundecryptable;
303 struct cmd_ds_802_11_snmp_mib {
304 __le16 querytype;
305 __le16 oid;
306 __le16 bufsize;
307 u8 value[128];
310 struct cmd_ds_mac_reg_map {
311 __le16 buffersize;
312 u8 regmap[128];
313 __le16 reserved;
316 struct cmd_ds_bbp_reg_map {
317 __le16 buffersize;
318 u8 regmap[128];
319 __le16 reserved;
322 struct cmd_ds_rf_reg_map {
323 __le16 buffersize;
324 u8 regmap[64];
325 __le16 reserved;
328 struct cmd_ds_mac_reg_access {
329 __le16 action;
330 __le16 offset;
331 __le32 value;
334 struct cmd_ds_bbp_reg_access {
335 __le16 action;
336 __le16 offset;
337 u8 value;
338 u8 reserved[3];
341 struct cmd_ds_rf_reg_access {
342 __le16 action;
343 __le16 offset;
344 u8 value;
345 u8 reserved[3];
348 struct cmd_ds_802_11_radio_control {
349 struct cmd_header hdr;
351 __le16 action;
352 __le16 control;
355 struct cmd_ds_802_11_beacon_control {
356 __le16 action;
357 __le16 beacon_enable;
358 __le16 beacon_period;
361 struct cmd_ds_802_11_sleep_params {
362 struct cmd_header hdr;
364 /* ACT_GET/ACT_SET */
365 __le16 action;
367 /* Sleep clock error in ppm */
368 __le16 error;
370 /* Wakeup offset in usec */
371 __le16 offset;
373 /* Clock stabilization time in usec */
374 __le16 stabletime;
376 /* control periodic calibration */
377 uint8_t calcontrol;
379 /* control the use of external sleep clock */
380 uint8_t externalsleepclk;
382 /* reserved field, should be set to zero */
383 __le16 reserved;
386 struct cmd_ds_802_11_inactivity_timeout {
387 struct cmd_header hdr;
389 /* ACT_GET/ACT_SET */
390 __le16 action;
392 /* Inactivity timeout in msec */
393 __le16 timeout;
396 struct cmd_ds_802_11_rf_channel {
397 struct cmd_header hdr;
399 __le16 action;
400 __le16 channel;
401 __le16 rftype; /* unused */
402 __le16 reserved; /* unused */
403 u8 channellist[32]; /* unused */
406 struct cmd_ds_802_11_rssi {
407 /* weighting factor */
408 __le16 N;
410 __le16 reserved_0;
411 __le16 reserved_1;
412 __le16 reserved_2;
415 struct cmd_ds_802_11_rssi_rsp {
416 __le16 SNR;
417 __le16 noisefloor;
418 __le16 avgSNR;
419 __le16 avgnoisefloor;
422 struct cmd_ds_802_11_mac_address {
423 __le16 action;
424 u8 macadd[ETH_ALEN];
427 struct cmd_ds_802_11_rf_tx_power {
428 __le16 action;
429 __le16 currentlevel;
432 struct cmd_ds_802_11_rf_antenna {
433 __le16 action;
435 /* Number of antennas or 0xffff(diversity) */
436 __le16 antennamode;
440 struct cmd_ds_802_11_monitor_mode {
441 __le16 action;
442 __le16 mode;
445 struct cmd_ds_set_boot2_ver {
446 struct cmd_header hdr;
448 __le16 action;
449 __le16 version;
452 struct cmd_ds_802_11_fw_wake_method {
453 struct cmd_header hdr;
455 __le16 action;
456 __le16 method;
459 struct cmd_ds_802_11_sleep_period {
460 struct cmd_header hdr;
462 __le16 action;
463 __le16 period;
466 struct cmd_ds_802_11_ps_mode {
467 __le16 action;
468 __le16 nullpktinterval;
469 __le16 multipledtim;
470 __le16 reserved;
471 __le16 locallisteninterval;
474 struct PS_CMD_ConfirmSleep {
475 __le16 command;
476 __le16 size;
477 __le16 seqnum;
478 __le16 result;
480 __le16 action;
481 __le16 reserved1;
482 __le16 multipledtim;
483 __le16 reserved;
484 __le16 locallisteninterval;
487 struct cmd_ds_802_11_data_rate {
488 struct cmd_header hdr;
490 __le16 action;
491 __le16 reserved;
492 u8 rates[MAX_RATES];
495 struct cmd_ds_802_11_rate_adapt_rateset {
496 __le16 action;
497 __le16 enablehwauto;
498 __le16 bitmap;
501 struct cmd_ds_802_11_ad_hoc_start {
502 u8 ssid[IW_ESSID_MAX_SIZE];
503 u8 bsstype;
504 __le16 beaconperiod;
505 u8 dtimperiod;
506 union IEEEtypes_ssparamset ssparamset;
507 union ieeetypes_phyparamset phyparamset;
508 __le16 probedelay;
509 __le16 capability;
510 u8 rates[MAX_RATES];
511 u8 tlv_memory_size_pad[100];
512 } __attribute__ ((packed));
514 struct adhoc_bssdesc {
515 u8 bssid[6];
516 u8 ssid[32];
517 u8 type;
518 __le16 beaconperiod;
519 u8 dtimperiod;
520 __le64 timestamp;
521 __le64 localtime;
522 union ieeetypes_phyparamset phyparamset;
523 union IEEEtypes_ssparamset ssparamset;
524 __le16 capability;
525 u8 rates[MAX_RATES];
527 /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
528 * Adhoc join command and will cause a binary layout mismatch with
529 * the firmware
531 } __attribute__ ((packed));
533 struct cmd_ds_802_11_ad_hoc_join {
534 struct adhoc_bssdesc bss;
535 __le16 failtimeout;
536 __le16 probedelay;
538 } __attribute__ ((packed));
540 struct cmd_ds_802_11_enable_rsn {
541 struct cmd_header hdr;
543 __le16 action;
544 __le16 enable;
545 } __attribute__ ((packed));
547 struct MrvlIEtype_keyParamSet {
548 /* type ID */
549 __le16 type;
551 /* length of Payload */
552 __le16 length;
554 /* type of key: WEP=0, TKIP=1, AES=2 */
555 __le16 keytypeid;
557 /* key control Info specific to a keytypeid */
558 __le16 keyinfo;
560 /* length of key */
561 __le16 keylen;
563 /* key material of size keylen */
564 u8 key[32];
567 struct cmd_ds_host_sleep {
568 struct cmd_header hdr;
569 __le32 criteria;
570 uint8_t gpio;
571 uint8_t gap;
572 } __attribute__ ((packed));
574 struct cmd_ds_802_11_key_material {
575 struct cmd_header hdr;
577 __le16 action;
578 struct MrvlIEtype_keyParamSet keyParamSet[2];
579 } __attribute__ ((packed));
581 struct cmd_ds_802_11_eeprom_access {
582 __le16 action;
584 /* multiple 4 */
585 __le16 offset;
586 __le16 bytecount;
587 u8 value;
588 } __attribute__ ((packed));
590 struct cmd_ds_802_11_tpc_cfg {
591 __le16 action;
592 u8 enable;
593 s8 P0;
594 s8 P1;
595 s8 P2;
596 u8 usesnr;
597 } __attribute__ ((packed));
599 struct cmd_ds_802_11_led_ctrl {
600 __le16 action;
601 __le16 numled;
602 u8 data[256];
603 } __attribute__ ((packed));
605 struct cmd_ds_802_11_pwr_cfg {
606 __le16 action;
607 u8 enable;
608 s8 PA_P0;
609 s8 PA_P1;
610 s8 PA_P2;
611 } __attribute__ ((packed));
613 struct cmd_ds_802_11_afc {
614 __le16 afc_auto;
615 union {
616 struct {
617 __le16 threshold;
618 __le16 period;
620 struct {
621 __le16 timing_offset; /* signed */
622 __le16 carrier_offset; /* signed */
625 } __attribute__ ((packed));
627 struct cmd_tx_rate_query {
628 __le16 txrate;
629 } __attribute__ ((packed));
631 struct cmd_ds_get_tsf {
632 __le64 tsfvalue;
633 } __attribute__ ((packed));
635 struct cmd_ds_bt_access {
636 __le16 action;
637 __le32 id;
638 u8 addr1[ETH_ALEN];
639 u8 addr2[ETH_ALEN];
640 } __attribute__ ((packed));
642 struct cmd_ds_fwt_access {
643 __le16 action;
644 __le32 id;
645 u8 valid;
646 u8 da[ETH_ALEN];
647 u8 dir;
648 u8 ra[ETH_ALEN];
649 __le32 ssn;
650 __le32 dsn;
651 __le32 metric;
652 u8 rate;
653 u8 hopcount;
654 u8 ttl;
655 __le32 expiration;
656 u8 sleepmode;
657 __le32 snr;
658 __le32 references;
659 u8 prec[ETH_ALEN];
660 } __attribute__ ((packed));
663 struct cmd_ds_mesh_config {
664 struct cmd_header hdr;
666 __le16 action;
667 __le16 channel;
668 __le16 type;
669 __le16 length;
670 u8 data[128]; /* last position reserved */
671 } __attribute__ ((packed));
674 struct cmd_ds_mesh_access {
675 struct cmd_header hdr;
677 __le16 action;
678 __le32 data[32]; /* last position reserved */
679 } __attribute__ ((packed));
681 /* Number of stats counters returned by the firmware */
682 #define MESH_STATS_NUM 8
684 struct cmd_ds_command {
685 /* command header */
686 __le16 command;
687 __le16 size;
688 __le16 seqnum;
689 __le16 result;
691 /* command Body */
692 union {
693 struct cmd_ds_802_11_ps_mode psmode;
694 struct cmd_ds_802_11_scan scan;
695 struct cmd_ds_802_11_scan_rsp scanresp;
696 struct cmd_ds_mac_control macctrl;
697 struct cmd_ds_802_11_associate associate;
698 struct cmd_ds_802_11_deauthenticate deauth;
699 struct cmd_ds_802_11_ad_hoc_start ads;
700 struct cmd_ds_802_11_reset reset;
701 struct cmd_ds_802_11_ad_hoc_result result;
702 struct cmd_ds_802_11_get_log glog;
703 struct cmd_ds_802_11_authenticate auth;
704 struct cmd_ds_802_11_get_stat gstat;
705 struct cmd_ds_802_3_get_stat gstat_8023;
706 struct cmd_ds_802_11_snmp_mib smib;
707 struct cmd_ds_802_11_rf_tx_power txp;
708 struct cmd_ds_802_11_rf_antenna rant;
709 struct cmd_ds_802_11_monitor_mode monitor;
710 struct cmd_ds_802_11_rate_adapt_rateset rateset;
711 struct cmd_ds_mac_multicast_adr madr;
712 struct cmd_ds_802_11_ad_hoc_join adj;
713 struct cmd_ds_802_11_rssi rssi;
714 struct cmd_ds_802_11_rssi_rsp rssirsp;
715 struct cmd_ds_802_11_disassociate dassociate;
716 struct cmd_ds_802_11_mac_address macadd;
717 struct cmd_ds_mac_reg_access macreg;
718 struct cmd_ds_bbp_reg_access bbpreg;
719 struct cmd_ds_rf_reg_access rfreg;
720 struct cmd_ds_802_11_eeprom_access rdeeprom;
722 struct cmd_ds_802_11d_domain_info domaininfo;
723 struct cmd_ds_802_11d_domain_info domaininforesp;
725 struct cmd_ds_802_11_tpc_cfg tpccfg;
726 struct cmd_ds_802_11_pwr_cfg pwrcfg;
727 struct cmd_ds_802_11_afc afc;
728 struct cmd_ds_802_11_led_ctrl ledgpio;
730 struct cmd_tx_rate_query txrate;
731 struct cmd_ds_bt_access bt;
732 struct cmd_ds_fwt_access fwt;
733 struct cmd_ds_get_tsf gettsf;
734 struct cmd_ds_802_11_beacon_control bcn_ctrl;
735 } params;
736 } __attribute__ ((packed));
738 #endif