]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/staging/wlan-ng/p80211netdev.h
Merge remote-tracking branches 'spi/topic/img-spfi', 'spi/topic/imx', 'spi/topic...
[mirror_ubuntu-artful-kernel.git] / drivers / staging / wlan-ng / p80211netdev.h
CommitLineData
00b3ed16
GKH
1/* p80211netdev.h
2*
3* WLAN net device structure and functions
4*
5* Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
6* --------------------------------------------------------------------
7*
8* linux-wlan
9*
10* The contents of this file are subject to the Mozilla Public
11* License Version 1.1 (the "License"); you may not use this file
12* except in compliance with the License. You may obtain a copy of
13* the License at http://www.mozilla.org/MPL/
14*
15* Software distributed under the License is distributed on an "AS
16* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17* implied. See the License for the specific language governing
18* rights and limitations under the License.
19*
20* Alternatively, the contents of this file may be used under the
21* terms of the GNU Public License version 2 (the "GPL"), in which
22* case the provisions of the GPL are applicable instead of the
23* above. If you wish to allow the use of your version of this file
24* only under the terms of the GPL and not to allow others to use
25* your version of this file under the MPL, indicate your decision
26* by deleting the provisions above and replace them with the notice
27* and other provisions required by the GPL. If you do not delete
28* the provisions above, a recipient may use your version of this
29* file under either the MPL or the GPL.
30*
31* --------------------------------------------------------------------
32*
33* Inquiries regarding the linux-wlan Open Source project can be
34* made directly to:
35*
36* AbsoluteValue Systems Inc.
37* info@linux-wlan.com
38* http://www.linux-wlan.com
39*
40* --------------------------------------------------------------------
41*
42* Portions of the development of this software were funded by
43* Intersil Corporation as part of PRISM(R) chipset product development.
44*
45* --------------------------------------------------------------------
46*
47* This file declares the structure type that represents each wlan
48* interface.
49*
50* --------------------------------------------------------------------
51*/
52
53#ifndef _LINUX_P80211NETDEV_H
54#define _LINUX_P80211NETDEV_H
55
56#include <linux/interrupt.h>
57#include <linux/wireless.h>
96c5abd7 58#include <linux/netdevice.h>
00b3ed16 59
96c5abd7
MM
60#undef netdevice_t
61typedef struct net_device netdevice_t;
62
1f61379e
MM
63#define WLAN_RELEASE "0.3.0-staging"
64
00b3ed16
GKH
65#define WLAN_DEVICE_CLOSED 0
66#define WLAN_DEVICE_OPEN 1
67
68#define WLAN_MACMODE_NONE 0
69#define WLAN_MACMODE_IBSS_STA 1
70#define WLAN_MACMODE_ESS_STA 2
71#define WLAN_MACMODE_ESS_AP 3
72
73/* MSD States */
00b3ed16
GKH
74#define WLAN_MSD_HWPRESENT_PENDING 1
75#define WLAN_MSD_HWFAIL 2
76#define WLAN_MSD_HWPRESENT 3
77#define WLAN_MSD_FWLOAD_PENDING 4
78#define WLAN_MSD_FWLOAD 5
79#define WLAN_MSD_RUNNING_PENDING 6
80#define WLAN_MSD_RUNNING 7
81
82#ifndef ETH_P_ECONET
a32fb5f7 83#define ETH_P_ECONET 0x0018 /* needed for 2.2.x kernels */
00b3ed16
GKH
84#endif
85
86#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
87
88#ifndef ARPHRD_IEEE80211
a32fb5f7 89#define ARPHRD_IEEE80211 801 /* kernel 2.4.6 */
00b3ed16
GKH
90#endif
91
a32fb5f7 92#ifndef ARPHRD_IEEE80211_PRISM /* kernel 2.4.18 */
00b3ed16
GKH
93#define ARPHRD_IEEE80211_PRISM 802
94#endif
95
96/*--- NSD Capabilities Flags ------------------------------*/
4314e5a6
JM
97#define P80211_NSDCAP_HARDWAREWEP 0x01 /* hardware wep engine */
98#define P80211_NSDCAP_SHORT_PREAMBLE 0x10 /* hardware supports */
99#define P80211_NSDCAP_HWFRAGMENT 0x80 /* nsd handles frag/defrag */
100#define P80211_NSDCAP_AUTOJOIN 0x100 /* nsd does autojoin */
101#define P80211_NSDCAP_NOSCAN 0x200 /* nsd can scan */
00b3ed16
GKH
102
103/* Received frame statistics */
a32fb5f7
MM
104typedef struct p80211_frmrx_t {
105 u32 mgmt;
106 u32 assocreq;
107 u32 assocresp;
108 u32 reassocreq;
109 u32 reassocresp;
110 u32 probereq;
111 u32 proberesp;
112 u32 beacon;
113 u32 atim;
114 u32 disassoc;
115 u32 authen;
116 u32 deauthen;
117 u32 mgmt_unknown;
118 u32 ctl;
119 u32 pspoll;
120 u32 rts;
121 u32 cts;
122 u32 ack;
123 u32 cfend;
124 u32 cfendcfack;
125 u32 ctl_unknown;
126 u32 data;
127 u32 dataonly;
128 u32 data_cfack;
129 u32 data_cfpoll;
130 u32 data__cfack_cfpoll;
131 u32 null;
132 u32 cfack;
133 u32 cfpoll;
134 u32 cfack_cfpoll;
135 u32 data_unknown;
136 u32 decrypt;
137 u32 decrypt_err;
00b3ed16
GKH
138} p80211_frmrx_t;
139
00b3ed16 140/* called by /proc/net/wireless */
40e4205a 141struct iw_statistics *p80211wext_get_wireless_stats(netdevice_t *dev);
00b3ed16 142/* wireless extensions' ioctls */
00b3ed16 143extern struct iw_handler_def p80211wext_handler_def;
00b3ed16 144int p80211wext_event_associated(struct wlandevice *wlandev, int assoc);
00b3ed16
GKH
145
146/* WEP stuff */
147#define NUM_WEPKEYS 4
148#define MAX_KEYLEN 32
149
7f6e0e44 150#define HOSTWEP_DEFAULTKEY_MASK (BIT(1)|BIT(0))
cb3126e6 151#define HOSTWEP_SHAREDKEY BIT(3)
7f6e0e44
MM
152#define HOSTWEP_DECRYPT BIT(4)
153#define HOSTWEP_ENCRYPT BIT(5)
154#define HOSTWEP_PRIVACYINVOKED BIT(6)
155#define HOSTWEP_EXCLUDEUNENCRYPTED BIT(7)
00b3ed16
GKH
156
157extern int wlan_watchdog;
158extern int wlan_wext_write;
159
160/* WLAN device type */
a32fb5f7
MM
161typedef struct wlandevice {
162 struct wlandevice *next; /* link for list of devices */
163 void *priv; /* private data for MSD */
00b3ed16
GKH
164
165 /* Subsystem State */
a32fb5f7
MM
166 char name[WLAN_DEVNAMELEN_MAX]; /* Dev name, from register_wlandev() */
167 char *nsdname;
00b3ed16 168
a32fb5f7
MM
169 u32 state; /* Device I/F state (open/closed) */
170 u32 msdstate; /* state of underlying driver */
171 u32 hwremoved; /* Has the hw been yanked out? */
00b3ed16
GKH
172
173 /* Hardware config */
a32fb5f7
MM
174 unsigned int irq;
175 unsigned int iobase;
176 unsigned int membase;
177 u32 nsdcaps; /* NSD Capabilities flags */
00b3ed16
GKH
178
179 /* Config vars */
a32fb5f7 180 unsigned int ethconv;
00b3ed16
GKH
181
182 /* device methods (init by MSD, used by p80211 */
43bb32a5
AO
183 int (*open)(struct wlandevice *wlandev);
184 int (*close)(struct wlandevice *wlandev);
185 void (*reset)(struct wlandevice *wlandev);
186 int (*txframe)(struct wlandevice *wlandev, struct sk_buff *skb,
93df38e5 187 union p80211_hdr *p80211_hdr,
51e4896a 188 struct p80211_metawep *p80211_wep);
43bb32a5
AO
189 int (*mlmerequest)(struct wlandevice *wlandev, struct p80211msg *msg);
190 int (*set_multicast_list)(struct wlandevice *wlandev,
5dd8acc8 191 netdevice_t *dev);
43bb32a5 192 void (*tx_timeout)(struct wlandevice *wlandev);
00b3ed16 193
00b3ed16 194 /* 802.11 State */
a32fb5f7
MM
195 u8 bssid[WLAN_BSSID_LEN];
196 p80211pstr32_t ssid;
197 u32 macmode;
198 int linkstatus;
00b3ed16
GKH
199
200 /* WEP State */
aaad4303
SP
201 u8 wep_keys[NUM_WEPKEYS][MAX_KEYLEN];
202 u8 wep_keylens[NUM_WEPKEYS];
a32fb5f7 203 int hostwep;
00b3ed16
GKH
204
205 /* Request/Confirm i/f state (used by p80211) */
a32fb5f7 206 unsigned long request_pending; /* flag, access atomically */
00b3ed16
GKH
207
208 /* netlink socket */
209 /* queue for indications waiting for cmd completion */
210 /* Linux netdevice and support */
a32fb5f7 211 netdevice_t *netdev; /* ptr to linux netdevice */
00b3ed16 212
00b3ed16 213 /* Rx bottom half */
a32fb5f7 214 struct tasklet_struct rx_bh;
00b3ed16 215
a32fb5f7 216 struct sk_buff_head nsd_rxq;
00b3ed16
GKH
217
218 /* 802.11 device statistics */
a32fb5f7 219 struct p80211_frmrx_t rx;
00b3ed16 220
a32fb5f7 221 struct iw_statistics wstats;
00b3ed16
GKH
222
223 /* jkriegl: iwspy fields */
a32fb5f7
MM
224 u8 spy_number;
225 char spy_address[IW_MAX_SPY][ETH_ALEN];
226 struct iw_quality spy_stat[IW_MAX_SPY];
00b3ed16
GKH
227} wlandevice_t;
228
229/* WEP stuff */
5dd8acc8
SK
230int wep_change_key(wlandevice_t *wlandev, int keynum, u8 *key, int keylen);
231int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override,
232 u8 *iv, u8 *icv);
233int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum,
234 u8 *iv, u8 *icv);
235
cb3126e6 236int wlan_setup(wlandevice_t *wlandev, struct device *physdev);
3f459327 237void wlan_unsetup(wlandevice_t *wlandev);
5dd8acc8
SK
238int register_wlandev(wlandevice_t *wlandev);
239int unregister_wlandev(wlandevice_t *wlandev);
240void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb);
241void p80211netdev_hwremoved(wlandevice_t *wlandev);
00b3ed16 242#endif