1 /**
2  * This file is compiled from several Madwifi header files.
3  * Original copyright is:
4  *
5  * Copyright (c) 2001 Atsushi Onoe
6  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * Alternatively, this software may be distributed under the terms of the
21  * GNU General Public License ("GPL") version 2 as published by the Free
22  * Software Foundation.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef MADWIFI_H
37 #define MADWIFI_H
38 
39 #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
40 #define IEEE80211_RATE_VAL 0x7f
41 #define IEEE80211_RATE_SIZE 8     /* 802.11 standard */
42 #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
43 
44 /*
45  * Per/node (station) statistics available when operating as an AP.
46  */
47 struct ieee80211_nodestats {
48   u_int32_t ns_rx_data;      /* rx data frames */
49   u_int32_t ns_rx_mgmt;      /* rx management frames */
50   u_int32_t ns_rx_ctrl;      /* rx control frames */
51   u_int32_t ns_rx_ucast;     /* rx unicast frames */
52   u_int32_t ns_rx_mcast;     /* rx multi/broadcast frames */
53   u_int64_t ns_rx_bytes;     /* rx data count (bytes) */
54   u_int64_t ns_rx_beacons;   /* rx beacon frames */
55   u_int32_t ns_rx_proberesp; /* rx probe response frames */
56 
57   u_int32_t ns_rx_dup;         /* rx discard because it's a dup */
58   u_int32_t ns_rx_noprivacy;   /* rx w/ wep but privacy off */
59   u_int32_t ns_rx_wepfail;     /* rx wep processing failed */
60   u_int32_t ns_rx_demicfail;   /* rx demic failed */
61   u_int32_t ns_rx_decap;       /* rx decapsulation failed */
62   u_int32_t ns_rx_defrag;      /* rx defragmentation failed */
63   u_int32_t ns_rx_disassoc;    /* rx disassociation */
64   u_int32_t ns_rx_deauth;      /* rx deauthentication */
65   u_int32_t ns_rx_decryptcrc;  /* rx decrypt failed on crc */
66   u_int32_t ns_rx_unauth;      /* rx on unauthorized port */
67   u_int32_t ns_rx_unencrypted; /* rx unecrypted w/ privacy */
68 
69   u_int32_t ns_tx_data;     /* tx data frames */
70   u_int32_t ns_tx_mgmt;     /* tx management frames */
71   u_int32_t ns_tx_ucast;    /* tx unicast frames */
72   u_int32_t ns_tx_mcast;    /* tx multi/broadcast frames */
73   u_int64_t ns_tx_bytes;    /* tx data count (bytes) */
74   u_int32_t ns_tx_probereq; /* tx probe request frames */
75   u_int32_t ns_tx_uapsd;    /* tx on uapsd queue */
76 
77   u_int32_t ns_tx_novlantag;    /* tx discard due to no tag */
78   u_int32_t ns_tx_vlanmismatch; /* tx discard due to of bad tag */
79 
80   u_int32_t ns_tx_eosplost; /* uapsd EOSP retried out */
81 
82   u_int32_t ns_ps_discard; /* ps discard due to of age */
83 
84   u_int32_t ns_uapsd_triggers; /* uapsd triggers */
85 
86   /* MIB-related state */
87   u_int32_t ns_tx_assoc;         /* [re]associations */
88   u_int32_t ns_tx_assoc_fail;    /* [re]association failures */
89   u_int32_t ns_tx_auth;          /* [re]authentications */
90   u_int32_t ns_tx_auth_fail;     /* [re]authentication failures*/
91   u_int32_t ns_tx_deauth;        /* deauthentications */
92   u_int32_t ns_tx_deauth_code;   /* last deauth reason */
93   u_int32_t ns_tx_disassoc;      /* disassociations */
94   u_int32_t ns_tx_disassoc_code; /* last disassociation reason */
95   u_int32_t ns_psq_drops;        /* power save queue drops */
96 };
97 
98 /*
99  * Summary statistics.
100  */
101 struct ieee80211_stats {
102   u_int32_t is_rx_badversion;           /* rx frame with bad version */
103   u_int32_t is_rx_tooshort;             /* rx frame too short */
104   u_int32_t is_rx_wrongbss;             /* rx from wrong bssid */
105   u_int32_t is_rx_dup;                  /* rx discard due to it's a dup */
106   u_int32_t is_rx_wrongdir;             /* rx w/ wrong direction */
107   u_int32_t is_rx_mcastecho;            /* rx discard due to of mcast echo */
108   u_int32_t is_rx_notassoc;             /* rx discard due to sta !assoc */
109   u_int32_t is_rx_noprivacy;            /* rx w/ wep but privacy off */
110   u_int32_t is_rx_unencrypted;          /* rx w/o wep and privacy on */
111   u_int32_t is_rx_wepfail;              /* rx wep processing failed */
112   u_int32_t is_rx_decap;                /* rx decapsulation failed */
113   u_int32_t is_rx_mgtdiscard;           /* rx discard mgt frames */
114   u_int32_t is_rx_ctl;                  /* rx discard ctrl frames */
115   u_int32_t is_rx_beacon;               /* rx beacon frames */
116   u_int32_t is_rx_rstoobig;             /* rx rate set truncated */
117   u_int32_t is_rx_elem_missing;         /* rx required element missing*/
118   u_int32_t is_rx_elem_toobig;          /* rx element too big */
119   u_int32_t is_rx_elem_toosmall;        /* rx element too small */
120   u_int32_t is_rx_elem_unknown;         /* rx element unknown */
121   u_int32_t is_rx_badchan;              /* rx frame w/ invalid chan */
122   u_int32_t is_rx_chanmismatch;         /* rx frame chan mismatch */
123   u_int32_t is_rx_nodealloc;            /* rx frame dropped */
124   u_int32_t is_rx_ssidmismatch;         /* rx frame ssid mismatch  */
125   u_int32_t is_rx_auth_unsupported;     /* rx w/ unsupported auth alg */
126   u_int32_t is_rx_auth_fail;            /* rx sta auth failure */
127   u_int32_t is_rx_auth_countermeasures; /* rx auth discard due to CM */
128   u_int32_t is_rx_assoc_bss;            /* rx assoc from wrong bssid */
129   u_int32_t is_rx_assoc_notauth;        /* rx assoc w/o auth */
130   u_int32_t is_rx_assoc_capmismatch;    /* rx assoc w/ cap mismatch */
131   u_int32_t is_rx_assoc_norate;         /* rx assoc w/ no rate match */
132   u_int32_t is_rx_assoc_badwpaie;       /* rx assoc w/ bad WPA IE */
133   u_int32_t is_rx_deauth;               /* rx deauthentication */
134   u_int32_t is_rx_disassoc;             /* rx disassociation */
135   u_int32_t is_rx_badsubtype;           /* rx frame w/ unknown subtype*/
136   u_int32_t is_rx_nobuf;                /* rx failed for lack of buf */
137   u_int32_t is_rx_decryptcrc;           /* rx decrypt failed on crc */
138   u_int32_t is_rx_ahdemo_mgt;           /* rx discard ahdemo mgt frame*/
139   u_int32_t is_rx_bad_auth;             /* rx bad auth request */
140   u_int32_t is_rx_unauth;               /* rx on unauthorized port */
141   u_int32_t is_rx_badkeyid;             /* rx w/ incorrect keyid */
142   u_int32_t is_rx_ccmpreplay;           /* rx seq# violation (CCMP) */
143   u_int32_t is_rx_ccmpformat;           /* rx format bad (CCMP) */
144   u_int32_t is_rx_ccmpmic;              /* rx MIC check failed (CCMP) */
145   u_int32_t is_rx_tkipreplay;           /* rx seq# violation (TKIP) */
146   u_int32_t is_rx_tkipformat;           /* rx format bad (TKIP) */
147   u_int32_t is_rx_tkipmic;              /* rx MIC check failed (TKIP) */
148   u_int32_t is_rx_tkipicv;              /* rx ICV check failed (TKIP) */
149   u_int32_t is_rx_badcipher;            /* rx failed due to of key type */
150   u_int32_t is_rx_nocipherctx;          /* rx failed due to key !setup */
151   u_int32_t is_rx_acl;                  /* rx discard due to of acl policy */
152   u_int32_t is_rx_ffcnt;                /* rx fast frames */
153   u_int32_t is_rx_badathtnl;            /* driver key alloc failed */
154   u_int32_t is_tx_nobuf;                /* tx failed for lack of buf */
155   u_int32_t is_tx_nonode;               /* tx failed for no node */
156   u_int32_t is_tx_unknownmgt;           /* tx of unknown mgt frame */
157   u_int32_t is_tx_badcipher;            /* tx failed due to of key type */
158   u_int32_t is_tx_nodefkey;             /* tx failed due to no defkey */
159   u_int32_t is_tx_noheadroom;           /* tx failed due to no space */
160   u_int32_t is_tx_ffokcnt;              /* tx fast frames sent success */
161   u_int32_t is_tx_fferrcnt;             /* tx fast frames sent success */
162   u_int32_t is_scan_active;             /* active scans started */
163   u_int32_t is_scan_passive;            /* passive scans started */
164   u_int32_t is_node_timeout;            /* nodes timed out inactivity */
165   u_int32_t is_crypto_nomem;            /* no memory for crypto ctx */
166   u_int32_t is_crypto_tkip;             /* tkip crypto done in s/w */
167   u_int32_t is_crypto_tkipenmic;        /* tkip en-MIC done in s/w */
168   u_int32_t is_crypto_tkipdemic;        /* tkip de-MIC done in s/w */
169   u_int32_t is_crypto_tkipcm;           /* tkip counter measures */
170   u_int32_t is_crypto_ccmp;             /* ccmp crypto done in s/w */
171   u_int32_t is_crypto_wep;              /* wep crypto done in s/w */
172   u_int32_t is_crypto_setkey_cipher;    /* cipher rejected key */
173   u_int32_t is_crypto_setkey_nokey;     /* no key index for setkey */
174   u_int32_t is_crypto_delkey;           /* driver key delete failed */
175   u_int32_t is_crypto_badcipher;        /* unknown cipher */
176   u_int32_t is_crypto_nocipher;         /* cipher not available */
177   u_int32_t is_crypto_attachfail;       /* cipher attach failed */
178   u_int32_t is_crypto_swfallback;       /* cipher fallback to s/w */
179   u_int32_t is_crypto_keyfail;          /* driver key alloc failed */
180   u_int32_t is_crypto_enmicfail;        /* en-MIC failed */
181   u_int32_t is_ibss_capmismatch;        /* merge failed-cap mismatch */
182   u_int32_t is_ibss_norate;             /* merge failed-rate mismatch */
183   u_int32_t is_ps_unassoc;              /* ps-poll for unassoc. sta */
184   u_int32_t is_ps_badaid;               /* ps-poll w/ incorrect aid */
185   u_int32_t is_ps_qempty;               /* ps-poll w/ nothing to send */
186 };
187 
188 /*
189  * Retrieve per-node statistics.
190  */
191 struct ieee80211req_sta_stats {
192   union {
193     /* NB: explicitly force 64-bit alignment */
194     u_int8_t macaddr[IEEE80211_ADDR_LEN];
195     u_int64_t pad;
196   } is_u;
197   struct ieee80211_nodestats is_stats;
198 };
199 
200 /*
201  * Station information block; the mac address is used
202  * to retrieve other data like stats, unicast key, etc.
203  */
204 struct ieee80211req_sta_info {
205   u_int16_t isi_len;     /* length (mult of 4) */
206   u_int16_t isi_freq;    /* MHz */
207   u_int16_t isi_flags;   /* channel flags */
208   u_int16_t isi_state;   /* state flags */
209   u_int8_t isi_authmode; /* authentication algorithm */
210   u_int8_t isi_rssi;
211   u_int16_t isi_capinfo; /* capabilities */
212   u_int8_t isi_athflags; /* Atheros capabilities */
213   u_int8_t isi_erp;      /* ERP element */
214   u_int8_t isi_macaddr[IEEE80211_ADDR_LEN];
215   u_int8_t isi_nrates; /* negotiated rates */
216   u_int8_t isi_rates[IEEE80211_RATE_MAXSIZE];
217   u_int8_t isi_txrate;      /* index to isi_rates[] */
218   u_int16_t isi_ie_len;     /* IE length */
219   u_int16_t isi_associd;    /* assoc response */
220   u_int16_t isi_txpower;    /* current tx power */
221   u_int16_t isi_vlan;       /* vlan tag */
222   u_int16_t isi_txseqs[17]; /* seq to be transmitted */
223   u_int16_t isi_rxseqs[17]; /* seq previous for qos frames*/
224   u_int16_t isi_inact;      /* inactivity timer */
225   u_int8_t isi_uapsd;       /* UAPSD queues */
226   u_int8_t isi_opmode;      /* sta operating mode */
227 
228   /* XXX frag state? */
229   /* variable length IE data */
230 };
231 
232 struct ath_stats {
233   u_int32_t ast_watchdog;      /* device reset by watchdog */
234   u_int32_t ast_hardware;      /* fatal hardware error interrupts */
235   u_int32_t ast_bmiss;         /* beacon miss interrupts */
236   u_int32_t ast_rxorn;         /* rx overrun interrupts */
237   u_int32_t ast_rxeol;         /* rx eol interrupts */
238   u_int32_t ast_txurn;         /* tx underrun interrupts */
239   u_int32_t ast_mib;           /* mib interrupts */
240   u_int32_t ast_tx_packets;    /* packet sent on the interface */
241   u_int32_t ast_tx_mgmt;       /* management frames transmitted */
242   u_int32_t ast_tx_discard;    /* frames discarded prior to assoc */
243   u_int32_t ast_tx_invalid;    /* frames discarded due to is device gone */
244   u_int32_t ast_tx_qstop;      /* tx queue stopped because it's full */
245   u_int32_t ast_tx_encap;      /* tx encapsulation failed */
246   u_int32_t ast_tx_nonode;     /* tx failed due to of no node */
247   u_int32_t ast_tx_nobuf;      /* tx failed due to of no tx buffer (data) */
248   u_int32_t ast_tx_nobufmgt;   /* tx failed due to of no tx buffer (mgmt)*/
249   u_int32_t ast_tx_xretries;   /* tx failed due to of too many retries */
250   u_int32_t ast_tx_fifoerr;    /* tx failed due to of FIFO underrun */
251   u_int32_t ast_tx_filtered;   /* tx failed due to xmit filtered */
252   u_int32_t ast_tx_shortretry; /* tx on-chip retries (short) */
253   u_int32_t ast_tx_longretry;  /* tx on-chip retries (long) */
254   u_int32_t ast_tx_badrate;    /* tx failed due to of bogus xmit rate */
255   u_int32_t ast_tx_noack;      /* tx frames with no ack marked */
256   u_int32_t ast_tx_rts;        /* tx frames with rts enabled */
257   u_int32_t ast_tx_cts;        /* tx frames with cts enabled */
258   u_int32_t ast_tx_shortpre;   /* tx frames with short preamble */
259   u_int32_t ast_tx_altrate;    /* tx frames with alternate rate */
260   u_int32_t ast_tx_protect;    /* tx frames with protection */
261   u_int32_t ast_rx_orn;        /* rx failed due to of desc overrun */
262   u_int32_t ast_rx_crcerr;     /* rx failed due to of bad CRC */
263   u_int32_t ast_rx_fifoerr;    /* rx failed due to of FIFO overrun */
264   u_int32_t ast_rx_badcrypt;   /* rx failed due to of decryption */
265   u_int32_t ast_rx_badmic;     /* rx failed due to of MIC failure */
266   u_int32_t ast_rx_phyerr;     /* rx PHY error summary count */
267   u_int32_t ast_rx_phy[32];    /* rx PHY error per-code counts */
268   u_int32_t ast_rx_tooshort;   /* rx discarded due to frame too short */
269   u_int32_t ast_rx_toobig;     /* rx discarded due to frame too large */
270   u_int32_t ast_rx_nobuf;      /* rx setup failed due to of no skbuff */
271   u_int32_t ast_rx_packets;    /* packet recv on the interface */
272   u_int32_t ast_rx_mgt;        /* management frames received */
273   u_int32_t ast_rx_ctl;        /* control frames received */
274   int8_t ast_tx_rssi;          /* tx rssi of last ack */
275   int8_t ast_rx_rssi;          /* rx rssi from histogram */
276   u_int32_t ast_be_xmit;       /* beacons transmitted */
277   u_int32_t ast_be_nobuf;      /* no skbuff available for beacon */
278   u_int32_t ast_per_cal;       /* periodic calibration calls */
279   u_int32_t ast_per_calfail;   /* periodic calibration failed */
280   u_int32_t ast_per_rfgain;    /* periodic calibration rfgain reset */
281   u_int32_t ast_rate_calls;    /* rate control checks */
282   u_int32_t ast_rate_raise;    /* rate control raised xmit rate */
283   u_int32_t ast_rate_drop;     /* rate control dropped xmit rate */
284   u_int32_t ast_ant_defswitch; /* rx/default antenna switches */
285   u_int32_t ast_ant_txswitch;  /* tx antenna switches */
286   u_int32_t ast_ant_rx[8];     /* rx frames with antenna */
287   u_int32_t ast_ant_tx[8];     /* tx frames with antenna */
288 };
289 
290 #define SIOCGATHSTATS (SIOCDEVPRIVATE + 0)
291 #define SIOCGATHDIAG (SIOCDEVPRIVATE + 1)
292 #define SIOCGATHRADARSIG (SIOCDEVPRIVATE + 2)
293 #define SIOCGATHHALDIAG (SIOCDEVPRIVATE + 3)
294 #define SIOCG80211STATS (SIOCDEVPRIVATE + 2)
295 /* NB: require in+out parameters so cannot use wireless extensions, yech */
296 #define IEEE80211_IOCTL_GETKEY (SIOCDEVPRIVATE + 3)
297 #define IEEE80211_IOCTL_GETWPAIE (SIOCDEVPRIVATE + 4)
298 #define IEEE80211_IOCTL_STA_STATS (SIOCDEVPRIVATE + 5)
299 #define IEEE80211_IOCTL_STA_INFO (SIOCDEVPRIVATE + 6)
300 #define SIOC80211IFCREATE (SIOCDEVPRIVATE + 7)
301 #define SIOC80211IFDESTROY (SIOCDEVPRIVATE + 8)
302 #define IEEE80211_IOCTL_SCAN_RESULTS (SIOCDEVPRIVATE + 9)
303 
304 #endif
305