3 * Common definitions to all pieces of the various orinoco
10 #define DRIVER_VERSION "0.15"
12 #include <linux/interrupt.h>
13 #include <linux/suspend.h>
14 #include <linux/netdevice.h>
15 #include <linux/wireless.h>
16 #include <net/iw_handler.h>
17 #include <net/cfg80211.h>
21 /* To enable debug messages */
22 /*#define ORINOCO_DEBUG 3*/
24 #define WIRELESS_SPY /* enable iwspy support */
26 #define MAX_SCAN_LEN 4096
28 #define ORINOCO_SEQ_LEN 8
29 #define ORINOCO_MAX_KEY_SIZE 14
30 #define ORINOCO_MAX_KEYS 4
33 __le16 len
; /* always stored as little-endian */
34 char data
[ORINOCO_MAX_KEY_SIZE
];
35 } __attribute__ ((packed
));
37 #define TKIP_KEYLEN 16
40 struct orinoco_tkip_key
{
42 u8 tx_mic
[MIC_KEYLEN
];
43 u8 rx_mic
[MIC_KEYLEN
];
54 FIRMWARE_TYPE_INTERSIL
,
60 struct orinoco_private
{
61 void *card
; /* Pointer to card dependent structure */
63 int (*hard_reset
)(struct orinoco_private
*);
64 int (*stop_fw
)(struct orinoco_private
*, int);
66 struct ieee80211_supported_band band
;
67 struct ieee80211_channel channels
[14];
70 /* Synchronisation stuff */
73 struct work_struct reset_work
;
75 /* Interrupt tasklets */
76 struct tasklet_struct rx_tasklet
;
77 struct list_head rx_list
;
82 struct work_struct join_work
;
83 struct work_struct wevent_work
;
85 /* Net device stuff */
86 struct net_device
*ndev
;
87 struct net_device_stats stats
;
88 struct iw_statistics wstats
;
90 /* Hardware control variables */
94 /* Capabilities of the hardware/firmware */
95 fwtype_t firmware_type
;
100 /* Boolean capabilities */
101 unsigned int has_ibss
:1;
102 unsigned int has_port3
:1;
103 unsigned int has_wep
:1;
104 unsigned int has_big_wep
:1;
105 unsigned int has_mwo
:1;
106 unsigned int has_pm
:1;
107 unsigned int has_preamble
:1;
108 unsigned int has_sensitivity
:1;
109 unsigned int has_hostscan
:1;
110 unsigned int has_alt_txcntl
:1;
111 unsigned int has_ext_scan
:1;
112 unsigned int has_wpa
:1;
113 unsigned int do_fw_download
:1;
114 unsigned int broken_disableport
:1;
115 unsigned int broken_monitor
:1;
116 unsigned int prefer_port3
:1;
118 /* Configuration paramaters */
119 enum nl80211_iftype iw_mode
;
120 enum orinoco_alg encode_alg
;
121 u16 wep_restrict
, tx_key
;
122 struct key_params keys
[ORINOCO_MAX_KEYS
];
125 char nick
[IW_ESSID_MAX_SIZE
+1];
126 char desired_essid
[IW_ESSID_MAX_SIZE
+1];
127 char desired_bssid
[ETH_ALEN
];
129 u16 frag_thresh
, mwo_robust
;
131 u16 ap_density
, rts_thresh
;
132 u16 pm_on
, pm_mcast
, pm_period
, pm_timeout
;
135 struct iw_spy_data spy_data
; /* iwspy support */
136 struct iw_public_data wireless_data
;
139 /* Configuration dependent variables */
140 int port_type
, createibss
;
141 int promiscuous
, mc_count
;
143 /* Scanning support */
144 struct cfg80211_scan_request
*scan_request
;
145 struct work_struct process_scan
;
146 struct list_head scan_list
;
147 spinlock_t scan_lock
; /* protects the scan list */
153 struct crypto_hash
*rx_tfm_mic
;
154 struct crypto_hash
*tx_tfm_mic
;
156 unsigned int wpa_enabled
:1;
157 unsigned int tkip_cm_active
:1;
158 unsigned int key_mgmt
:3;
160 #if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
161 /* Cached in memory firmware to use during ->resume. */
162 const struct firmware
*cached_pri_fw
;
163 const struct firmware
*cached_fw
;
166 struct notifier_block pm_notifier
;
170 extern int orinoco_debug
;
171 #define DEBUG(n, args...) do { \
172 if (orinoco_debug > (n)) \
173 printk(KERN_DEBUG args); \
176 #define DEBUG(n, args...) do { } while (0)
177 #endif /* ORINOCO_DEBUG */
179 /********************************************************************/
180 /* Exported prototypes */
181 /********************************************************************/
183 extern struct orinoco_private
*alloc_orinocodev(
184 int sizeof_card
, struct device
*device
,
185 int (*hard_reset
)(struct orinoco_private
*),
186 int (*stop_fw
)(struct orinoco_private
*, int));
187 extern void free_orinocodev(struct orinoco_private
*priv
);
188 extern int orinoco_init(struct orinoco_private
*priv
);
189 extern int orinoco_if_add(struct orinoco_private
*priv
,
190 unsigned long base_addr
,
192 extern void orinoco_if_del(struct orinoco_private
*priv
);
193 extern int orinoco_up(struct orinoco_private
*priv
);
194 extern void orinoco_down(struct orinoco_private
*priv
);
195 extern irqreturn_t
orinoco_interrupt(int irq
, void *dev_id
);
197 /********************************************************************/
198 /* Locking and synchronization functions */
199 /********************************************************************/
201 static inline int orinoco_lock(struct orinoco_private
*priv
,
202 unsigned long *flags
)
204 spin_lock_irqsave(&priv
->lock
, *flags
);
205 if (priv
->hw_unavailable
) {
206 DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
208 spin_unlock_irqrestore(&priv
->lock
, *flags
);
214 static inline void orinoco_unlock(struct orinoco_private
*priv
,
215 unsigned long *flags
)
217 spin_unlock_irqrestore(&priv
->lock
, *flags
);
220 /*** Navigate from net_device to orinoco_private ***/
221 static inline struct orinoco_private
*ndev_priv(struct net_device
*dev
)
223 struct wireless_dev
*wdev
= netdev_priv(dev
);
224 return wdev_priv(wdev
);
226 #endif /* _ORINOCO_H */