0001
0002
0003
0004
0005
0006
0007 #ifndef _ORINOCO_H
0008 #define _ORINOCO_H
0009
0010 #define DRIVER_VERSION "0.15"
0011
0012 #include <linux/interrupt.h>
0013 #include <linux/suspend.h>
0014 #include <linux/netdevice.h>
0015 #include <linux/wireless.h>
0016 #include <net/iw_handler.h>
0017 #include <net/cfg80211.h>
0018
0019 #include "hermes.h"
0020
0021
0022
0023
0024 #define WIRELESS_SPY
0025
0026 #define MAX_SCAN_LEN 4096
0027
0028 #define ORINOCO_SEQ_LEN 8
0029 #define ORINOCO_MAX_KEY_SIZE 14
0030 #define ORINOCO_MAX_KEYS 4
0031
0032 struct orinoco_key {
0033 __le16 len;
0034 char data[ORINOCO_MAX_KEY_SIZE];
0035 } __packed;
0036
0037 #define TKIP_KEYLEN 16
0038 #define MIC_KEYLEN 8
0039
0040 struct orinoco_tkip_key {
0041 u8 tkip[TKIP_KEYLEN];
0042 u8 tx_mic[MIC_KEYLEN];
0043 u8 rx_mic[MIC_KEYLEN];
0044 };
0045
0046 enum orinoco_alg {
0047 ORINOCO_ALG_NONE,
0048 ORINOCO_ALG_WEP,
0049 ORINOCO_ALG_TKIP
0050 };
0051
0052 enum fwtype {
0053 FIRMWARE_TYPE_AGERE,
0054 FIRMWARE_TYPE_INTERSIL,
0055 FIRMWARE_TYPE_SYMBOL
0056 };
0057
0058 struct firmware;
0059
0060 struct orinoco_private {
0061 void *card;
0062 struct device *dev;
0063 int (*hard_reset)(struct orinoco_private *);
0064 int (*stop_fw)(struct orinoco_private *, int);
0065
0066 struct ieee80211_supported_band band;
0067 struct ieee80211_channel channels[14];
0068 u32 cipher_suites[3];
0069
0070
0071 spinlock_t lock;
0072 int hw_unavailable;
0073 struct work_struct reset_work;
0074
0075
0076 struct tasklet_struct rx_tasklet;
0077 struct list_head rx_list;
0078
0079
0080 int open;
0081 u16 last_linkstatus;
0082 struct work_struct join_work;
0083 struct work_struct wevent_work;
0084
0085
0086 struct net_device *ndev;
0087 struct iw_statistics wstats;
0088
0089
0090 struct hermes hw;
0091 u16 txfid;
0092
0093
0094 enum fwtype firmware_type;
0095 int ibss_port;
0096 int nicbuf_size;
0097 u16 channel_mask;
0098
0099
0100 unsigned int has_ibss:1;
0101 unsigned int has_port3:1;
0102 unsigned int has_wep:1;
0103 unsigned int has_big_wep:1;
0104 unsigned int has_mwo:1;
0105 unsigned int has_pm:1;
0106 unsigned int has_preamble:1;
0107 unsigned int has_sensitivity:1;
0108 unsigned int has_hostscan:1;
0109 unsigned int has_alt_txcntl:1;
0110 unsigned int has_ext_scan:1;
0111 unsigned int has_wpa:1;
0112 unsigned int do_fw_download:1;
0113 unsigned int broken_disableport:1;
0114 unsigned int broken_monitor:1;
0115 unsigned int prefer_port3:1;
0116
0117
0118 enum nl80211_iftype iw_mode;
0119 enum orinoco_alg encode_alg;
0120 u16 wep_restrict, tx_key;
0121 struct key_params keys[ORINOCO_MAX_KEYS];
0122
0123 int bitratemode;
0124 char nick[IW_ESSID_MAX_SIZE + 1];
0125 char desired_essid[IW_ESSID_MAX_SIZE + 1];
0126 char desired_bssid[ETH_ALEN];
0127 int bssid_fixed;
0128 u16 frag_thresh, mwo_robust;
0129 u16 channel;
0130 u16 ap_density, rts_thresh;
0131 u16 pm_on, pm_mcast, pm_period, pm_timeout;
0132 u16 preamble;
0133 u16 short_retry_limit, long_retry_limit;
0134 u16 retry_lifetime;
0135 #ifdef WIRELESS_SPY
0136 struct iw_spy_data spy_data;
0137 struct iw_public_data wireless_data;
0138 #endif
0139
0140
0141 int port_type, createibss;
0142 int promiscuous, mc_count;
0143
0144
0145 struct cfg80211_scan_request *scan_request;
0146 struct work_struct process_scan;
0147 struct list_head scan_list;
0148 spinlock_t scan_lock;
0149
0150
0151 u8 *wpa_ie;
0152 int wpa_ie_len;
0153
0154 struct crypto_shash *rx_tfm_mic;
0155 struct crypto_shash *tx_tfm_mic;
0156
0157 unsigned int wpa_enabled:1;
0158 unsigned int tkip_cm_active:1;
0159 unsigned int key_mgmt:3;
0160
0161 #if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
0162
0163 const struct firmware *cached_pri_fw;
0164 const struct firmware *cached_fw;
0165 #endif
0166
0167 struct notifier_block pm_notifier;
0168 };
0169
0170 #ifdef ORINOCO_DEBUG
0171 extern int orinoco_debug;
0172 #define DEBUG(n, args...) do { \
0173 if (orinoco_debug > (n)) \
0174 printk(KERN_DEBUG args); \
0175 } while (0)
0176 #else
0177 #define DEBUG(n, args...) do { } while (0)
0178 #endif
0179
0180
0181
0182
0183
0184 struct orinoco_private *alloc_orinocodev(int sizeof_card, struct device *device,
0185 int (*hard_reset)(struct orinoco_private *),
0186 int (*stop_fw)(struct orinoco_private *, int));
0187 void free_orinocodev(struct orinoco_private *priv);
0188 int orinoco_init(struct orinoco_private *priv);
0189 int orinoco_if_add(struct orinoco_private *priv, unsigned long base_addr,
0190 unsigned int irq, const struct net_device_ops *ops);
0191 void orinoco_if_del(struct orinoco_private *priv);
0192 int orinoco_up(struct orinoco_private *priv);
0193 void orinoco_down(struct orinoco_private *priv);
0194 irqreturn_t orinoco_interrupt(int irq, void *dev_id);
0195
0196 void __orinoco_ev_info(struct net_device *dev, struct hermes *hw);
0197 void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw);
0198
0199 int orinoco_process_xmit_skb(struct sk_buff *skb,
0200 struct net_device *dev,
0201 struct orinoco_private *priv,
0202 int *tx_control,
0203 u8 *mic);
0204
0205
0206 int orinoco_open(struct net_device *dev);
0207 int orinoco_stop(struct net_device *dev);
0208 void orinoco_set_multicast_list(struct net_device *dev);
0209 int orinoco_change_mtu(struct net_device *dev, int new_mtu);
0210 void orinoco_tx_timeout(struct net_device *dev, unsigned int txqueue);
0211
0212
0213
0214
0215
0216 static inline int orinoco_lock(struct orinoco_private *priv,
0217 unsigned long *flags)
0218 {
0219 priv->hw.ops->lock_irqsave(&priv->lock, flags);
0220 if (priv->hw_unavailable) {
0221 DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
0222 priv->ndev);
0223 priv->hw.ops->unlock_irqrestore(&priv->lock, flags);
0224 return -EBUSY;
0225 }
0226 return 0;
0227 }
0228
0229 static inline void orinoco_unlock(struct orinoco_private *priv,
0230 unsigned long *flags)
0231 {
0232 priv->hw.ops->unlock_irqrestore(&priv->lock, flags);
0233 }
0234
0235 static inline void orinoco_lock_irq(struct orinoco_private *priv)
0236 {
0237 priv->hw.ops->lock_irq(&priv->lock);
0238 }
0239
0240 static inline void orinoco_unlock_irq(struct orinoco_private *priv)
0241 {
0242 priv->hw.ops->unlock_irq(&priv->lock);
0243 }
0244
0245
0246 static inline struct orinoco_private *ndev_priv(struct net_device *dev)
0247 {
0248 struct wireless_dev *wdev = netdev_priv(dev);
0249 return wdev_priv(wdev);
0250 }
0251 #endif