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