1 /* SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) */
4 * WLAN net device structure and functions
6 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
7 * --------------------------------------------------------------------
11 * --------------------------------------------------------------------
13 * Inquiries regarding the linux-wlan Open Source project can be
16 * AbsoluteValue Systems Inc.
18 * http://www.linux-wlan.com
20 * --------------------------------------------------------------------
22 * Portions of the development of this software were funded by
23 * Intersil Corporation as part of PRISM(R) chipset product development.
25 * --------------------------------------------------------------------
27 * This file declares the structure type that represents each wlan
30 * --------------------------------------------------------------------
33 #ifndef _LINUX_P80211NETDEV_H
34 #define _LINUX_P80211NETDEV_H
36 #include <linux/interrupt.h>
37 #include <linux/wireless.h>
38 #include <linux/netdevice.h>
40 #define WLAN_RELEASE "0.3.0-staging"
42 #define WLAN_DEVICE_CLOSED 0
43 #define WLAN_DEVICE_OPEN 1
45 #define WLAN_MACMODE_NONE 0
46 #define WLAN_MACMODE_IBSS_STA 1
47 #define WLAN_MACMODE_ESS_STA 2
48 #define WLAN_MACMODE_ESS_AP 3
51 #define WLAN_MSD_HWPRESENT_PENDING 1
52 #define WLAN_MSD_HWFAIL 2
53 #define WLAN_MSD_HWPRESENT 3
54 #define WLAN_MSD_FWLOAD_PENDING 4
55 #define WLAN_MSD_FWLOAD 5
56 #define WLAN_MSD_RUNNING_PENDING 6
57 #define WLAN_MSD_RUNNING 7
60 #define ETH_P_ECONET 0x0018 /* needed for 2.2.x kernels */
63 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
65 #ifndef ARPHRD_IEEE80211
66 #define ARPHRD_IEEE80211 801 /* kernel 2.4.6 */
69 #ifndef ARPHRD_IEEE80211_PRISM /* kernel 2.4.18 */
70 #define ARPHRD_IEEE80211_PRISM 802
73 /*--- NSD Capabilities Flags ------------------------------*/
74 #define P80211_NSDCAP_HARDWAREWEP 0x01 /* hardware wep engine */
75 #define P80211_NSDCAP_SHORT_PREAMBLE 0x10 /* hardware supports */
76 #define P80211_NSDCAP_HWFRAGMENT 0x80 /* nsd handles frag/defrag */
77 #define P80211_NSDCAP_AUTOJOIN 0x100 /* nsd does autojoin */
78 #define P80211_NSDCAP_NOSCAN 0x200 /* nsd can scan */
80 /* Received frame statistics */
107 u32 data__cfack_cfpoll;
118 #define NUM_WEPKEYS 4
119 #define MAX_KEYLEN 32
121 #define HOSTWEP_DEFAULTKEY_MASK GENMASK(1, 0)
122 #define HOSTWEP_SHAREDKEY BIT(3)
123 #define HOSTWEP_DECRYPT BIT(4)
124 #define HOSTWEP_ENCRYPT BIT(5)
125 #define HOSTWEP_PRIVACYINVOKED BIT(6)
126 #define HOSTWEP_EXCLUDEUNENCRYPTED BIT(7)
128 extern int wlan_watchdog;
129 extern int wlan_wext_write;
131 /* WLAN device type */
133 void *priv; /* private data for MSD */
135 /* Subsystem State */
136 char name[WLAN_DEVNAMELEN_MAX]; /* Dev name, from register_wlandev() */
139 u32 state; /* Device I/F state (open/closed) */
140 u32 msdstate; /* state of underlying driver */
141 u32 hwremoved; /* Has the hw been yanked out? */
143 /* Hardware config */
146 unsigned int membase;
147 u32 nsdcaps; /* NSD Capabilities flags */
150 unsigned int ethconv;
152 /* device methods (init by MSD, used by p80211 */
153 int (*open)(struct wlandevice *wlandev);
154 int (*close)(struct wlandevice *wlandev);
155 void (*reset)(struct wlandevice *wlandev);
156 int (*txframe)(struct wlandevice *wlandev, struct sk_buff *skb,
157 struct p80211_hdr *p80211_hdr,
158 struct p80211_metawep *p80211_wep);
159 int (*mlmerequest)(struct wlandevice *wlandev, struct p80211msg *msg);
160 int (*set_multicast_list)(struct wlandevice *wlandev,
161 struct net_device *dev);
162 void (*tx_timeout)(struct wlandevice *wlandev);
165 u8 bssid[WLAN_BSSID_LEN];
166 struct p80211pstr32 ssid;
171 u8 wep_keys[NUM_WEPKEYS][MAX_KEYLEN];
172 u8 wep_keylens[NUM_WEPKEYS];
175 /* Request/Confirm i/f state (used by p80211) */
176 unsigned long request_pending; /* flag, access atomically */
179 /* queue for indications waiting for cmd completion */
180 /* Linux netdevice and support */
181 struct net_device *netdev; /* ptr to linux netdevice */
184 struct tasklet_struct rx_bh;
186 struct sk_buff_head nsd_rxq;
188 /* 802.11 device statistics */
189 struct p80211_frmrx rx;
191 struct iw_statistics wstats;
193 /* jkriegl: iwspy fields */
195 char spy_address[IW_MAX_SPY][ETH_ALEN];
196 struct iw_quality spy_stat[IW_MAX_SPY];
200 int wep_change_key(struct wlandevice *wlandev, int keynum, u8 *key, int keylen);
201 int wep_decrypt(struct wlandevice *wlandev, u8 *buf, u32 len, int key_override,
203 int wep_encrypt(struct wlandevice *wlandev, u8 *buf, u8 *dst, u32 len,
204 int keynum, u8 *iv, u8 *icv);
206 int wlan_setup(struct wlandevice *wlandev, struct device *physdev);
207 void wlan_unsetup(struct wlandevice *wlandev);
208 int register_wlandev(struct wlandevice *wlandev);
209 int unregister_wlandev(struct wlandevice *wlandev);
210 void p80211netdev_rx(struct wlandevice *wlandev, struct sk_buff *skb);
211 void p80211netdev_hwremoved(struct wlandevice *wlandev);