1b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/*
2b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * Merged with mainline ieee80211.h in Aug 2004.  Original ieee802_11
3b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * remains copyright by the original authors
4b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
5b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * Portions of the merged code are based on Host AP (software wireless
6b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * LAN access point) driver for Intersil Prism2/2.5/3.
7b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
8b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
985d32e7b0ea53a11d2a4018d8ad2605052778df7Jouni Malinen * <j@w1.fi>
1085d32e7b0ea53a11d2a4018d8ad2605052778df7Jouni Malinen * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
11b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
12b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * <jketreno@linux.intel.com>
14ebeaddcc02fd47d1dbb7f25318d046461d90e4afJames Ketrenos * Copyright (c) 2004-2005, Intel Corporation
15b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
16b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * This program is free software; you can redistribute it and/or modify
17b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * it under the terms of the GNU General Public License version 2 as
18b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * published by the Free Software Foundation. See README and COPYING for
19b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * more details.
2031696160c7415b5a7efa650c7f1ca5c9623f5d8fJames Ketrenos *
2131696160c7415b5a7efa650c7f1ca5c9623f5d8fJames Ketrenos * API Version History
2231696160c7415b5a7efa650c7f1ca5c9623f5d8fJames Ketrenos * 1.0.x -- Initial version
23b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville * 1.1.x -- Added radiotap, QoS, TIM, libipw_geo APIs,
2431696160c7415b5a7efa650c7f1ca5c9623f5d8fJames Ketrenos *          various structure changes, and crypto API init method
25b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik */
26b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#ifndef LIBIPW_H
27b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_H
2874079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos#include <linux/if_ether.h>	/* ETH_ALEN */
2974079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos#include <linux/kernel.h>	/* ARRAY_SIZE */
30b7721ff96fa15459c7c5de59323bedd61f1bcbd7Adrian Bunk#include <linux/wireless.h>
3172118015271e6d3852cb9f647efe0987d131adaaJohn W. Linville#include <linux/ieee80211.h>
32b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
33274bfb8dc5ffa16cb073801bebe76ab7f4e2e73dJohn W. Linville#include <net/lib80211.h>
34a3caa99e6c68f466c13cfea74097f6fb01b45e25John W. Linville#include <net/cfg80211.h>
35274bfb8dc5ffa16cb073801bebe76ab7f4e2e73dJohn W. Linville
36b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_VERSION "git-1.1.13"
3731696160c7415b5a7efa650c7f1ca5c9623f5d8fJames Ketrenos
38b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DATA_LEN		2304
39b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
40b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik   6.2.1.1.2.
41b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
42b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik   The figure in section 7.1.2 suggests a body size of up to 2312
43b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik   bytes is allowed, which is a bit confusing, I suspect this
44b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik   represents the 2304 bytes of real data, plus a possible 8 bytes of
45b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik   WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
46b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
47b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_1ADDR_LEN 10
48b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_2ADDR_LEN 16
49b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_3ADDR_LEN 24
50b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_4ADDR_LEN 30
51b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_FCS_LEN    4
52b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_HLEN			(LIBIPW_4ADDR_LEN)
53b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_FRAME_LEN		(LIBIPW_DATA_LEN + LIBIPW_HLEN)
54b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
55b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define MIN_FRAG_THRESHOLD     256U
56b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define	MAX_FRAG_THRESHOLD     2346U
57b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
58ea2841521a7e061b772d6cee03f5b23c58a58284Zhu Yi/* QOS control */
59b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_QCTL_TID		0x000F
60ea2841521a7e061b772d6cee03f5b23c58a58284Zhu Yi
61b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/* debug macros */
62b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
633756162b06001d122ce31c716f9784636c592c9cHelmut Schaa#ifdef CONFIG_LIBIPW_DEBUG
64b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern u32 libipw_debug_level;
65b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG(level, fmt, args...) \
66b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilledo { if (libipw_debug_level & (level)) \
6727ae60f8f7aac221b428422eecafddaa7aff9549Pavel Roskin  printk(KERN_DEBUG "libipw: %c %s " fmt, \
68d5c003b4d1690e666dbab02bc8e705947baa848cHarvey Harrison         in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
69b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#else
70b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG(level, fmt, args...) do {} while (0)
713756162b06001d122ce31c716f9784636c592c9cHelmut Schaa#endif				/* CONFIG_LIBIPW_DEBUG */
72e88187eedc0a9223914b23b063342db8bcc31f9cJiri Benc
73b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/*
74e88187eedc0a9223914b23b063342db8bcc31f9cJiri Benc * To use the debug system:
75b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
76b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * If you are defining a new debug classification, simply add it to the #define
77b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * list here in the form of:
78b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
79b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville * #define LIBIPW_DL_xxxx VALUE
80b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
81b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * shifting value to the left one bit from the previous entry.  xxxx should be
82b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * the name of the classification (for example, WEP)
83b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
84b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville * You then need to either add a LIBIPW_xxxx_DEBUG() macro definition for your
85b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville * classification, or use LIBIPW_DEBUG(LIBIPW_DL_xxxx, ...) whenever you want
86b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * to send output to that classification.
87b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
88b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * To add your debug level to the list of levels seen when you perform
89b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
9091cb70c1769d9b72dd1efe40c31f01005820b09eJouni Malinen * % cat /proc/net/ieee80211/debug_level
91b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
92b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville * you simply need to add your entry to the libipw_debug_level array.
93b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
9491cb70c1769d9b72dd1efe40c31f01005820b09eJouni Malinen * If you do not see debug_level in /proc/net/ieee80211 then you do not have
953756162b06001d122ce31c716f9784636c592c9cHelmut Schaa * CONFIG_LIBIPW_DEBUG defined in your kernel configuration
96b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
97b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik */
98b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
99b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_INFO          (1<<0)
100b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_WX            (1<<1)
101b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_SCAN          (1<<2)
102b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_STATE         (1<<3)
103b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_MGMT          (1<<4)
104b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_FRAG          (1<<5)
105b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_DROP          (1<<7)
106b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
107b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_TX            (1<<8)
108b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_RX            (1<<9)
109b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DL_QOS           (1<<31)
110b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
11127ae60f8f7aac221b428422eecafddaa7aff9549Pavel Roskin#define LIBIPW_ERROR(f, a...) printk(KERN_ERR "libipw: " f, ## a)
11227ae60f8f7aac221b428422eecafddaa7aff9549Pavel Roskin#define LIBIPW_WARNING(f, a...) printk(KERN_WARNING "libipw: " f, ## a)
113b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_INFO(f, a...)   LIBIPW_DEBUG(LIBIPW_DL_INFO, f, ## a)
114b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
115b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_WX(f, a...)     LIBIPW_DEBUG(LIBIPW_DL_WX, f, ## a)
116b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_SCAN(f, a...)   LIBIPW_DEBUG(LIBIPW_DL_SCAN, f, ## a)
117b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_STATE(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_STATE, f, ## a)
118b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_MGMT(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_MGMT, f, ## a)
119b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_FRAG(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_FRAG, f, ## a)
120b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_DROP(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_DROP, f, ## a)
121b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_TX(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_TX, f, ## a)
122b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_RX(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_RX, f, ## a)
123b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEBUG_QOS(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_QOS, f, ## a)
124b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#include <linux/netdevice.h>
12574079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos#include <linux/if_arp.h>	/* ARPHRD_ETHER */
126b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
127b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#ifndef WIRELESS_SPY
128099c5bb169e9816a7761336f668b63010762807bJiri Benc#define WIRELESS_SPY		/* enable iwspy support */
129b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#endif
130099c5bb169e9816a7761336f668b63010762807bJiri Benc#include <net/iw_handler.h>	/* new driver API */
131b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
13274079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos#define ETH_P_PREAUTH 0x88C7	/* IEEE 802.11i pre-authentication */
133b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
134b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#ifndef ETH_P_80211_RAW
135b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
136b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#endif
137b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
138b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/* IEEE 802.11 defines */
139b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
140b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define P80211_OUI_LEN 3
141b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
142b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_snap_hdr {
143b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
14474079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	u8 dsap;		/* always 0xAA */
14574079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	u8 ssap;		/* always 0xAA */
14674079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	u8 ctrl;		/* always 0x03 */
14774079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	u8 oui[P80211_OUI_LEN];	/* organizational universal id */
148b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
149ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
150b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
151b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define SNAP_SIZE sizeof(struct libipw_snap_hdr)
152b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
153f13baae43e97e84d3f06080908db75a017c62165Jiri Benc#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
154b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
155b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
156b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
157b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
1583eb546057dd65ec75c900c9948684ffd5e617630Zhu Yi#define WLAN_GET_SEQ_SEQ(seq)  (((seq) & IEEE80211_SCTL_SEQ) >> 4)
159b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
160b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_STATMASK_SIGNAL (1<<0)
161b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_STATMASK_RSSI (1<<1)
162b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_STATMASK_NOISE (1<<2)
163b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_STATMASK_RATE (1<<3)
164b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_STATMASK_WEMASK 0x7
165b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
166b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_MODULATION    (1<<0)
167b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_MODULATION   (1<<1)
168b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
169b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_24GHZ_BAND     (1<<0)
170b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_52GHZ_BAND     (1<<1)
171b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
172b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATE_1MB		        0x02
173b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATE_2MB		        0x04
174b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATE_5MB		        0x0B
175b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATE_11MB		        0x16
176b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_6MB		        0x0C
177b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_9MB		        0x12
178b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_12MB		0x18
179b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_18MB		0x24
180b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_24MB		0x30
181b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_36MB		0x48
182b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_48MB		0x60
183b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_54MB		0x6C
184b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_BASIC_RATE_MASK		0x80
185b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
186b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATE_1MB_MASK		(1<<0)
187b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATE_2MB_MASK		(1<<1)
188b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATE_5MB_MASK		(1<<2)
189b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATE_11MB_MASK		(1<<3)
190b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_6MB_MASK		(1<<4)
191b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_9MB_MASK		(1<<5)
192b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_12MB_MASK		(1<<6)
193b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_18MB_MASK		(1<<7)
194b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_24MB_MASK		(1<<8)
195b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_36MB_MASK		(1<<9)
196b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_48MB_MASK		(1<<10)
197b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATE_54MB_MASK		(1<<11)
198b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
199b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_RATES_MASK	        0x0000000F
200b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_BASIC_RATES_MASK	(LIBIPW_CCK_RATE_1MB_MASK | \
201b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_CCK_RATE_2MB_MASK)
202b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_CCK_DEFAULT_RATES_MASK	(LIBIPW_CCK_BASIC_RATES_MASK | \
203b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville        LIBIPW_CCK_RATE_5MB_MASK | \
204b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville        LIBIPW_CCK_RATE_11MB_MASK)
205b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
206b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_RATES_MASK		0x00000FF0
207b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_BASIC_RATES_MASK	(LIBIPW_OFDM_RATE_6MB_MASK | \
208b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_OFDM_RATE_12MB_MASK | \
209b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_OFDM_RATE_24MB_MASK)
210b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_DEFAULT_RATES_MASK	(LIBIPW_OFDM_BASIC_RATES_MASK | \
211b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_OFDM_RATE_9MB_MASK  | \
212b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_OFDM_RATE_18MB_MASK | \
213b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_OFDM_RATE_36MB_MASK | \
214b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_OFDM_RATE_48MB_MASK | \
215b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_OFDM_RATE_54MB_MASK)
216b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_DEFAULT_RATES_MASK (LIBIPW_OFDM_DEFAULT_RATES_MASK | \
217b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville                                LIBIPW_CCK_DEFAULT_RATES_MASK)
218b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville
219b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_NUM_OFDM_RATES	    8
220b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_NUM_CCK_RATES	            4
221b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_OFDM_SHIFT_MASK_A         4
222b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
223b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/* NOTE: This data is for statistical purposes; not all hardware provides this
224c9fa7d5d6cec7a45f9dc6c2f23500af50d5617c9Johannes Berg *       information for frames received.
225b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville *       For libipw_rx_mgt, you need to set at least the 'len' parameter.
226c9fa7d5d6cec7a45f9dc6c2f23500af50d5617c9Johannes Berg */
227b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_rx_stats {
228b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u32 mac_time;
229b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	s8 rssi;
230b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 signal;
231b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 noise;
23274079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	u16 rate;		/* in 100 kbps */
233b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 received_channel;
234b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 control;
235b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 mask;
236b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 freq;
237b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 len;
238b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u64 tsf;
239b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u32 beacon_time;
240b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik};
241b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
242b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/* IEEE 802.11 requires that STA supports concurrent reception of at least
243b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * three fragmented frames. This define can be increased to support more
244b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * concurrent frames, but it should be noted that each entry can consume about
245b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
246b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_FRAG_CACHE_LEN 4
247b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
248b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_frag_entry {
249b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned long first_frag_time;
250b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int seq;
251b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int last_frag;
252b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	struct sk_buff *skb;
253b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 src_addr[ETH_ALEN];
254b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 dst_addr[ETH_ALEN];
255b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik};
256b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
257b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_stats {
258b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_unicast_frames;
259b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_multicast_frames;
260b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_fragments;
261b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_unicast_octets;
262b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_multicast_octets;
263b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_deferred_transmissions;
264b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_single_retry_frames;
265b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_multiple_retry_frames;
266b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_retry_limit_exceeded;
267b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_discards;
268b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_unicast_frames;
269b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_multicast_frames;
270b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_fragments;
271b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_unicast_octets;
272b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_multicast_octets;
273b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_fcs_errors;
274b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_discards_no_buffer;
275b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int tx_discards_wrong_sa;
276b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_discards_undecryptable;
277b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_message_in_msg_fragments;
278b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int rx_message_in_bad_msg_fragments;
279b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik};
280b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
281b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_device;
282b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
283f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_KEY_1		(1<<0)
284f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_KEY_2		(1<<1)
285f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_KEY_3		(1<<2)
286f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_KEY_4		(1<<3)
287f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_ACTIVE_KEY		(1<<4)
288f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_AUTH_MODE		(1<<5)
289f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_UNICAST_GROUP	(1<<6)
290f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_LEVEL		(1<<7)
291f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_ENABLED		(1<<8)
292259bf1fd8a7cc0f6b47fd8a9ac5e2dfc33182a3dJames Ketrenos#define SEC_ENCRYPT		(1<<9)
293f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos
294f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_LEVEL_0		0	/* None */
295f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_LEVEL_1		1	/* WEP 40 and 104 bit */
296f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_LEVEL_2		2	/* Level 1 + TKIP */
297f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_LEVEL_2_CKIP	3	/* Level 1 + CKIP */
298f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SEC_LEVEL_3		4	/* Level 2 + CCMP */
299f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos
300e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos#define SEC_ALG_NONE		0
301e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos#define SEC_ALG_WEP		1
302e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos#define SEC_ALG_TKIP		2
303e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos#define SEC_ALG_CCMP		3
304e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos
305f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define WEP_KEYS		4
306f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define WEP_KEY_LEN		13
307f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SCM_KEY_LEN		32
308f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos#define SCM_TEMPORAL_KEY_LENGTH	16
309b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
310b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_security {
3110f202aa2e1e1db1d20da9bcc3f5ad43c5a22d2d5John W. Linville	u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1;
3120f202aa2e1e1db1d20da9bcc3f5ad43c5a22d2d5John W. Linville	u8 auth_mode;
313e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos	u8 encode_alg[WEP_KEYS];
314b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 key_sizes[WEP_KEYS];
315f1bf6638af9e9bbbb6fb0b769054fb7db1ae652fJames Ketrenos	u8 keys[WEP_KEYS][SCM_KEY_LEN];
316b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 level;
317b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 flags;
318ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
319b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
320b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/*
321b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
322b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik 802.11 data frame from AP
323b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
324b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik      ,-------------------------------------------------------------------.
325b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff GarzikBytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
326b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik      |------|------|---------|---------|---------|------|---------|------|
327b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff GarzikDesc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  frame  |  fcs |
328b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik      |      | tion | (BSSID) |         |         | ence |  data   |      |
329b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik      `-------------------------------------------------------------------'
330b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
331b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff GarzikTotal: 28-2340 bytes
332b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
333b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik*/
334b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
335b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define BEACON_PROBE_SSID_ID_POSITION 12
336b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
337b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_hdr_1addr {
338cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 frame_ctl;
339cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 duration_id;
340ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr1[ETH_ALEN];
341ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 payload[0];
342ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
343ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
344b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_hdr_2addr {
345cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 frame_ctl;
346cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 duration_id;
347ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr1[ETH_ALEN];
348ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr2[ETH_ALEN];
349ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 payload[0];
350ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
351ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
352b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_hdr_3addr {
353cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 frame_ctl;
354cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 duration_id;
355ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr1[ETH_ALEN];
356ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr2[ETH_ALEN];
357ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr3[ETH_ALEN];
358cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 seq_ctl;
359ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 payload[0];
360ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
361ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
362b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_hdr_4addr {
363cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 frame_ctl;
364cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 duration_id;
365ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr1[ETH_ALEN];
366ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr2[ETH_ALEN];
367ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr3[ETH_ALEN];
368cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 seq_ctl;
369ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 addr4[ETH_ALEN];
370ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 payload[0];
371ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
372ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
373b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_hdr_3addrqos {
374cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 frame_ctl;
375cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 duration_id;
3769e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 addr1[ETH_ALEN];
3779e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 addr2[ETH_ALEN];
3789e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 addr3[ETH_ALEN];
379cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 seq_ctl;
3809e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 payload[0];
381cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 qos_ctl;
382ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
3839e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
384b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_info_element {
385b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 id;
386b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 len;
387b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 data[0];
388ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
389b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
390b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/*
391b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * These are the data types that can make up management packets
392b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik *
393b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 auth_algorithm;
394b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 auth_sequence;
395b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 beacon_interval;
396b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 capability;
397b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 current_ap[ETH_ALEN];
398b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 listen_interval;
399b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	struct {
400b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		u16 association_id:14, reserved:2;
401ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet	} __packed;
402b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u32 time_stamp[2];
403b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 reason;
404b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 status;
405b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik*/
406b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
407b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_auth {
408b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_hdr_3addr header;
409099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 algorithm;
410099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 transaction;
411099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 status;
412e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos	/* challenge */
413b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element info_element[0];
414ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
415b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
416b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_channel_switch {
417b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 id;
418b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 len;
419b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 mode;
420b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 channel;
421b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 count;
422ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
423b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
424b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_action {
425b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_hdr_3addr header;
426b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 category;
427b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 action;
428b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	union {
429b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville		struct libipw_action_exchange {
430b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi			u8 token;
431b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			struct libipw_info_element info_element[0];
432b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi		} exchange;
433b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville		struct libipw_channel_switch channel_switch;
434b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
435b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	} format;
436ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
437b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
438b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_disassoc {
439b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_hdr_3addr header;
440e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos	__le16 reason;
441ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
442ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
443e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos/* Alias deauth for disassoc */
444b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define libipw_deauth libipw_disassoc
445e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos
446b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_probe_request {
447b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_hdr_3addr header;
448e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos	/* SSID, supported rates */
449b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element info_element[0];
450ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
451ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
452b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_probe_response {
453b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_hdr_3addr header;
454d9e94d5647ee6700773d81514a8ccb7dc6342fb4Al Viro	__le32 time_stamp[2];
455099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 beacon_interval;
456099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 capability;
457e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos	/* SSID, supported rates, FH params, DS params,
458e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos	 * CF params, IBSS params, TIM (if beacon), RSN */
459b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element info_element[0];
460ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
461b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
462ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos/* Alias beacon for probe_response */
463b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define libipw_beacon libipw_probe_response
464ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
465b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_assoc_request {
466b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_hdr_3addr header;
467cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 capability;
468cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 listen_interval;
469e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos	/* SSID, supported rates, RSN */
470b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element info_element[0];
471ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
472ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
473b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_reassoc_request {
474b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_hdr_3addr header;
475099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 capability;
476099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 listen_interval;
477b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 current_ap[ETH_ALEN];
478b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element info_element[0];
479ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
480b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
481b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_assoc_response {
482b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_hdr_3addr header;
483099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 capability;
484099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 status;
485099c5bb169e9816a7761336f668b63010762807bJiri Benc	__le16 aid;
486e5658d3e8a347f4393a9403b0cec8d43fa6214b1James Ketrenos	/* supported rates */
487b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element info_element[0];
488ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
489b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
490b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_txb {
491b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 nr_frags;
492b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 encrypted;
493ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 rts_included;
494ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	u8 reserved;
495d9e94d5647ee6700773d81514a8ccb7dc6342fb4Al Viro	u16 frag_size;
496d9e94d5647ee6700773d81514a8ccb7dc6342fb4Al Viro	u16 payload_size;
497b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	struct sk_buff *fragments[0];
498b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik};
499b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
500099c5bb169e9816a7761336f668b63010762807bJiri Benc/* SWEEP TABLE ENTRIES NUMBER */
501b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define MAX_SWEEP_TAB_ENTRIES		  42
502b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET  7
503b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik/* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
504b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * only use 8, and then use extended rates for the remaining supported
505b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * rates.  Other APs, however, stick all of their supported rates on the
506b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik * main rates information element... */
507b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define MAX_RATES_LENGTH                  ((u8)12)
508b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define MAX_RATES_EX_LENGTH               ((u8)16)
509b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define MAX_NETWORK_COUNT                  128
510b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
511b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define CRC_LENGTH                 4U
512b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
513b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define MAX_WPA_IE_LEN 64
514b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
5159e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define NETWORK_HAS_OFDM       (1<<1)
5169e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define NETWORK_HAS_CCK        (1<<2)
5179e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
5189e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos/* QoS structure */
5199e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define NETWORK_HAS_QOS_PARAMETERS      (1<<3)
5209e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define NETWORK_HAS_QOS_INFORMATION     (1<<4)
521b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi#define NETWORK_HAS_QOS_MASK            (NETWORK_HAS_QOS_PARAMETERS | \
522b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi					 NETWORK_HAS_QOS_INFORMATION)
523b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
524b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi/* 802.11h */
525b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi#define NETWORK_HAS_POWER_CONSTRAINT    (1<<5)
526b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi#define NETWORK_HAS_CSA                 (1<<6)
527b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi#define NETWORK_HAS_QUIET               (1<<7)
528b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi#define NETWORK_HAS_IBSS_DFS            (1<<8)
529b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi#define NETWORK_HAS_TPC_REPORT          (1<<9)
5309e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
531d8e2be90d301a0381e9b2528fe2835cf2992bca3Daniel Drake#define NETWORK_HAS_ERP_VALUE           (1<<10)
532d8e2be90d301a0381e9b2528fe2835cf2992bca3Daniel Drake
5339e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define QOS_QUEUE_NUM                   4
5349e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define QOS_OUI_LEN                     3
5359e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define QOS_OUI_TYPE                    2
5369e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define QOS_ELEMENT_ID                  221
5379e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define QOS_OUI_INFO_SUB_TYPE           0
5389e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define QOS_OUI_PARAM_SUB_TYPE          1
5399e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define QOS_VERSION_1                   1
5409e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos#define QOS_AIFSN_MIN_VALUE             2
5419e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
542b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_qos_information_element {
5439e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 elementID;
5449e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 length;
5459e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 qui[QOS_OUI_LEN];
5469e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 qui_type;
5479e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 qui_subtype;
5489e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 version;
5499e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 ac_info;
550ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
5519e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
552b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_qos_ac_parameter {
5539e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 aci_aifsn;
5549e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 ecw_min_max;
555cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 tx_op_limit;
556ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
5579e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
558b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_qos_parameter_info {
559b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_qos_information_element info_element;
5609e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 reserved;
561b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
562ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
5639e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
564b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_qos_parameters {
565cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 cw_min[QOS_QUEUE_NUM];
566cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 cw_max[QOS_QUEUE_NUM];
5679e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 aifs[QOS_QUEUE_NUM];
5689e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 flag[QOS_QUEUE_NUM];
569cdcfc210820b8e043cb606eddc145906185c6743James Ketrenos	__le16 tx_op_limit[QOS_QUEUE_NUM];
570ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
5719e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
572b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_qos_data {
573b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_qos_parameters parameters;
5749e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	int active;
5759e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	int supported;
5769e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 param_count;
5779e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 old_param_count;
5789e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos};
5799e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
580b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_tim_parameters {
5819e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 tim_count;
5829e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u8 tim_period;
583ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
5849e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
5859e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos/*******************************************************/
586b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
587b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleenum {				/* libipw_basic_report.map */
588b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_BASIC_MAP_BSS = (1 << 0),
589b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_BASIC_MAP_OFDM = (1 << 1),
590b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_BASIC_MAP_UNIDENTIFIED = (1 << 2),
591b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_BASIC_MAP_RADAR = (1 << 3),
592b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_BASIC_MAP_UNMEASURED = (1 << 4),
593b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* Bits 5-7 are reserved */
594b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
595b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi};
596b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_basic_report {
597b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 channel;
598b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	__le64 start_time;
599b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	__le16 duration;
600b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 map;
601ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
602b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
603b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleenum {				/* libipw_measurement_request.mode */
604b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* Bit 0 is reserved */
605b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_MEASUREMENT_ENABLE = (1 << 1),
606b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_MEASUREMENT_REQUEST = (1 << 2),
607b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_MEASUREMENT_REPORT = (1 << 3),
608b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* Bits 4-7 are reserved */
609b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi};
610b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
611b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yienum {
612b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_REPORT_BASIC = 0,	/* required */
613b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_REPORT_CCA = 1,	/* optional */
614b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_REPORT_RPI = 2,	/* optional */
615b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* 3-255 reserved */
616b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi};
617b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
618b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_measurement_params {
619b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 channel;
620b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	__le64 start_time;
621b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	__le16 duration;
622ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
623b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
624b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_measurement_request {
625b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element ie;
626b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 token;
627b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 mode;
628b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 type;
629b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_measurement_params params[0];
630ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
631b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
632b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_measurement_report {
633b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element ie;
634b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 token;
635b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 mode;
636b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 type;
637b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	union {
638b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville		struct libipw_basic_report basic[0];
639b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	} u;
640ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
641b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
642b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_tpc_report {
643b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 transmit_power;
644b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 link_margin;
645ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
646b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
647b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_channel_map {
648b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 channel;
649b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 map;
650ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
651b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
652b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_ibss_dfs {
653b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_info_element ie;
654b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 owner[ETH_ALEN];
655b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 recovery_interval;
656b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_channel_map channel_map[0];
657b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi};
658b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
659b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_csa {
660b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 mode;
661b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 channel;
662b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 count;
663ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
664b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
665b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_quiet {
666b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 count;
667b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 period;
668b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 duration;
669b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 offset;
670ba2d3587912f82d1ab4367975b1df460db60fb1eEric Dumazet} __packed;
671b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
672b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_network {
673b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* These entries are used to identify a unique network */
674b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 bssid[ETH_ALEN];
675b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 channel;
676b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* Ensure null-terminated for any debug msgs */
677b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 ssid[IW_ESSID_MAX_SIZE + 1];
678b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 ssid_len;
679b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
680b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_qos_data qos_data;
6819e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
682b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* These are network statistics */
683b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_rx_stats stats;
684b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 capability;
685b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 rates[MAX_RATES_LENGTH];
686b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 rates_len;
687b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 rates_ex[MAX_RATES_EX_LENGTH];
688b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 rates_ex_len;
689b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned long last_scanned;
690b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 mode;
691b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u32 flags;
692b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u32 last_associate;
693b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u32 time_stamp[2];
694b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 beacon_interval;
695b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 listen_interval;
696b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u16 atim_window;
69742c94e43be27f8b9be9b5be491bae8af05e54dbdJames Ketrenos	u8 erp_value;
698b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 wpa_ie[MAX_WPA_IE_LEN];
699b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	size_t wpa_ie_len;
700b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 rsn_ie[MAX_WPA_IE_LEN];
701b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	size_t rsn_ie_len;
702b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_tim_parameters tim;
703b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
704b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* 802.11h info */
705b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
706b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* Power Constraint - mandatory if spctrm mgmt required */
707b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	u8 power_constraint;
708b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
709b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* TPC Report - mandatory if spctrm mgmt required */
710b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_tpc_report tpc_report;
711b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
712b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* IBSS DFS - mandatory if spctrm mgmt required and IBSS
713b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	 * NOTE: This is variable length and so must be allocated dynamically */
714b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_ibss_dfs *ibss_dfs;
715b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
716b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* Channel Switch Announcement - optional if spctrm mgmt required */
717b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_csa csa;
718b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
719b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	/* Quiet - optional if spctrm mgmt required */
720b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_quiet quiet;
721b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi
722b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	struct list_head list;
723b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik};
724b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
725b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleenum libipw_state {
726b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_UNINITIALIZED = 0,
727b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_INITIALIZED,
728b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_ASSOCIATING,
729b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_ASSOCIATED,
730b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_AUTHENTICATING,
731b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_AUTHENTICATED,
732b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_SHUTDOWN
733b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik};
734b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
735b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
736b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define DEFAULT_FTS 2346
737b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
738b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define CFG_LIBIPW_RESERVE_FCS (1<<0)
739b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define CFG_LIBIPW_COMPUTE_FCS (1<<1)
740b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define CFG_LIBIPW_RTS (1<<2)
741b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
742b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_24GHZ_MIN_CHANNEL 1
743b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_24GHZ_MAX_CHANNEL 14
744b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_24GHZ_CHANNELS (LIBIPW_24GHZ_MAX_CHANNEL - \
745b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				  LIBIPW_24GHZ_MIN_CHANNEL + 1)
74602cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos
747b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_52GHZ_MIN_CHANNEL 34
748b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_52GHZ_MAX_CHANNEL 165
749b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#define LIBIPW_52GHZ_CHANNELS (LIBIPW_52GHZ_MAX_CHANNEL - \
750b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				  LIBIPW_52GHZ_MIN_CHANNEL + 1)
75102cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos
75202cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenosenum {
753b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_CH_PASSIVE_ONLY = (1 << 0),
754b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_CH_80211H_RULES = (1 << 1),
755b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_CH_B_ONLY = (1 << 2),
756b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_CH_NO_IBSS = (1 << 3),
757b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_CH_UNIFORM_SPREADING = (1 << 4),
758b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_CH_RADAR_DETECT = (1 << 5),
759b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	LIBIPW_CH_INVALID = (1 << 6),
76002cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos};
76102cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos
762b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_channel {
76374f4903363579d3336c294ebb11f02c8f35845caLarry Finger	u32 freq;	/* in MHz */
76402cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos	u8 channel;
76502cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos	u8 flags;
76674f4903363579d3336c294ebb11f02c8f35845caLarry Finger	u8 max_power;	/* in dBm */
76702cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos};
76802cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos
769b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_geo {
77002cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos	u8 name[4];
77102cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos	u8 bg_channels;
77202cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos	u8 a_channels;
773b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_channel bg[LIBIPW_24GHZ_CHANNELS];
774b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_channel a[LIBIPW_52GHZ_CHANNELS];
77502cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos};
77602cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos
777b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestruct libipw_device {
778b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	struct net_device *dev;
779a3caa99e6c68f466c13cfea74097f6fb01b45e25John W. Linville	struct wireless_dev wdev;
780b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_security sec;
781b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
782b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* Bookkeeping structures */
783b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_stats ieee_stats;
784b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
785b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_geo geo;
786a3caa99e6c68f466c13cfea74097f6fb01b45e25John W. Linville	struct ieee80211_supported_band bg_band;
787a3caa99e6c68f466c13cfea74097f6fb01b45e25John W. Linville	struct ieee80211_supported_band a_band;
78802cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos
789b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* Probe / Beacon management */
790b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	struct list_head network_free_list;
791b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	struct list_head network_list;
7928e59340e4fb65cfd748eaa1e23db057c52520f35Zhu Yi	struct libipw_network *networks[MAX_NETWORK_COUNT];
793b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	int scans;
794b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	int scan_age;
795b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
79674079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	int iw_mode;		/* operating mode (IW_MODE_*) */
79774079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	struct iw_spy_data spy_data;	/* iwspy support */
798b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
799b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	spinlock_t lock;
800b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
80174079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	int tx_headroom;	/* Set to size of any additional room needed at front
80274079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos				 * of allocated Tx SKBs */
803b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u32 config;
804b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
805b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* WEP and other encryption related settings at the device level */
80674079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	int open_wep;		/* Set to 1 to allow unencrypted frames */
807b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
808b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* If the host performs {en,de}cryption, then set to 1 */
809b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	int host_encrypt;
8101264fc0498e1e20f97b1ab690e523e7a7fc50eabJames Ketrenos	int host_encrypt_msdu;
811b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	int host_decrypt;
812ccd0fda3a6d9186d067893114f65b8df758d5a1fJames Ketrenos	/* host performs multicast decryption */
813ccd0fda3a6d9186d067893114f65b8df758d5a1fJames Ketrenos	int host_mc_decrypt;
814ccd0fda3a6d9186d067893114f65b8df758d5a1fJames Ketrenos
815c9308b06c049a107edfbd4e5271771564eb6024dDaniel Drake	/* host should strip IV and ICV from protected frames */
816c9308b06c049a107edfbd4e5271771564eb6024dDaniel Drake	/* meaningful only when hardware decryption is being used */
817c9308b06c049a107edfbd4e5271771564eb6024dDaniel Drake	int host_strip_iv_icv;
818c9308b06c049a107edfbd4e5271771564eb6024dDaniel Drake
8191264fc0498e1e20f97b1ab690e523e7a7fc50eabJames Ketrenos	int host_open_frag;
82074079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	int ieee802_1x;		/* is IEEE 802.1X used */
821b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
822b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* WPA data */
823b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	int wpa_enabled;
824b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	int drop_unencrypted;
825b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	int privacy_invoked;
826b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	size_t wpa_ie_len;
827b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 *wpa_ie;
828b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
829274bfb8dc5ffa16cb073801bebe76ab7f4e2e73dJohn W. Linville	struct lib80211_crypt_info crypt_info;
830b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
83174079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	int bcrx_sta_key;	/* use individual keys to override default keys even
83274079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos				 * with RX of broad/multicast frames */
833b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
834b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* Fragmentation structures */
835b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	struct libipw_frag_entry frag_cache[LIBIPW_FRAG_CACHE_LEN];
836b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	unsigned int frag_next_idx;
83774079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	u16 fts;		/* Fragmentation Threshold */
8383cdd00c5827621cd0b1bb0665aa62ef9a724297dJames Ketrenos	u16 rts;		/* RTS threshold */
839b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
840b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* Association info */
841b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 bssid[ETH_ALEN];
842b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
843b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	enum libipw_state state;
844b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
84574079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	int mode;		/* A, B, G */
84674079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	int modulation;		/* CCK, OFDM */
84774079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	int freq_band;		/* 2.4Ghz, 5.2Ghz, Mixed */
8483bc5ed684253f407b1567799d13cb06a0d86fe80James Ketrenos	int abg_true;		/* ABG flag              */
849b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
850b1b508e1b13529b3cc5b59c352f49b9b58a302b6James Ketrenos	int perfect_rssi;
851b1b508e1b13529b3cc5b59c352f49b9b58a302b6James Ketrenos	int worst_rssi;
852b1b508e1b13529b3cc5b59c352f49b9b58a302b6James Ketrenos
853837925df022a667c302b24aad9d6a58f94efd959Larry Finger	u16 prev_seq_ctl;	/* used to drop duplicate frames */
854837925df022a667c302b24aad9d6a58f94efd959Larry Finger
855b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* Callback functions */
85674079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos	void (*set_security) (struct net_device * dev,
857b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			      struct libipw_security * sec);
858d0cf9c0dadcdc89a755bcb301cfc9c796eb28ccfStephen Hemminger	netdev_tx_t (*hard_start_xmit) (struct libipw_txb * txb,
859d0cf9c0dadcdc89a755bcb301cfc9c796eb28ccfStephen Hemminger					struct net_device * dev, int pri);
8603f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	int (*is_queue_full) (struct net_device * dev, int pri);
8613f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos
8629e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	int (*handle_management) (struct net_device * dev,
863b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				  struct libipw_network * network, u16 type);
86473858062b66c07d71bce47a0e4798dd3ce604590Zhu Yi	int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
8659e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos
8663f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	/* Typical STA methods */
8673f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	int (*handle_auth) (struct net_device * dev,
868b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			    struct libipw_auth * auth);
86931b59eaee8f8ec29d8cb6ac0c8eed086689d8030James Ketrenos	int (*handle_deauth) (struct net_device * dev,
870b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			      struct libipw_deauth * auth);
871b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi	int (*handle_action) (struct net_device * dev,
872b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			      struct libipw_action * action,
873b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			      struct libipw_rx_stats * stats);
8743f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	int (*handle_disassoc) (struct net_device * dev,
875b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				struct libipw_disassoc * assoc);
8763f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	int (*handle_beacon) (struct net_device * dev,
877b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			      struct libipw_beacon * beacon,
878b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			      struct libipw_network * network);
8793f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	int (*handle_probe_response) (struct net_device * dev,
880b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				      struct libipw_probe_response * resp,
881b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				      struct libipw_network * network);
88242c94e43be27f8b9be9b5be491bae8af05e54dbdJames Ketrenos	int (*handle_probe_request) (struct net_device * dev,
883b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				     struct libipw_probe_request * req,
884b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				     struct libipw_rx_stats * stats);
8853f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	int (*handle_assoc_response) (struct net_device * dev,
886b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				      struct libipw_assoc_response * resp,
887b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				      struct libipw_network * network);
8883f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos
8893f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	/* Typical AP methods */
8903f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	int (*handle_assoc_request) (struct net_device * dev);
8913f552bbf8614d2d26f488ca0d3e188bdec484bf4James Ketrenos	int (*handle_reassoc_request) (struct net_device * dev,
892b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville				       struct libipw_reassoc_request * req);
893b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
894b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/* This must be the last item so that it points to the data
89527ae60f8f7aac221b428422eecafddaa7aff9549Pavel Roskin	 * allocated beyond this structure by alloc_libipw */
896b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	u8 priv[0];
897b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik};
898b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
899b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define IEEE_A            (1<<0)
900b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define IEEE_B            (1<<1)
901b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define IEEE_G            (1<<2)
902b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik#define IEEE_MODE_MASK    (IEEE_A|IEEE_B|IEEE_G)
903b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
904b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestatic inline void *libipw_priv(struct net_device *dev)
905b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik{
906b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	return ((struct libipw_device *)netdev_priv(dev))->priv;
907b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik}
908b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
909b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestatic inline int libipw_is_valid_mode(struct libipw_device *ieee,
91074079fdce472a2b16d502fe39e06b135ef06c69bJames Ketrenos					  int mode)
911b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik{
912b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	/*
913b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	 * It is possible for both access points and our device to support
914b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	 * combinations of modes, so as long as there is one valid combination
915b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	 * of ap/device supported modes, then return success
916b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	 *
917b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	 */
918b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	if ((mode & IEEE_A) &&
919b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	    (ieee->modulation & LIBIPW_OFDM_MODULATION) &&
920b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	    (ieee->freq_band & LIBIPW_52GHZ_BAND))
921b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		return 1;
922b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
923b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	if ((mode & IEEE_G) &&
924b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	    (ieee->modulation & LIBIPW_OFDM_MODULATION) &&
925b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	    (ieee->freq_band & LIBIPW_24GHZ_BAND))
926b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		return 1;
927b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
928b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	if ((mode & IEEE_B) &&
929b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	    (ieee->modulation & LIBIPW_CCK_MODULATION) &&
930b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	    (ieee->freq_band & LIBIPW_24GHZ_BAND))
931b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		return 1;
932b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
933b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	return 0;
934b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik}
935b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
936b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestatic inline int libipw_get_hdrlen(u16 fc)
937b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik{
938b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	int hdrlen = LIBIPW_3ADDR_LEN;
9399e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos	u16 stype = WLAN_FC_GET_STYPE(fc);
940b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
941b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	switch (WLAN_FC_GET_TYPE(fc)) {
942b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	case IEEE80211_FTYPE_DATA:
943b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
944b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			hdrlen = LIBIPW_4ADDR_LEN;
9459e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos		if (stype & IEEE80211_STYPE_QOS_DATA)
9469e8571affd1c54b9638b4ff9844e47aae07310f6James Ketrenos			hdrlen += 2;
947b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		break;
948b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	case IEEE80211_FTYPE_CTL:
949b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		switch (WLAN_FC_GET_STYPE(fc)) {
950b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		case IEEE80211_STYPE_CTS:
951b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		case IEEE80211_STYPE_ACK:
952b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			hdrlen = LIBIPW_1ADDR_LEN;
953b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik			break;
954b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		default:
955b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			hdrlen = LIBIPW_2ADDR_LEN;
956b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik			break;
957b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		}
958b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik		break;
959b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	}
960b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
961b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	return hdrlen;
962b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik}
963b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
964b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestatic inline u8 *libipw_get_payload(struct ieee80211_hdr *hdr)
965ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos{
966b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	switch (libipw_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
967b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_1ADDR_LEN:
968b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville		return ((struct libipw_hdr_1addr *)hdr)->payload;
969b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_2ADDR_LEN:
970b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville		return ((struct libipw_hdr_2addr *)hdr)->payload;
971b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_3ADDR_LEN:
972b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville		return ((struct libipw_hdr_3addr *)hdr)->payload;
973b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_4ADDR_LEN:
974b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville		return ((struct libipw_hdr_4addr *)hdr)->payload;
975ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos	}
976cea00da3972806d213a7dbe1b98e889435385e6bAndrew Morton	return NULL;
977ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos}
978ee34af37c095482b9dba254b9cd7cb5e65e9a25eJames Ketrenos
979b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestatic inline int libipw_is_ofdm_rate(u8 rate)
9807c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn{
981b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	switch (rate & ~LIBIPW_BASIC_RATE_MASK) {
982b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_OFDM_RATE_6MB:
983b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_OFDM_RATE_9MB:
984b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_OFDM_RATE_12MB:
985b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_OFDM_RATE_18MB:
986b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_OFDM_RATE_24MB:
987b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_OFDM_RATE_36MB:
988b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_OFDM_RATE_48MB:
989b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_OFDM_RATE_54MB:
9907c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn		return 1;
9917c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn	}
9927c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn	return 0;
9937c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn}
9947c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn
995b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestatic inline int libipw_is_cck_rate(u8 rate)
9967c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn{
997b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	switch (rate & ~LIBIPW_BASIC_RATE_MASK) {
998b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_CCK_RATE_1MB:
999b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_CCK_RATE_2MB:
1000b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_CCK_RATE_5MB:
1001b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville	case LIBIPW_CCK_RATE_11MB:
10027c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn		return 1;
10037c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn	}
10047c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn	return 0;
10057c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn}
10067c254d3dba0fae124b1d33f784ca23572ac386b0Ivo van Doorn
100727ae60f8f7aac221b428422eecafddaa7aff9549Pavel Roskin/* libipw.c */
100827ae60f8f7aac221b428422eecafddaa7aff9549Pavel Roskinextern void free_libipw(struct net_device *dev, int monitor);
100927ae60f8f7aac221b428422eecafddaa7aff9549Pavel Roskinextern struct net_device *alloc_libipw(int sizeof_priv, int monitor);
1010b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_change_mtu(struct net_device *dev, int new_mtu);
1011b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
1012b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern void libipw_networks_age(struct libipw_device *ieee,
1013c3d72b968129ad4aec86c5fc8d2380f01ebebc53Dan Williams				   unsigned long age_secs);
1014c3d72b968129ad4aec86c5fc8d2380f01ebebc53Dan Williams
1015b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_set_encryption(struct libipw_device *ieee);
1016b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
1017b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville/* libipw_tx.c */
1018d0cf9c0dadcdc89a755bcb301cfc9c796eb28ccfStephen Hemmingerextern netdev_tx_t libipw_xmit(struct sk_buff *skb,
1019d0cf9c0dadcdc89a755bcb301cfc9c796eb28ccfStephen Hemminger			       struct net_device *dev);
1020b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern void libipw_txb_free(struct libipw_txb *);
1021b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
1022b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville/* libipw_rx.c */
1023b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern void libipw_rx_any(struct libipw_device *ieee,
1024b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville		     struct sk_buff *skb, struct libipw_rx_stats *stats);
1025b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb,
1026b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			struct libipw_rx_stats *rx_stats);
1027c9fa7d5d6cec7a45f9dc6c2f23500af50d5617c9Johannes Berg/* make sure to set stats->len */
1028b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern void libipw_rx_mgt(struct libipw_device *ieee,
1029b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			     struct libipw_hdr_4addr *header,
1030b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			     struct libipw_rx_stats *stats);
1031b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern void libipw_network_reset(struct libipw_network *network);
1032b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
1033b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville/* libipw_geo.c */
1034b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern const struct libipw_geo *libipw_get_geo(struct libipw_device
103502cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos						     *ieee);
1036b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_set_geo(struct libipw_device *ieee,
1037b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville			     const struct libipw_geo *geo);
103802cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos
1039b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_is_valid_channel(struct libipw_device *ieee,
104002cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos				      u8 channel);
1041b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_channel_to_index(struct libipw_device *ieee,
104202cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos				      u8 channel);
1043b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern u8 libipw_freq_to_channel(struct libipw_device *ieee, u32 freq);
1044b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern u8 libipw_get_channel_flags(struct libipw_device *ieee,
1045b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi				      u8 channel);
1046b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern const struct libipw_channel *libipw_get_channel(struct
1047b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville							     libipw_device
1048b79e20b60997e427b701055a2c69fb0c1d507aa9Zhu Yi							     *ieee, u8 channel);
1049b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern u32 libipw_channel_to_freq(struct libipw_device * ieee,
1050f5cdf30618cf855c2043e5c0c131ebb120929864Larry Finger				      u8 channel);
105102cda6ae01814f58422c45259fb48136fbd7bcc1James Ketrenos
1052b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville/* libipw_wx.c */
1053b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_wx_get_scan(struct libipw_device *ieee,
1054b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik				 struct iw_request_info *info,
1055b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik				 union iwreq_data *wrqu, char *key);
1056b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_wx_set_encode(struct libipw_device *ieee,
1057b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik				   struct iw_request_info *info,
1058b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik				   union iwreq_data *wrqu, char *key);
1059b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_wx_get_encode(struct libipw_device *ieee,
1060b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik				   struct iw_request_info *info,
1061b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik				   union iwreq_data *wrqu, char *key);
1062b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_wx_set_encodeext(struct libipw_device *ieee,
1063e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos				      struct iw_request_info *info,
1064e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos				      union iwreq_data *wrqu, char *extra);
1065b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvilleextern int libipw_wx_get_encodeext(struct libipw_device *ieee,
1066e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos				      struct iw_request_info *info,
1067e0d369d1d969fc9e4fd08a20f6dad04d369aceeaJames Ketrenos				      union iwreq_data *wrqu, char *extra);
1068b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
1069b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestatic inline void libipw_increment_scans(struct libipw_device *ieee)
1070b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik{
1071b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	ieee->scans++;
1072b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik}
1073b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
1074b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linvillestatic inline int libipw_get_scans(struct libipw_device *ieee)
1075b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik{
1076b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik	return ieee->scans;
1077b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik}
1078b453872c35cfcbdbf5a794737817f7d4e7b1b579Jeff Garzik
1079b0a4e7d8a291de63f35b04464de9ab4a83d38a7cJohn W. Linville#endif				/* LIBIPW_H */
1080