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