root/drivers/net/wireless/intersil/orinoco/orinoco.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. orinoco_lock
  2. orinoco_unlock
  3. orinoco_lock_irq
  4. orinoco_unlock_irq
  5. ndev_priv

   1 /* orinoco.h
   2  *
   3  * Common definitions to all pieces of the various orinoco
   4  * drivers
   5  */
   6 
   7 #ifndef _ORINOCO_H
   8 #define _ORINOCO_H
   9 
  10 #define DRIVER_VERSION "0.15"
  11 
  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>
  18 
  19 #include "hermes.h"
  20 
  21 /* To enable debug messages */
  22 /*#define ORINOCO_DEBUG         3*/
  23 
  24 #define WIRELESS_SPY            /* enable iwspy support */
  25 
  26 #define MAX_SCAN_LEN            4096
  27 
  28 #define ORINOCO_SEQ_LEN         8
  29 #define ORINOCO_MAX_KEY_SIZE    14
  30 #define ORINOCO_MAX_KEYS        4
  31 
  32 struct orinoco_key {
  33         __le16 len;     /* always stored as little-endian */
  34         char data[ORINOCO_MAX_KEY_SIZE];
  35 } __packed;
  36 
  37 #define TKIP_KEYLEN     16
  38 #define MIC_KEYLEN      8
  39 
  40 struct orinoco_tkip_key {
  41         u8 tkip[TKIP_KEYLEN];
  42         u8 tx_mic[MIC_KEYLEN];
  43         u8 rx_mic[MIC_KEYLEN];
  44 };
  45 
  46 enum orinoco_alg {
  47         ORINOCO_ALG_NONE,
  48         ORINOCO_ALG_WEP,
  49         ORINOCO_ALG_TKIP
  50 };
  51 
  52 enum fwtype {
  53         FIRMWARE_TYPE_AGERE,
  54         FIRMWARE_TYPE_INTERSIL,
  55         FIRMWARE_TYPE_SYMBOL
  56 };
  57 
  58 struct firmware;
  59 
  60 struct orinoco_private {
  61         void *card;     /* Pointer to card dependent structure */
  62         struct device *dev;
  63         int (*hard_reset)(struct orinoco_private *);
  64         int (*stop_fw)(struct orinoco_private *, int);
  65 
  66         struct ieee80211_supported_band band;
  67         struct ieee80211_channel channels[14];
  68         u32 cipher_suites[3];
  69 
  70         /* Synchronisation stuff */
  71         spinlock_t lock;
  72         int hw_unavailable;
  73         struct work_struct reset_work;
  74 
  75         /* Interrupt tasklets */
  76         struct tasklet_struct rx_tasklet;
  77         struct list_head rx_list;
  78 
  79         /* driver state */
  80         int open;
  81         u16 last_linkstatus;
  82         struct work_struct join_work;
  83         struct work_struct wevent_work;
  84 
  85         /* Net device stuff */
  86         struct net_device *ndev;
  87         struct iw_statistics wstats;
  88 
  89         /* Hardware control variables */
  90         struct hermes hw;
  91         u16 txfid;
  92 
  93         /* Capabilities of the hardware/firmware */
  94         enum fwtype firmware_type;
  95         int ibss_port;
  96         int nicbuf_size;
  97         u16 channel_mask;
  98 
  99         /* Boolean capabilities */
 100         unsigned int has_ibss:1;
 101         unsigned int has_port3:1;
 102         unsigned int has_wep:1;
 103         unsigned int has_big_wep:1;
 104         unsigned int has_mwo:1;
 105         unsigned int has_pm:1;
 106         unsigned int has_preamble:1;
 107         unsigned int has_sensitivity:1;
 108         unsigned int has_hostscan:1;
 109         unsigned int has_alt_txcntl:1;
 110         unsigned int has_ext_scan:1;
 111         unsigned int has_wpa:1;
 112         unsigned int do_fw_download:1;
 113         unsigned int broken_disableport:1;
 114         unsigned int broken_monitor:1;
 115         unsigned int prefer_port3:1;
 116 
 117         /* Configuration paramaters */
 118         enum nl80211_iftype iw_mode;
 119         enum orinoco_alg encode_alg;
 120         u16 wep_restrict, tx_key;
 121         struct key_params keys[ORINOCO_MAX_KEYS];
 122 
 123         int bitratemode;
 124         char nick[IW_ESSID_MAX_SIZE + 1];
 125         char desired_essid[IW_ESSID_MAX_SIZE + 1];
 126         char desired_bssid[ETH_ALEN];
 127         int bssid_fixed;
 128         u16 frag_thresh, mwo_robust;
 129         u16 channel;
 130         u16 ap_density, rts_thresh;
 131         u16 pm_on, pm_mcast, pm_period, pm_timeout;
 132         u16 preamble;
 133         u16 short_retry_limit, long_retry_limit;
 134         u16 retry_lifetime;
 135 #ifdef WIRELESS_SPY
 136         struct iw_spy_data spy_data; /* iwspy support */
 137         struct iw_public_data   wireless_data;
 138 #endif
 139 
 140         /* Configuration dependent variables */
 141         int port_type, createibss;
 142         int promiscuous, mc_count;
 143 
 144         /* Scanning support */
 145         struct cfg80211_scan_request *scan_request;
 146         struct work_struct process_scan;
 147         struct list_head scan_list;
 148         spinlock_t scan_lock; /* protects the scan list */
 149 
 150         /* WPA support */
 151         u8 *wpa_ie;
 152         int wpa_ie_len;
 153 
 154         struct crypto_shash *rx_tfm_mic;
 155         struct crypto_shash *tx_tfm_mic;
 156 
 157         unsigned int wpa_enabled:1;
 158         unsigned int tkip_cm_active:1;
 159         unsigned int key_mgmt:3;
 160 
 161 #if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
 162         /* Cached in memory firmware to use during ->resume. */
 163         const struct firmware *cached_pri_fw;
 164         const struct firmware *cached_fw;
 165 #endif
 166 
 167         struct notifier_block pm_notifier;
 168 };
 169 
 170 #ifdef ORINOCO_DEBUG
 171 extern int orinoco_debug;
 172 #define DEBUG(n, args...) do { \
 173         if (orinoco_debug > (n)) \
 174                 printk(KERN_DEBUG args); \
 175 } while (0)
 176 #else
 177 #define DEBUG(n, args...) do { } while (0)
 178 #endif  /* ORINOCO_DEBUG */
 179 
 180 /********************************************************************/
 181 /* Exported prototypes                                              */
 182 /********************************************************************/
 183 
 184 struct orinoco_private *alloc_orinocodev(int sizeof_card, struct device *device,
 185                                          int (*hard_reset)(struct orinoco_private *),
 186                                          int (*stop_fw)(struct orinoco_private *, int));
 187 void free_orinocodev(struct orinoco_private *priv);
 188 int orinoco_init(struct orinoco_private *priv);
 189 int orinoco_if_add(struct orinoco_private *priv, unsigned long base_addr,
 190                    unsigned int irq, const struct net_device_ops *ops);
 191 void orinoco_if_del(struct orinoco_private *priv);
 192 int orinoco_up(struct orinoco_private *priv);
 193 void orinoco_down(struct orinoco_private *priv);
 194 irqreturn_t orinoco_interrupt(int irq, void *dev_id);
 195 
 196 void __orinoco_ev_info(struct net_device *dev, struct hermes *hw);
 197 void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw);
 198 
 199 int orinoco_process_xmit_skb(struct sk_buff *skb,
 200                              struct net_device *dev,
 201                              struct orinoco_private *priv,
 202                              int *tx_control,
 203                              u8 *mic);
 204 
 205 /* Common ndo functions exported for reuse by orinoco_usb */
 206 int orinoco_open(struct net_device *dev);
 207 int orinoco_stop(struct net_device *dev);
 208 void orinoco_set_multicast_list(struct net_device *dev);
 209 int orinoco_change_mtu(struct net_device *dev, int new_mtu);
 210 void orinoco_tx_timeout(struct net_device *dev);
 211 
 212 /********************************************************************/
 213 /* Locking and synchronization functions                            */
 214 /********************************************************************/
 215 
 216 static inline int orinoco_lock(struct orinoco_private *priv,
 217                                unsigned long *flags)
 218 {
 219         priv->hw.ops->lock_irqsave(&priv->lock, flags);
 220         if (priv->hw_unavailable) {
 221                 DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
 222                        priv->ndev);
 223                 priv->hw.ops->unlock_irqrestore(&priv->lock, flags);
 224                 return -EBUSY;
 225         }
 226         return 0;
 227 }
 228 
 229 static inline void orinoco_unlock(struct orinoco_private *priv,
 230                                   unsigned long *flags)
 231 {
 232         priv->hw.ops->unlock_irqrestore(&priv->lock, flags);
 233 }
 234 
 235 static inline void orinoco_lock_irq(struct orinoco_private *priv)
 236 {
 237         priv->hw.ops->lock_irq(&priv->lock);
 238 }
 239 
 240 static inline void orinoco_unlock_irq(struct orinoco_private *priv)
 241 {
 242         priv->hw.ops->unlock_irq(&priv->lock);
 243 }
 244 
 245 /*** Navigate from net_device to orinoco_private ***/
 246 static inline struct orinoco_private *ndev_priv(struct net_device *dev)
 247 {
 248         struct wireless_dev *wdev = netdev_priv(dev);
 249         return wdev_priv(wdev);
 250 }
 251 #endif /* _ORINOCO_H */

/* [<][>][^][v][top][bottom][index][help] */