mac80211: unify config_interface and bss_info_changed
[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 _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         /* union to cope up with later FW revisions */
17         union {
18                 /* Current Tx packet status */
19                 __le32 tx_status;
20                 struct {
21                         /* BSS type: client, AP, etc. */
22                         u8 bss_type;
23                         /* BSS number */
24                         u8 bss_num;
25                         /* Reserved */
26                         __le16 reserved;
27                 } bss;
28         } u;
29         /* Tx control */
30         __le32 tx_control;
31         __le32 tx_packet_location;
32         /* Tx packet length */
33         __le16 tx_packet_length;
34         /* First 2 byte of destination MAC address */
35         u8 tx_dest_addr_high[2];
36         /* Last 4 byte of destination MAC address */
37         u8 tx_dest_addr_low[4];
38         /* Pkt Priority */
39         u8 priority;
40         /* Pkt Trasnit Power control */
41         u8 powermgmt;
42         /* Amount of time the packet has been queued in the driver (units = 2ms) */
43         u8 pktdelay_2ms;
44         /* reserved */
45         u8 reserved1;
46 } __attribute__ ((packed));
47
48 /* RxPD Descriptor */
49 struct rxpd {
50         /* union to cope up with later FW revisions */
51         union {
52                 /* Current Rx packet status */
53                 __le16 status;
54                 struct {
55                         /* BSS type: client, AP, etc. */
56                         u8 bss_type;
57                         /* BSS number */
58                         u8 bss_num;
59                 } bss;
60         } u;
61
62         /* SNR */
63         u8 snr;
64
65         /* Tx control */
66         u8 rx_control;
67
68         /* Pkt length */
69         __le16 pkt_len;
70
71         /* Noise Floor */
72         u8 nf;
73
74         /* Rx Packet Rate */
75         u8 rx_rate;
76
77         /* Pkt addr */
78         __le32 pkt_ptr;
79
80         /* Next Rx RxPD addr */
81         __le32 next_rxpd_ptr;
82
83         /* Pkt Priority */
84         u8 priority;
85         u8 reserved[3];
86 } __attribute__ ((packed));
87
88 struct cmd_header {
89         __le16 command;
90         __le16 size;
91         __le16 seqnum;
92         __le16 result;
93 } __attribute__ ((packed));
94
95 struct cmd_ctrl_node {
96         struct list_head list;
97         int result;
98         /* command response */
99         int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *);
100         unsigned long callback_arg;
101         /* command data */
102         struct cmd_header *cmdbuf;
103         /* wait queue */
104         u16 cmdwaitqwoken;
105         wait_queue_head_t cmdwait_q;
106 };
107
108 /* Generic structure to hold all key types. */
109 struct enc_key {
110         u16 len;
111         u16 flags;  /* KEY_INFO_* from defs.h */
112         u16 type; /* KEY_TYPE_* from defs.h */
113         u8 key[32];
114 };
115
116 /* lbs_offset_value */
117 struct lbs_offset_value {
118         u32 offset;
119         u32 value;
120 } __attribute__ ((packed));
121
122 /* Define general data structure */
123 /* cmd_DS_GEN */
124 struct cmd_ds_gen {
125         __le16 command;
126         __le16 size;
127         __le16 seqnum;
128         __le16 result;
129         void *cmdresp[0];
130 } __attribute__ ((packed));
131
132 #define S_DS_GEN sizeof(struct cmd_ds_gen)
133
134
135 /*
136  * Define data structure for CMD_GET_HW_SPEC
137  * This structure defines the response for the GET_HW_SPEC command
138  */
139 struct cmd_ds_get_hw_spec {
140         struct cmd_header hdr;
141
142         /* HW Interface version number */
143         __le16 hwifversion;
144         /* HW version number */
145         __le16 version;
146         /* Max number of TxPD FW can handle */
147         __le16 nr_txpd;
148         /* Max no of Multicast address */
149         __le16 nr_mcast_adr;
150         /* MAC address */
151         u8 permanentaddr[6];
152
153         /* region Code */
154         __le16 regioncode;
155
156         /* Number of antenna used */
157         __le16 nr_antenna;
158
159         /* FW release number, example 0x01030304 = 2.3.4p1 */
160         __le32 fwrelease;
161
162         /* Base Address of TxPD queue */
163         __le32 wcb_base;
164         /* Read Pointer of RxPd queue */
165         __le32 rxpd_rdptr;
166
167         /* Write Pointer of RxPd queue */
168         __le32 rxpd_wrptr;
169
170         /*FW/HW capability */
171         __le32 fwcapinfo;
172 } __attribute__ ((packed));
173
174 struct cmd_ds_802_11_subscribe_event {
175         struct cmd_header hdr;
176
177         __le16 action;
178         __le16 events;
179
180         /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
181          * number of TLVs. From the v5.1 manual, those TLVs would add up to
182          * 40 bytes. However, future firmware might add additional TLVs, so I
183          * bump this up a bit.
184          */
185         uint8_t tlv[128];
186 } __attribute__ ((packed));
187
188 /*
189  * This scan handle Country Information IE(802.11d compliant)
190  * Define data structure for CMD_802_11_SCAN
191  */
192 struct cmd_ds_802_11_scan {
193         struct cmd_header hdr;
194
195         uint8_t bsstype;
196         uint8_t bssid[ETH_ALEN];
197         uint8_t tlvbuffer[0];
198 #if 0
199         mrvlietypes_ssidparamset_t ssidParamSet;
200         mrvlietypes_chanlistparamset_t ChanListParamSet;
201         mrvlietypes_ratesparamset_t OpRateSet;
202 #endif
203 } __attribute__ ((packed));
204
205 struct cmd_ds_802_11_scan_rsp {
206         struct cmd_header hdr;
207
208         __le16 bssdescriptsize;
209         uint8_t nr_sets;
210         uint8_t bssdesc_and_tlvbuffer[0];
211 } __attribute__ ((packed));
212
213 struct cmd_ds_802_11_get_log {
214         struct cmd_header hdr;
215
216         __le32 mcasttxframe;
217         __le32 failed;
218         __le32 retry;
219         __le32 multiretry;
220         __le32 framedup;
221         __le32 rtssuccess;
222         __le32 rtsfailure;
223         __le32 ackfailure;
224         __le32 rxfrag;
225         __le32 mcastrxframe;
226         __le32 fcserror;
227         __le32 txframe;
228         __le32 wepundecryptable;
229 } __attribute__ ((packed));
230
231 struct cmd_ds_mac_control {
232         struct cmd_header hdr;
233         __le16 action;
234         u16 reserved;
235 } __attribute__ ((packed));
236
237 struct cmd_ds_mac_multicast_adr {
238         struct cmd_header hdr;
239         __le16 action;
240         __le16 nr_of_adrs;
241         u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
242 } __attribute__ ((packed));
243
244 struct cmd_ds_gspi_bus_config {
245         struct cmd_header hdr;
246         __le16 action;
247         __le16 bus_delay_mode;
248         __le16 host_time_delay_to_read_port;
249         __le16 host_time_delay_to_read_register;
250 } __attribute__ ((packed));
251
252 struct cmd_ds_802_11_authenticate {
253         u8 macaddr[ETH_ALEN];
254         u8 authtype;
255         u8 reserved[10];
256 } __attribute__ ((packed));
257
258 struct cmd_ds_802_11_deauthenticate {
259         struct cmd_header hdr;
260
261         u8 macaddr[ETH_ALEN];
262         __le16 reasoncode;
263 } __attribute__ ((packed));
264
265 struct cmd_ds_802_11_associate {
266         u8 peerstaaddr[6];
267         __le16 capability;
268         __le16 listeninterval;
269         __le16 bcnperiod;
270         u8 dtimperiod;
271
272 #if 0
273         mrvlietypes_ssidparamset_t ssidParamSet;
274         mrvlietypes_phyparamset_t phyparamset;
275         mrvlietypes_ssparamset_t ssparamset;
276         mrvlietypes_ratesparamset_t ratesParamSet;
277 #endif
278 } __attribute__ ((packed));
279
280 struct cmd_ds_802_11_associate_rsp {
281         struct ieeetypes_assocrsp assocRsp;
282 } __attribute__ ((packed));
283
284 struct cmd_ds_802_11_set_wep {
285         struct cmd_header hdr;
286
287         /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
288         __le16 action;
289
290         /* key Index selected for Tx */
291         __le16 keyindex;
292
293         /* 40, 128bit or TXWEP */
294         uint8_t keytype[4];
295         uint8_t keymaterial[4][16];
296 } __attribute__ ((packed));
297
298 struct cmd_ds_802_3_get_stat {
299         __le32 xmitok;
300         __le32 rcvok;
301         __le32 xmiterror;
302         __le32 rcverror;
303         __le32 rcvnobuffer;
304         __le32 rcvcrcerror;
305 } __attribute__ ((packed));
306
307 struct cmd_ds_802_11_get_stat {
308         __le32 txfragmentcnt;
309         __le32 mcasttxframecnt;
310         __le32 failedcnt;
311         __le32 retrycnt;
312         __le32 Multipleretrycnt;
313         __le32 rtssuccesscnt;
314         __le32 rtsfailurecnt;
315         __le32 ackfailurecnt;
316         __le32 frameduplicatecnt;
317         __le32 rxfragmentcnt;
318         __le32 mcastrxframecnt;
319         __le32 fcserrorcnt;
320         __le32 bcasttxframecnt;
321         __le32 bcastrxframecnt;
322         __le32 txbeacon;
323         __le32 rxbeacon;
324         __le32 wepundecryptable;
325 } __attribute__ ((packed));
326
327 struct cmd_ds_802_11_snmp_mib {
328         struct cmd_header hdr;
329
330         __le16 action;
331         __le16 oid;
332         __le16 bufsize;
333         u8 value[128];
334 } __attribute__ ((packed));
335
336 struct cmd_ds_mac_reg_map {
337         __le16 buffersize;
338         u8 regmap[128];
339         __le16 reserved;
340 } __attribute__ ((packed));
341
342 struct cmd_ds_bbp_reg_map {
343         __le16 buffersize;
344         u8 regmap[128];
345         __le16 reserved;
346 } __attribute__ ((packed));
347
348 struct cmd_ds_rf_reg_map {
349         __le16 buffersize;
350         u8 regmap[64];
351         __le16 reserved;
352 } __attribute__ ((packed));
353
354 struct cmd_ds_mac_reg_access {
355         __le16 action;
356         __le16 offset;
357         __le32 value;
358 } __attribute__ ((packed));
359
360 struct cmd_ds_bbp_reg_access {
361         __le16 action;
362         __le16 offset;
363         u8 value;
364         u8 reserved[3];
365 } __attribute__ ((packed));
366
367 struct cmd_ds_rf_reg_access {
368         __le16 action;
369         __le16 offset;
370         u8 value;
371         u8 reserved[3];
372 } __attribute__ ((packed));
373
374 struct cmd_ds_802_11_radio_control {
375         struct cmd_header hdr;
376
377         __le16 action;
378         __le16 control;
379 } __attribute__ ((packed));
380
381 struct cmd_ds_802_11_beacon_control {
382         __le16 action;
383         __le16 beacon_enable;
384         __le16 beacon_period;
385 } __attribute__ ((packed));
386
387 struct cmd_ds_802_11_sleep_params {
388         struct cmd_header hdr;
389
390         /* ACT_GET/ACT_SET */
391         __le16 action;
392
393         /* Sleep clock error in ppm */
394         __le16 error;
395
396         /* Wakeup offset in usec */
397         __le16 offset;
398
399         /* Clock stabilization time in usec */
400         __le16 stabletime;
401
402         /* control periodic calibration */
403         uint8_t calcontrol;
404
405         /* control the use of external sleep clock */
406         uint8_t externalsleepclk;
407
408         /* reserved field, should be set to zero */
409         __le16 reserved;
410 } __attribute__ ((packed));
411
412 struct cmd_ds_802_11_inactivity_timeout {
413         struct cmd_header hdr;
414
415         /* ACT_GET/ACT_SET */
416         __le16 action;
417
418         /* Inactivity timeout in msec */
419         __le16 timeout;
420 } __attribute__ ((packed));
421
422 struct cmd_ds_802_11_rf_channel {
423         struct cmd_header hdr;
424
425         __le16 action;
426         __le16 channel;
427         __le16 rftype;      /* unused */
428         __le16 reserved;    /* unused */
429         u8 channellist[32]; /* unused */
430 } __attribute__ ((packed));
431
432 struct cmd_ds_802_11_rssi {
433         /* weighting factor */
434         __le16 N;
435
436         __le16 reserved_0;
437         __le16 reserved_1;
438         __le16 reserved_2;
439 } __attribute__ ((packed));
440
441 struct cmd_ds_802_11_rssi_rsp {
442         __le16 SNR;
443         __le16 noisefloor;
444         __le16 avgSNR;
445         __le16 avgnoisefloor;
446 } __attribute__ ((packed));
447
448 struct cmd_ds_802_11_mac_address {
449         struct cmd_header hdr;
450
451         __le16 action;
452         u8 macadd[ETH_ALEN];
453 } __attribute__ ((packed));
454
455 struct cmd_ds_802_11_rf_tx_power {
456         struct cmd_header hdr;
457
458         __le16 action;
459         __le16 curlevel;
460         s8 maxlevel;
461         s8 minlevel;
462 } __attribute__ ((packed));
463
464 struct cmd_ds_802_11_rf_antenna {
465         __le16 action;
466
467         /* Number of antennas or 0xffff(diversity) */
468         __le16 antennamode;
469
470 } __attribute__ ((packed));
471
472 struct cmd_ds_802_11_monitor_mode {
473         __le16 action;
474         __le16 mode;
475 } __attribute__ ((packed));
476
477 struct cmd_ds_set_boot2_ver {
478         struct cmd_header hdr;
479
480         __le16 action;
481         __le16 version;
482 } __attribute__ ((packed));
483
484 struct cmd_ds_802_11_fw_wake_method {
485         struct cmd_header hdr;
486
487         __le16 action;
488         __le16 method;
489 } __attribute__ ((packed));
490
491 struct cmd_ds_802_11_sleep_period {
492         struct cmd_header hdr;
493
494         __le16 action;
495         __le16 period;
496 } __attribute__ ((packed));
497
498 struct cmd_ds_802_11_ps_mode {
499         __le16 action;
500         __le16 nullpktinterval;
501         __le16 multipledtim;
502         __le16 reserved;
503         __le16 locallisteninterval;
504 } __attribute__ ((packed));
505
506 struct cmd_confirm_sleep {
507         struct cmd_header hdr;
508
509         __le16 action;
510         __le16 nullpktinterval;
511         __le16 multipledtim;
512         __le16 reserved;
513         __le16 locallisteninterval;
514 } __attribute__ ((packed));
515
516 struct cmd_ds_802_11_data_rate {
517         struct cmd_header hdr;
518
519         __le16 action;
520         __le16 reserved;
521         u8 rates[MAX_RATES];
522 } __attribute__ ((packed));
523
524 struct cmd_ds_802_11_rate_adapt_rateset {
525         struct cmd_header hdr;
526         __le16 action;
527         __le16 enablehwauto;
528         __le16 bitmap;
529 } __attribute__ ((packed));
530
531 struct cmd_ds_802_11_ad_hoc_start {
532         struct cmd_header hdr;
533
534         u8 ssid[IW_ESSID_MAX_SIZE];
535         u8 bsstype;
536         __le16 beaconperiod;
537         u8 dtimperiod;   /* Reserved on v9 and later */
538         union IEEEtypes_ssparamset ssparamset;
539         union ieeetypes_phyparamset phyparamset;
540         __le16 probedelay;
541         __le16 capability;
542         u8 rates[MAX_RATES];
543         u8 tlv_memory_size_pad[100];
544 } __attribute__ ((packed));
545
546 struct cmd_ds_802_11_ad_hoc_result {
547         struct cmd_header hdr;
548
549         u8 pad[3];
550         u8 bssid[ETH_ALEN];
551 } __attribute__ ((packed));
552
553 struct adhoc_bssdesc {
554         u8 bssid[ETH_ALEN];
555         u8 ssid[IW_ESSID_MAX_SIZE];
556         u8 type;
557         __le16 beaconperiod;
558         u8 dtimperiod;
559         __le64 timestamp;
560         __le64 localtime;
561         union ieeetypes_phyparamset phyparamset;
562         union IEEEtypes_ssparamset ssparamset;
563         __le16 capability;
564         u8 rates[MAX_RATES];
565
566         /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
567          * Adhoc join command and will cause a binary layout mismatch with
568          * the firmware
569          */
570 } __attribute__ ((packed));
571
572 struct cmd_ds_802_11_ad_hoc_join {
573         struct cmd_header hdr;
574
575         struct adhoc_bssdesc bss;
576         __le16 failtimeout;   /* Reserved on v9 and later */
577         __le16 probedelay;    /* Reserved on v9 and later */
578 } __attribute__ ((packed));
579
580 struct cmd_ds_802_11_ad_hoc_stop {
581         struct cmd_header hdr;
582 } __attribute__ ((packed));
583
584 struct cmd_ds_802_11_enable_rsn {
585         struct cmd_header hdr;
586
587         __le16 action;
588         __le16 enable;
589 } __attribute__ ((packed));
590
591 struct MrvlIEtype_keyParamSet {
592         /* type ID */
593         __le16 type;
594
595         /* length of Payload */
596         __le16 length;
597
598         /* type of key: WEP=0, TKIP=1, AES=2 */
599         __le16 keytypeid;
600
601         /* key control Info specific to a keytypeid */
602         __le16 keyinfo;
603
604         /* length of key */
605         __le16 keylen;
606
607         /* key material of size keylen */
608         u8 key[32];
609 } __attribute__ ((packed));
610
611 #define MAX_WOL_RULES           16
612
613 struct host_wol_rule {
614         uint8_t rule_no;
615         uint8_t rule_ops;
616         __le16 sig_offset;
617         __le16 sig_length;
618         __le16 reserve;
619         __be32 sig_mask;
620         __be32 signature;
621 } __attribute__ ((packed));
622
623 struct wol_config {
624         uint8_t action;
625         uint8_t pattern;
626         uint8_t no_rules_in_cmd;
627         uint8_t result;
628         struct host_wol_rule rule[MAX_WOL_RULES];
629 } __attribute__ ((packed));
630
631 struct cmd_ds_host_sleep {
632         struct cmd_header hdr;
633         __le32 criteria;
634         uint8_t gpio;
635         uint16_t gap;
636         struct wol_config wol_conf;
637 } __attribute__ ((packed));
638
639
640
641 struct cmd_ds_802_11_key_material {
642         struct cmd_header hdr;
643
644         __le16 action;
645         struct MrvlIEtype_keyParamSet keyParamSet[2];
646 } __attribute__ ((packed));
647
648 struct cmd_ds_802_11_eeprom_access {
649         struct cmd_header hdr;
650         __le16 action;
651         __le16 offset;
652         __le16 len;
653         /* firmware says it returns a maximum of 20 bytes */
654 #define LBS_EEPROM_READ_LEN 20
655         u8 value[LBS_EEPROM_READ_LEN];
656 } __attribute__ ((packed));
657
658 struct cmd_ds_802_11_tpc_cfg {
659         struct cmd_header hdr;
660
661         __le16 action;
662         uint8_t enable;
663         int8_t P0;
664         int8_t P1;
665         int8_t P2;
666         uint8_t usesnr;
667 } __attribute__ ((packed));
668
669
670 struct cmd_ds_802_11_pa_cfg {
671         struct cmd_header hdr;
672
673         __le16 action;
674         uint8_t enable;
675         int8_t P0;
676         int8_t P1;
677         int8_t P2;
678 } __attribute__ ((packed));
679
680
681 struct cmd_ds_802_11_led_ctrl {
682         __le16 action;
683         __le16 numled;
684         u8 data[256];
685 } __attribute__ ((packed));
686
687 struct cmd_ds_802_11_afc {
688         __le16 afc_auto;
689         union {
690                 struct {
691                         __le16 threshold;
692                         __le16 period;
693                 };
694                 struct {
695                         __le16 timing_offset; /* signed */
696                         __le16 carrier_offset; /* signed */
697                 };
698         };
699 } __attribute__ ((packed));
700
701 struct cmd_tx_rate_query {
702         __le16 txrate;
703 } __attribute__ ((packed));
704
705 struct cmd_ds_get_tsf {
706         __le64 tsfvalue;
707 } __attribute__ ((packed));
708
709 struct cmd_ds_bt_access {
710         __le16 action;
711         __le32 id;
712         u8 addr1[ETH_ALEN];
713         u8 addr2[ETH_ALEN];
714 } __attribute__ ((packed));
715
716 struct cmd_ds_fwt_access {
717         __le16 action;
718         __le32 id;
719         u8 valid;
720         u8 da[ETH_ALEN];
721         u8 dir;
722         u8 ra[ETH_ALEN];
723         __le32 ssn;
724         __le32 dsn;
725         __le32 metric;
726         u8 rate;
727         u8 hopcount;
728         u8 ttl;
729         __le32 expiration;
730         u8 sleepmode;
731         __le32 snr;
732         __le32 references;
733         u8 prec[ETH_ALEN];
734 } __attribute__ ((packed));
735
736
737 struct cmd_ds_mesh_config {
738         struct cmd_header hdr;
739
740         __le16 action;
741         __le16 channel;
742         __le16 type;
743         __le16 length;
744         u8 data[128];   /* last position reserved */
745 } __attribute__ ((packed));
746
747
748 struct cmd_ds_mesh_access {
749         struct cmd_header hdr;
750
751         __le16 action;
752         __le32 data[32];        /* last position reserved */
753 } __attribute__ ((packed));
754
755 /* Number of stats counters returned by the firmware */
756 #define MESH_STATS_NUM 8
757
758 struct cmd_ds_command {
759         /* command header */
760         __le16 command;
761         __le16 size;
762         __le16 seqnum;
763         __le16 result;
764
765         /* command Body */
766         union {
767                 struct cmd_ds_802_11_ps_mode psmode;
768                 struct cmd_ds_802_11_associate associate;
769                 struct cmd_ds_802_11_authenticate auth;
770                 struct cmd_ds_802_11_get_stat gstat;
771                 struct cmd_ds_802_3_get_stat gstat_8023;
772                 struct cmd_ds_802_11_rf_antenna rant;
773                 struct cmd_ds_802_11_monitor_mode monitor;
774                 struct cmd_ds_802_11_rssi rssi;
775                 struct cmd_ds_802_11_rssi_rsp rssirsp;
776                 struct cmd_ds_mac_reg_access macreg;
777                 struct cmd_ds_bbp_reg_access bbpreg;
778                 struct cmd_ds_rf_reg_access rfreg;
779
780                 struct cmd_ds_802_11d_domain_info domaininfo;
781                 struct cmd_ds_802_11d_domain_info domaininforesp;
782
783                 struct cmd_ds_802_11_tpc_cfg tpccfg;
784                 struct cmd_ds_802_11_afc afc;
785                 struct cmd_ds_802_11_led_ctrl ledgpio;
786
787                 struct cmd_tx_rate_query txrate;
788                 struct cmd_ds_bt_access bt;
789                 struct cmd_ds_fwt_access fwt;
790                 struct cmd_ds_get_tsf gettsf;
791                 struct cmd_ds_802_11_beacon_control bcn_ctrl;
792         } params;
793 } __attribute__ ((packed));
794
795 #endif