]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/net/wireless/libertas/hostcmd.h
libertas: remove cmd_ctrl_node->status
[mirror_ubuntu-artful-kernel.git] / 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 /* 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_ctrl_node {
69 /* CMD link list */
70 struct list_head list;
71 /*CMD wait option: wait for finish or no wait */
72 u16 wait_option;
73 /* command parameter */
74 void *pdata_buf;
75 /*command data */
76 u8 *bufvirtualaddr;
77 /* wait queue */
78 u16 cmdwaitqwoken;
79 wait_queue_head_t cmdwait_q;
80 };
81
82 /* Generic structure to hold all key types. */
83 struct enc_key {
84 u16 len;
85 u16 flags; /* KEY_INFO_* from defs.h */
86 u16 type; /* KEY_TYPE_* from defs.h */
87 u8 key[32];
88 };
89
90 /* lbs_offset_value */
91 struct lbs_offset_value {
92 u32 offset;
93 u32 value;
94 };
95
96 /* Define general data structure */
97 /* cmd_DS_GEN */
98 struct cmd_ds_gen {
99 __le16 command;
100 __le16 size;
101 __le16 seqnum;
102 __le16 result;
103 };
104
105 #define S_DS_GEN sizeof(struct cmd_ds_gen)
106 /*
107 * Define data structure for CMD_GET_HW_SPEC
108 * This structure defines the response for the GET_HW_SPEC command
109 */
110 struct cmd_ds_get_hw_spec {
111 /* HW Interface version number */
112 __le16 hwifversion;
113 /* HW version number */
114 __le16 version;
115 /* Max number of TxPD FW can handle */
116 __le16 nr_txpd;
117 /* Max no of Multicast address */
118 __le16 nr_mcast_adr;
119 /* MAC address */
120 u8 permanentaddr[6];
121
122 /* region Code */
123 __le16 regioncode;
124
125 /* Number of antenna used */
126 __le16 nr_antenna;
127
128 /* FW release number, example 1,2,3,4 = 3.2.1p4 */
129 u8 fwreleasenumber[4];
130
131 /* Base Address of TxPD queue */
132 __le32 wcb_base;
133 /* Read Pointer of RxPd queue */
134 __le32 rxpd_rdptr;
135
136 /* Write Pointer of RxPd queue */
137 __le32 rxpd_wrptr;
138
139 /*FW/HW capability */
140 __le32 fwcapinfo;
141 } __attribute__ ((packed));
142
143 struct cmd_ds_802_11_reset {
144 __le16 action;
145 };
146
147 struct cmd_ds_802_11_subscribe_event {
148 __le16 action;
149 __le16 events;
150
151 /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
152 * number of TLVs. From the v5.1 manual, those TLVs would add up to
153 * 40 bytes. However, future firmware might add additional TLVs, so I
154 * bump this up a bit.
155 */
156 u8 tlv[128];
157 };
158
159 /*
160 * This scan handle Country Information IE(802.11d compliant)
161 * Define data structure for CMD_802_11_SCAN
162 */
163 struct cmd_ds_802_11_scan {
164 u8 bsstype;
165 u8 bssid[ETH_ALEN];
166 u8 tlvbuffer[1];
167 #if 0
168 mrvlietypes_ssidparamset_t ssidParamSet;
169 mrvlietypes_chanlistparamset_t ChanListParamSet;
170 mrvlietypes_ratesparamset_t OpRateSet;
171 #endif
172 };
173
174 struct cmd_ds_802_11_scan_rsp {
175 __le16 bssdescriptsize;
176 u8 nr_sets;
177 u8 bssdesc_and_tlvbuffer[1];
178 };
179
180 struct cmd_ds_802_11_get_log {
181 __le32 mcasttxframe;
182 __le32 failed;
183 __le32 retry;
184 __le32 multiretry;
185 __le32 framedup;
186 __le32 rtssuccess;
187 __le32 rtsfailure;
188 __le32 ackfailure;
189 __le32 rxfrag;
190 __le32 mcastrxframe;
191 __le32 fcserror;
192 __le32 txframe;
193 __le32 wepundecryptable;
194 };
195
196 struct cmd_ds_mac_control {
197 __le16 action;
198 __le16 reserved;
199 };
200
201 struct cmd_ds_mac_multicast_adr {
202 __le16 action;
203 __le16 nr_of_adrs;
204 u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
205 };
206
207 struct cmd_ds_802_11_authenticate {
208 u8 macaddr[ETH_ALEN];
209 u8 authtype;
210 u8 reserved[10];
211 };
212
213 struct cmd_ds_802_11_deauthenticate {
214 u8 macaddr[6];
215 __le16 reasoncode;
216 };
217
218 struct cmd_ds_802_11_associate {
219 u8 peerstaaddr[6];
220 __le16 capability;
221 __le16 listeninterval;
222 __le16 bcnperiod;
223 u8 dtimperiod;
224
225 #if 0
226 mrvlietypes_ssidparamset_t ssidParamSet;
227 mrvlietypes_phyparamset_t phyparamset;
228 mrvlietypes_ssparamset_t ssparamset;
229 mrvlietypes_ratesparamset_t ratesParamSet;
230 #endif
231 } __attribute__ ((packed));
232
233 struct cmd_ds_802_11_disassociate {
234 u8 destmacaddr[6];
235 __le16 reasoncode;
236 };
237
238 struct cmd_ds_802_11_associate_rsp {
239 struct ieeetypes_assocrsp assocRsp;
240 };
241
242 struct cmd_ds_802_11_ad_hoc_result {
243 u8 pad[3];
244 u8 bssid[ETH_ALEN];
245 };
246
247 struct cmd_ds_802_11_set_wep {
248 /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
249 __le16 action;
250
251 /* key Index selected for Tx */
252 __le16 keyindex;
253
254 /* 40, 128bit or TXWEP */
255 u8 keytype[4];
256 u8 keymaterial[4][16];
257 };
258
259 struct cmd_ds_802_3_get_stat {
260 __le32 xmitok;
261 __le32 rcvok;
262 __le32 xmiterror;
263 __le32 rcverror;
264 __le32 rcvnobuffer;
265 __le32 rcvcrcerror;
266 };
267
268 struct cmd_ds_802_11_get_stat {
269 __le32 txfragmentcnt;
270 __le32 mcasttxframecnt;
271 __le32 failedcnt;
272 __le32 retrycnt;
273 __le32 Multipleretrycnt;
274 __le32 rtssuccesscnt;
275 __le32 rtsfailurecnt;
276 __le32 ackfailurecnt;
277 __le32 frameduplicatecnt;
278 __le32 rxfragmentcnt;
279 __le32 mcastrxframecnt;
280 __le32 fcserrorcnt;
281 __le32 bcasttxframecnt;
282 __le32 bcastrxframecnt;
283 __le32 txbeacon;
284 __le32 rxbeacon;
285 __le32 wepundecryptable;
286 };
287
288 struct cmd_ds_802_11_snmp_mib {
289 __le16 querytype;
290 __le16 oid;
291 __le16 bufsize;
292 u8 value[128];
293 };
294
295 struct cmd_ds_mac_reg_map {
296 __le16 buffersize;
297 u8 regmap[128];
298 __le16 reserved;
299 };
300
301 struct cmd_ds_bbp_reg_map {
302 __le16 buffersize;
303 u8 regmap[128];
304 __le16 reserved;
305 };
306
307 struct cmd_ds_rf_reg_map {
308 __le16 buffersize;
309 u8 regmap[64];
310 __le16 reserved;
311 };
312
313 struct cmd_ds_mac_reg_access {
314 __le16 action;
315 __le16 offset;
316 __le32 value;
317 };
318
319 struct cmd_ds_bbp_reg_access {
320 __le16 action;
321 __le16 offset;
322 u8 value;
323 u8 reserved[3];
324 };
325
326 struct cmd_ds_rf_reg_access {
327 __le16 action;
328 __le16 offset;
329 u8 value;
330 u8 reserved[3];
331 };
332
333 struct cmd_ds_802_11_radio_control {
334 __le16 action;
335 __le16 control;
336 };
337
338 struct cmd_ds_802_11_beacon_control {
339 __le16 action;
340 __le16 beacon_enable;
341 __le16 beacon_period;
342 };
343
344 struct cmd_ds_802_11_sleep_params {
345 /* ACT_GET/ACT_SET */
346 __le16 action;
347
348 /* Sleep clock error in ppm */
349 __le16 error;
350
351 /* Wakeup offset in usec */
352 __le16 offset;
353
354 /* Clock stabilization time in usec */
355 __le16 stabletime;
356
357 /* control periodic calibration */
358 u8 calcontrol;
359
360 /* control the use of external sleep clock */
361 u8 externalsleepclk;
362
363 /* reserved field, should be set to zero */
364 __le16 reserved;
365 };
366
367 struct cmd_ds_802_11_inactivity_timeout {
368 /* ACT_GET/ACT_SET */
369 __le16 action;
370
371 /* Inactivity timeout in msec */
372 __le16 timeout;
373 };
374
375 struct cmd_ds_802_11_rf_channel {
376 __le16 action;
377 __le16 currentchannel;
378 __le16 rftype;
379 __le16 reserved;
380 u8 channellist[32];
381 };
382
383 struct cmd_ds_802_11_rssi {
384 /* weighting factor */
385 __le16 N;
386
387 __le16 reserved_0;
388 __le16 reserved_1;
389 __le16 reserved_2;
390 };
391
392 struct cmd_ds_802_11_rssi_rsp {
393 __le16 SNR;
394 __le16 noisefloor;
395 __le16 avgSNR;
396 __le16 avgnoisefloor;
397 };
398
399 struct cmd_ds_802_11_mac_address {
400 __le16 action;
401 u8 macadd[ETH_ALEN];
402 };
403
404 struct cmd_ds_802_11_rf_tx_power {
405 __le16 action;
406 __le16 currentlevel;
407 };
408
409 struct cmd_ds_802_11_rf_antenna {
410 __le16 action;
411
412 /* Number of antennas or 0xffff(diversity) */
413 __le16 antennamode;
414
415 };
416
417 struct cmd_ds_802_11_monitor_mode {
418 u16 action;
419 u16 mode;
420 };
421
422 struct cmd_ds_set_boot2_ver {
423 u16 action;
424 u16 version;
425 };
426
427 struct cmd_ds_802_11_ps_mode {
428 __le16 action;
429 __le16 nullpktinterval;
430 __le16 multipledtim;
431 __le16 reserved;
432 __le16 locallisteninterval;
433 };
434
435 struct PS_CMD_ConfirmSleep {
436 __le16 command;
437 __le16 size;
438 __le16 seqnum;
439 __le16 result;
440
441 __le16 action;
442 __le16 reserved1;
443 __le16 multipledtim;
444 __le16 reserved;
445 __le16 locallisteninterval;
446 };
447
448 struct cmd_ds_802_11_data_rate {
449 __le16 action;
450 __le16 reserved;
451 u8 rates[MAX_RATES];
452 };
453
454 struct cmd_ds_802_11_rate_adapt_rateset {
455 __le16 action;
456 __le16 enablehwauto;
457 __le16 bitmap;
458 };
459
460 struct cmd_ds_802_11_ad_hoc_start {
461 u8 ssid[IW_ESSID_MAX_SIZE];
462 u8 bsstype;
463 __le16 beaconperiod;
464 u8 dtimperiod;
465 union IEEEtypes_ssparamset ssparamset;
466 union ieeetypes_phyparamset phyparamset;
467 __le16 probedelay;
468 __le16 capability;
469 u8 rates[MAX_RATES];
470 u8 tlv_memory_size_pad[100];
471 } __attribute__ ((packed));
472
473 struct adhoc_bssdesc {
474 u8 bssid[6];
475 u8 ssid[32];
476 u8 type;
477 __le16 beaconperiod;
478 u8 dtimperiod;
479 __le64 timestamp;
480 __le64 localtime;
481 union ieeetypes_phyparamset phyparamset;
482 union IEEEtypes_ssparamset ssparamset;
483 __le16 capability;
484 u8 rates[MAX_RATES];
485
486 /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
487 * Adhoc join command and will cause a binary layout mismatch with
488 * the firmware
489 */
490 } __attribute__ ((packed));
491
492 struct cmd_ds_802_11_ad_hoc_join {
493 struct adhoc_bssdesc bss;
494 __le16 failtimeout;
495 __le16 probedelay;
496
497 } __attribute__ ((packed));
498
499 struct cmd_ds_802_11_enable_rsn {
500 __le16 action;
501 __le16 enable;
502 } __attribute__ ((packed));
503
504 struct MrvlIEtype_keyParamSet {
505 /* type ID */
506 __le16 type;
507
508 /* length of Payload */
509 __le16 length;
510
511 /* type of key: WEP=0, TKIP=1, AES=2 */
512 __le16 keytypeid;
513
514 /* key control Info specific to a keytypeid */
515 __le16 keyinfo;
516
517 /* length of key */
518 __le16 keylen;
519
520 /* key material of size keylen */
521 u8 key[32];
522 };
523
524 struct cmd_ds_802_11_key_material {
525 __le16 action;
526 struct MrvlIEtype_keyParamSet keyParamSet[2];
527 } __attribute__ ((packed));
528
529 struct cmd_ds_802_11_eeprom_access {
530 __le16 action;
531
532 /* multiple 4 */
533 __le16 offset;
534 __le16 bytecount;
535 u8 value;
536 } __attribute__ ((packed));
537
538 struct cmd_ds_802_11_tpc_cfg {
539 __le16 action;
540 u8 enable;
541 s8 P0;
542 s8 P1;
543 s8 P2;
544 u8 usesnr;
545 } __attribute__ ((packed));
546
547 struct cmd_ds_802_11_led_ctrl {
548 __le16 action;
549 __le16 numled;
550 u8 data[256];
551 } __attribute__ ((packed));
552
553 struct cmd_ds_802_11_pwr_cfg {
554 __le16 action;
555 u8 enable;
556 s8 PA_P0;
557 s8 PA_P1;
558 s8 PA_P2;
559 } __attribute__ ((packed));
560
561 struct cmd_ds_802_11_afc {
562 __le16 afc_auto;
563 union {
564 struct {
565 __le16 threshold;
566 __le16 period;
567 };
568 struct {
569 __le16 timing_offset; /* signed */
570 __le16 carrier_offset; /* signed */
571 };
572 };
573 } __attribute__ ((packed));
574
575 struct cmd_tx_rate_query {
576 __le16 txrate;
577 } __attribute__ ((packed));
578
579 struct cmd_ds_get_tsf {
580 __le64 tsfvalue;
581 } __attribute__ ((packed));
582
583 struct cmd_ds_bt_access {
584 __le16 action;
585 __le32 id;
586 u8 addr1[ETH_ALEN];
587 u8 addr2[ETH_ALEN];
588 } __attribute__ ((packed));
589
590 struct cmd_ds_fwt_access {
591 __le16 action;
592 __le32 id;
593 u8 valid;
594 u8 da[ETH_ALEN];
595 u8 dir;
596 u8 ra[ETH_ALEN];
597 __le32 ssn;
598 __le32 dsn;
599 __le32 metric;
600 u8 rate;
601 u8 hopcount;
602 u8 ttl;
603 __le32 expiration;
604 u8 sleepmode;
605 __le32 snr;
606 __le32 references;
607 u8 prec[ETH_ALEN];
608 } __attribute__ ((packed));
609
610 struct cmd_ds_mesh_access {
611 __le16 action;
612 __le32 data[32]; /* last position reserved */
613 } __attribute__ ((packed));
614
615 /* Number of stats counters returned by the firmware */
616 #define MESH_STATS_NUM 8
617
618 struct cmd_ds_command {
619 /* command header */
620 __le16 command;
621 __le16 size;
622 __le16 seqnum;
623 __le16 result;
624
625 /* command Body */
626 union {
627 struct cmd_ds_get_hw_spec hwspec;
628 struct cmd_ds_802_11_ps_mode psmode;
629 struct cmd_ds_802_11_scan scan;
630 struct cmd_ds_802_11_scan_rsp scanresp;
631 struct cmd_ds_mac_control macctrl;
632 struct cmd_ds_802_11_associate associate;
633 struct cmd_ds_802_11_deauthenticate deauth;
634 struct cmd_ds_802_11_set_wep wep;
635 struct cmd_ds_802_11_ad_hoc_start ads;
636 struct cmd_ds_802_11_reset reset;
637 struct cmd_ds_802_11_ad_hoc_result result;
638 struct cmd_ds_802_11_get_log glog;
639 struct cmd_ds_802_11_authenticate auth;
640 struct cmd_ds_802_11_get_stat gstat;
641 struct cmd_ds_802_3_get_stat gstat_8023;
642 struct cmd_ds_802_11_snmp_mib smib;
643 struct cmd_ds_802_11_rf_tx_power txp;
644 struct cmd_ds_802_11_rf_antenna rant;
645 struct cmd_ds_802_11_monitor_mode monitor;
646 struct cmd_ds_802_11_data_rate drate;
647 struct cmd_ds_802_11_rate_adapt_rateset rateset;
648 struct cmd_ds_mac_multicast_adr madr;
649 struct cmd_ds_802_11_ad_hoc_join adj;
650 struct cmd_ds_802_11_radio_control radio;
651 struct cmd_ds_802_11_rf_channel rfchannel;
652 struct cmd_ds_802_11_rssi rssi;
653 struct cmd_ds_802_11_rssi_rsp rssirsp;
654 struct cmd_ds_802_11_disassociate dassociate;
655 struct cmd_ds_802_11_mac_address macadd;
656 struct cmd_ds_802_11_enable_rsn enbrsn;
657 struct cmd_ds_802_11_key_material keymaterial;
658 struct cmd_ds_mac_reg_access macreg;
659 struct cmd_ds_bbp_reg_access bbpreg;
660 struct cmd_ds_rf_reg_access rfreg;
661 struct cmd_ds_802_11_eeprom_access rdeeprom;
662
663 struct cmd_ds_802_11d_domain_info domaininfo;
664 struct cmd_ds_802_11d_domain_info domaininforesp;
665
666 struct cmd_ds_802_11_sleep_params sleep_params;
667 struct cmd_ds_802_11_inactivity_timeout inactivity_timeout;
668 struct cmd_ds_802_11_tpc_cfg tpccfg;
669 struct cmd_ds_802_11_pwr_cfg pwrcfg;
670 struct cmd_ds_802_11_afc afc;
671 struct cmd_ds_802_11_led_ctrl ledgpio;
672
673 struct cmd_tx_rate_query txrate;
674 struct cmd_ds_bt_access bt;
675 struct cmd_ds_fwt_access fwt;
676 struct cmd_ds_mesh_access mesh;
677 struct cmd_ds_set_boot2_ver boot2_ver;
678 struct cmd_ds_get_tsf gettsf;
679 struct cmd_ds_802_11_subscribe_event subscribe_event;
680 struct cmd_ds_802_11_beacon_control bcn_ctrl;
681 } params;
682 } __attribute__ ((packed));
683
684 #endif