File: /usr/src/linux/drivers/net/wireless/orinoco.h
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 /* To enable debug messages */
11 //#define ORINOCO_DEBUG 3
12
13 #if (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10)
14 #error "orinoco_cs requires Wireless extensions v10 or later."
15 #endif /* (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10) */
16 #define WIRELESS_SPY // enable iwspy support
17
18
19 #define DLDWD_MIN_MTU 256
20 #define DLDWD_MAX_MTU (HERMES_FRAME_LEN_MAX - ENCAPS_OVERHEAD)
21
22 #define LTV_BUF_SIZE 128
23 #define USER_BAP 0
24 #define IRQ_BAP 1
25 #define DLDWD_MACPORT 0
26 #define IRQ_LOOP_MAX 10
27 #define TX_NICBUF_SIZE 2048
28 #define TX_NICBUF_SIZE_BUG 1585 /* Bug in Intel firmware */
29 #define MAX_KEYS 4
30 #define MAX_KEY_SIZE 14
31 #define LARGE_KEY_SIZE 13
32 #define SMALL_KEY_SIZE 5
33 #define MAX_FRAME_SIZE 2304
34
35 typedef struct dldwd_key {
36 uint16_t len;
37 char data[MAX_KEY_SIZE];
38 } __attribute__ ((packed)) dldwd_key_t;
39
40 typedef dldwd_key_t dldwd_keys_t[MAX_KEYS];
41
42 /*====================================================================*/
43
44
45 typedef struct dldwd_priv {
46 void* card; /* Pointer to card dependant structure */
47 /* card dependant extra reset code (i.e. bus/interface specific */
48 int (*card_reset_handler)(struct dldwd_priv *);
49
50 spinlock_t lock;
51 long state;
52 #define DLDWD_STATE_INIRQ 0
53 #define DLDWD_STATE_DOIRQ 1
54 int hw_ready; /* HW may be suspended by platform */
55
56 /* Net device stuff */
57 struct net_device ndev;
58 struct net_device_stats stats;
59 struct iw_statistics wstats;
60
61
62 /* Hardware control variables */
63 hermes_t hw;
64 uint16_t txfid;
65
66 /* Capabilities of the hardware/firmware */
67 int firmware_type;
68 #define FIRMWARE_TYPE_LUCENT 1
69 #define FIRMWARE_TYPE_INTERSIL 2
70 #define FIRMWARE_TYPE_SYMBOL 3
71 int has_ibss, has_port3, prefer_port3, has_ibss_any, ibss_port;
72 int has_wep, has_big_wep;
73 int has_mwo;
74 int has_pm;
75 int has_preamble;
76 int need_card_reset, broken_reset, broken_allocate;
77 uint16_t channel_mask;
78
79 /* Current configuration */
80 uint32_t iw_mode;
81 int port_type, allow_ibss;
82 uint16_t wep_on, wep_restrict, tx_key;
83 dldwd_keys_t keys;
84 char nick[IW_ESSID_MAX_SIZE+1];
85 char desired_essid[IW_ESSID_MAX_SIZE+1];
86 uint16_t frag_thresh, mwo_robust;
87 uint16_t channel;
88 uint16_t ap_density, rts_thresh;
89 uint16_t tx_rate_ctrl;
90 uint16_t pm_on, pm_mcast, pm_period, pm_timeout;
91 uint16_t preamble;
92
93 int promiscuous, allmulti, mc_count;
94
95 #ifdef WIRELESS_SPY
96 int spy_number;
97 u_char spy_address[IW_MAX_SPY][ETH_ALEN];
98 struct iw_quality spy_stat[IW_MAX_SPY];
99 #endif
100
101 /* /proc based debugging stuff */
102 struct proc_dir_entry *dir_dev;
103 struct proc_dir_entry *dir_regs;
104 struct proc_dir_entry *dir_recs;
105 } dldwd_priv_t;
106
107 /*====================================================================*/
108
109 extern struct list_head dldwd_instances;
110
111 #ifdef ORINOCO_DEBUG
112 extern int dldwd_debug;
113 #define DEBUG(n, args...) if (dldwd_debug>(n)) printk(KERN_DEBUG args)
114 #define DEBUGMORE(n, args...) do { if (dldwd_debug>(n)) printk(args); } while (0)
115 #else
116 #define DEBUG(n, args...) do { } while (0)
117 #define DEBUGMORE(n, args...) do { } while (0)
118 #endif /* ORINOCO_DEBUG */
119
120 #define TRACE_ENTER(devname) DEBUG(2, "%s: -> " __FUNCTION__ "()\n", devname);
121 #define TRACE_EXIT(devname) DEBUG(2, "%s: <- " __FUNCTION__ "()\n", devname);
122
123 #define MAX(a, b) ( (a) > (b) ? (a) : (b) )
124 #define MIN(a, b) ( (a) < (b) ? (a) : (b) )
125
126 #define RUP_EVEN(a) ( (a) % 2 ? (a) + 1 : (a) )
127
128 /* struct net_device methods */
129 extern int dldwd_init(struct net_device *dev);
130 extern int dldwd_xmit(struct sk_buff *skb, struct net_device *dev);
131 extern void dldwd_tx_timeout(struct net_device *dev);
132
133 extern int dldwd_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
134 extern int dldwd_change_mtu(struct net_device *dev, int new_mtu);
135 extern void dldwd_set_multicast_list(struct net_device *dev);
136
137 /* utility routines */
138 extern void dldwd_shutdown(dldwd_priv_t *dev);
139 extern int dldwd_reset(dldwd_priv_t *dev);
140 extern int dldwd_setup(dldwd_priv_t* priv);
141 extern int dldwd_proc_dev_init(dldwd_priv_t *dev);
142 extern void dldwd_proc_dev_cleanup(dldwd_priv_t *priv);
143 extern void dldwd_interrupt(int irq, void * dev_id, struct pt_regs *regs);
144
145 #endif
146