2005-04-17 06:20:36 +08:00
|
|
|
/* orinoco.h
|
2009-01-26 04:08:43 +08:00
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* Common definitions to all pieces of the various orinoco
|
|
|
|
* drivers
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ORINOCO_H
|
|
|
|
#define _ORINOCO_H
|
|
|
|
|
2006-04-07 16:11:02 +08:00
|
|
|
#define DRIVER_VERSION "0.15"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-08-22 06:28:04 +08:00
|
|
|
#include <linux/interrupt.h>
|
2008-11-22 18:37:28 +08:00
|
|
|
#include <linux/suspend.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/wireless.h>
|
2005-09-10 06:43:02 +08:00
|
|
|
#include <net/iw_handler.h>
|
2009-06-19 06:21:26 +08:00
|
|
|
#include <net/cfg80211.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include "hermes.h"
|
|
|
|
|
|
|
|
/* To enable debug messages */
|
2009-01-26 04:08:43 +08:00
|
|
|
/*#define ORINOCO_DEBUG 3*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-01-26 04:08:43 +08:00
|
|
|
#define WIRELESS_SPY /* enable iwspy support */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-06-19 07:27:51 +08:00
|
|
|
#define MAX_SCAN_LEN 4096
|
|
|
|
|
2009-08-06 04:23:28 +08:00
|
|
|
#define ORINOCO_SEQ_LEN 8
|
2005-04-17 06:20:36 +08:00
|
|
|
#define ORINOCO_MAX_KEY_SIZE 14
|
|
|
|
#define ORINOCO_MAX_KEYS 4
|
|
|
|
|
|
|
|
struct orinoco_key {
|
2005-09-23 16:18:06 +08:00
|
|
|
__le16 len; /* always stored as little-endian */
|
2005-04-17 06:20:36 +08:00
|
|
|
char data[ORINOCO_MAX_KEY_SIZE];
|
2010-06-03 02:10:09 +08:00
|
|
|
} __packed;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-08-22 06:28:02 +08:00
|
|
|
#define TKIP_KEYLEN 16
|
|
|
|
#define MIC_KEYLEN 8
|
|
|
|
|
|
|
|
struct orinoco_tkip_key {
|
|
|
|
u8 tkip[TKIP_KEYLEN];
|
|
|
|
u8 tx_mic[MIC_KEYLEN];
|
|
|
|
u8 rx_mic[MIC_KEYLEN];
|
|
|
|
};
|
|
|
|
|
2009-08-06 04:23:28 +08:00
|
|
|
enum orinoco_alg {
|
|
|
|
ORINOCO_ALG_NONE,
|
|
|
|
ORINOCO_ALG_WEP,
|
|
|
|
ORINOCO_ALG_TKIP
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
typedef enum {
|
|
|
|
FIRMWARE_TYPE_AGERE,
|
|
|
|
FIRMWARE_TYPE_INTERSIL,
|
|
|
|
FIRMWARE_TYPE_SYMBOL
|
|
|
|
} fwtype_t;
|
|
|
|
|
2008-10-19 16:06:11 +08:00
|
|
|
struct firmware;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct orinoco_private {
|
|
|
|
void *card; /* Pointer to card dependent structure */
|
2008-08-22 06:27:54 +08:00
|
|
|
struct device *dev;
|
2005-04-17 06:20:36 +08:00
|
|
|
int (*hard_reset)(struct orinoco_private *);
|
2008-08-22 06:27:54 +08:00
|
|
|
int (*stop_fw)(struct orinoco_private *, int);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-06-19 06:21:26 +08:00
|
|
|
struct ieee80211_supported_band band;
|
|
|
|
struct ieee80211_channel channels[14];
|
|
|
|
u32 cipher_suites[3];
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Synchronisation stuff */
|
|
|
|
spinlock_t lock;
|
|
|
|
int hw_unavailable;
|
|
|
|
struct work_struct reset_work;
|
|
|
|
|
2008-08-22 06:28:04 +08:00
|
|
|
/* Interrupt tasklets */
|
|
|
|
struct tasklet_struct rx_tasklet;
|
|
|
|
struct list_head rx_list;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* driver state */
|
|
|
|
int open;
|
|
|
|
u16 last_linkstatus;
|
2005-06-19 07:27:51 +08:00
|
|
|
struct work_struct join_work;
|
2005-06-19 07:27:56 +08:00
|
|
|
struct work_struct wevent_work;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Net device stuff */
|
|
|
|
struct net_device *ndev;
|
|
|
|
struct net_device_stats stats;
|
|
|
|
struct iw_statistics wstats;
|
|
|
|
|
|
|
|
/* Hardware control variables */
|
|
|
|
hermes_t hw;
|
|
|
|
u16 txfid;
|
|
|
|
|
|
|
|
/* Capabilities of the hardware/firmware */
|
|
|
|
fwtype_t firmware_type;
|
|
|
|
int ibss_port;
|
|
|
|
int nicbuf_size;
|
|
|
|
u16 channel_mask;
|
|
|
|
|
|
|
|
/* Boolean capabilities */
|
|
|
|
unsigned int has_ibss:1;
|
|
|
|
unsigned int has_port3:1;
|
|
|
|
unsigned int has_wep:1;
|
|
|
|
unsigned int has_big_wep:1;
|
|
|
|
unsigned int has_mwo:1;
|
|
|
|
unsigned int has_pm:1;
|
|
|
|
unsigned int has_preamble:1;
|
|
|
|
unsigned int has_sensitivity:1;
|
2005-06-19 07:27:56 +08:00
|
|
|
unsigned int has_hostscan:1;
|
2008-08-22 06:27:56 +08:00
|
|
|
unsigned int has_alt_txcntl:1;
|
2008-08-22 06:27:58 +08:00
|
|
|
unsigned int has_ext_scan:1;
|
2008-08-22 06:28:02 +08:00
|
|
|
unsigned int has_wpa:1;
|
2008-08-22 06:27:54 +08:00
|
|
|
unsigned int do_fw_download:1;
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned int broken_disableport:1;
|
2005-06-19 07:28:06 +08:00
|
|
|
unsigned int broken_monitor:1;
|
2009-08-06 04:23:27 +08:00
|
|
|
unsigned int prefer_port3:1;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Configuration paramaters */
|
2009-06-19 06:21:32 +08:00
|
|
|
enum nl80211_iftype iw_mode;
|
2009-08-06 04:23:28 +08:00
|
|
|
enum orinoco_alg encode_alg;
|
|
|
|
u16 wep_restrict, tx_key;
|
2009-08-06 04:23:32 +08:00
|
|
|
struct key_params keys[ORINOCO_MAX_KEYS];
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
int bitratemode;
|
2009-01-26 04:08:43 +08:00
|
|
|
char nick[IW_ESSID_MAX_SIZE+1];
|
2005-04-17 06:20:36 +08:00
|
|
|
char desired_essid[IW_ESSID_MAX_SIZE+1];
|
2005-06-19 07:27:51 +08:00
|
|
|
char desired_bssid[ETH_ALEN];
|
|
|
|
int bssid_fixed;
|
2005-04-17 06:20:36 +08:00
|
|
|
u16 frag_thresh, mwo_robust;
|
|
|
|
u16 channel;
|
|
|
|
u16 ap_density, rts_thresh;
|
|
|
|
u16 pm_on, pm_mcast, pm_period, pm_timeout;
|
|
|
|
u16 preamble;
|
2010-04-19 15:16:21 +08:00
|
|
|
u16 short_retry_limit, long_retry_limit;
|
|
|
|
u16 retry_lifetime;
|
2005-04-17 06:20:36 +08:00
|
|
|
#ifdef WIRELESS_SPY
|
2009-01-26 04:08:43 +08:00
|
|
|
struct iw_spy_data spy_data; /* iwspy support */
|
2005-09-10 06:43:02 +08:00
|
|
|
struct iw_public_data wireless_data;
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Configuration dependent variables */
|
|
|
|
int port_type, createibss;
|
|
|
|
int promiscuous, mc_count;
|
2005-06-19 07:27:56 +08:00
|
|
|
|
|
|
|
/* Scanning support */
|
2009-06-19 06:21:33 +08:00
|
|
|
struct cfg80211_scan_request *scan_request;
|
|
|
|
struct work_struct process_scan;
|
|
|
|
struct list_head scan_list;
|
|
|
|
spinlock_t scan_lock; /* protects the scan list */
|
2008-08-22 06:28:02 +08:00
|
|
|
|
|
|
|
/* WPA support */
|
|
|
|
u8 *wpa_ie;
|
|
|
|
int wpa_ie_len;
|
|
|
|
|
2008-08-22 06:28:05 +08:00
|
|
|
struct crypto_hash *rx_tfm_mic;
|
|
|
|
struct crypto_hash *tx_tfm_mic;
|
2008-08-22 06:28:02 +08:00
|
|
|
|
|
|
|
unsigned int wpa_enabled:1;
|
|
|
|
unsigned int tkip_cm_active:1;
|
|
|
|
unsigned int key_mgmt:3;
|
2008-10-19 16:06:11 +08:00
|
|
|
|
2009-03-01 04:09:09 +08:00
|
|
|
#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
|
2008-11-22 18:37:26 +08:00
|
|
|
/* Cached in memory firmware to use during ->resume. */
|
|
|
|
const struct firmware *cached_pri_fw;
|
2008-10-19 16:06:11 +08:00
|
|
|
const struct firmware *cached_fw;
|
2009-03-01 04:09:09 +08:00
|
|
|
#endif
|
2008-11-22 18:37:28 +08:00
|
|
|
|
|
|
|
struct notifier_block pm_notifier;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef ORINOCO_DEBUG
|
|
|
|
extern int orinoco_debug;
|
2009-01-26 04:08:43 +08:00
|
|
|
#define DEBUG(n, args...) do { \
|
|
|
|
if (orinoco_debug > (n)) \
|
|
|
|
printk(KERN_DEBUG args); \
|
|
|
|
} while (0)
|
2005-04-17 06:20:36 +08:00
|
|
|
#else
|
|
|
|
#define DEBUG(n, args...) do { } while (0)
|
|
|
|
#endif /* ORINOCO_DEBUG */
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
/* Exported prototypes */
|
|
|
|
/********************************************************************/
|
|
|
|
|
2009-06-19 06:21:23 +08:00
|
|
|
extern struct orinoco_private *alloc_orinocodev(
|
2008-08-22 06:27:54 +08:00
|
|
|
int sizeof_card, struct device *device,
|
|
|
|
int (*hard_reset)(struct orinoco_private *),
|
|
|
|
int (*stop_fw)(struct orinoco_private *, int));
|
2009-06-19 06:21:23 +08:00
|
|
|
extern void free_orinocodev(struct orinoco_private *priv);
|
2009-06-19 06:21:24 +08:00
|
|
|
extern int orinoco_init(struct orinoco_private *priv);
|
2009-06-19 06:21:28 +08:00
|
|
|
extern int orinoco_if_add(struct orinoco_private *priv,
|
|
|
|
unsigned long base_addr,
|
2010-05-01 21:05:39 +08:00
|
|
|
unsigned int irq,
|
|
|
|
const struct net_device_ops *ops);
|
2009-06-19 06:21:28 +08:00
|
|
|
extern void orinoco_if_del(struct orinoco_private *priv);
|
2009-06-19 06:21:30 +08:00
|
|
|
extern int orinoco_up(struct orinoco_private *priv);
|
|
|
|
extern void orinoco_down(struct orinoco_private *priv);
|
2009-01-26 04:08:43 +08:00
|
|
|
extern irqreturn_t orinoco_interrupt(int irq, void *dev_id);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-05-01 21:05:41 +08:00
|
|
|
extern void __orinoco_ev_info(struct net_device *dev, hermes_t *hw);
|
|
|
|
extern void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw);
|
|
|
|
|
2010-05-05 05:54:41 +08:00
|
|
|
int orinoco_process_xmit_skb(struct sk_buff *skb,
|
|
|
|
struct net_device *dev,
|
|
|
|
struct orinoco_private *priv,
|
|
|
|
int *tx_control,
|
|
|
|
u8 *mic);
|
|
|
|
|
2010-05-01 21:05:39 +08:00
|
|
|
/* Common ndo functions exported for reuse by orinoco_usb */
|
|
|
|
int orinoco_open(struct net_device *dev);
|
|
|
|
int orinoco_stop(struct net_device *dev);
|
|
|
|
struct net_device_stats *orinoco_get_stats(struct net_device *dev);
|
|
|
|
void orinoco_set_multicast_list(struct net_device *dev);
|
|
|
|
int orinoco_change_mtu(struct net_device *dev, int new_mtu);
|
|
|
|
void orinoco_tx_timeout(struct net_device *dev);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/********************************************************************/
|
|
|
|
/* Locking and synchronization functions */
|
|
|
|
/********************************************************************/
|
|
|
|
|
2006-08-16 08:45:00 +08:00
|
|
|
static inline int orinoco_lock(struct orinoco_private *priv,
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned long *flags)
|
|
|
|
{
|
2010-05-01 21:05:40 +08:00
|
|
|
priv->hw.ops->lock_irqsave(&priv->lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (priv->hw_unavailable) {
|
|
|
|
DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
|
|
|
|
priv->ndev);
|
2010-05-01 21:05:40 +08:00
|
|
|
priv->hw.ops->unlock_irqrestore(&priv->lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-08-16 08:45:00 +08:00
|
|
|
static inline void orinoco_unlock(struct orinoco_private *priv,
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned long *flags)
|
|
|
|
{
|
2010-05-01 21:05:40 +08:00
|
|
|
priv->hw.ops->unlock_irqrestore(&priv->lock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void orinoco_lock_irq(struct orinoco_private *priv)
|
|
|
|
{
|
|
|
|
priv->hw.ops->lock_irq(&priv->lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void orinoco_unlock_irq(struct orinoco_private *priv)
|
|
|
|
{
|
|
|
|
priv->hw.ops->unlock_irq(&priv->lock);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2009-06-19 06:21:26 +08:00
|
|
|
/*** Navigate from net_device to orinoco_private ***/
|
|
|
|
static inline struct orinoco_private *ndev_priv(struct net_device *dev)
|
|
|
|
{
|
|
|
|
struct wireless_dev *wdev = netdev_priv(dev);
|
|
|
|
return wdev_priv(wdev);
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* _ORINOCO_H */
|