3 * WLAN net device structure and functions
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
6 * --------------------------------------------------------------------
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/
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.
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.
31 * --------------------------------------------------------------------
33 * Inquiries regarding the linux-wlan Open Source project can be
36 * AbsoluteValue Systems Inc.
38 * http://www.linux-wlan.com
40 * --------------------------------------------------------------------
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
45 * --------------------------------------------------------------------
47 * This file declares the structure type that represents each wlan
50 * --------------------------------------------------------------------
53 #ifndef _LINUX_P80211NETDEV_H
54 #define _LINUX_P80211NETDEV_H
56 #include <linux/interrupt.h>
57 #include <linux/wireless.h>
58 #include <linux/netdevice.h>
60 #define WLAN_RELEASE "0.3.0-staging"
62 #define WLAN_DEVICE_CLOSED 0
63 #define WLAN_DEVICE_OPEN 1
65 #define WLAN_MACMODE_NONE 0
66 #define WLAN_MACMODE_IBSS_STA 1
67 #define WLAN_MACMODE_ESS_STA 2
68 #define WLAN_MACMODE_ESS_AP 3
71 #define WLAN_MSD_HWPRESENT_PENDING 1
72 #define WLAN_MSD_HWFAIL 2
73 #define WLAN_MSD_HWPRESENT 3
74 #define WLAN_MSD_FWLOAD_PENDING 4
75 #define WLAN_MSD_FWLOAD 5
76 #define WLAN_MSD_RUNNING_PENDING 6
77 #define WLAN_MSD_RUNNING 7
80 #define ETH_P_ECONET 0x0018 /* needed for 2.2.x kernels */
83 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
85 #ifndef ARPHRD_IEEE80211
86 #define ARPHRD_IEEE80211 801 /* kernel 2.4.6 */
89 #ifndef ARPHRD_IEEE80211_PRISM /* kernel 2.4.18 */
90 #define ARPHRD_IEEE80211_PRISM 802
93 /*--- NSD Capabilities Flags ------------------------------*/
94 #define P80211_NSDCAP_HARDWAREWEP 0x01 /* hardware wep engine */
95 #define P80211_NSDCAP_SHORT_PREAMBLE 0x10 /* hardware supports */
96 #define P80211_NSDCAP_HWFRAGMENT 0x80 /* nsd handles frag/defrag */
97 #define P80211_NSDCAP_AUTOJOIN 0x100 /* nsd does autojoin */
98 #define P80211_NSDCAP_NOSCAN 0x200 /* nsd can scan */
100 /* Received frame statistics */
101 struct p80211_frmrx
{
127 u32 data__cfack_cfpoll
;
137 /* called by /proc/net/wireless */
138 struct iw_statistics
*p80211wext_get_wireless_stats(struct net_device
*dev
);
139 /* wireless extensions' ioctls */
140 extern struct iw_handler_def p80211wext_handler_def
;
143 #define NUM_WEPKEYS 4
144 #define MAX_KEYLEN 32
146 #define HOSTWEP_DEFAULTKEY_MASK GENMASK(1, 0)
147 #define HOSTWEP_SHAREDKEY BIT(3)
148 #define HOSTWEP_DECRYPT BIT(4)
149 #define HOSTWEP_ENCRYPT BIT(5)
150 #define HOSTWEP_PRIVACYINVOKED BIT(6)
151 #define HOSTWEP_EXCLUDEUNENCRYPTED BIT(7)
153 extern int wlan_watchdog
;
154 extern int wlan_wext_write
;
156 /* WLAN device type */
158 void *priv
; /* private data for MSD */
160 /* Subsystem State */
161 char name
[WLAN_DEVNAMELEN_MAX
]; /* Dev name, from register_wlandev() */
164 u32 state
; /* Device I/F state (open/closed) */
165 u32 msdstate
; /* state of underlying driver */
166 u32 hwremoved
; /* Has the hw been yanked out? */
168 /* Hardware config */
171 unsigned int membase
;
172 u32 nsdcaps
; /* NSD Capabilities flags */
175 unsigned int ethconv
;
177 /* device methods (init by MSD, used by p80211 */
178 int (*open
)(struct wlandevice
*wlandev
);
179 int (*close
)(struct wlandevice
*wlandev
);
180 void (*reset
)(struct wlandevice
*wlandev
);
181 int (*txframe
)(struct wlandevice
*wlandev
, struct sk_buff
*skb
,
182 union p80211_hdr
*p80211_hdr
,
183 struct p80211_metawep
*p80211_wep
);
184 int (*mlmerequest
)(struct wlandevice
*wlandev
, struct p80211msg
*msg
);
185 int (*set_multicast_list
)(struct wlandevice
*wlandev
,
186 struct net_device
*dev
);
187 void (*tx_timeout
)(struct wlandevice
*wlandev
);
190 u8 bssid
[WLAN_BSSID_LEN
];
191 struct p80211pstr32 ssid
;
196 u8 wep_keys
[NUM_WEPKEYS
][MAX_KEYLEN
];
197 u8 wep_keylens
[NUM_WEPKEYS
];
200 /* Request/Confirm i/f state (used by p80211) */
201 unsigned long request_pending
; /* flag, access atomically */
204 /* queue for indications waiting for cmd completion */
205 /* Linux netdevice and support */
206 struct net_device
*netdev
; /* ptr to linux netdevice */
209 struct tasklet_struct rx_bh
;
211 struct sk_buff_head nsd_rxq
;
213 /* 802.11 device statistics */
214 struct p80211_frmrx rx
;
216 struct iw_statistics wstats
;
218 /* jkriegl: iwspy fields */
220 char spy_address
[IW_MAX_SPY
][ETH_ALEN
];
221 struct iw_quality spy_stat
[IW_MAX_SPY
];
225 int wep_change_key(struct wlandevice
*wlandev
, int keynum
, u8
*key
, int keylen
);
226 int wep_decrypt(struct wlandevice
*wlandev
, u8
*buf
, u32 len
, int key_override
,
228 int wep_encrypt(struct wlandevice
*wlandev
, u8
*buf
, u8
*dst
, u32 len
,
229 int keynum
, u8
*iv
, u8
*icv
);
231 int wlan_setup(struct wlandevice
*wlandev
, struct device
*physdev
);
232 void wlan_unsetup(struct wlandevice
*wlandev
);
233 int register_wlandev(struct wlandevice
*wlandev
);
234 int unregister_wlandev(struct wlandevice
*wlandev
);
235 void p80211netdev_rx(struct wlandevice
*wlandev
, struct sk_buff
*skb
);
236 void p80211netdev_hwremoved(struct wlandevice
*wlandev
);