xref: /openbsd/sys/dev/ic/if_wi_ieee.h (revision 4b1a56af)
1 /*	$OpenBSD: if_wi_ieee.h,v 1.31 2022/01/09 05:42:38 jsg Exp $	*/
2 
3 /*
4  * Copyright (c) 1997, 1998, 1999
5  *	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by Bill Paul.
18  * 4. Neither the name of the author nor the names of any co-contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32  * THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  *	From: if_wavelan_ieee.h,v 1.5.2.1 2001/07/04 00:12:34 brooks Exp $
35  */
36 
37 #ifndef _IF_WI_IEEE_H
38 #define _IF_WI_IEEE_H
39 
40 /*
41  * This header defines a simple command interface to the FreeBSD
42  * WaveLAN/IEEE driver (wi) driver, which is used to set certain
43  * device-specific parameters which can't be easily managed through
44  * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_
45  * interface, didn't I.
46  */
47 
48 #define SIOCSWAVELAN	_IOW('i', 206, struct ifreq)	/* wavelan set op */
49 #define SIOCGWAVELAN	_IOWR('i', 207, struct ifreq)	/* wavelan get op */
50 
51 /*
52  * Technically I don't think there's a limit to a record
53  * length. The largest record is the one that contains the CIS
54  * data, which is 240 words long, so 256 should be a safe
55  * value.
56  */
57 #define WI_MAX_DATALEN	512
58 
59 struct wi_req {
60 	u_int16_t	wi_len;
61 	u_int16_t	wi_type;
62 	u_int16_t	wi_val[WI_MAX_DATALEN];
63 };
64 
65 /*
66  * Private LTV records (interpreted only by the driver). This is
67  * a minor kludge to allow reading the interface statistics from
68  * the driver.
69  */
70 #define WI_RID_IFACE_STATS	0x0100
71 #define WI_RID_MGMT_XMIT	0x0200
72 #define	WI_RID_MONITOR_MODE	0x0500
73 #define WI_RID_SCAN_APS		0x0600
74 #define WI_RID_READ_APS		0x0700
75 
76 struct wi_80211_hdr {
77 	u_int16_t		frame_ctl;
78 	u_int16_t		dur_id;
79 	u_int8_t		addr1[6];
80 	u_int8_t		addr2[6];
81 	u_int8_t		addr3[6];
82 	u_int16_t		seq_ctl;
83 	u_int8_t		addr4[6];
84 };
85 
86 #define WI_FCTL_VERS		0x0002
87 #define WI_FCTL_FTYPE		0x000C
88 #define WI_FCTL_STYPE		0x00F0
89 #define WI_FCTL_TODS		0x0100
90 #define WI_FCTL_FROMDS		0x0200
91 #define WI_FCTL_MOREFRAGS	0x0400
92 #define WI_FCTL_RETRY		0x0800
93 #define WI_FCTL_PM		0x1000
94 #define WI_FCTL_MOREDATA	0x2000
95 #define WI_FCTL_WEP		0x4000
96 #define WI_FCTL_ORDER		0x8000
97 
98 #define WI_FTYPE_MGMT		0x0000
99 #define WI_FTYPE_CTL		0x0004
100 #define WI_FTYPE_DATA		0x0008
101 
102 #define WI_STYPE_MGMT_ASREQ	0x0000	/* association request */
103 #define WI_STYPE_MGMT_ASRESP	0x0010	/* association response */
104 #define WI_STYPE_MGMT_REASREQ	0x0020	/* reassociation request */
105 #define WI_STYPE_MGMT_REASRESP	0x0030	/* reassociation response */
106 #define WI_STYPE_MGMT_PROBEREQ	0x0040	/* probe request */
107 #define WI_STYPE_MGMT_PROBERESP	0x0050	/* probe response */
108 #define WI_STYPE_MGMT_BEACON	0x0080	/* beacon */
109 #define WI_STYPE_MGMT_ATIM	0x0090	/* announcement traffic ind msg */
110 #define WI_STYPE_MGMT_DISAS	0x00A0	/* disassociation */
111 #define WI_STYPE_MGMT_AUTH	0x00B0	/* authentication */
112 #define WI_STYPE_MGMT_DEAUTH	0x00C0	/* deauthentication */
113 
114 #define WI_STYPE_CTL_PSPOLL	0x00A0
115 #define WI_STYPE_CTL_RTS	0x00B0
116 #define WI_STYPE_CTL_CTS	0x00C0
117 #define WI_STYPE_CTL_ACK	0x00D0
118 #define WI_STYPE_CTL_CFEND	0x00E0
119 #define WI_STYPE_CTL_CFENDACK	0x00F0
120 #define WI_STYPE_CTL_CFENDCFACK	WI_STYPE_CTL_CFENDACK
121 
122 #define WI_STYPE_DATA		0x0000
123 #define WI_STYPE_DATA_CFACK	0x0010
124 #define WI_STYPE_DATA_CFPOLL	0x0020
125 #define WI_STYPE_DATA_CFACKPOLL	0x0030
126 #define WI_STYPE_NULLFUNC	0x0040
127 #define WI_STYPE_CFACK		0x0050
128 #define WI_STYPE_CFPOLL		0x0060
129 #define WI_STYPE_CFACKPOLL	0x0070
130 
131 struct wi_mgmt_hdr {
132 	u_int16_t		frame_ctl;
133 	u_int16_t		duration;
134 	u_int8_t		dst_addr[6];
135 	u_int8_t		src_addr[6];
136 	u_int8_t		bssid[6];
137 	u_int16_t		seq_ctl;
138 };
139 
140 struct wi_counters {
141 	u_int32_t		wi_tx_unicast_frames;
142 	u_int32_t		wi_tx_multicast_frames;
143 	u_int32_t		wi_tx_fragments;
144 	u_int32_t		wi_tx_unicast_octets;
145 	u_int32_t		wi_tx_multicast_octets;
146 	u_int32_t		wi_tx_deferred_xmits;
147 	u_int32_t		wi_tx_single_retries;
148 	u_int32_t		wi_tx_multi_retries;
149 	u_int32_t		wi_tx_retry_limit;
150 	u_int32_t		wi_tx_discards;
151 	u_int32_t		wi_rx_unicast_frames;
152 	u_int32_t		wi_rx_multicast_frames;
153 	u_int32_t		wi_rx_fragments;
154 	u_int32_t		wi_rx_unicast_octets;
155 	u_int32_t		wi_rx_multicast_octets;
156 	u_int32_t		wi_rx_fcs_errors;
157 	u_int32_t		wi_rx_discards_nobuf;
158 	u_int32_t		wi_tx_discards_wrong_sa;
159 	u_int32_t		wi_rx_WEP_cant_decrypt;
160 	u_int32_t		wi_rx_msg_in_msg_frags;
161 	u_int32_t		wi_rx_msg_in_bad_msg_frags;
162 };
163 
164 /*
165  * These are all the LTV record types that we can read or write
166  * from the WaveLAN. Not all of them are tremendously useful, but I
167  * list as many as I know about here for completeness.
168  */
169 
170 #define WI_RID_DNLD_BUF		0xFD01
171 #define WI_RID_MEMSZ		0xFD02 /* memory size info (Lucent) */
172 #define WI_RID_PRI_IDENTITY	0xFD02 /* primary firmware ident (PRISM2) */
173 #define WI_RID_DOMAINS		0xFD11 /* List of intended regulatory domains */
174 #define WI_RID_CIS		0xFD13 /* CIS info */
175 #define WI_RID_COMMQUAL		0xFD43 /* Communications quality */
176 #define WI_RID_SCALETHRESH	0xFD46 /* Actual system scale thresholds */
177 #define WI_RID_PCF		0xFD87 /* PCF info */
178 
179 /*
180  * Network parameters, static configuration entities.
181  */
182 #define	WI_RID_PORTTYPE		0xFC00 /* Connection control characteristics */
183 #define	WI_RID_MAC_NODE		0xFC01 /* MAC address of this station */
184 #define	WI_RID_DESIRED_SSID	0xFC02 /* Service Set ID for connection */
185 #define	WI_RID_OWN_CHNL		0xFC03 /* Comm channel for BSS creation */
186 #define	WI_RID_OWN_SSID		0xFC04 /* IBSS creation ID */
187 #define	WI_RID_OWN_ATIM_WIN	0xFC05 /* ATIM window time for IBSS creation */
188 #define	WI_RID_SYSTEM_SCALE	0xFC06 /* scale that specifies AP density */
189 #define	WI_RID_MAX_DATALEN	0xFC07 /* Max len of MAC frame body data */
190 #define	WI_RID_MAC_WDS		0xFC08 /* MAC addr of corresponding WDS node */
191 #define	WI_RID_PM_ENABLED	0xFC09 /* ESS power management enable */
192 #define	WI_RID_PM_EPS		0xFC0A /* PM EPS/PS mode */
193 #define	WI_RID_MCAST_RX		0xFC0B /* ESS PM mcast reception */
194 #define	WI_RID_MAX_SLEEP	0xFC0C /* max sleep time for ESS PM */
195 #define	WI_RID_HOLDOVER		0xFC0D /* holdover time for ESS PM */
196 #define	WI_RID_NODENAME		0xFC0E /* ID name of this node for diag */
197 #define	WI_RID_DTIM_PERIOD	0xFC10 /* beacon interval between DTIMs */
198 #define	WI_RID_WDS_ADDR1	0xFC11 /* port 1 MAC of WDS link node */
199 #define	WI_RID_WDS_ADDR2	0xFC12 /* port 1 MAC of WDS link node */
200 #define	WI_RID_WDS_ADDR3	0xFC13 /* port 1 MAC of WDS link node */
201 #define	WI_RID_WDS_ADDR4	0xFC14 /* port 1 MAC of WDS link node */
202 #define	WI_RID_WDS_ADDR5	0xFC15 /* port 1 MAC of WDS link node */
203 #define	WI_RID_WDS_ADDR6	0xFC16 /* port 1 MAC of WDS link node */
204 #define	WI_RID_MCAST_PM_BUF	0xFC17 /* PM buffering of mcast */
205 #define	WI_RID_ENCRYPTION	0xFC20 /* enable/disable WEP */
206 #define	WI_RID_AUTHTYPE		0xFC21 /* specify authentication type */
207 #define	WI_RID_SYMBOL_MANDATORYBSSID 0xFC21
208 #define	WI_RID_P2_TX_CRYPT_KEY	0xFC23
209 #define	WI_RID_P2_CRYPT_KEY0	0xFC24
210 #define	WI_RID_P2_CRYPT_KEY1	0xFC25
211 #define	WI_RID_MICROWAVE_OVEN	0xFC25 /* Microwave oven robustness */
212 #define	WI_RID_P2_CRYPT_KEY2	0xFC26
213 #define	WI_RID_P2_CRYPT_KEY3	0xFC27
214 #define	WI_RID_P2_ENCRYPTION	0xFC28
215 #define PRIVACY_INVOKED		0x01
216 #define EXCLUDE_UNENCRYPTED	0x02
217 #define HOST_ENCRYPT		0x10
218 #define IV_EVERY_FRAME		0x00
219 #define IV_EVERY10_FRAME	0x20
220 #define IV_EVERY50_FRAME	0x40
221 #define IV_EVERY100_FRAME	0x60
222 #define HOST_DECRYPT		0x80
223 #define	WI_RID_WEP_MAPTABLE	0xFC29
224 #define	WI_RID_CNFAUTHMODE	0xFC2A
225 #define	WI_RID_SYMBOL_KEYLENGTH	0xFC2B
226 #define	WI_RID_ROAMING_MODE	0xFC2D /* Roaming mode (1:firm,3:disable) */
227 #define WI_RID_CUR_BEACON_INT	0xFC33 /* beacon xmit time for BSS creation */
228 #define	WI_RID_ENH_SECURITY	0xFC43 /* hide SSID name (prism fw >= 1.6.3) */
229 #define WI_HIDESSID		0x01
230 #define WI_IGNPROBES		0x02
231 #define WI_HIDESSID_IGNPROBES	0x03
232 #define	WI_RID_DBM_ADJUST	0xFC46 /* Get DBM adjustment factor */
233 #define	WI_RID_SYMBOL_PREAMBLE	0xFC8C /* Enable/disable short preamble */
234 #define	WI_RID_P2_SHORT_PREAMBLE	0xFCB0 /* Short preamble support */
235 #define	WI_RID_P2_EXCLUDE_LONG_PREAMBLE	0xFCB1 /* Don't send long preamble */
236 #define	WI_RID_BASIC_RATE	0xFCB3
237 #define	WI_RID_SUPPORT_RATE	0xFCB4
238 #define WI_RID_SYMBOL_DIVERSITY	0xFC87 /* Symbol antenna diversity */
239 #define WI_RID_SYMBOL_BASIC_RATE 0xFC90
240 
241 /*
242  * Network parameters, dynamic configuration entities
243  */
244 #define WI_RID_MCAST_LIST	0xFC80 /* list of multicast addrs (up to 16) */
245 #define WI_RID_CREATE_IBSS	0xFC81 /* create IBSS */
246 #define WI_RID_FRAG_THRESH	0xFC82 /* frag len, unicast msg xmit */
247 #define WI_RID_RTS_THRESH	0xFC83 /* frame len for RTS/CTS handshake */
248 #define WI_RID_TX_RATE		0xFC84 /* data rate for message xmit */
249 #define WI_RID_PROMISC		0xFC85 /* enable promisc mode */
250 #define WI_RID_FRAG_THRESH0	0xFC90
251 #define WI_RID_FRAG_THRESH1	0xFC91
252 #define WI_RID_FRAG_THRESH2	0xFC92
253 #define WI_RID_FRAG_THRESH3	0xFC93
254 #define WI_RID_FRAG_THRESH4	0xFC94
255 #define WI_RID_FRAG_THRESH5	0xFC95
256 #define WI_RID_FRAG_THRESH6	0xFC96
257 #define WI_RID_RTS_THRESH0	0xFC97
258 #define WI_RID_RTS_THRESH1	0xFC98
259 #define WI_RID_RTS_THRESH2	0xFC99
260 #define WI_RID_RTS_THRESH3	0xFC9A
261 #define WI_RID_RTS_THRESH4	0xFC9B
262 #define WI_RID_RTS_THRESH5	0xFC9C
263 #define WI_RID_RTS_THRESH6	0xFC9D
264 #define WI_RID_TX_RATE0		0xFC9E
265 #define WI_RID_TX_RATE1		0xFC9F
266 #define WI_RID_TX_RATE2		0xFCA0
267 #define WI_RID_TX_RATE3		0xFCA1
268 #define WI_RID_TX_RATE4		0xFCA2
269 #define WI_RID_TX_RATE5		0xFCA3
270 #define WI_RID_TX_RATE6		0xFCA4
271 #define WI_RID_DEFLT_CRYPT_KEYS	0xFCB0
272 #define WI_RID_TX_CRYPT_KEY	0xFCB1
273 #define WI_RID_TICK_TIME	0xFCE0 /* Auxiliary Timer tick interval */
274 
275 struct wi_key {
276 	u_int16_t		wi_keylen;
277 	u_int8_t		wi_keydat[13];
278 };
279 
280 #define	WI_NLTV_KEYS	4
281 struct wi_ltv_keys {
282 	u_int16_t		wi_len;
283 	u_int16_t		wi_type;
284 	struct wi_key		wi_keys[WI_NLTV_KEYS];
285 };
286 
287 /*
288  * NIC information
289  */
290 #define WI_RID_FIRM_ID		0xFD02 /* Primary func firmware ID. */
291 #define WI_RID_PRI_SUP_RANGE	0xFD03 /* primary supplier compatibility */
292 #define WI_RID_CIF_ACT_RANGE	0xFD04 /* controller sup. compatibility */
293 #define WI_RID_SERIALNO		0xFD0A /* card serial number */
294 #define WI_RID_CARD_ID		0xFD0B /* card identification */
295 #define WI_RID_MFI_SUP_RANGE	0xFD0C /* modem supplier compatibility */
296 #define WI_RID_CFI_SUP_RANGE	0xFD0D /* controller sup. compatibility */
297 #define WI_RID_CHANNEL_LIST	0xFD10 /* allowed comm. frequencies. */
298 #define WI_RID_REG_DOMAINS	0xFD11 /* list of intended regulatory doms */
299 #define WI_RID_TEMP_TYPE	0xFD12 /* hw temp range code */
300 #define WI_RID_CIS		0xFD13 /* PC card info struct */
301 #define WI_RID_STA_IDENTITY	0xFD20 /* station funcs firmware ident */
302 #define WI_RID_STA_SUP_RANGE	0xFD21 /* station supplier compat */
303 #define WI_RID_MFI_ACT_RANGE	0xFD22
304 #define WI_RID_SYMBOL_IDENTITY	0xFD24 /* Symbol station firmware ident */
305 #define WI_RID_CFI_ACT_RANGE	0xFD33
306 
307 /*
308  * MAC information
309  */
310 #define WI_RID_PORT_STAT	0xFD40 /* actual MAC port con control stat */
311 #define WI_RID_CURRENT_SSID	0xFD41 /* ID of actually connected SS */
312 #define WI_RID_CURRENT_BSSID	0xFD42 /* ID of actually connected BSS */
313 #define WI_RID_COMMS_QUALITY	0xFD43 /* quality of BSS connection */
314 #define WI_RID_CUR_TX_RATE	0xFD44 /* current TX rate */
315 #define WI_RID_OWN_BEACON_INT	0xFD45 /* beacon xmit time for BSS creation */
316 #define WI_RID_CUR_SCALE_THRESH	0xFD46 /* actual system scale thresh setting */
317 #define WI_RID_PROT_RESP_TIME	0xFD47 /* time to wait for resp to req msg */
318 #define WI_RID_SHORT_RTR_LIM	0xFD48 /* max tx attempts for short frames */
319 #define WI_RID_LONG_RTS_LIM	0xFD49 /* max tx attempts for long frames */
320 #define WI_RID_MAX_TX_LIFE	0xFD4A /* max tx frame handling duration */
321 #define WI_RID_MAX_RX_LIFE	0xFD4B /* max rx frame handling duration */
322 #define WI_RID_CF_POLL		0xFD4C /* contention free pollable ind */
323 #define WI_RID_AUTH_ALGS	0xFD4D /* auth algorithms available */
324 #define WI_RID_AUTH_TYPE	0xFD4E /* available auth types */
325 #define WI_RID_WEP_AVAIL	0xFD4F /* WEP privacy option available */
326 #define WI_RID_CUR_TX_RATE1	0xFD80
327 #define WI_RID_CUR_TX_RATE2	0xFD81
328 #define WI_RID_CUR_TX_RATE3	0xFD82
329 #define WI_RID_CUR_TX_RATE4	0xFD83
330 #define WI_RID_CUR_TX_RATE5	0xFD84
331 #define WI_RID_CUR_TX_RATE6	0xFD85
332 #define WI_RID_OWN_MAC		0xFD86 /* unique local MAC addr */
333 #define WI_RID_PCI_INFO		0xFD87 /* point coordination func cap */
334 
335 /*
336  * Scan Information
337  */
338 #define WI_RID_BCAST_SCAN_REQ	0xFCAB /* Broadcast Scan request (Symbol) */
339 #define BSCAN_5SEC		0x01
340 #define BSCAN_ONETIME		0x02
341 #define BSCAN_PASSIVE		0x40
342 #define BSCAN_BCAST		0x80
343 #define WI_RID_SCAN_REQ		0xFCE1 /* Scan request (STA only) */
344 #define WI_RID_JOIN_REQ		0xFCE2 /* Join request (STA only) */
345 #define WI_RID_AUTH_STATION	0xFCE3 /* Authenticates Station (AP) */
346 #define WI_RID_CHANNEL_REQ	0xFCE4 /* Channel Information Request (AP) */
347 #define WI_RID_SCAN_RES		0xFD88 /* Scan Results Table */
348 
349 struct wi_apinfo {
350 	int			scanreason;	/* ScanReason */
351 	char			bssid[6];	/* BSSID (mac address) */
352 	int			channel;	/* Channel */
353 	int			signal;		/* Signal level */
354 	int			noise;		/* Average Noise Level*/
355 	int			quality;	/* Quality */
356 	int			namelen;	/* Length of SSID string */
357 	char			name[32];	/* SSID string */
358 	int			capinfo;	/* Capability info. */
359 	int			interval;	/* BSS Beacon Interval */
360 	int			rate;		/* Data Rate */
361 };
362 
363 /*
364  * The following do not get passed down to the card, they are used
365  * by wicontrol to modify the behavior of the driver (use WEP in software or
366  * firmware, use alternate cryptographic algorithms, etc.)  I'm calling them
367  * "fake record IDs."
368  */
369 #define	WI_FRID_CRYPTO_ALG	0xFCE3
370 #define	WI_FRID_DEBUGGING	0xFCE4
371 
372 /*
373  * bsd-airtools v0.2 - source-mods v0.2 [common.h]
374  * by h1kari - (c) Dachb0den Labs 2001
375  */
376 
377 /*
378  * Copyright (c) 2001 Dachb0den Labs.
379  *      David Hulton <h1kari@dachb0den.com>.  All rights reserved.
380  *
381  * Redistribution and use in source and binary forms, with or without
382  * modification, are permitted provided that the following conditions
383  * are met:
384  * 1. Redistributions of source code must retain the above copyright
385  *    notice, this list of conditions and the following disclaimer.
386  * 2. Redistributions in binary form must reproduce the above copyright
387  *    notice, this list of conditions and the following disclaimer in the
388  *    documentation and/or other materials provided with the distribution.
389  * 3. All advertising materials mentioning features or use of this software
390  *    must display the following acknowledgement:
391  *      This product includes software developed by David Hulton.
392  * 4. Neither the name of the author nor the names of any co-contributors
393  *    may be used to endorse or promote products derived from this software
394  *    without specific prior written permission.
395  *
396  * THIS SOFTWARE IS PROVIDED BY David Hulton AND CONTRIBUTORS ``AS IS'' AND
397  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
398  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
399  * ARE DISCLAIMED.  IN NO EVENT SHALL David Hulton OR THE VOICES IN HIS HEAD
400  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
401  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
402  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
403  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
404  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
405  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
406  * THE POSSIBILITY OF SUCH DAMAGE.
407  */
408 
409 /*
410  * standard hermes receive frame used by wavelan/prism2 cards
411  */
412 struct wi_rx_frame {
413 	/*
414 	 * hermes prefix header. supplies information on the current status of
415 	 * the network and various other statistics gathered from the
416 	 * management/control frames as used internally.
417 	 */
418 	u_int16_t	wi_status;
419 	u_int16_t	wi_ts0;
420 	u_int16_t	wi_ts1;
421 	u_int8_t	wi_silence;
422 	u_int8_t	wi_signal;
423 	u_int8_t	wi_rate;
424 	u_int8_t	wi_rx_flow;
425 	u_int16_t	wi_rsvd0;
426 	u_int16_t	wi_rsvd1;
427 	/*
428 	 * standard 80211 frame header. all packets have to use this header as
429 	 * per the AN9900 from intersil, even management/control. for
430 	 * management packets, they just threw the header into the data field,
431 	 * but for control packets the headers are lost in translation and
432 	 * therefore not all control packet info can be displayed.
433 	 */
434 	u_int16_t	wi_frame_ctl;
435 	u_int16_t	wi_id;
436 	u_int8_t	wi_addr1[6];
437 	u_int8_t	wi_addr2[6];
438 	u_int8_t	wi_addr3[6];
439 	u_int16_t	wi_seq_ctl;
440 	u_int8_t	wi_addr4[6];
441 	u_int16_t	wi_dat_len;
442 	/*
443 	 * another oddity with the drivers. they append a 802.3 header which
444 	 * is somewhat redundant, since all the same data is provided in the
445 	 * 802.11 header.
446 	 */
447 	u_int8_t	wi_dst_addr[6];
448 	u_int8_t	wi_src_addr[6];
449 	u_int16_t	wi_len;
450 };
451 #define WI_DATA_HDRLEN		WI_802_11_OFFSET
452 #define WI_MGMT_HDRLEN		WI_802_11_OFFSET_RAW
453 #define WI_CTL_HDRLEN		WI_802_11_OFFSET_RAW
454 
455 
456 /*
457  * all data packets have a snap (sub-network access protocol) header that
458  * isn't entirely defined, but added for ethernet compatibility.
459  */
460 struct wi_snap_frame {
461 	u_int16_t	wi_dat[3];
462 	u_int16_t	wi_type;
463 };
464 
465 
466 /*
467  * management frame headers
468  * note: all management frames consist of a static header and variable length
469  * fields.
470  */
471 
472 /*
473  * variable length field structure
474  */
475 struct wi_mgmt_var_hdr {
476 	u_int8_t	wi_code;
477 	u_int8_t	wi_len;
478 	u_int8_t	wi_data[256];
479 };
480 
481 /*
482  * management beacon frame prefix
483  */
484 struct wi_mgmt_beacon_hdr {
485 	u_int32_t	wi_ts0;
486 	u_int32_t	wi_ts1;
487 	u_int16_t	wi_interval;
488 	u_int16_t	wi_capinfo;
489 };
490 
491 /*
492  * ibss announcement traffic indication message (atim) frame
493  * note: no parameters
494  */
495 
496 /*
497  * management disassociation frame
498  */
499 struct wi_mgmt_disas_hdr {
500 	u_int16_t	wi_reason;
501 };
502 
503 /*
504  * management association request frame prefix
505  */
506 struct wi_mgmt_asreq_hdr {
507 	u_int16_t	wi_capinfo;
508 	u_int16_t	wi_interval;
509 };
510 
511 /*
512  * management association response frame prefix
513  */
514 struct wi_mgmt_asresp_hdr {
515 	u_int16_t	wi_capinfo;
516 	u_int16_t	wi_status;
517 	u_int16_t	wi_aid;
518 };
519 
520 /*
521  * management reassociation request frame prefix
522  */
523 struct wi_mgmt_reasreq_hdr {
524 	u_int16_t	wi_capinfo;
525 	u_int16_t	wi_interval;
526 	u_int8_t	wi_currap[6];
527 };
528 
529 /*
530  * management reassociation response frame prefix
531  */
532 struct wi_mgmt_reasresp_hdr {
533 	u_int16_t	wi_capinfo;
534 	u_int16_t	wi_status;
535 	u_int16_t	wi_aid;
536 };
537 
538 /*
539  * management probe request frame prefix
540  * note: no static parameters, only variable length
541  */
542 
543 /*
544  * management probe response frame prefix
545  */
546 struct wi_mgmt_proberesp_hdr {
547 	u_int32_t	wi_ts0;
548 	u_int32_t	wi_ts1;
549 	u_int16_t	wi_interval;
550 	u_int16_t	wi_capinfo;
551 };
552 
553 /*
554  * management authentication frame prefix
555  */
556 struct wi_mgmt_auth_hdr {
557 	u_int16_t	wi_algo;
558 	u_int16_t	wi_seq;
559 	u_int16_t	wi_status;
560 };
561 
562 /*
563  * management deauthentication frame
564  */
565 struct wi_mgmt_deauth_hdr {
566 	u_int16_t	wi_reason;
567 };
568 
569 
570 /*
571  * rid configuration register definitions
572  */
573 #define WI_RID_PROCFRAME	0x3137 /* Return full frame information */
574 #define WI_RID_PRISM2		0x3138 /* tell if we're a prism2 card or not */
575 
576 
577 /*
578  * 802.11 definitions
579  */
580 #define WI_STAT_BADCRC		0x0001
581 #define WI_STAT_UNDECRYPTABLE	0x0002
582 #define WI_STAT_ERRSTAT		0x0003
583 #define WI_STAT_MAC_PORT	0x0700
584 #define WI_STAT_1042		0x2000
585 #define WI_STAT_TUNNEL		0x4000
586 #define WI_STAT_WMP_MSG		0x6000
587 #define WI_RXSTAT_MSG_TYPE	0xE000
588 
589 #define WI_FCTL_OPT_MASK	0xFF00
590 #define WI_AID_SET		0xC000
591 #define WI_AID_MASK		0x3FFF
592 #define WI_SCTL_FRAGNUM_MASK	0x000F
593 #define WI_SCTL_SEQNUM_MASK	0xFFF0
594 
595 #define WI_STAT_UNSPEC_FAIL	1
596 #define WI_STAT_CAPINFO_FAIL	10
597 #define WI_STAT_REAS_DENY	11
598 #define WI_STAT_ASSOC_DENY	12
599 #define WI_STAT_ALGO_FAIL	13
600 #define WI_STAT_SEQ_FAIL	14
601 #define WI_STAT_CHAL_FAIL	15
602 #define WI_STAT_TOUT_FAIL	16
603 #define WI_STAT_OVERL_DENY	17
604 #define WI_STAT_RATE_DENY	18
605 
606 #define WI_FTYPE_MGMT		0x0000
607 #define WI_FTYPE_CTL		0x0004
608 #define WI_FTYPE_DATA		0x0008
609 
610 #define WI_FCTL_VERS		0x0002
611 #define WI_FCTL_FTYPE		0x000C
612 #define WI_FCTL_STYPE		0x00F0
613 #define WI_FCTL_TODS		0x0100
614 #define WI_FCTL_FROMDS		0x0200
615 #define WI_FCTL_MOREFRAGS	0x0400
616 #define WI_FCTL_RETRY		0x0800
617 #define WI_FCTL_PM		0x1000
618 #define WI_FCTL_MOREDATA	0x2000
619 #define WI_FCTL_WEP		0x4000
620 #define WI_FCTL_ORDER		0x8000
621 
622 #define WI_FCS_LEN		0x4 /* checksum length */
623 
624 
625 /*
626  * management definitions
627  */
628 #define WI_CAPINFO_ESS		0x01
629 #define WI_CAPINFO_IBSS		0x02
630 #define WI_CAPINFO_CFPOLL	0x04
631 #define WI_CAPINFO_CFPOLLREQ	0x08
632 #define WI_CAPINFO_PRIV		0x10
633 
634 #define WI_REASON_UNSPEC	1
635 #define WI_REASON_AUTH_INVALID	2
636 #define WI_REASON_DEAUTH_LEAVE	3
637 #define WI_REASON_DISAS_INACT	4
638 #define WI_REASON_DISAS_OVERL	5
639 #define WI_REASON_CLASS2	6
640 #define WI_REASON_CLASS3	7
641 #define WI_REASON_DISAS_LEAVE	8
642 #define WI_REASON_NOAUTH	9
643 
644 #define WI_VAR_SSID		0
645 #define WI_VAR_SRATES		1
646 #define WI_VAR_FH		2
647 #define WI_VAR_DS		3
648 #define WI_VAR_CF		4
649 #define WI_VAR_TIM		5
650 #define WI_VAR_IBSS		6
651 #define WI_VAR_CHAL		16
652 
653 #define WI_VAR_SRATES_MASK	0x7F
654 
655 /*
656  * ap scanning structures
657  */
658 struct wi_scan_res {
659 	u_int16_t	wi_chan;
660 	u_int16_t	wi_noise;
661 	u_int16_t	wi_signal;
662 	u_int8_t	wi_bssid[6];
663 	u_int16_t	wi_interval;
664 	u_int16_t	wi_capinfo;
665 	u_int16_t	wi_ssid_len;
666 	u_int8_t	wi_ssid[32];
667 	u_int8_t	wi_srates[10];
668 	u_int8_t	wi_rate;
669 	u_int8_t	wi_rsvd;
670 };
671 #define WI_WAVELAN_RES_1M	0x0a
672 #define WI_WAVELAN_RES_2M	0x14
673 #define WI_WAVELAN_RES_5M	0x37
674 #define WI_WAVELAN_RES_11M	0x6e
675 
676 #define WI_WAVELAN_RES_SIZE	50
677 #define WI_WAVELAN_RES_TIMEOUT	((hz / 10) * 2)		/* 200ms */
678 #define WI_WAVELAN_RES_TRIES	100
679 
680 struct wi_scan_p2_hdr {
681 	u_int16_t	wi_rsvd;
682 	u_int16_t	wi_reason;
683 };
684 #define WI_PRISM2_RES_SIZE	62
685 
686 /*
687  * prism2 debug mode definitions
688  */
689 #define SIOCSPRISM2DEBUG	_IOW('i', 137, struct ifreq)
690 #define SIOCGPRISM2DEBUG	_IOWR('i', 138, struct ifreq)
691 
692 #define WI_CMD_DEBUG		0x0038 /* prism2 debug */
693 
694 #define WI_DEBUG_RESET		0x00
695 #define WI_DEBUG_INIT		0x01
696 #define WI_DEBUG_SLEEP		0x02
697 #define WI_DEBUG_WAKE		0x03
698 #define WI_DEBUG_CHAN		0x08
699 #define WI_DEBUG_DELAYSUPP	0x09
700 #define WI_DEBUG_TXSUPP		0x0A
701 #define WI_DEBUG_MONITOR	0x0B
702 #define WI_DEBUG_LEDTEST	0x0C
703 #define WI_DEBUG_CONTTX		0x0E
704 #define WI_DEBUG_STOPTEST	0x0F
705 #define WI_DEBUG_CONTRX		0x10
706 #define WI_DEBUG_SIGSTATE	0x11
707 #define WI_DEBUG_CALENABLE	0x13
708 #define WI_DEBUG_CONFBITS	0x15
709 
710 /*
711  * Modem information
712  */
713 #define WI_RID_PHY_TYPE		0xFDC0 /* phys layer type indication */
714 #define WI_RID_CURRENT_CHAN	0xFDC1 /* current frequency */
715 #define WI_RID_PWR_STATE	0xFDC2 /* pwr consumption status */
716 #define WI_RID_CCA_MODE		0xFDC3 /* clear chan assess mode indication */
717 #define WI_RID_CCA_TIME		0xFDC4 /* clear chan assess time */
718 #define WI_RID_MAC_PROC_DELAY	0xFDC5 /* MAC processing delay time */
719 #define WI_RID_DATA_RATES	0xFDC6 /* supported data rates */
720 
721 /*
722  * Values for supported crypto algorithms:
723  */
724 #define	WI_CRYPTO_FIRMWARE_WEP		0x00 /* default */
725 #define	WI_CRYPTO_SOFTWARE_WEP		0x01
726 
727 /* Firmware types */
728 #define	WI_NOTYPE	0
729 #define	WI_LUCENT	1
730 #define	WI_INTERSIL	2
731 #define	WI_SYMBOL	3
732 
733 /* Card identities */
734 #define	WI_NIC_LUCENT		0x0001
735 
736 #define	WI_NIC_SONY		0x0002
737 
738 #define	WI_NIC_LUCENT_EMB	0x0005
739 
740 #define	WI_NIC_EVB2		0x8000
741 
742 #define	WI_NIC_HWB3763		0x8001
743 
744 #define	WI_NIC_HWB3163		0x8002
745 
746 #define	WI_NIC_HWB3163B		0x8003
747 
748 #define	WI_NIC_EVB3		0x8004
749 
750 #define	WI_NIC_HWB1153		0x8007
751 
752 #define	WI_NIC_P2_SST		0x8008	/* Prism2 with SST flush */
753 
754 #define	WI_NIC_EVB2_SST		0x8009
755 
756 #define	WI_NIC_3842_EVA		0x800A	/* 3842 Evaluation Board */
757 
758 #define	WI_NIC_3842_PCMCIA_AMD	0x800B	/* Prism2.5 PCMCIA */
759 #define	WI_NIC_3842_PCMCIA_SST	0x800C
760 #define	WI_NIC_3842_PCMCIA_ATL	0x800D
761 #define	WI_NIC_3842_PCMCIA_ATS	0x800E
762 
763 #define WI_NIC_3842_USB_AMD	0x800f	/* Prism2.5 USB */
764 #define WI_NIC_3842_USB_SST	0x8010
765 #define WI_NIC_3842_USB_ATL	0x8011
766 
767 #define	WI_NIC_3842_MINI_AMD	0x8012	/* Prism2.5 Mini-PCI */
768 #define	WI_NIC_3842_MINI_SST	0x8013
769 #define	WI_NIC_3842_MINI_ATL	0x8014
770 #define	WI_NIC_3842_MINI_ATS	0x8015
771 
772 #define	WI_NIC_3842_PCI_AMD	0x8016	/* Prism2.5 PCI-bridge */
773 #define	WI_NIC_3842_PCI_SST	0x8017
774 #define	WI_NIC_3842_PCI_ATL	0x8018
775 #define	WI_NIC_3842_PCI_ATS	0x8019
776 
777 #define	WI_NIC_P3_PCMCIA_AMD	0x801A	/* Prism3 PCMCIA */
778 #define	WI_NIC_P3_PCMCIA_SST	0x801B
779 #define	WI_NIC_P3_PCMCIA_ATL	0x801C
780 #define	WI_NIC_P3_PCMCIA_ATS	0x801D
781 
782 #define WI_NIC_3842_USB_AMD_2	0x801E	/* Prism2.5 USB */
783 #define WI_NIC_3842_USB_SST_2	0x801F
784 #define WI_NIC_3842_USB_ATL_2	0x8020
785 
786 #define	WI_NIC_P3_MINI_AMD	0x8021	/* Prism3 Mini-PCI */
787 #define	WI_NIC_P3_MINI_SST	0x8022
788 #define	WI_NIC_P3_MINI_ATL	0x8023
789 #define	WI_NIC_P3_MINI_ATS	0x8024
790 
791 #define WI_NIC_P3_USB		0x8025 	/* Prism3 USB */
792 #define	WI_NIC_P3_USB_NETGEAR	0x8026
793 #define WI_NIC_P3_USB_2		0x8027
794 
795 struct wi_card_ident {
796 	const u_int16_t	card_id;
797 	const char	*card_name;
798 	const u_int8_t	firm_type;
799 };
800 
801 #define WI_CARD_IDS							\
802 	{								\
803 		WI_NIC_LUCENT,						\
804 		"Lucent WaveLAN/IEEE",					\
805 		WI_LUCENT						\
806 	}, {								\
807 		WI_NIC_SONY,						\
808 		"Sony WaveLAN/IEEE",					\
809 		WI_LUCENT						\
810 	}, {								\
811 		WI_NIC_LUCENT_EMB,					\
812 		"Lucent Embedded WaveLAN/IEEE",				\
813 		WI_LUCENT						\
814 	}, {								\
815 		WI_NIC_EVB2,						\
816 		"PRISM2 HFA3841(EVB2)",					\
817 		WI_INTERSIL						\
818 	}, {								\
819 		WI_NIC_HWB3763,						\
820 		"PRISM2 HWB3763 rev.B",					\
821 		WI_INTERSIL						\
822 	}, {								\
823 		WI_NIC_HWB3163,						\
824 		"PRISM2 HWB3163 rev.A",					\
825 		WI_INTERSIL						\
826 	}, {								\
827 		WI_NIC_HWB3163B,					\
828 		"PRISM2 HWB3163 rev.B",					\
829 		WI_INTERSIL						\
830 	}, {								\
831 		WI_NIC_EVB3,						\
832 		"PRISM2 HFA3842(EVB3)",					\
833 		WI_INTERSIL						\
834 	}, {								\
835 		WI_NIC_HWB1153,						\
836 		"PRISM1 HWB1153",					\
837 		WI_INTERSIL						\
838 	}, {								\
839 		WI_NIC_P2_SST,						\
840 		"PRISM2 HWB3163 SST-flash",				\
841 		WI_INTERSIL						\
842 	}, {								\
843 		WI_NIC_EVB2_SST,					\
844 		"PRISM2 HWB3163(EVB2) SST-flash",			\
845 		WI_INTERSIL						\
846 	}, {								\
847 		WI_NIC_3842_EVA,					\
848 		"PRISM2 HFA3842(EVAL)",					\
849 		WI_INTERSIL						\
850 	}, {								\
851 		WI_NIC_3842_PCMCIA_AMD,					\
852 		"PRISM2.5 ISL3873",					\
853 		WI_INTERSIL						\
854 	}, {								\
855 		WI_NIC_3842_PCMCIA_SST,					\
856 		"PRISM2.5 ISL3873",					\
857 		WI_INTERSIL						\
858 	}, {								\
859 		WI_NIC_3842_PCMCIA_ATL,					\
860 		"PRISM2.5 ISL3873",					\
861 		WI_INTERSIL						\
862 	}, {								\
863 		WI_NIC_3842_PCMCIA_ATS,					\
864 		"PRISM2.5 ISL3873",					\
865 		WI_INTERSIL						\
866 	}, {								\
867 		WI_NIC_3842_USB_AMD,					\
868 		"PRISM2.5 USB",						\
869 		WI_INTERSIL						\
870 	}, {								\
871 		WI_NIC_3842_USB_SST,					\
872 		"PRISM2.5 USB",						\
873 		WI_INTERSIL						\
874 	}, {								\
875 		WI_NIC_3842_USB_ATL,					\
876 		"PRISM2.5 USB",						\
877 		WI_INTERSIL						\
878 	}, {								\
879 		WI_NIC_3842_MINI_AMD,					\
880 		"PRISM2.5 ISL3874A(Mini-PCI)",				\
881 		WI_INTERSIL						\
882 	}, {								\
883 		WI_NIC_3842_MINI_SST,					\
884 		"PRISM2.5 ISL3874A(Mini-PCI)",				\
885 		WI_INTERSIL						\
886 	}, {								\
887 		WI_NIC_3842_MINI_ATL,					\
888 		"PRISM2.5 ISL3874A(Mini-PCI)",				\
889 		WI_INTERSIL						\
890 	}, {								\
891 		WI_NIC_3842_MINI_ATS,					\
892 		"PRISM2.5 ISL3874A(Mini-PCI)",				\
893 		WI_INTERSIL						\
894 	}, {								\
895 		WI_NIC_3842_PCI_AMD,					\
896 		"PRISM2.5 ISL3874A(PCI-bridge)",			\
897 		WI_INTERSIL						\
898 	}, {								\
899 		WI_NIC_3842_PCI_SST,					\
900 		"PRISM2.5 ISL3874A(PCI-bridge)",			\
901 		WI_INTERSIL						\
902 	}, {								\
903 		WI_NIC_3842_PCI_ATS,					\
904 		"PRISM2.5 ISL3874A(PCI-bridge)",			\
905 		WI_INTERSIL						\
906 	}, {								\
907 		WI_NIC_3842_PCI_ATL,					\
908 		"PRISM2.5 ISL3874A(PCI-bridge)",			\
909 		WI_INTERSIL						\
910 	}, {								\
911 		WI_NIC_P3_PCMCIA_AMD,					\
912 		"PRISM3 ISL37300P",					\
913 		WI_INTERSIL						\
914 	}, {								\
915 		WI_NIC_P3_PCMCIA_SST,					\
916 		"PRISM3 ISL37300P",					\
917 		WI_INTERSIL						\
918 	}, {								\
919 		WI_NIC_P3_PCMCIA_ATL,					\
920 		"PRISM3 ISL37300P",					\
921 		WI_INTERSIL						\
922 	}, {								\
923 		WI_NIC_P3_PCMCIA_ATS,					\
924 		"PRISM3 ISL37300P",					\
925 		WI_INTERSIL						\
926 	}, {								\
927 		WI_NIC_3842_USB_AMD_2,					\
928 		"PRISM2.5 USB",						\
929 		WI_INTERSIL						\
930 	}, {								\
931 		WI_NIC_3842_USB_SST_2,					\
932 		"PRISM2.5 USB",						\
933 		WI_INTERSIL						\
934 	}, {								\
935 		WI_NIC_3842_USB_ATL_2,					\
936 		"PRISM2.5 USB",						\
937 		WI_INTERSIL						\
938 	}, {								\
939 		WI_NIC_P3_MINI_AMD,					\
940 		"PRISM3 ISL37300P(PCI)",				\
941 		WI_INTERSIL						\
942 	}, {								\
943 		WI_NIC_P3_MINI_SST,					\
944 		"PRISM3 ISL37300P(PCI)",				\
945 		WI_INTERSIL						\
946 	}, {								\
947 		WI_NIC_P3_MINI_ATL,					\
948 		"PRISM3 ISL37300P(PCI)",				\
949 		WI_INTERSIL						\
950 	}, {								\
951 		WI_NIC_P3_MINI_ATS,					\
952 		"PRISM3 ISL37300P(PCI)",				\
953 		WI_INTERSIL						\
954 	}, {								\
955 		WI_NIC_P3_USB,						\
956 		"PRISM3 (USB)",						\
957 		WI_INTERSIL						\
958 	}, {								\
959 		WI_NIC_P3_USB_NETGEAR,					\
960 		"PRISM3 (USB)",						\
961 		WI_INTERSIL						\
962 	}, {								\
963 		WI_NIC_P3_USB_2,						\
964 		"PRISM3 (USB)",						\
965 		WI_INTERSIL						\
966 	}, {								\
967 		0,							\
968 		NULL,							\
969 		WI_NOTYPE						\
970 	}
971 
972 #endif /* _IF_WI_IEEE_H */
973