fix some madwifi-testing bugs
[openwrt.git] / package / libertas / src / hostcmd.h
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
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_header {
69 __le16 command;
70 __le16 size;
71 __le16 seqnum;
72 __le16 result;
73 } __attribute__ ((packed));
74
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;
86 };
87
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];
94 };
95
96 /* lbs_offset_value */
97 struct lbs_offset_value {
98 u32 offset;
99 u32 value;
100 };
101
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];
110 };
111
112 #define S_DS_GEN sizeof(struct cmd_ds_gen)
113
114
115 /*
116 * Define data structure for CMD_GET_HW_SPEC
117 * This structure defines the response for the GET_HW_SPEC command
118 */
119 struct cmd_ds_get_hw_spec {
120 struct cmd_header hdr;
121
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];
132
133 /* region Code */
134 __le16 regioncode;
135
136 /* Number of antenna used */
137 __le16 nr_antenna;
138
139 /* FW release number, example 1,2,3,4 = 3.2.1p4 */
140 u8 fwreleasenumber[4];
141
142 /* Base Address of TxPD queue */
143 __le32 wcb_base;
144 /* Read Pointer of RxPd queue */
145 __le32 rxpd_rdptr;
146
147 /* Write Pointer of RxPd queue */
148 __le32 rxpd_wrptr;
149
150 /*FW/HW capability */
151 __le32 fwcapinfo;
152 } __attribute__ ((packed));
153
154 struct cmd_ds_802_11_reset {
155 __le16 action;
156 };
157
158 struct cmd_ds_802_11_subscribe_event {
159 struct cmd_header hdr;
160
161 __le16 action;
162 __le16 events;
163
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.
168 */
169 uint8_t tlv[128];
170 };
171
172 /*
173 * This scan handle Country Information IE(802.11d compliant)
174 * Define data structure for CMD_802_11_SCAN
175 */
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
185 };
186
187 struct cmd_ds_802_11_scan_rsp {
188 __le16 bssdescriptsize;
189 u8 nr_sets;
190 u8 bssdesc_and_tlvbuffer[1];
191 };
192
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;
207 };
208
209 struct cmd_ds_mac_control {
210 __le16 action;
211 __le16 reserved;
212 };
213
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];
218 };
219
220 struct cmd_ds_802_11_authenticate {
221 u8 macaddr[ETH_ALEN];
222 u8 authtype;
223 u8 reserved[10];
224 };
225
226 struct cmd_ds_802_11_deauthenticate {
227 u8 macaddr[6];
228 __le16 reasoncode;
229 };
230
231 struct cmd_ds_802_11_associate {
232 u8 peerstaaddr[6];
233 __le16 capability;
234 __le16 listeninterval;
235 __le16 bcnperiod;
236 u8 dtimperiod;
237
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));
245
246 struct cmd_ds_802_11_disassociate {
247 u8 destmacaddr[6];
248 __le16 reasoncode;
249 };
250
251 struct cmd_ds_802_11_associate_rsp {
252 struct ieeetypes_assocrsp assocRsp;
253 };
254
255 struct cmd_ds_802_11_ad_hoc_result {
256 u8 pad[3];
257 u8 bssid[ETH_ALEN];
258 };
259
260 struct cmd_ds_802_11_set_wep {
261 struct cmd_header hdr;
262
263 /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
264 __le16 action;
265
266 /* key Index selected for Tx */
267 __le16 keyindex;
268
269 /* 40, 128bit or TXWEP */
270 uint8_t keytype[4];
271 uint8_t keymaterial[4][16];
272 };
273
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;
281 };
282
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;
301 };
302
303 struct cmd_ds_802_11_snmp_mib {
304 __le16 querytype;
305 __le16 oid;
306 __le16 bufsize;
307 u8 value[128];
308 };
309
310 struct cmd_ds_mac_reg_map {
311 __le16 buffersize;
312 u8 regmap[128];
313 __le16 reserved;
314 };
315
316 struct cmd_ds_bbp_reg_map {
317 __le16 buffersize;
318 u8 regmap[128];
319 __le16 reserved;
320 };
321
322 struct cmd_ds_rf_reg_map {
323 __le16 buffersize;
324 u8 regmap[64];
325 __le16 reserved;
326 };
327
328 struct cmd_ds_mac_reg_access {
329 __le16 action;
330 __le16 offset;
331 __le32 value;
332 };
333
334 struct cmd_ds_bbp_reg_access {
335 __le16 action;
336 __le16 offset;
337 u8 value;
338 u8 reserved[3];
339 };
340
341 struct cmd_ds_rf_reg_access {
342 __le16 action;
343 __le16 offset;
344 u8 value;
345 u8 reserved[3];
346 };
347
348 struct cmd_ds_802_11_radio_control {
349 struct cmd_header hdr;
350
351 __le16 action;
352 __le16 control;
353 };
354
355 struct cmd_ds_802_11_beacon_control {
356 __le16 action;
357 __le16 beacon_enable;
358 __le16 beacon_period;
359 };
360
361 struct cmd_ds_802_11_sleep_params {
362 struct cmd_header hdr;
363
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 uint8_t calcontrol;
378
379 /* control the use of external sleep clock */
380 uint8_t externalsleepclk;
381
382 /* reserved field, should be set to zero */
383 __le16 reserved;
384 };
385
386 struct cmd_ds_802_11_inactivity_timeout {
387 struct cmd_header hdr;
388
389 /* ACT_GET/ACT_SET */
390 __le16 action;
391
392 /* Inactivity timeout in msec */
393 __le16 timeout;
394 };
395
396 struct cmd_ds_802_11_rf_channel {
397 struct cmd_header hdr;
398
399 __le16 action;
400 __le16 channel;
401 __le16 rftype; /* unused */
402 __le16 reserved; /* unused */
403 u8 channellist[32]; /* unused */
404 };
405
406 struct cmd_ds_802_11_rssi {
407 /* weighting factor */
408 __le16 N;
409
410 __le16 reserved_0;
411 __le16 reserved_1;
412 __le16 reserved_2;
413 };
414
415 struct cmd_ds_802_11_rssi_rsp {
416 __le16 SNR;
417 __le16 noisefloor;
418 __le16 avgSNR;
419 __le16 avgnoisefloor;
420 };
421
422 struct cmd_ds_802_11_mac_address {
423 __le16 action;
424 u8 macadd[ETH_ALEN];
425 };
426
427 struct cmd_ds_802_11_rf_tx_power {
428 __le16 action;
429 __le16 currentlevel;
430 };
431
432 struct cmd_ds_802_11_rf_antenna {
433 __le16 action;
434
435 /* Number of antennas or 0xffff(diversity) */
436 __le16 antennamode;
437
438 };
439
440 struct cmd_ds_802_11_monitor_mode {
441 __le16 action;
442 __le16 mode;
443 };
444
445 struct cmd_ds_set_boot2_ver {
446 struct cmd_header hdr;
447
448 __le16 action;
449 __le16 version;
450 };
451
452 struct cmd_ds_802_11_fw_wake_method {
453 struct cmd_header hdr;
454
455 __le16 action;
456 __le16 method;
457 };
458
459 struct cmd_ds_802_11_sleep_period {
460 struct cmd_header hdr;
461
462 __le16 action;
463 __le16 period;
464 };
465
466 struct cmd_ds_802_11_ps_mode {
467 __le16 action;
468 __le16 nullpktinterval;
469 __le16 multipledtim;
470 __le16 reserved;
471 __le16 locallisteninterval;
472 };
473
474 struct PS_CMD_ConfirmSleep {
475 __le16 command;
476 __le16 size;
477 __le16 seqnum;
478 __le16 result;
479
480 __le16 action;
481 __le16 reserved1;
482 __le16 multipledtim;
483 __le16 reserved;
484 __le16 locallisteninterval;
485 };
486
487 struct cmd_ds_802_11_data_rate {
488 struct cmd_header hdr;
489
490 __le16 action;
491 __le16 reserved;
492 u8 rates[MAX_RATES];
493 };
494
495 struct cmd_ds_802_11_rate_adapt_rateset {
496 __le16 action;
497 __le16 enablehwauto;
498 __le16 bitmap;
499 };
500
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));
513
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];
526
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
530 */
531 } __attribute__ ((packed));
532
533 struct cmd_ds_802_11_ad_hoc_join {
534 struct adhoc_bssdesc bss;
535 __le16 failtimeout;
536 __le16 probedelay;
537
538 } __attribute__ ((packed));
539
540 struct cmd_ds_802_11_enable_rsn {
541 struct cmd_header hdr;
542
543 __le16 action;
544 __le16 enable;
545 } __attribute__ ((packed));
546
547 struct MrvlIEtype_keyParamSet {
548 /* type ID */
549 __le16 type;
550
551 /* length of Payload */
552 __le16 length;
553
554 /* type of key: WEP=0, TKIP=1, AES=2 */
555 __le16 keytypeid;
556
557 /* key control Info specific to a keytypeid */
558 __le16 keyinfo;
559
560 /* length of key */
561 __le16 keylen;
562
563 /* key material of size keylen */
564 u8 key[32];
565 };
566
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));
573
574 struct cmd_ds_802_11_key_material {
575 __le16 action;
576 struct MrvlIEtype_keyParamSet keyParamSet[2];
577 } __attribute__ ((packed));
578
579 struct cmd_ds_802_11_eeprom_access {
580 __le16 action;
581
582 /* multiple 4 */
583 __le16 offset;
584 __le16 bytecount;
585 u8 value;
586 } __attribute__ ((packed));
587
588 struct cmd_ds_802_11_tpc_cfg {
589 __le16 action;
590 u8 enable;
591 s8 P0;
592 s8 P1;
593 s8 P2;
594 u8 usesnr;
595 } __attribute__ ((packed));
596
597 struct cmd_ds_802_11_led_ctrl {
598 __le16 action;
599 __le16 numled;
600 u8 data[256];
601 } __attribute__ ((packed));
602
603 struct cmd_ds_802_11_pwr_cfg {
604 __le16 action;
605 u8 enable;
606 s8 PA_P0;
607 s8 PA_P1;
608 s8 PA_P2;
609 } __attribute__ ((packed));
610
611 struct cmd_ds_802_11_afc {
612 __le16 afc_auto;
613 union {
614 struct {
615 __le16 threshold;
616 __le16 period;
617 };
618 struct {
619 __le16 timing_offset; /* signed */
620 __le16 carrier_offset; /* signed */
621 };
622 };
623 } __attribute__ ((packed));
624
625 struct cmd_tx_rate_query {
626 __le16 txrate;
627 } __attribute__ ((packed));
628
629 struct cmd_ds_get_tsf {
630 __le64 tsfvalue;
631 } __attribute__ ((packed));
632
633 struct cmd_ds_bt_access {
634 __le16 action;
635 __le32 id;
636 u8 addr1[ETH_ALEN];
637 u8 addr2[ETH_ALEN];
638 } __attribute__ ((packed));
639
640 struct cmd_ds_fwt_access {
641 __le16 action;
642 __le32 id;
643 u8 valid;
644 u8 da[ETH_ALEN];
645 u8 dir;
646 u8 ra[ETH_ALEN];
647 __le32 ssn;
648 __le32 dsn;
649 __le32 metric;
650 u8 rate;
651 u8 hopcount;
652 u8 ttl;
653 __le32 expiration;
654 u8 sleepmode;
655 __le32 snr;
656 __le32 references;
657 u8 prec[ETH_ALEN];
658 } __attribute__ ((packed));
659
660
661 struct cmd_ds_mesh_config {
662 struct cmd_header hdr;
663
664 __le16 action;
665 __le16 channel;
666 __le16 type;
667 __le16 length;
668 u8 data[128]; /* last position reserved */
669 } __attribute__ ((packed));
670
671
672 struct cmd_ds_mesh_access {
673 struct cmd_header hdr;
674
675 __le16 action;
676 __le32 data[32]; /* last position reserved */
677 } __attribute__ ((packed));
678
679 /* Number of stats counters returned by the firmware */
680 #define MESH_STATS_NUM 8
681
682 struct cmd_ds_command {
683 /* command header */
684 __le16 command;
685 __le16 size;
686 __le16 seqnum;
687 __le16 result;
688
689 /* command Body */
690 union {
691 struct cmd_ds_802_11_ps_mode psmode;
692 struct cmd_ds_802_11_scan scan;
693 struct cmd_ds_802_11_scan_rsp scanresp;
694 struct cmd_ds_mac_control macctrl;
695 struct cmd_ds_802_11_associate associate;
696 struct cmd_ds_802_11_deauthenticate deauth;
697 struct cmd_ds_802_11_ad_hoc_start ads;
698 struct cmd_ds_802_11_reset reset;
699 struct cmd_ds_802_11_ad_hoc_result result;
700 struct cmd_ds_802_11_get_log glog;
701 struct cmd_ds_802_11_authenticate auth;
702 struct cmd_ds_802_11_get_stat gstat;
703 struct cmd_ds_802_3_get_stat gstat_8023;
704 struct cmd_ds_802_11_snmp_mib smib;
705 struct cmd_ds_802_11_rf_tx_power txp;
706 struct cmd_ds_802_11_rf_antenna rant;
707 struct cmd_ds_802_11_monitor_mode monitor;
708 struct cmd_ds_802_11_rate_adapt_rateset rateset;
709 struct cmd_ds_mac_multicast_adr madr;
710 struct cmd_ds_802_11_ad_hoc_join adj;
711 struct cmd_ds_802_11_rssi rssi;
712 struct cmd_ds_802_11_rssi_rsp rssirsp;
713 struct cmd_ds_802_11_disassociate dassociate;
714 struct cmd_ds_802_11_mac_address macadd;
715 struct cmd_ds_802_11_key_material keymaterial;
716 struct cmd_ds_mac_reg_access macreg;
717 struct cmd_ds_bbp_reg_access bbpreg;
718 struct cmd_ds_rf_reg_access rfreg;
719 struct cmd_ds_802_11_eeprom_access rdeeprom;
720
721 struct cmd_ds_802_11d_domain_info domaininfo;
722 struct cmd_ds_802_11d_domain_info domaininforesp;
723
724 struct cmd_ds_802_11_tpc_cfg tpccfg;
725 struct cmd_ds_802_11_pwr_cfg pwrcfg;
726 struct cmd_ds_802_11_afc afc;
727 struct cmd_ds_802_11_led_ctrl ledgpio;
728
729 struct cmd_tx_rate_query txrate;
730 struct cmd_ds_bt_access bt;
731 struct cmd_ds_fwt_access fwt;
732 struct cmd_ds_get_tsf gettsf;
733 struct cmd_ds_802_11_beacon_control bcn_ctrl;
734 } params;
735 } __attribute__ ((packed));
736
737 #endif
This page took 0.077137 seconds and 5 git commands to generate.