3 * Common definitions to all pieces of the various orinoco
10 #define DRIVER_VERSION "0.15"
12 #include <linux/interrupt.h>
13 #include <linux/netdevice.h>
14 #include <linux/wireless.h>
15 #include <net/iw_handler.h>
19 /* To enable debug messages */
20 //#define ORINOCO_DEBUG 3
22 #define WIRELESS_SPY // enable iwspy support
24 #define MAX_SCAN_LEN 4096
26 #define ORINOCO_MAX_KEY_SIZE 14
27 #define ORINOCO_MAX_KEYS 4
30 __le16 len; /* always stored as little-endian */
31 char data[ORINOCO_MAX_KEY_SIZE];
32 } __attribute__ ((packed));
34 #define TKIP_KEYLEN 16
37 struct orinoco_tkip_key {
39 u8 tx_mic[MIC_KEYLEN];
40 u8 rx_mic[MIC_KEYLEN];
45 FIRMWARE_TYPE_INTERSIL,
50 union hermes_scan_info bss;
51 unsigned long last_scanned;
52 struct list_head list;
56 struct agere_ext_scan_info bss;
57 unsigned long last_scanned;
58 struct list_head list;
61 struct hermes_rx_descriptor;
63 struct orinoco_rx_data {
64 struct hermes_rx_descriptor *desc;
66 struct list_head list;
71 struct orinoco_private {
72 void *card; /* Pointer to card dependent structure */
74 int (*hard_reset)(struct orinoco_private *);
75 int (*stop_fw)(struct orinoco_private *, int);
77 /* Synchronisation stuff */
80 struct work_struct reset_work;
82 /* Interrupt tasklets */
83 struct tasklet_struct rx_tasklet;
84 struct list_head rx_list;
85 struct orinoco_rx_data *rx_data;
90 struct work_struct join_work;
91 struct work_struct wevent_work;
93 /* Net device stuff */
94 struct net_device *ndev;
95 struct net_device_stats stats;
96 struct iw_statistics wstats;
98 /* Hardware control variables */
102 /* Capabilities of the hardware/firmware */
103 fwtype_t firmware_type;
109 /* Boolean capabilities */
110 unsigned int has_ibss:1;
111 unsigned int has_port3:1;
112 unsigned int has_wep:1;
113 unsigned int has_big_wep:1;
114 unsigned int has_mwo:1;
115 unsigned int has_pm:1;
116 unsigned int has_preamble:1;
117 unsigned int has_sensitivity:1;
118 unsigned int has_hostscan:1;
119 unsigned int has_alt_txcntl:1;
120 unsigned int has_ext_scan:1;
121 unsigned int has_wpa:1;
122 unsigned int do_fw_download:1;
123 unsigned int broken_disableport:1;
124 unsigned int broken_monitor:1;
126 /* Configuration paramaters */
129 u16 encode_alg, wep_restrict, tx_key;
130 struct orinoco_key keys[ORINOCO_MAX_KEYS];
132 char nick[IW_ESSID_MAX_SIZE+1];
133 char desired_essid[IW_ESSID_MAX_SIZE+1];
134 char desired_bssid[ETH_ALEN];
136 u16 frag_thresh, mwo_robust;
138 u16 ap_density, rts_thresh;
139 u16 pm_on, pm_mcast, pm_period, pm_timeout;
142 struct iw_spy_data spy_data; /* iwspy support */
143 struct iw_public_data wireless_data;
146 /* Configuration dependent variables */
147 int port_type, createibss;
148 int promiscuous, mc_count;
150 /* Scanning support */
151 struct list_head bss_list;
152 struct list_head bss_free_list;
155 int scan_inprogress; /* Scan pending... */
156 u32 scan_mode; /* Type of scan done */
162 struct orinoco_tkip_key tkip_key[ORINOCO_MAX_KEYS];
163 struct crypto_hash *rx_tfm_mic;
164 struct crypto_hash *tx_tfm_mic;
166 unsigned int wpa_enabled:1;
167 unsigned int tkip_cm_active:1;
168 unsigned int key_mgmt:3;
170 /* Cached in memory firmware to use in ->resume */
171 const struct firmware *cached_fw;
175 extern int orinoco_debug;
176 #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
178 #define DEBUG(n, args...) do { } while (0)
179 #endif /* ORINOCO_DEBUG */
181 /********************************************************************/
182 /* Exported prototypes */
183 /********************************************************************/
185 extern struct net_device *alloc_orinocodev(
186 int sizeof_card, struct device *device,
187 int (*hard_reset)(struct orinoco_private *),
188 int (*stop_fw)(struct orinoco_private *, int));
189 extern void free_orinocodev(struct net_device *dev);
190 extern int __orinoco_up(struct net_device *dev);
191 extern int __orinoco_down(struct net_device *dev);
192 extern int orinoco_reinit_firmware(struct net_device *dev);
193 extern irqreturn_t orinoco_interrupt(int irq, void * dev_id);
195 /********************************************************************/
196 /* Locking and synchronization functions */
197 /********************************************************************/
199 static inline int orinoco_lock(struct orinoco_private *priv,
200 unsigned long *flags)
202 spin_lock_irqsave(&priv->lock, *flags);
203 if (priv->hw_unavailable) {
204 DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
206 spin_unlock_irqrestore(&priv->lock, *flags);
212 static inline void orinoco_unlock(struct orinoco_private *priv,
213 unsigned long *flags)
215 spin_unlock_irqrestore(&priv->lock, *flags);
218 #endif /* _ORINOCO_H */