more coding style fixes
[acx-mac80211.git] / acx_struct.h
blob3302922044a28eb912f7e55300ac0c919896dbe1
1 /**** (legal) claimer in README
2 ** Copyright (C) 2003 ACX100 Open Source Project
3 */
5 /***********************************************************************
6 ** Forward declarations of types
7 */
8 typedef struct tx tx_t;
9 typedef struct acx_device acx_device_t;
10 typedef struct client client_t;
11 typedef struct rxdesc rxdesc_t;
12 typedef struct txdesc txdesc_t;
13 typedef struct rxhostdesc rxhostdesc_t;
14 typedef struct txhostdesc txhostdesc_t;
17 /***********************************************************************
18 ** Debug / log functionality
20 enum {
21 L_LOCK = (ACX_DEBUG>1)*0x0001, /* locking debug log */
22 L_INIT = (ACX_DEBUG>0)*0x0002, /* special card initialization logging */
23 L_IRQ = (ACX_DEBUG>0)*0x0004, /* interrupt stuff */
24 L_ASSOC = (ACX_DEBUG>0)*0x0008, /* assocation (network join) and station log */
25 L_FUNC = (ACX_DEBUG>1)*0x0020, /* logging of function enter / leave */
26 L_XFER = (ACX_DEBUG>1)*0x0080, /* logging of transfers and mgmt */
27 L_DATA = (ACX_DEBUG>1)*0x0100, /* logging of transfer data */
28 L_DEBUG = (ACX_DEBUG>1)*0x0200, /* log of debug info */
29 L_IOCTL = (ACX_DEBUG>0)*0x0400, /* log ioctl calls */
30 L_CTL = (ACX_DEBUG>1)*0x0800, /* log of low-level ctl commands */
31 L_BUFR = (ACX_DEBUG>1)*0x1000, /* debug rx buffer mgmt (ring buffer etc.) */
32 L_XFER_BEACON = (ACX_DEBUG>1)*0x2000, /* also log beacon packets */
33 L_BUFT = (ACX_DEBUG>1)*0x4000, /* debug tx buffer mgmt (ring buffer etc.) */
34 L_USBRXTX = (ACX_DEBUG>0)*0x8000, /* debug USB rx/tx operations */
35 L_BUF = L_BUFR + L_BUFT,
36 L_ANY = 0xffff
39 #if ACX_DEBUG
40 extern unsigned int acx_debug;
41 #else
42 enum { acx_debug = 0 };
43 #endif
46 /***********************************************************************
47 ** Random helpers
49 #define ACX_PACKED __attribute__ ((packed))
51 /***********************************************************************
52 ** Constants
54 #define OK 0
55 #define NOT_OK 1
57 /* The supported chip models */
58 #define CHIPTYPE_ACX100 1
59 #define CHIPTYPE_ACX111 2
61 #define IS_ACX100(adev) ((adev)->chip_type == CHIPTYPE_ACX100)
62 #define IS_ACX111(adev) ((adev)->chip_type == CHIPTYPE_ACX111)
64 /* Supported interfaces */
65 #define DEVTYPE_PCI 0
66 #define DEVTYPE_USB 1
68 #if !(defined(CONFIG_ACX_MAC80211_PCI) || defined(CONFIG_ACX_MAC80211_USB))
69 #error Driver must include PCI and/or USB support. You selected neither.
70 #endif
72 #if defined(CONFIG_ACX_MAC80211_PCI)
73 #if !defined(CONFIG_ACX_MAC80211_USB)
74 #define IS_PCI(adev) 1
75 #else
76 #define IS_PCI(adev) ((adev)->dev_type == DEVTYPE_PCI)
77 #endif
78 #else
79 #define IS_PCI(adev) 0
80 #endif
82 #if defined(CONFIG_ACX_MAC80211_USB)
83 #if !defined(CONFIG_ACX_MAC80211_PCI)
84 #define IS_USB(adev) 1
85 #else
86 #define IS_USB(adev) ((adev)->dev_type == DEVTYPE_USB)
87 #endif
88 #else
89 #define IS_USB(adev) 0
90 #endif
92 /* Driver defaults */
93 #define DEFAULT_DTIM_INTERVAL 10
94 /* used to be 2048, but FreeBSD driver changed it to 4096 to work properly
95 ** in noisy wlans */
96 #define DEFAULT_MSDU_LIFETIME 4096
97 #define DEFAULT_RTS_THRESHOLD 2312 /* max. size: disable RTS mechanism */
98 #define DEFAULT_BEACON_INTERVAL 100
100 #define ACX100_BAP_DATALEN_MAX 4096
101 #define ACX100_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */
102 #define ACX100_RIDDATA_MAXLEN ACX100_RID_GUESSING_MAXLEN
104 /* Support Constants */
105 /* Radio type names, found in Win98 driver's TIACXLN.INF */
106 #define RADIO_MAXIM_0D 0x0d
107 #define RADIO_RFMD_11 0x11
108 #define RADIO_RALINK_15 0x15
109 /* used in ACX111 cards (WG311v2, WL-121, ...): */
110 #define RADIO_RADIA_16 0x16
111 /* most likely *sometimes* used in ACX111 cards: */
112 #define RADIO_UNKNOWN_17 0x17
113 /* FwRad19.bin was found in a Safecom driver; must be an ACX111 radio: */
114 #define RADIO_UNKNOWN_19 0x19
115 #define RADIO_UNKNOWN_1B 0x1b /* radio in SafeCom SWLUT-54125 USB adapter; entirely unknown!! */
117 /* Controller Commands */
118 /* can be found in table cmdTable in firmware "Rev. 1.5.0" (FW150) */
119 #define ACX1xx_CMD_RESET 0x00
120 #define ACX1xx_CMD_INTERROGATE 0x01
121 #define ACX1xx_CMD_CONFIGURE 0x02
122 #define ACX1xx_CMD_ENABLE_RX 0x03
123 #define ACX1xx_CMD_ENABLE_TX 0x04
124 #define ACX1xx_CMD_DISABLE_RX 0x05
125 #define ACX1xx_CMD_DISABLE_TX 0x06
126 #define ACX1xx_CMD_FLUSH_QUEUE 0x07
127 #define ACX1xx_CMD_SCAN 0x08
128 #define ACX1xx_CMD_STOP_SCAN 0x09
129 #define ACX1xx_CMD_CONFIG_TIM 0x0a
130 #define ACX1xx_CMD_JOIN 0x0b
131 #define ACX1xx_CMD_WEP_MGMT 0x0c
132 #ifdef OLD_FIRMWARE_VERSIONS
133 #define ACX100_CMD_HALT 0x0e /* mapped to unknownCMD in FW150 */
134 #else
135 #define ACX1xx_CMD_MEM_READ 0x0d
136 #define ACX1xx_CMD_MEM_WRITE 0x0e
137 #endif
138 #define ACX1xx_CMD_SLEEP 0x0f
139 #define ACX1xx_CMD_WAKE 0x10
140 #define ACX1xx_CMD_UNKNOWN_11 0x11 /* mapped to unknownCMD in FW150 */
141 #define ACX100_CMD_INIT_MEMORY 0x12
142 #define ACX1FF_CMD_DISABLE_RADIO 0x12 /* new firmware? TNETW1450? */
143 #define ACX1xx_CMD_CONFIG_BEACON 0x13
144 #define ACX1xx_CMD_CONFIG_PROBE_RESPONSE 0x14
145 #define ACX1xx_CMD_CONFIG_NULL_DATA 0x15
146 #define ACX1xx_CMD_CONFIG_PROBE_REQUEST 0x16
147 #define ACX1xx_CMD_FCC_TEST 0x17
148 #define ACX1xx_CMD_RADIOINIT 0x18
149 #define ACX111_CMD_RADIOCALIB 0x19
150 #define ACX1FF_CMD_NOISE_HISTOGRAM 0x1c /* new firmware? TNETW1450? */
151 #define ACX1FF_CMD_RX_RESET 0x1d /* new firmware? TNETW1450? */
152 #define ACX1FF_CMD_LNA_CONTROL 0x20 /* new firmware? TNETW1450? */
153 #define ACX1FF_CMD_CONTROL_DBG_TRACE 0x21 /* new firmware? TNETW1450? */
155 /* 'After Interrupt' Commands */
156 #define ACX_AFTER_IRQ_CMD_STOP_SCAN 0x01
157 #define ACX_AFTER_IRQ_CMD_ASSOCIATE 0x02
158 #define ACX_AFTER_IRQ_CMD_RADIO_RECALIB 0x04
159 #define ACX_AFTER_IRQ_UPDATE_CARD_CFG 0x08
160 #define ACX_AFTER_IRQ_TX_CLEANUP 0x10
161 #define ACX_AFTER_IRQ_COMPLETE_SCAN 0x20
162 #define ACX_AFTER_IRQ_RESTART_SCAN 0x40
164 /***********************************************************************
165 ** Tx/Rx buffer sizes and watermarks
167 ** This will alloc and use DMAable buffers of
168 ** WLAN_A4FR_MAXLEN_WEP_FCS * (RX_CNT + TX_CNT) bytes
169 ** RX/TX_CNT=32 -> ~150k DMA buffers
170 ** RX/TX_CNT=16 -> ~75k DMA buffers
172 ** 2005-10-10: reduced memory usage by lowering both to 16
174 #define RX_CNT 16
175 #define TX_CNT 16
177 /* we clean up txdescs when we have N free txdesc: */
178 #define TX_CLEAN_BACKLOG (TX_CNT/4)
179 #define TX_START_CLEAN (TX_CNT - TX_CLEAN_BACKLOG)
180 #define TX_EMERG_CLEAN 2
181 /* we stop queue if we have < N free txbufs: */
182 #define TX_STOP_QUEUE 3
183 /* we start queue if we have >= N free txbufs: */
184 #define TX_START_QUEUE 5
186 /***********************************************************************
187 ** Interrogate/Configure cmd constants
189 ** NB: length includes JUST the data part of the IE
190 ** (does not include size of the (type,len) pair)
192 ** TODO: seems that acx100, acx100usb, acx111 have some differences,
193 ** fix code with regard to this!
196 #define DEF_IE(name, val, len) enum { ACX##name=val, ACX##name##_LEN=len }
198 /* Information Elements: Network Parameters, Static Configuration Entities */
199 /* these are handled by real_cfgtable in firmware "Rev 1.5.0" (FW150) */
200 DEF_IE(1xx_IE_UNKNOWN_00 ,0x0000, -1); /* mapped to cfgInvalid in FW150 */
201 DEF_IE(100_IE_ACX_TIMER ,0x0001, 0x10);
202 DEF_IE(1xx_IE_POWER_MGMT ,0x0002, 0x06); /* TNETW1450: length 0x18!! */
203 DEF_IE(1xx_IE_QUEUE_CONFIG ,0x0003, 0x1c);
204 DEF_IE(100_IE_BLOCK_SIZE ,0x0004, 0x02);
205 DEF_IE(1FF_IE_SLOT_TIME ,0x0004, 0x08); /* later firmware versions only? */
206 DEF_IE(1xx_IE_MEMORY_CONFIG_OPTIONS ,0x0005, 0x14);
207 DEF_IE(1FF_IE_QUEUE_HEAD ,0x0005, 0x14 /* FIXME: length? */);
208 DEF_IE(1xx_IE_RATE_FALLBACK ,0x0006, 0x01); /* TNETW1450: length 2 */
209 DEF_IE(100_IE_WEP_OPTIONS ,0x0007, 0x03);
210 DEF_IE(111_IE_RADIO_BAND ,0x0007, -1);
211 DEF_IE(1FF_IE_TIMING_CFG ,0x0007, -1); /* later firmware versions; TNETW1450 only? */
212 DEF_IE(100_IE_SSID ,0x0008, 0x20); /* huh? */
213 DEF_IE(1xx_IE_MEMORY_MAP ,0x0008, 0x28); /* huh? TNETW1450 has length 0x40!! */
214 DEF_IE(1xx_IE_SCAN_STATUS ,0x0009, 0x04); /* mapped to cfgInvalid in FW150 */
215 DEF_IE(1xx_IE_ASSOC_ID ,0x000a, 0x02);
216 DEF_IE(1xx_IE_UNKNOWN_0B ,0x000b, -1); /* mapped to cfgInvalid in FW150 */
217 DEF_IE(1FF_IE_TX_POWER_LEVEL_TABLE ,0x000b, 0x18); /* later firmware versions; TNETW1450 only? */
218 DEF_IE(100_IE_UNKNOWN_0C ,0x000c, -1); /* very small implementation in FW150! */
219 /* ACX100 has an equivalent struct in the cmd mailbox directly after reset.
220 * 0x14c seems extremely large, will trash stack on failure (memset!)
221 * in case of small input struct --> OOPS! */
222 DEF_IE(111_IE_CONFIG_OPTIONS ,0x000c, 0x14c);
223 DEF_IE(1xx_IE_FWREV ,0x000d, 0x18);
224 DEF_IE(1xx_IE_FCS_ERROR_COUNT ,0x000e, 0x04);
225 DEF_IE(1xx_IE_MEDIUM_USAGE ,0x000f, 0x08);
226 DEF_IE(1xx_IE_RXCONFIG ,0x0010, 0x04);
227 DEF_IE(100_IE_UNKNOWN_11 ,0x0011, -1); /* NONBINARY: large implementation in FW150! link quality readings or so? */
228 DEF_IE(111_IE_QUEUE_THRESH ,0x0011, -1);
229 DEF_IE(100_IE_UNKNOWN_12 ,0x0012, -1); /* NONBINARY: VERY large implementation in FW150!! */
230 DEF_IE(111_IE_BSS_POWER_SAVE ,0x0012, /* -1 */ 2);
231 DEF_IE(1xx_IE_FIRMWARE_STATISTICS ,0x0013, 0x9c); /* TNETW1450: length 0x134!! */
232 DEF_IE(1FF_IE_RX_INTR_CONFIG ,0x0014, 0x14); /* later firmware versions, TNETW1450 only? */
233 DEF_IE(1xx_IE_FEATURE_CONFIG ,0x0015, 0x08);
234 DEF_IE(111_IE_KEY_CHOOSE ,0x0016, 0x04); /* for rekeying. really len=4?? */
235 DEF_IE(1FF_IE_MISC_CONFIG_TABLE ,0x0017, 0x04); /* later firmware versions, TNETW1450 only? */
236 DEF_IE(1FF_IE_WONE_CONFIG ,0x0018, -1); /* later firmware versions, TNETW1450 only? */
237 DEF_IE(1FF_IE_TID_CONFIG ,0x001a, 0x2c); /* later firmware versions, TNETW1450 only? */
238 DEF_IE(1FF_IE_CALIB_ASSESSMENT ,0x001e, 0x04); /* later firmware versions, TNETW1450 only? */
239 DEF_IE(1FF_IE_BEACON_FILTER_OPTIONS ,0x001f, 0x02); /* later firmware versions, TNETW1450 only? */
240 DEF_IE(1FF_IE_LOW_RSSI_THRESH_OPT ,0x0020, 0x04); /* later firmware versions, TNETW1450 only? */
241 DEF_IE(1FF_IE_NOISE_HISTOGRAM_RESULTS ,0x0021, 0x30); /* later firmware versions, TNETW1450 only? */
242 DEF_IE(1FF_IE_PACKET_DETECT_THRESH ,0x0023, 0x04); /* later firmware versions, TNETW1450 only? */
243 DEF_IE(1FF_IE_TX_CONFIG_OPTIONS ,0x0024, 0x04); /* later firmware versions, TNETW1450 only? */
244 DEF_IE(1FF_IE_CCA_THRESHOLD ,0x0025, 0x02); /* later firmware versions, TNETW1450 only? */
245 DEF_IE(1FF_IE_EVENT_MASK ,0x0026, 0x08); /* later firmware versions, TNETW1450 only? */
246 DEF_IE(1FF_IE_DTIM_PERIOD ,0x0027, 0x02); /* later firmware versions, TNETW1450 only? */
247 DEF_IE(1FF_IE_ACI_CONFIG_SET ,0x0029, 0x06); /* later firmware versions; maybe TNETW1450 only? */
248 DEF_IE(1FF_IE_EEPROM_VER ,0x0030, 0x04); /* later firmware versions; maybe TNETW1450 only? */
249 DEF_IE(1xx_IE_DOT11_STATION_ID ,0x1001, 0x06);
250 DEF_IE(100_IE_DOT11_UNKNOWN_1002 ,0x1002, -1); /* mapped to cfgInvalid in FW150 */
251 DEF_IE(111_IE_DOT11_FRAG_THRESH ,0x1002, -1); /* mapped to cfgInvalid in FW150; TNETW1450 has length 2!! */
252 DEF_IE(100_IE_DOT11_BEACON_PERIOD ,0x1003, 0x02); /* mapped to cfgInvalid in FW150 */
253 DEF_IE(1xx_IE_DOT11_DTIM_PERIOD ,0x1004, -1); /* mapped to cfgInvalid in FW150 */
254 DEF_IE(1FF_IE_DOT11_MAX_RX_LIFETIME ,0x1004, -1); /* later firmware versions; maybe TNETW1450 only? */
255 DEF_IE(1xx_IE_DOT11_SHORT_RETRY_LIMIT ,0x1005, 0x01); /* TNETW1450: length 2 */
256 DEF_IE(1xx_IE_DOT11_LONG_RETRY_LIMIT ,0x1006, 0x01); /* TNETW1450: length 2 */
257 DEF_IE(100_IE_DOT11_WEP_DEFAULT_KEY_WRITE ,0x1007, 0x20); /* configure default keys; TNETW1450 has length 0x24!! */
258 DEF_IE(1xx_IE_DOT11_MAX_XMIT_MSDU_LIFETIME ,0x1008, 0x04);
259 DEF_IE(1xx_IE_DOT11_GROUP_ADDR ,0x1009, -1);
260 DEF_IE(1xx_IE_DOT11_CURRENT_REG_DOMAIN ,0x100a, 0x02);
261 /* It's harmless to have larger struct. Use USB case always. */
262 DEF_IE(1xx_IE_DOT11_CURRENT_ANTENNA ,0x100b, 0x02); /* in fact len=1 for PCI */
263 DEF_IE(1xx_IE_DOT11_UNKNOWN_100C ,0x100c, -1); /* mapped to cfgInvalid in FW150 */
264 DEF_IE(1xx_IE_DOT11_TX_POWER_LEVEL ,0x100d, 0x01); /* TNETW1450 has length 2!! */
265 DEF_IE(1xx_IE_DOT11_CURRENT_CCA_MODE ,0x100e, 0x02); /* in fact len=1 for PCI */
266 /* USB doesn't return anything - len==0?! */
267 DEF_IE(100_IE_DOT11_ED_THRESHOLD ,0x100f, 0x04);
268 DEF_IE(1xx_IE_DOT11_WEP_DEFAULT_KEY_SET ,0x1010, 0x01); /* set default key ID; TNETW1450: length 2 */
269 DEF_IE(100_IE_DOT11_UNKNOWN_1011 ,0x1011, -1); /* mapped to cfgInvalid in FW150 */
270 DEF_IE(1FF_IE_DOT11_CURR_5GHZ_REGDOM ,0x1011, -1); /* later firmware versions; maybe TNETW1450 only? */
271 DEF_IE(100_IE_DOT11_UNKNOWN_1012 ,0x1012, -1); /* mapped to cfgInvalid in FW150 */
272 DEF_IE(100_IE_DOT11_UNKNOWN_1013 ,0x1013, -1); /* mapped to cfgInvalid in FW150 */
274 #if 0
275 /* Experimentally obtained on acx100, fw 1.9.8.b
276 ** -1 means that fw returned 'invalid IE'
277 ** 0200 FC00 nnnn... are test read contents: u16 type, u16 len, data
278 ** (AA are poison bytes marking bytes not written by fw)
280 ** Looks like acx100 fw does not update len field (thus len=256-4=FC here)
281 ** A number of IEs seem to trash type,len fields
282 ** IEs marked 'huge' return gobs of data (no poison bytes remain)
284 DEF_IE(100_IE_INVAL_00, 0x0000, -1);
285 DEF_IE(100_IE_INVAL_01, 0x0001, -1); /* IE_ACX_TIMER, len=16 on older fw */
286 DEF_IE(100_IE_POWER_MGMT, 0x0002, 4); /* 0200FC00 00040000 AAAAAAAA */
287 DEF_IE(100_IE_QUEUE_CONFIG, 0x0003, 28); /* 0300FC00 48060000 9CAD0000 0101AAAA DCB00000 E4B00000 9CAA0000 00AAAAAA */
288 DEF_IE(100_IE_BLOCK_SIZE, 0x0004, 2); /* 0400FC00 0001AAAA AAAAAAAA AAAAAAAA */
289 /* write only: */
290 DEF_IE(100_IE_MEMORY_CONFIG_OPTIONS, 0x0005, 20);
291 DEF_IE(100_IE_RATE_FALLBACK, 0x0006, 1); /* 0600FC00 00AAAAAA AAAAAAAA AAAAAAAA */
292 /* write only: */
293 DEF_IE(100_IE_WEP_OPTIONS, 0x0007, 3);
294 DEF_IE(100_IE_MEMORY_MAP, 0x0008, 40); /* huge: 0800FC00 30000000 6CA20000 70A20000... */
295 /* gives INVAL on read: */
296 DEF_IE(100_IE_SCAN_STATUS, 0x0009, -1);
297 DEF_IE(100_IE_ASSOC_ID, 0x000a, 2); /* huge: 0A00FC00 00000000 01040800 00000000... */
298 DEF_IE(100_IE_INVAL_0B, 0x000b, -1);
299 /* 'command rejected': */
300 DEF_IE(100_IE_CONFIG_OPTIONS, 0x000c, -3);
301 DEF_IE(100_IE_FWREV, 0x000d, 24); /* 0D00FC00 52657620 312E392E 382E6200 AAAAAAAA AAAAAAAA 05050201 AAAAAAAA */
302 DEF_IE(100_IE_FCS_ERROR_COUNT, 0x000e, 4);
303 DEF_IE(100_IE_MEDIUM_USAGE, 0x000f, 8); /* E41F0000 2D780300 FCC91300 AAAAAAAA */
304 DEF_IE(100_IE_RXCONFIG, 0x0010, 4); /* 1000FC00 00280000 AAAAAAAA AAAAAAAA */
305 DEF_IE(100_IE_QUEUE_THRESH, 0x0011, 12); /* 1100FC00 AAAAAAAA 00000000 00000000 */
306 DEF_IE(100_IE_BSS_POWER_SAVE, 0x0012, 1); /* 1200FC00 00AAAAAA AAAAAAAA AAAAAAAA */
307 /* read only, variable len */
308 DEF_IE(100_IE_FIRMWARE_STATISTICS, 0x0013, 256); /* 0000AC00 00000000 ... */
309 DEF_IE(100_IE_INT_CONFIG, 0x0014, 20); /* 00000000 00000000 00000000 00000000 5D74D105 00000000 AAAAAAAA AAAAAAAA */
310 DEF_IE(100_IE_FEATURE_CONFIG, 0x0015, 8); /* 1500FC00 16000000 AAAAAAAA AAAAAAAA */
311 /* returns 'invalid MAC': */
312 DEF_IE(100_IE_KEY_CHOOSE, 0x0016, -4);
313 DEF_IE(100_IE_INVAL_17, 0x0017, -1);
314 DEF_IE(100_IE_UNKNOWN_18, 0x0018, 0); /* null len?! 1800FC00 AAAAAAAA AAAAAAAA AAAAAAAA */
315 DEF_IE(100_IE_UNKNOWN_19, 0x0019, 256); /* huge: 1900FC00 9C1F00EA FEFFFFEA FEFFFFEA... */
316 DEF_IE(100_IE_INVAL_1A, 0x001A, -1);
318 DEF_IE(100_IE_DOT11_INVAL_1000, 0x1000, -1);
319 DEF_IE(100_IE_DOT11_STATION_ID, 0x1001, 6); /* huge: 0110FC00 58B10E2F 03000000 00000000... */
320 DEF_IE(100_IE_DOT11_INVAL_1002, 0x1002, -1);
321 DEF_IE(100_IE_DOT11_INVAL_1003, 0x1003, -1);
322 DEF_IE(100_IE_DOT11_INVAL_1004, 0x1004, -1);
323 DEF_IE(100_IE_DOT11_SHORT_RETRY_LIMIT, 0x1005, 1);
324 DEF_IE(100_IE_DOT11_LONG_RETRY_LIMIT, 0x1006, 1);
325 /* write only: */
326 DEF_IE(100_IE_DOT11_WEP_DEFAULT_KEY_WRITE, 0x1007, 32);
327 DEF_IE(100_IE_DOT11_MAX_XMIT_MSDU_LIFETIME, 0x1008, 4); /* huge: 0810FC00 00020000 F4010000 00000000... */
328 /* undoc but returns something */
329 DEF_IE(100_IE_DOT11_GROUP_ADDR, 0x1009, 12); /* huge: 0910FC00 00000000 00000000 00000000... */
330 DEF_IE(100_IE_DOT11_CURRENT_REG_DOMAIN, 0x100a, 1); /* 0A10FC00 30AAAAAA AAAAAAAA AAAAAAAA */
331 DEF_IE(100_IE_DOT11_CURRENT_ANTENNA, 0x100b, 1); /* 0B10FC00 8FAAAAAA AAAAAAAA AAAAAAAA */
332 DEF_IE(100_IE_DOT11_INVAL_100C, 0x100c, -1);
333 DEF_IE(100_IE_DOT11_TX_POWER_LEVEL, 0x100d, 2); /* 00000000 0100AAAA AAAAAAAA AAAAAAAA */
334 DEF_IE(100_IE_DOT11_CURRENT_CCA_MODE, 0x100e, 1); /* 0E10FC00 0DAAAAAA AAAAAAAA AAAAAAAA */
335 DEF_IE(100_IE_DOT11_ED_THRESHOLD, 0x100f, 4); /* 0F10FC00 70000000 AAAAAAAA AAAAAAAA */
336 /* set default key ID */
337 DEF_IE(100_IE_DOT11_WEP_DEFAULT_KEY_SET, 0x1010, 1); /* 1010FC00 00AAAAAA AAAAAAAA AAAAAAAA */
338 DEF_IE(100_IE_DOT11_INVAL_1011, 0x1011, -1);
339 DEF_IE(100_IE_DOT11_INVAL_1012, 0x1012, -1);
340 DEF_IE(100_IE_DOT11_INVAL_1013, 0x1013, -1);
341 DEF_IE(100_IE_DOT11_UNKNOWN_1014, 0x1014, 256); /* huge */
342 DEF_IE(100_IE_DOT11_UNKNOWN_1015, 0x1015, 256); /* huge */
343 DEF_IE(100_IE_DOT11_UNKNOWN_1016, 0x1016, 256); /* huge */
344 DEF_IE(100_IE_DOT11_UNKNOWN_1017, 0x1017, 256); /* huge */
345 DEF_IE(100_IE_DOT11_UNKNOWN_1018, 0x1018, 256); /* huge */
346 DEF_IE(100_IE_DOT11_UNKNOWN_1019, 0x1019, 256); /* huge */
347 #endif
349 #if 0
350 /* Experimentally obtained on PCI acx111 Xterasys XN-2522g, fw 1.2.1.34
351 ** -1 means that fw returned 'invalid IE'
352 ** 0400 0800 nnnn... are test read contents: u16 type, u16 len, data
353 ** (AA are poison bytes marking bytes not written by fw)
355 ** Looks like acx111 fw reports real len!
357 DEF_IE(111_IE_INVAL_00, 0x0000, -1);
358 DEF_IE(111_IE_INVAL_01, 0x0001, -1);
359 DEF_IE(111_IE_POWER_MGMT, 0x0002, 12);
360 /* write only, variable len: 12 + rxqueue_cnt*8 + txqueue_cnt*4: */
361 DEF_IE(111_IE_MEMORY_CONFIG, 0x0003, 24);
362 DEF_IE(111_IE_BLOCK_SIZE, 0x0004, 8); /* 04000800 AA00AAAA AAAAAAAA */
363 /* variable len: 8 + rxqueue_cnt*8 + txqueue_cnt*8: */
364 DEF_IE(111_IE_QUEUE_HEAD, 0x0005, 24);
365 DEF_IE(111_IE_RATE_FALLBACK, 0x0006, 1);
366 /* acx100 name:WEP_OPTIONS */
367 /* said to have len:1 (not true, actually returns 12 bytes): */
368 DEF_IE(111_IE_RADIO_BAND, 0x0007, 12); /* 07000C00 AAAA1F00 FF03AAAA AAAAAAAA */
369 DEF_IE(111_IE_MEMORY_MAP, 0x0008, 48);
370 /* said to have len:4, but gives INVAL on read: */
371 DEF_IE(111_IE_SCAN_STATUS, 0x0009, -1);
372 DEF_IE(111_IE_ASSOC_ID, 0x000a, 2);
373 /* write only, len is not known: */
374 DEF_IE(111_IE_UNKNOWN_0B, 0x000b, 0);
375 /* read only, variable len. I see 67 byte reads: */
376 DEF_IE(111_IE_CONFIG_OPTIONS, 0x000c, 67); /* 0C004300 01160500 ... */
377 DEF_IE(111_IE_FWREV, 0x000d, 24);
378 DEF_IE(111_IE_FCS_ERROR_COUNT, 0x000e, 4);
379 DEF_IE(111_IE_MEDIUM_USAGE, 0x000f, 8);
380 DEF_IE(111_IE_RXCONFIG, 0x0010, 4);
381 DEF_IE(111_IE_QUEUE_THRESH, 0x0011, 12);
382 DEF_IE(111_IE_BSS_POWER_SAVE, 0x0012, 1);
383 /* read only, variable len. I see 240 byte reads: */
384 DEF_IE(111_IE_FIRMWARE_STATISTICS, 0x0013, 240); /* 1300F000 00000000 ... */
385 /* said to have len=17. looks like fw pads it to 20: */
386 DEF_IE(111_IE_INT_CONFIG, 0x0014, 20); /* 14001400 00000000 00000000 00000000 00000000 00000000 */
387 DEF_IE(111_IE_FEATURE_CONFIG, 0x0015, 8);
388 /* said to be name:KEY_INDICATOR, len:4, but gives INVAL on read: */
389 DEF_IE(111_IE_KEY_CHOOSE, 0x0016, -1);
390 /* said to have len:4, but in fact returns 8: */
391 DEF_IE(111_IE_MAX_USB_XFR, 0x0017, 8); /* 17000800 00014000 00000000 */
392 DEF_IE(111_IE_INVAL_18, 0x0018, -1);
393 DEF_IE(111_IE_INVAL_19, 0x0019, -1);
394 /* undoc but returns something: */
395 /* huh, fw indicates len=20 but uses 4 more bytes in buffer??? */
396 DEF_IE(111_IE_UNKNOWN_1A, 0x001A, 20); /* 1A001400 AA00AAAA 0000020F FF030000 00020000 00000007 04000000 */
398 DEF_IE(111_IE_DOT11_INVAL_1000, 0x1000, -1);
399 DEF_IE(111_IE_DOT11_STATION_ID, 0x1001, 6);
400 DEF_IE(111_IE_DOT11_FRAG_THRESH, 0x1002, 2);
401 /* acx100 only? gives INVAL on read: */
402 DEF_IE(111_IE_DOT11_BEACON_PERIOD, 0x1003, -1);
403 /* said to be MAX_RECV_MSDU_LIFETIME: */
404 DEF_IE(111_IE_DOT11_DTIM_PERIOD, 0x1004, 4);
405 DEF_IE(111_IE_DOT11_SHORT_RETRY_LIMIT, 0x1005, 1);
406 DEF_IE(111_IE_DOT11_LONG_RETRY_LIMIT, 0x1006, 1);
407 /* acx100 only? gives INVAL on read: */
408 DEF_IE(111_IE_DOT11_WEP_DEFAULT_KEY_WRITE, 0x1007, -1);
409 DEF_IE(111_IE_DOT11_MAX_XMIT_MSDU_LIFETIME, 0x1008, 4);
410 /* undoc but returns something. maybe it's 2 multicast MACs to listen to? */
411 DEF_IE(111_IE_DOT11_GROUP_ADDR, 0x1009, 12); /* 09100C00 00000000 00000000 00000000 */
412 DEF_IE(111_IE_DOT11_CURRENT_REG_DOMAIN, 0x100a, 1);
413 DEF_IE(111_IE_DOT11_CURRENT_ANTENNA, 0x100b, 2);
414 DEF_IE(111_IE_DOT11_INVAL_100C, 0x100c, -1);
415 DEF_IE(111_IE_DOT11_TX_POWER_LEVEL, 0x100d, 1);
416 /* said to have len=1 but gives INVAL on read: */
417 DEF_IE(111_IE_DOT11_CURRENT_CCA_MODE, 0x100e, -1);
418 /* said to have len=4 but gives INVAL on read: */
419 DEF_IE(111_IE_DOT11_ED_THRESHOLD, 0x100f, -1);
420 /* set default key ID. write only: */
421 DEF_IE(111_IE_DOT11_WEP_DEFAULT_KEY_SET, 0x1010, 1);
422 /* undoc but returns something: */
423 DEF_IE(111_IE_DOT11_UNKNOWN_1011, 0x1011, 1); /* 11100100 20 */
424 DEF_IE(111_IE_DOT11_INVAL_1012, 0x1012, -1);
425 DEF_IE(111_IE_DOT11_INVAL_1013, 0x1013, -1);
426 #endif
429 /***********************************************************************
430 **Information Frames Structures
433 /* Used in beacon frames and the like */
434 #define DOT11RATEBYTE_1 (1*2)
435 #define DOT11RATEBYTE_2 (2*2)
436 #define DOT11RATEBYTE_5_5 (5*2+1)
437 #define DOT11RATEBYTE_11 (11*2)
438 #define DOT11RATEBYTE_22 (22*2)
439 #define DOT11RATEBYTE_6_G (6*2)
440 #define DOT11RATEBYTE_9_G (9*2)
441 #define DOT11RATEBYTE_12_G (12*2)
442 #define DOT11RATEBYTE_18_G (18*2)
443 #define DOT11RATEBYTE_24_G (24*2)
444 #define DOT11RATEBYTE_36_G (36*2)
445 #define DOT11RATEBYTE_48_G (48*2)
446 #define DOT11RATEBYTE_54_G (54*2)
447 #define DOT11RATEBYTE_BASIC 0x80 /* flags rates included in basic rate set */
450 /***********************************************************************
451 ** rxbuffer_t
453 ** This is the format of rx data returned by acx
456 /* I've hoped it's a 802.11 PHY header, but no...
457 * so far, I've seen on acx111:
458 * 0000 3a00 0000 0000 IBSS Beacons
459 * 0000 3c00 0000 0000 ESS Beacons
460 * 0000 2700 0000 0000 Probe requests
461 * --vda
463 typedef struct phy_hdr {
464 u8 unknown[4];
465 u8 acx111_unknown[4];
466 } ACX_PACKED phy_hdr_t;
468 /* seems to be a bit similar to hfa384x_rx_frame.
469 * These fields are still not quite obvious, though.
470 * Some seem to have different meanings... */
472 #define RXBUF_HDRSIZE 12
473 #define RXBUF_BYTES_RCVD(adev, rxbuf) \
474 ((le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0xfff) - (adev)->phy_header_len)
475 #define RXBUF_BYTES_USED(rxbuf) \
476 ((le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0xfff) + RXBUF_HDRSIZE)
477 /* USBism */
478 #define RXBUF_IS_TXSTAT(rxbuf) (le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0x8000)
480 mac_cnt_rcvd:
481 12 bits: length of frame from control field to first byte of FCS
482 3 bits: reserved
483 1 bit: 1 = it's a tx status info, not a rx packet (USB only)
485 mac_cnt_mblks:
486 6 bits: number of memory block used to store frame in adapter memory
487 1 bit: Traffic Indicator bit in TIM of received Beacon was set
489 mac_status: 1 byte (bitmap):
490 7 Matching BSSID
491 6 Matching SSID
492 5 BDCST Address 1 field is a broadcast
493 4 VBM received beacon frame has more than one set bit (?!)
494 3 TIM Set bit representing this station is set in TIM of received beacon
495 2 GROUP Address 1 is a multicast
496 1 ADDR1 Address 1 matches our MAC
497 0 FCSGD FSC is good
499 phy_stat_baseband: 1 byte (bitmap):
500 7 Preamble frame had a long preamble
501 6 PLCP Error CRC16 error in PLCP header
502 5 Unsup_Mod unsupported modulation
503 4 Selected Antenna antenna 1 was used to receive this frame
504 3 PBCC/CCK frame used: 1=PBCC, 0=CCK modulation
505 2 OFDM frame used OFDM modulation
506 1 TI Protection protection frame was detected
507 0 Reserved
509 phy_plcp_signal: 1 byte:
510 Receive PLCP Signal field from the Baseband Processor
512 phy_level: 1 byte:
513 receive AGC gain level (can be used to measure receive signal strength)
515 phy_snr: 1 byte:
516 estimated noise power of equalized receive signal
517 at input of FEC decoder (can be used to measure receive signal quality)
519 time: 4 bytes:
520 timestamp sampled from either the Access Manager TSF counter
521 or free-running microsecond counter when the MAC receives
522 first byte of PLCP header.
525 typedef struct rxbuffer {
526 u16 mac_cnt_rcvd; /* only 12 bits are len! (0xfff) */
527 u8 mac_cnt_mblks;
528 u8 mac_status;
529 u8 phy_stat_baseband; /* bit 0x80: used LNA (Low-Noise Amplifier) */
530 u8 phy_plcp_signal;
531 u8 phy_level; /* PHY stat */
532 u8 phy_snr; /* PHY stat */
533 u32 time; /* timestamp upon MAC rcv first byte */
534 /* 4-byte (acx100) or 8-byte (acx111) phy header will be here
535 ** if RX_CFG1_INCLUDE_PHY_HDR is in effect:
536 ** phy_hdr_t phy */
537 struct ieee80211_hdr hdr_a3;
538 /* maximally sized data part of wlan packet */
539 u8 data_a3[30 + 2312 + 4 - 24]; /*WLAN_A4FR_MAXLEN_WEP_FCS - WLAN_HDR_A3_LEN]*/
540 /* can add hdr/data_a4 if needed */
541 } ACX_PACKED rxbuffer_t;
544 /*--- Firmware statistics ----------------------------------------------------*/
546 /* define a random 100 bytes more to catch firmware versions which
547 * provide a bigger struct */
548 #define FW_STATS_FUTURE_EXTENSION 100
550 typedef struct fw_stats_tx {
551 u32 tx_desc_of;
552 } ACX_PACKED fw_stats_tx_t;
554 typedef struct fw_stats_rx {
555 u32 rx_oom;
556 u32 rx_hdr_of;
557 u32 rx_hw_stuck; /* old: u32 rx_hdr_use_next */
558 u32 rx_dropped_frame;
559 u32 rx_frame_ptr_err;
560 u32 rx_xfr_hint_trig;
561 u32 rx_aci_events; /* later versions only */
562 u32 rx_aci_resets; /* later versions only */
563 } ACX_PACKED fw_stats_rx_t;
565 typedef struct fw_stats_dma {
566 u32 rx_dma_req;
567 u32 rx_dma_err;
568 u32 tx_dma_req;
569 u32 tx_dma_err;
570 } ACX_PACKED fw_stats_dma_t;
572 typedef struct fw_stats_irq {
573 u32 cmd_cplt;
574 u32 fiq;
575 u32 rx_hdrs;
576 u32 rx_cmplt;
577 u32 rx_mem_of;
578 u32 rx_rdys;
579 u32 irqs;
580 u32 tx_procs;
581 u32 decrypt_done;
582 u32 dma_0_done;
583 u32 dma_1_done;
584 u32 tx_exch_complet;
585 u32 commands;
586 u32 rx_procs;
587 u32 hw_pm_mode_changes;
588 u32 host_acks;
589 u32 pci_pm;
590 u32 acm_wakeups;
591 } ACX_PACKED fw_stats_irq_t;
593 typedef struct fw_stats_wep {
594 u32 wep_key_count;
595 u32 wep_default_key_count;
596 u32 dot11_def_key_mib;
597 u32 wep_key_not_found;
598 u32 wep_decrypt_fail;
599 u32 wep_pkt_decrypt;
600 u32 wep_decrypt_irqs;
601 } ACX_PACKED fw_stats_wep_t;
603 typedef struct fw_stats_pwr {
604 u32 tx_start_ctr;
605 u32 no_ps_tx_too_short;
606 u32 rx_start_ctr;
607 u32 no_ps_rx_too_short;
608 u32 lppd_started;
609 u32 no_lppd_too_noisy;
610 u32 no_lppd_too_short;
611 u32 no_lppd_matching_frame;
612 } ACX_PACKED fw_stats_pwr_t;
614 typedef struct fw_stats_mic {
615 u32 mic_rx_pkts;
616 u32 mic_calc_fail;
617 } ACX_PACKED fw_stats_mic_t;
619 typedef struct fw_stats_aes {
620 u32 aes_enc_fail;
621 u32 aes_dec_fail;
622 u32 aes_enc_pkts;
623 u32 aes_dec_pkts;
624 u32 aes_enc_irq;
625 u32 aes_dec_irq;
626 } ACX_PACKED fw_stats_aes_t;
628 typedef struct fw_stats_event {
629 u32 heartbeat;
630 u32 calibration;
631 u32 rx_mismatch;
632 u32 rx_mem_empty;
633 u32 rx_pool;
634 u32 oom_late;
635 u32 phy_tx_err;
636 u32 tx_stuck;
637 } ACX_PACKED fw_stats_event_t;
639 /* mainly for size calculation only */
640 typedef struct fw_stats {
641 u16 type;
642 u16 len;
643 fw_stats_tx_t tx;
644 fw_stats_rx_t rx;
645 fw_stats_dma_t dma;
646 fw_stats_irq_t irq;
647 fw_stats_wep_t wep;
648 fw_stats_pwr_t pwr;
649 fw_stats_mic_t mic;
650 fw_stats_aes_t aes;
651 fw_stats_event_t evt;
652 u8 _padding[FW_STATS_FUTURE_EXTENSION];
653 } fw_stats_t;
655 /* Firmware version struct */
657 typedef struct fw_ver {
658 u16 cmd;
659 u16 size;
660 char fw_id[20];
661 u32 hw_id;
662 } ACX_PACKED fw_ver_t;
664 #define FW_ID_SIZE 20
667 /*--- WEP stuff --------------------------------------------------------------*/
668 #define DOT11_MAX_DEFAULT_WEP_KEYS 4
670 /* non-firmware struct, no packing necessary */
671 typedef struct wep_key {
672 size_t size; /* most often used member first */
673 u8 index;
674 u8 key[29];
675 u16 strange_filler;
676 } wep_key_t; /* size = 264 bytes (33*8) */
677 /* FIXME: We don't have size 264! Or is there 2 bytes beyond the key
678 * (strange_filler)? */
680 /* non-firmware struct, no packing necessary */
681 typedef struct key_struct {
682 u8 addr[ETH_ALEN]; /* 0x00 */
683 u16 filler1; /* 0x06 */
684 u32 filler2; /* 0x08 */
685 u32 index; /* 0x0c */
686 u16 len; /* 0x10 */
687 u8 key[29]; /* 0x12; is this long enough??? */
688 } key_struct_t; /* size = 276. FIXME: where is the remaining space?? */
691 /*--- Client (peer) info -----------------------------------------------------*/
692 /* adev->sta_list[] is used for:
693 ** accumulating and processing of scan results
694 ** keeping client info in AP mode
695 ** keeping AP info in STA mode (AP is the only one 'client')
696 ** keeping peer info in ad-hoc mode
697 ** non-firmware struct --> no packing necessary */
698 enum {
699 CLIENT_EMPTY_SLOT_0 = 0,
700 CLIENT_EXIST_1 = 1,
701 CLIENT_AUTHENTICATED_2 = 2,
702 CLIENT_ASSOCIATED_3 = 3,
703 CLIENT_JOIN_CANDIDATE = 4
705 struct client {
706 /* most frequent access first */
707 u8 used; /* misnamed, more like 'status' */
708 struct client* next;
709 unsigned long mtime; /* last time we heard it, in jiffies */
710 size_t essid_len; /* length of ESSID (without '\0') */
711 u32 sir; /* Standard IR */
712 u32 snr; /* Signal to Noise Ratio */
713 u16 aid; /* association ID */
714 u16 seq; /* from client's auth req */
715 u16 auth_alg; /* from client's auth req */
716 u16 cap_info; /* from client's assoc req */
717 u16 rate_cap; /* what client supports (all rates) */
718 u16 rate_bas; /* what client supports (basic rates) */
719 u16 rate_cfg; /* what is allowed (by iwconfig etc) */
720 u16 rate_cur; /* currently used rate mask */
721 u8 rate_100; /* currently used rate byte (acx100 only) */
722 u8 address[ETH_ALEN];
723 u8 bssid[ETH_ALEN]; /* ad-hoc hosts can have bssid != mac */
724 u8 channel;
725 u8 auth_step;
726 u8 ignore_count;
727 u8 fallback_count;
728 u8 stepup_count;
729 char essid[IW_ESSID_MAX_SIZE + 1]; /* ESSID and trailing '\0' */
730 /* FIXME: this one is too damn big */
731 char challenge_text[128]; /*WLAN_CHALLENGE_LEN*/
735 /***********************************************************************
736 ** Hardware structures
739 /* An opaque typesafe helper type
741 * Some hardware fields are actually pointers,
742 * but they have to remain u32, since using ptr instead
743 * (8 bytes on 64bit systems!) would disrupt the fixed descriptor
744 * format the acx firmware expects in the non-user area.
745 * Since we cannot cram an 8 byte ptr into 4 bytes, we need to
746 * enforce that pointed to data remains in low memory
747 * (address value needs to fit in 4 bytes) on 64bit systems.
749 * This is easy to get wrong, thus we are using a small struct
750 * and special macros to access it. Macros will check for
751 * attempts to overflow an acx_ptr with value > 0xffffffff.
753 * Attempts to use acx_ptr without macros result in compile-time errors */
755 typedef struct {
756 u32 v;
757 } ACX_PACKED acx_ptr;
759 #if ACX_DEBUG
760 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
761 #else
762 #define CHECK32(n) ((void)0)
763 #endif
765 /* acx_ptr <-> integer conversion */
766 #define cpu2acx(n) ({ CHECK32(n); ((acx_ptr){ .v = cpu_to_le32(n) }); })
767 #define acx2cpu(a) (le32_to_cpu(a.v))
769 /* acx_ptr <-> pointer conversion */
770 #define ptr2acx(p) ({ CHECK32(p); ((acx_ptr){ .v = cpu_to_le32((u32)(long)(p)) }); })
771 #define acx2ptr(a) ((void*)le32_to_cpu(a.v))
773 /* Values for rate field (acx100 only) */
774 #define RATE100_1 10
775 #define RATE100_2 20
776 #define RATE100_5 55
777 #define RATE100_11 110
778 #define RATE100_22 220
779 /* This bit denotes use of PBCC:
780 ** (PBCC encoding is usable with 11 and 22 Mbps speeds only) */
781 #define RATE100_PBCC511 0x80
783 /* Bit values for rate111 field */
784 #define RATE111_1 0x0001 /* DBPSK */
785 #define RATE111_2 0x0002 /* DQPSK */
786 #define RATE111_5 0x0004 /* CCK or PBCC */
787 #define RATE111_6 0x0008 /* CCK-OFDM or OFDM */
788 #define RATE111_9 0x0010 /* CCK-OFDM or OFDM */
789 #define RATE111_11 0x0020 /* CCK or PBCC */
790 #define RATE111_12 0x0040 /* CCK-OFDM or OFDM */
791 #define RATE111_18 0x0080 /* CCK-OFDM or OFDM */
792 #define RATE111_22 0x0100 /* PBCC */
793 #define RATE111_24 0x0200 /* CCK-OFDM or OFDM */
794 #define RATE111_36 0x0400 /* CCK-OFDM or OFDM */
795 #define RATE111_48 0x0800 /* CCK-OFDM or OFDM */
796 #define RATE111_54 0x1000 /* CCK-OFDM or OFDM */
797 #define RATE111_RESERVED 0x2000
798 #define RATE111_PBCC511 0x4000 /* PBCC mod at 5.5 or 11Mbit (else CCK) */
799 #define RATE111_SHORTPRE 0x8000 /* short preamble */
800 /* Special 'try everything' value */
801 #define RATE111_ALL 0x1fff
802 /* These bits denote acx100 compatible settings */
803 #define RATE111_ACX100_COMPAT 0x0127
804 /* These bits denote 802.11b compatible settings */
805 #define RATE111_80211B_COMPAT 0x0027
807 /* Descriptor Ctl field bits
808 * init value is 0x8e, "idle" value is 0x82 (in idle tx descs)
810 #define DESC_CTL_SHORT_PREAMBLE 0x01 /* preamble type: 0 = long; 1 = short */
811 #define DESC_CTL_FIRSTFRAG 0x02 /* this is the 1st frag of the frame */
812 #define DESC_CTL_AUTODMA 0x04
813 #define DESC_CTL_RECLAIM 0x08 /* ready to reuse */
814 #define DESC_CTL_HOSTDONE 0x20 /* host has finished processing */
815 #define DESC_CTL_ACXDONE 0x40 /* acx has finished processing */
816 /* host owns the desc [has to be released last, AFTER modifying all other desc fields!] */
817 #define DESC_CTL_HOSTOWN 0x80
818 #define DESC_CTL_ACXDONE_HOSTOWN (DESC_CTL_ACXDONE | DESC_CTL_HOSTOWN)
820 /* Descriptor Status field
822 #define DESC_STATUS_FULL (1 << 31)
824 /* NB: some bits may be interesting for Monitor mode tx (aka Raw tx): */
825 #define DESC_CTL2_SEQ 0x01 /* don't increase sequence field */
826 #define DESC_CTL2_FCS 0x02 /* don't add the FCS */
827 #define DESC_CTL2_MORE_FRAG 0x04
828 #define DESC_CTL2_RETRY 0x08 /* don't increase retry field */
829 #define DESC_CTL2_POWER 0x10 /* don't increase power mgmt. field */
830 #define DESC_CTL2_RTS 0x20 /* do RTS/CTS magic before sending */
831 #define DESC_CTL2_WEP 0x40 /* encrypt this frame */
832 #define DESC_CTL2_DUR 0x80 /* don't increase duration field */
834 /***********************************************************************
835 ** PCI structures
837 /* IRQ Constants
838 ** (outside of "#ifdef PCI" because USB (mis)uses HOST_INT_SCAN_COMPLETE) */
839 #define HOST_INT_RX_DATA 0x0001
840 #define HOST_INT_TX_COMPLETE 0x0002
841 #define HOST_INT_TX_XFER 0x0004
842 #define HOST_INT_RX_COMPLETE 0x0008
843 #define HOST_INT_DTIM 0x0010
844 #define HOST_INT_BEACON 0x0020
845 #define HOST_INT_TIMER 0x0040
846 #define HOST_INT_KEY_NOT_FOUND 0x0080
847 #define HOST_INT_IV_ICV_FAILURE 0x0100
848 #define HOST_INT_CMD_COMPLETE 0x0200
849 #define HOST_INT_INFO 0x0400
850 #define HOST_INT_OVERFLOW 0x0800
851 #define HOST_INT_PROCESS_ERROR 0x1000
852 #define HOST_INT_SCAN_COMPLETE 0x2000
853 #define HOST_INT_FCS_THRESHOLD 0x4000
854 #define HOST_INT_UNKNOWN 0x8000
856 /* Outside of "#ifdef PCI" because USB needs to know sizeof()
857 ** of txdesc and rxdesc: */
858 struct txdesc {
859 acx_ptr pNextDesc; /* pointer to next txdesc */
860 acx_ptr HostMemPtr; /* 0x04 */
861 acx_ptr AcxMemPtr; /* 0x08 */
862 u32 tx_time; /* 0x0c */
863 u16 total_length; /* 0x10 */
864 u16 Reserved; /* 0x12 */
866 /* The following 16 bytes do not change when acx100 owns the descriptor */
867 /* BUG: fw clears last byte of this area which is supposedly reserved
868 ** for driver use. amd64 blew up. We dare not use it now */
869 u32 dummy[4];
871 u8 Ctl_8; /* 0x24, 8bit value */
872 u8 Ctl2_8; /* 0x25, 8bit value */
873 u8 error; /* 0x26 */
874 u8 ack_failures; /* 0x27 */
875 u8 rts_failures; /* 0x28 */
876 u8 rts_ok; /* 0x29 */
877 union {
878 struct {
879 u8 rate; /* 0x2a */
880 u8 queue_ctrl; /* 0x2b */
881 } ACX_PACKED r1;
882 struct {
883 u16 rate111; /* 0x2a */
884 } ACX_PACKED r2;
885 } ACX_PACKED u;
886 u32 queue_info; /* 0x2c (acx100, reserved on acx111) */
887 } ACX_PACKED; /* size : 48 = 0x30 */
888 /* NB: acx111 txdesc structure is 4 byte larger */
889 /* All these 4 extra bytes are reserved. tx alloc code takes them into account */
891 struct rxdesc {
892 acx_ptr pNextDesc; /* 0x00 */
893 acx_ptr HostMemPtr; /* 0x04 */
894 acx_ptr ACXMemPtr; /* 0x08 */
895 u32 rx_time; /* 0x0c */
896 u16 total_length; /* 0x10 */
897 u16 WEP_length; /* 0x12 */
898 u32 WEP_ofs; /* 0x14 */
900 /* the following 16 bytes do not change when acx100 owns the descriptor */
901 u8 driverWorkspace[16]; /* 0x18 */
903 u8 Ctl_8;
904 u8 rate;
905 u8 error;
906 u8 SNR; /* Signal-to-Noise Ratio */
907 u8 RxLevel;
908 u8 queue_ctrl;
909 u16 unknown;
910 u32 unknown2;
911 } ACX_PACKED; /* size 52 = 0x34 */
913 #ifdef ACX_MAC80211_PCI
915 /* Register I/O offsets */
916 #define ACX100_EEPROM_ID_OFFSET 0x380
918 /* please add further ACX hardware register definitions only when
919 it turns out you need them in the driver, and please try to use
920 firmware functionality instead, since using direct I/O access instead
921 of letting the firmware do it might confuse the firmware's state
922 machine */
924 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
925 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
926 enum {
927 IO_ACX_SOFT_RESET = 0,
929 IO_ACX_SLV_MEM_ADDR,
930 IO_ACX_SLV_MEM_DATA,
931 IO_ACX_SLV_MEM_CTL,
932 IO_ACX_SLV_END_CTL,
934 IO_ACX_FEMR, /* Function Event Mask */
936 IO_ACX_INT_TRIG,
937 IO_ACX_IRQ_MASK,
938 IO_ACX_IRQ_STATUS_NON_DES,
939 IO_ACX_IRQ_STATUS_CLEAR, /* CLEAR = clear on read */
940 IO_ACX_IRQ_ACK,
941 IO_ACX_HINT_TRIG,
943 IO_ACX_ENABLE,
945 IO_ACX_EEPROM_CTL,
946 IO_ACX_EEPROM_ADDR,
947 IO_ACX_EEPROM_DATA,
948 IO_ACX_EEPROM_CFG,
950 IO_ACX_PHY_ADDR,
951 IO_ACX_PHY_DATA,
952 IO_ACX_PHY_CTL,
954 IO_ACX_GPIO_OE,
956 IO_ACX_GPIO_OUT,
958 IO_ACX_CMD_MAILBOX_OFFS,
959 IO_ACX_INFO_MAILBOX_OFFS,
960 IO_ACX_EEPROM_INFORMATION,
962 IO_ACX_EE_START,
963 IO_ACX_SOR_CFG,
964 IO_ACX_ECPU_CTRL
966 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
967 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
969 /* Values for IO_ACX_INT_TRIG register: */
970 /* inform hw that rxdesc in queue needs processing */
971 #define INT_TRIG_RXPRC 0x08
972 /* inform hw that txdesc in queue needs processing */
973 #define INT_TRIG_TXPRC 0x04
974 /* ack that we received info from info mailbox */
975 #define INT_TRIG_INFOACK 0x02
976 /* inform hw that we have filled command mailbox */
977 #define INT_TRIG_CMD 0x01
979 struct txhostdesc {
980 acx_ptr data_phy; /* 0x00 [u8 *] */
981 u16 data_offset; /* 0x04 */
982 u16 reserved; /* 0x06 */
983 u16 Ctl_16; /* 16bit value, endianness!! */
984 u16 length; /* 0x0a */
985 acx_ptr desc_phy_next; /* 0x0c [txhostdesc *] */
986 acx_ptr pNext; /* 0x10 [txhostdesc *] */
987 u32 Status; /* 0x14, unused on Tx */
988 /* From here on you can use this area as you want (variable length, too!) */
989 u8 *data;
990 struct ieee80211_tx_status txstatus;
991 struct sk_buff *skb;
993 } ACX_PACKED;
995 struct rxhostdesc {
996 acx_ptr data_phy; /* 0x00 [rxbuffer_t *] */
997 u16 data_offset; /* 0x04 */
998 u16 reserved; /* 0x06 */
999 u16 Ctl_16; /* 0x08; 16bit value, endianness!! */
1000 u16 length; /* 0x0a */
1001 acx_ptr desc_phy_next; /* 0x0c [rxhostdesc_t *] */
1002 acx_ptr pNext; /* 0x10 [rxhostdesc_t *] */
1003 u32 Status; /* 0x14 */
1004 /* From here on you can use this area as you want (variable length, too!) */
1005 rxbuffer_t *data;
1006 } ACX_PACKED;
1008 #endif /* ACX_PCI */
1010 /***********************************************************************
1011 ** USB structures and constants
1013 #ifdef ACX_MAC80211_USB
1015 /* Used for usb_txbuffer.desc field */
1016 #define USB_TXBUF_TXDESC 0xA
1017 /* Size of header (everything up to data[]) */
1018 #define USB_TXBUF_HDRSIZE 14
1019 typedef struct usb_txbuffer {
1020 u16 desc;
1021 u16 mpdu_len;
1022 u8 queue_index;
1023 u8 rate;
1024 u32 hostdata;
1025 u8 ctrl1;
1026 u8 ctrl2;
1027 u16 data_len;
1028 /* wlan packet content is placed here: */
1029 u8 data[30 + 2312 + 4]; /*WLAN_A4FR_MAXLEN_WEP_FCS]*/
1030 } ACX_PACKED usb_txbuffer_t;
1032 /* USB returns either rx packets (see rxbuffer) or
1033 ** these "tx status" structs: */
1034 typedef struct usb_txstatus {
1035 u16 mac_cnt_rcvd; /* only 12 bits are len! (0xfff) */
1036 u8 queue_index;
1037 u8 mac_status; /* seen 0x20 on tx failure */
1038 u32 hostdata;
1039 u8 rate;
1040 u8 ack_failures;
1041 u8 rts_failures;
1042 u8 rts_ok;
1043 // struct ieee80211_tx_status txstatus;
1044 // struct sk_buff *skb;
1045 } ACX_PACKED usb_txstatus_t;
1047 typedef struct usb_tx {
1048 unsigned busy:1;
1049 struct urb *urb;
1050 acx_device_t *adev;
1051 /* actual USB bulk output data block is here: */
1052 usb_txbuffer_t bulkout;
1053 } usb_tx_t;
1055 struct usb_rx_plain {
1056 unsigned busy:1;
1057 struct urb *urb;
1058 acx_device_t *adev;
1059 rxbuffer_t bulkin;
1062 typedef struct usb_rx {
1063 unsigned busy:1;
1064 struct urb *urb;
1065 acx_device_t *adev;
1066 rxbuffer_t bulkin;
1067 /* Make entire structure 4k */
1068 u8 padding[4*1024 - sizeof(struct usb_rx_plain)];
1069 } usb_rx_t;
1070 #endif /* ACX_USB */
1073 /* Config Option structs */
1075 typedef struct co_antennas {
1076 u8 type;
1077 u8 len;
1078 u8 list[2];
1079 } ACX_PACKED co_antennas_t;
1081 typedef struct co_powerlevels {
1082 u8 type;
1083 u8 len;
1084 u16 list[8];
1085 } ACX_PACKED co_powerlevels_t;
1087 typedef struct co_datarates {
1088 u8 type;
1089 u8 len;
1090 u8 list[8];
1091 } ACX_PACKED co_datarates_t;
1093 typedef struct co_domains {
1094 u8 type;
1095 u8 len;
1096 u8 list[6];
1097 } ACX_PACKED co_domains_t;
1099 typedef struct co_product_id {
1100 u8 type;
1101 u8 len;
1102 u8 list[128];
1103 } ACX_PACKED co_product_id_t;
1105 typedef struct co_manuf_id {
1106 u8 type;
1107 u8 len;
1108 u8 list[128];
1109 } ACX_PACKED co_manuf_t;
1111 typedef struct co_fixed {
1112 char NVSv[8];
1113 /* u16 NVS_vendor_offs; ACX111-only */
1114 /* u16 unknown; ACX111-only */
1115 u8 MAC[6]; /* ACX100-only */
1116 u16 probe_delay; /* ACX100-only */
1117 u32 eof_memory;
1118 u8 dot11CCAModes;
1119 u8 dot11Diversity;
1120 u8 dot11ShortPreambleOption;
1121 u8 dot11PBCCOption;
1122 u8 dot11ChannelAgility;
1123 u8 dot11PhyType; /* FIXME: does 802.11 call it "dot11PHYType"? */
1124 u8 dot11TempType;
1125 u8 table_count;
1126 } ACX_PACKED co_fixed_t;
1128 typedef struct acx111_ie_configoption {
1129 u16 type;
1130 u16 len;
1131 /* Do not access below members directly, they are in fact variable length */
1132 co_fixed_t fixed;
1133 co_antennas_t antennas;
1134 co_powerlevels_t power_levels;
1135 co_datarates_t data_rates;
1136 co_domains_t domains;
1137 co_product_id_t product_id;
1138 co_manuf_t manufacturer;
1139 u8 _padding[4];
1140 } ACX_PACKED acx111_ie_configoption_t;
1142 /***********************************************************************
1143 ** Main acx per-device data structure
1145 #define ACX_STATE_FW_LOADED 0x01
1146 #define ACX_STATE_IFACE_UP 0x02
1148 /* MAC mode (BSS type) defines
1149 * Note that they shouldn't be redefined, since they are also used
1150 * during communication with firmware */
1151 #define ACX_MODE_0_ADHOC 0
1152 #define ACX_MODE_1_UNUSED 1
1153 #define ACX_MODE_2_STA 2
1154 #define ACX_MODE_3_AP 3
1155 /* These are our own inventions. Sending these to firmware
1156 ** makes it stop emitting beacons, which is exactly what we want
1157 ** for these modes */
1158 #define ACX_MODE_MONITOR 0xfe
1159 #define ACX_MODE_OFF 0xff
1160 /* 'Submode': identifies exact status of ADHOC/STA host */
1161 #define ACX_STATUS_0_STOPPED 0
1162 #define ACX_STATUS_1_SCANNING 1
1163 #define ACX_STATUS_2_WAIT_AUTH 2
1164 #define ACX_STATUS_3_AUTHENTICATED 3
1165 #define ACX_STATUS_4_ASSOCIATED 4
1167 /* FIXME: this should be named something like struct acx_priv (typedef'd to
1168 * acx_priv_t) */
1170 /* non-firmware struct, no packing necessary */
1171 struct acx_device {
1172 /* most frequent accesses first (dereferencing and cache line!) */
1174 /*** Locking ***/
1175 struct mutex mutex;
1176 spinlock_t spinlock;
1177 #if defined(PARANOID_LOCKING) /* Lock debugging */
1178 const char *last_sem;
1179 const char *last_lock;
1180 unsigned long sem_time;
1181 unsigned long lock_time;
1182 #endif
1184 /*** Linux network device ***/
1185 //struct device *dev; /* pointer to linux netdevice */
1187 /*** Device statistics ***/
1188 struct ieee80211_low_level_stats ieee_stats; /* wireless device statistics */
1190 /*** Device statistics ***/
1191 struct net_device_stats stats; /* net device statistics */
1193 #ifdef WIRELESS_EXT
1194 // struct iw_statistics wstats; /* wireless statistics */
1195 #endif
1196 struct ieee80211_hw *ieee;
1197 struct ieee80211_hw_mode modes[2];
1198 struct ieee80211_rx_status rx_status;
1200 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
1201 struct ieee80211_vif *vif;
1202 #endif
1204 /*** Power managment ***/
1205 struct pm_dev *pm; /* PM crap */
1207 /*** Management timer ***/
1208 struct timer_list mgmt_timer;
1210 /*** Hardware identification ***/
1211 const char *chip_name;
1212 u8 dev_type;
1213 u8 chip_type;
1214 u8 form_factor;
1215 u8 radio_type;
1216 u8 eeprom_version;
1218 /*** Config retrieved from EEPROM ***/
1219 char cfgopt_NVSv[8];
1220 u16 cfgopt_NVS_vendor_offs;
1221 u8 cfgopt_MAC[6];
1222 u16 cfgopt_probe_delay;
1223 u32 cfgopt_eof_memory;
1224 u8 cfgopt_dot11CCAModes;
1225 u8 cfgopt_dot11Diversity;
1226 u8 cfgopt_dot11ShortPreambleOption;
1227 u8 cfgopt_dot11PBCCOption;
1228 u8 cfgopt_dot11ChannelAgility;
1229 u8 cfgopt_dot11PhyType;
1230 u8 cfgopt_dot11TempType;
1231 co_antennas_t cfgopt_antennas;
1232 co_powerlevels_t cfgopt_power_levels;
1233 co_datarates_t cfgopt_data_rates;
1234 co_domains_t cfgopt_domains;
1235 co_product_id_t cfgopt_product_id;
1236 co_manuf_t cfgopt_manufacturer;
1238 /*** Firmware identification ***/
1239 char firmware_version[FW_ID_SIZE+1];
1240 u32 firmware_numver;
1241 u32 firmware_id;
1242 const u16 *ie_len;
1243 const u16 *ie_len_dot11;
1245 /*** Device state ***/
1246 u16 dev_state_mask;
1247 u8 led_power; /* power LED status */
1248 u32 get_mask; /* mask of settings to fetch from the card */
1249 u32 set_mask; /* mask of settings to write to the card */
1250 u32 initialized:1;
1251 /* Barely used in USB case */
1252 u16 irq_status;
1253 int irq_savedstate;
1254 int irq_reason;
1255 u8 after_interrupt_jobs; /* mini job list for doing actions after an interrupt occurred */
1256 struct work_struct after_interrupt_task; /* our task for after interrupt actions */
1258 unsigned int irq;
1260 /*** scanning ***/
1261 u16 scan_count; /* number of times to do channel scan */
1262 u8 scan_mode; /* 0 == active, 1 == passive, 2 == background */
1263 u8 scan_rate;
1264 u16 scan_duration;
1265 u16 scan_probe_delay;
1266 #if WIRELESS_EXT > 15
1267 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
1268 #endif
1270 /*** Virtual interface struct ***/
1271 struct acx_interface interface;
1273 /*** Wireless network settings ***/
1274 /* copy of the device address (ifconfig hw ether) that we actually use
1275 ** for 802.11; copied over from the network device's MAC address
1276 ** (ifconfig) when it makes sense only */
1277 u8 dev_addr[MAX_ADDR_LEN];
1278 u8 bssid[ETH_ALEN]; /* the BSSID after having joined */
1279 u8 ap[ETH_ALEN]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
1280 u16 aid; /* The Association ID sent from the AP / last used AID if we're an AP */
1281 u16 mode; /* mode from iwconfig */
1282 int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
1283 u16 status; /* 802.11 association status */
1284 u8 essid_active; /* specific ESSID active, or select any? */
1285 u8 essid_len; /* to avoid dozens of strlen() */
1286 /* INCLUDES \0 termination for easy printf - but many places
1287 ** simply want the string data memcpy'd plus a length indicator!
1288 ** Keep that in mind... */
1289 char essid[IW_ESSID_MAX_SIZE+1];
1290 /* essid we are going to use for association, in case of "essid 'any'"
1291 ** and in case of hidden ESSID (use configured ESSID then) */
1292 char essid_for_assoc[IW_ESSID_MAX_SIZE+1];
1293 char nick[IW_ESSID_MAX_SIZE+1]; /* see essid! */
1294 u8 channel;
1295 u8 reg_dom_id; /* reg domain setting */
1296 u16 reg_dom_chanmask;
1297 u16 auth_or_assoc_retries;
1298 u16 scan_retries;
1299 unsigned long scan_start; /* YES, jiffies is defined as "unsigned long" */
1302 /* MAC80211 Template Reference */
1303 struct sk_buff *beacon_cache;
1304 /* stations known to us (if we're an ap) */
1305 // client_t sta_list[32]; /* tab is larger than list, so that */
1306 // client_t *sta_hash_tab[64]; /* hash collisions are not likely */
1307 // client_t *ap_client; /* this one is our AP (STA mode only) */
1309 int dup_count;
1310 int nondup_count;
1311 unsigned long dup_msg_expiry;
1312 u16 last_seq_ctrl; /* duplicate packet detection */
1314 /* 802.11 power save mode */
1315 u8 ps_wakeup_cfg;
1316 u8 ps_listen_interval;
1317 u8 ps_options;
1318 u8 ps_hangover_period;
1319 u32 ps_enhanced_transition_time;
1320 u32 ps_beacon_rx_time;
1322 /*** PHY settings ***/
1323 u8 fallback_threshold;
1324 u8 stepup_threshold;
1325 u16 rate_basic;
1326 u16 rate_oper;
1327 u16 rate_bcast;
1328 u16 rate_bcast100;
1329 u8 rate_auto; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
1330 u8 preamble_mode; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
1331 u8 preamble_cur;
1333 u8 tx_disabled;
1334 u8 tx_level_dbm;
1335 /* u8 tx_level_val; */
1336 /* u8 tx_level_auto; whether to do automatic power adjustment */
1338 unsigned long recalib_time_last_success;
1339 unsigned long recalib_time_last_attempt;
1340 int recalib_failure_count;
1341 int recalib_msg_ratelimit;
1342 int retry_errors_msg_ratelimit;
1344 unsigned long brange_time_last_state_change; /* time the power LED was last changed */
1345 u8 brange_last_state; /* last state of the LED */
1346 u8 brange_max_quality; /* maximum quality that equates to full speed */
1348 u8 sensitivity;
1349 u8 antenna; /* antenna settings */
1350 u8 ed_threshold; /* energy detect threshold */
1351 u8 cca; /* clear channel assessment */
1353 u16 rts_threshold;
1354 u16 frag_threshold;
1355 u32 short_retry;
1356 u32 long_retry;
1357 u16 msdu_lifetime;
1358 u16 listen_interval; /* given in units of beacon interval */
1359 u32 beacon_interval;
1361 u16 capabilities;
1362 u8 rate_supported_len;
1363 u8 rate_supported[13];
1365 /*** Encryption settings (WEP) ***/
1366 u32 auth_alg; /* used in transmit_authen1 */
1367 u8 wep_enabled;
1368 u8 wep_restricted;
1369 u8 wep_current_index;
1370 wep_key_t wep_keys[DOT11_MAX_DEFAULT_WEP_KEYS]; /* the default WEP keys */
1372 key_struct_t wep_key_struct[10];
1374 /*** Encryption Replacement for mac80211 ***/
1375 struct acx_key key[54];
1376 u16 security_offset;
1377 u8 default_key_idx;
1380 /*** Unknown ***/
1381 u8 dtim_interval;
1383 /*** Card Rx/Tx management ***/
1384 u16 rx_config_1;
1385 u16 rx_config_2;
1386 u16 memblocksize;
1387 unsigned int tx_free;
1388 unsigned int tx_head; /* keep as close as possible to Tx stuff below (cache line) */
1389 u16 phy_header_len;
1391 /*************************************************************************
1392 *** PCI/USB/... must be last or else hw agnostic code breaks horribly ***
1393 *************************************************************************/
1395 /* hack to let common code compile. FIXME */
1396 dma_addr_t rxhostdesc_startphy;
1398 /*** PCI stuff ***/
1399 #ifdef ACX_MAC80211_PCI
1400 /* pointers to tx buffers, tx host descriptors (in host memory)
1401 ** and tx descs in device memory */
1402 unsigned int tx_tail;
1403 u8 *txbuf_start;
1404 txhostdesc_t *txhostdesc_start;
1405 txdesc_t *txdesc_start; /* points to PCI-mapped memory */
1406 dma_addr_t txbuf_startphy;
1407 dma_addr_t txhostdesc_startphy;
1408 /* sizes of above host memory areas */
1409 unsigned int txbuf_area_size;
1410 unsigned int txhostdesc_area_size;
1412 unsigned int txdesc_size; /* size of txdesc; ACX111 = ACX100 + 4 */
1413 client_t *txc[TX_CNT];
1414 u16 txr[TX_CNT];
1416 /* same for rx */
1417 unsigned int rx_tail;
1418 rxbuffer_t *rxbuf_start;
1419 rxhostdesc_t *rxhostdesc_start;
1420 rxdesc_t *rxdesc_start;
1421 /* physical addresses of above host memory areas */
1422 dma_addr_t rxbuf_startphy;
1423 /* dma_addr_t rxhostdesc_startphy; */
1424 unsigned int rxbuf_area_size;
1425 unsigned int rxhostdesc_area_size;
1427 u8 need_radio_fw;
1428 u8 irqs_active; /* whether irq sending is activated */
1430 const u16 *io; /* points to ACX100 or ACX111 PCI I/O register address set */
1432 #ifdef CONFIG_PCI
1433 struct pci_dev *pdev;
1434 #endif
1435 #ifdef CONFIG_VLYNQ
1436 struct vlynq_device *vdev;
1437 #endif
1438 struct device *bus_dev;
1439 unsigned long membase;
1440 unsigned long membase2;
1441 void __iomem *iobase;
1442 void __iomem *iobase2;
1443 /* command interface */
1444 u8 __iomem *cmd_area;
1445 u8 __iomem *info_area;
1447 u16 irq_mask; /* interrupt types to mask out (not wanted) with many IRQs activated */
1448 u16 irq_mask_off; /* interrupt types to mask out (not wanted) with IRQs off */
1449 unsigned int irq_loops_this_jiffy;
1450 unsigned long irq_last_jiffies;
1451 #endif
1453 /*** USB stuff ***/
1454 #ifdef ACX_MAC80211_USB
1455 struct usb_device *usbdev;
1457 rxbuffer_t rxtruncbuf;
1459 usb_tx_t *usb_tx;
1460 usb_rx_t *usb_rx;
1462 int bulkinep; /* bulk-in endpoint */
1463 int bulkoutep; /* bulk-out endpoint */
1464 int rxtruncsize;
1465 #endif
1471 static inline
1472 acx_device_t * ieee2adev(struct ieee80211_hw *hw)
1474 return hw->priv;
1478 /* For use with ACX1xx_IE_RXCONFIG */
1479 /* bit description
1480 * 13 include additional header (length etc.) *required*
1481 * struct is defined in 'struct rxbuffer'
1482 * is this bit acx100 only? does acx111 always put the header,
1483 * and bit setting is irrelevant? --vda
1484 * 10 receive frames only with SSID used in last join cmd
1485 * 9 discard broadcast
1486 * 8 receive packets for multicast address 1
1487 * 7 receive packets for multicast address 0
1488 * 6 discard all multicast packets
1489 * 5 discard frames from foreign BSSID
1490 * 4 discard frames with foreign destination MAC address
1491 * 3 promiscuous mode (receive ALL frames, disable filter)
1492 * 2 include FCS
1493 * 1 include phy header
1494 * 0 ???
1496 #define RX_CFG1_INCLUDE_RXBUF_HDR 0x2000 /* ACX100 only */
1497 #define RX_CFG1_FILTER_SSID 0x0400
1498 #define RX_CFG1_FILTER_BCAST 0x0200
1499 #define RX_CFG1_RCV_MC_ADDR1 0x0100
1500 #define RX_CFG1_RCV_MC_ADDR0 0x0080
1501 #define RX_CFG1_FILTER_ALL_MULTI 0x0040
1502 #define RX_CFG1_FILTER_BSSID 0x0020
1503 #define RX_CFG1_FILTER_MAC 0x0010
1504 #define RX_CFG1_RCV_PROMISCUOUS 0x0008
1505 #define RX_CFG1_INCLUDE_FCS 0x0004
1506 #define RX_CFG1_INCLUDE_PHY_HDR (WANT_PHY_HDR ? 0x0002 : 0)
1507 /* bit description
1508 * 11 receive association requests etc.
1509 * 10 receive authentication frames
1510 * 9 receive beacon frames
1511 * 8 receive contention free packets
1512 * 7 receive control frames
1513 * 6 receive data frames
1514 * 5 receive broken frames
1515 * 4 receive management frames
1516 * 3 receive probe requests
1517 * 2 receive probe responses
1518 * 1 receive RTS/CTS/ACK frames
1519 * 0 receive other
1521 #define RX_CFG2_RCV_ASSOC_REQ 0x0800
1522 #define RX_CFG2_RCV_AUTH_FRAMES 0x0400
1523 #define RX_CFG2_RCV_BEACON_FRAMES 0x0200
1524 #define RX_CFG2_RCV_CONTENTION_FREE 0x0100
1525 #define RX_CFG2_RCV_CTRL_FRAMES 0x0080
1526 #define RX_CFG2_RCV_DATA_FRAMES 0x0040
1527 #define RX_CFG2_RCV_BROKEN_FRAMES 0x0020
1528 #define RX_CFG2_RCV_MGMT_FRAMES 0x0010
1529 #define RX_CFG2_RCV_PROBE_REQ 0x0008
1530 #define RX_CFG2_RCV_PROBE_RESP 0x0004
1531 #define RX_CFG2_RCV_ACK_FRAMES 0x0002
1532 #define RX_CFG2_RCV_OTHER 0x0001
1534 /* For use with ACX1xx_IE_FEATURE_CONFIG */
1535 #define FEATURE1_80MHZ_CLOCK 0x00000040L
1536 #define FEATURE1_4X 0x00000020L
1537 #define FEATURE1_LOW_RX 0x00000008L
1538 #define FEATURE1_EXTRA_LOW_RX 0x00000001L
1540 #define FEATURE2_SNIFFER 0x00000080L
1541 #define FEATURE2_NO_TXCRYPT 0x00000001L
1543 /*-- get and set mask values --*/
1544 #define GETSET_LED_POWER 0x00000001L
1545 #define GETSET_STATION_ID 0x00000002L
1546 #define SET_TEMPLATES 0x00000004L
1547 #define SET_STA_LIST 0x00000008L
1548 #define GETSET_TX 0x00000010L
1549 #define GETSET_RX 0x00000020L
1550 #define SET_RXCONFIG 0x00000040L
1551 #define GETSET_ANTENNA 0x00000080L
1552 #define GETSET_SENSITIVITY 0x00000100L
1553 #define GETSET_TXPOWER 0x00000200L
1554 #define GETSET_ED_THRESH 0x00000400L
1555 #define GETSET_CCA 0x00000800L
1556 #define GETSET_POWER_80211 0x00001000L
1557 #define GETSET_RETRY 0x00002000L
1558 #define GETSET_REG_DOMAIN 0x00004000L
1559 #define GETSET_CHANNEL 0x00008000L
1560 /* Used when ESSID changes etc and we need to scan for AP anew */
1561 #define GETSET_RESCAN 0x00010000L
1562 #define GETSET_MODE 0x00020000L
1563 #define GETSET_WEP 0x00040000L
1564 #define SET_WEP_OPTIONS 0x00080000L
1565 #define SET_MSDU_LIFETIME 0x00100000L
1566 #define SET_RATE_FALLBACK 0x00200000L
1568 /* keep in sync with the above */
1569 #define GETSET_ALL (0 \
1570 /* GETSET_LED_POWER */ | 0x00000001L \
1571 /* GETSET_STATION_ID */ | 0x00000002L \
1572 /* SET_TEMPLATES */ | 0x00000004L \
1573 /* SET_STA_LIST */ | 0x00000008L \
1574 /* GETSET_TX */ | 0x00000010L \
1575 /* GETSET_RX */ | 0x00000020L \
1576 /* SET_RXCONFIG */ | 0x00000040L \
1577 /* GETSET_ANTENNA */ | 0x00000080L \
1578 /* GETSET_SENSITIVITY */| 0x00000100L \
1579 /* GETSET_TXPOWER */ | 0x00000200L \
1580 /* GETSET_ED_THRESH */ | 0x00000400L \
1581 /* GETSET_CCA */ | 0x00000800L \
1582 /* GETSET_POWER_80211 */| 0x00001000L \
1583 /* GETSET_RETRY */ | 0x00002000L \
1584 /* GETSET_REG_DOMAIN */ | 0x00004000L \
1585 /* GETSET_CHANNEL */ | 0x00008000L \
1586 /* GETSET_RESCAN */ | 0x00010000L \
1587 /* GETSET_MODE */ | 0x00020000L \
1588 /* GETSET_WEP */ | 0x00040000L \
1589 /* SET_WEP_OPTIONS */ | 0x00080000L \
1590 /* SET_MSDU_LIFETIME */ | 0x00100000L \
1591 /* SET_RATE_FALLBACK */ | 0x00200000L \
1594 /***********************************************************************
1596 typedef struct acx100_ie_memblocksize {
1597 u16 type;
1598 u16 len;
1599 u16 size;
1600 } ACX_PACKED acx100_ie_memblocksize_t;
1602 typedef struct acx100_ie_queueconfig {
1603 u16 type;
1604 u16 len;
1605 u32 AreaSize;
1606 u32 RxQueueStart;
1607 u8 QueueOptions;
1608 u8 NumTxQueues;
1609 u8 NumRxDesc; /* for USB only */
1610 u8 pad1;
1611 u32 QueueEnd;
1612 u32 HostQueueEnd; /* QueueEnd2 */
1613 u32 TxQueueStart;
1614 u8 TxQueuePri;
1615 u8 NumTxDesc;
1616 u16 pad2;
1617 } ACX_PACKED acx100_ie_queueconfig_t;
1619 typedef struct acx111_ie_queueconfig {
1620 u16 type;
1621 u16 len;
1622 u32 tx_memory_block_address;
1623 u32 rx_memory_block_address;
1624 u32 rx1_queue_address;
1625 u32 reserved1;
1626 u32 tx1_queue_address;
1627 u8 tx1_attributes;
1628 u16 reserved2;
1629 u8 reserved3;
1630 } ACX_PACKED acx111_ie_queueconfig_t;
1632 typedef struct acx100_ie_memconfigoption {
1633 u16 type;
1634 u16 len;
1635 u32 DMA_config;
1636 acx_ptr pRxHostDesc;
1637 u32 rx_mem;
1638 u32 tx_mem;
1639 u16 RxBlockNum;
1640 u16 TxBlockNum;
1641 } ACX_PACKED acx100_ie_memconfigoption_t;
1643 typedef struct acx111_ie_memoryconfig {
1644 u16 type;
1645 u16 len;
1646 u16 no_of_stations;
1647 u16 memory_block_size;
1648 u8 tx_rx_memory_block_allocation;
1649 u8 count_rx_queues;
1650 u8 count_tx_queues;
1651 u8 options;
1652 u8 fragmentation;
1653 u16 reserved1;
1654 u8 reserved2;
1656 /* start of rx1 block */
1657 u8 rx_queue1_count_descs;
1658 u8 rx_queue1_reserved1;
1659 u8 rx_queue1_type; /* must be set to 7 */
1660 u8 rx_queue1_prio; /* must be set to 0 */
1661 acx_ptr rx_queue1_host_rx_start;
1662 /* end of rx1 block */
1664 /* start of tx1 block */
1665 u8 tx_queue1_count_descs;
1666 u8 tx_queue1_reserved1;
1667 u8 tx_queue1_reserved2;
1668 u8 tx_queue1_attributes;
1669 /* end of tx1 block */
1670 } ACX_PACKED acx111_ie_memoryconfig_t;
1672 typedef struct acx_ie_memmap {
1673 u16 type;
1674 u16 len;
1675 u32 CodeStart;
1676 u32 CodeEnd;
1677 u32 WEPCacheStart;
1678 u32 WEPCacheEnd;
1679 u32 PacketTemplateStart;
1680 u32 PacketTemplateEnd;
1681 u32 QueueStart;
1682 u32 QueueEnd;
1683 u32 PoolStart;
1684 u32 PoolEnd;
1685 } ACX_PACKED acx_ie_memmap_t;
1687 typedef struct acx111_ie_feature_config {
1688 u16 type;
1689 u16 len;
1690 u32 feature_options;
1691 u32 data_flow_options;
1692 } ACX_PACKED acx111_ie_feature_config_t;
1694 typedef struct acx111_ie_tx_level {
1695 u16 type;
1696 u16 len;
1697 u8 level;
1698 } ACX_PACKED acx111_ie_tx_level_t;
1700 #define PS_CFG_ENABLE 0x80
1701 #define PS_CFG_PENDING 0x40 /* status flag when entering PS */
1702 #define PS_CFG_WAKEUP_MODE_MASK 0x07
1703 #define PS_CFG_WAKEUP_BY_HOST 0x03
1704 #define PS_CFG_WAKEUP_EACH_ITVL 0x02
1705 #define PS_CFG_WAKEUP_ON_DTIM 0x01
1706 #define PS_CFG_WAKEUP_ALL_BEAC 0x00
1708 /* Enhanced PS mode: sleep until Rx Beacon w/ the STA's AID bit set
1709 ** in the TIM; newer firmwares only(?) */
1710 #define PS_OPT_ENA_ENHANCED_PS 0x04
1711 #define PS_OPT_TX_PSPOLL 0x02 /* send PSPoll frame to fetch waiting frames from AP (on frame with matching AID) */
1712 #define PS_OPT_STILL_RCV_BCASTS 0x01
1714 typedef struct acx100_ie_powersave {
1715 u16 type;
1716 u16 len;
1717 u8 wakeup_cfg;
1718 u8 listen_interval; /* for EACH_ITVL: wake up every "beacon units" interval */
1719 u8 options;
1720 u8 hangover_period; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1721 u16 enhanced_ps_transition_time; /* rem. wake time for Enh. PS */
1722 } ACX_PACKED acx100_ie_powersave_t;
1724 typedef struct acx111_ie_powersave {
1725 u16 type;
1726 u16 len;
1727 u8 wakeup_cfg;
1728 u8 listen_interval; /* for EACH_ITVL: wake up every "beacon units" interval */
1729 u8 options;
1730 u8 hangover_period; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1731 u32 beacon_rx_time;
1732 u32 enhanced_ps_transition_time; /* rem. wake time for Enh. PS */
1733 } ACX_PACKED acx111_ie_powersave_t;
1736 /***********************************************************************
1737 ** Commands and template structures
1741 ** SCAN command structure
1743 ** even though acx100 scan rates match RATE100 constants,
1744 ** acx111 ones do not match! Therefore we do not use RATE100 #defines */
1745 #define ACX_SCAN_RATE_1 10
1746 #define ACX_SCAN_RATE_2 20
1747 #define ACX_SCAN_RATE_5 55
1748 #define ACX_SCAN_RATE_11 110
1749 #define ACX_SCAN_RATE_22 220
1750 #define ACX_SCAN_RATE_PBCC 0x80 /* OR with this if needed */
1751 #define ACX_SCAN_OPT_ACTIVE 0x00 /* a bit mask */
1752 #define ACX_SCAN_OPT_PASSIVE 0x01
1753 /* Background scan: we go into Power Save mode (by transmitting
1754 ** NULL data frame to AP with the power mgmt bit set), do the scan,
1755 ** and then exit Power Save mode. A plus is that AP buffers frames
1756 ** for us while we do background scan. Thus we avoid frame losses.
1757 ** Background scan can be active or passive, just like normal one */
1758 #define ACX_SCAN_OPT_BACKGROUND 0x02
1759 typedef struct acx100_scan {
1760 u16 count; /* number of scans to do, 0xffff == continuous */
1761 u16 start_chan;
1762 u16 flags; /* channel list mask; 0x8000 == all channels? */
1763 u8 max_rate; /* max. probe rate */
1764 u8 options; /* bit mask, see defines above */
1765 u16 chan_duration;
1766 u16 max_probe_delay;
1767 } ACX_PACKED acx100_scan_t; /* length 0xc */
1769 #define ACX111_SCAN_RATE_6 0x0B
1770 #define ACX111_SCAN_RATE_9 0x0F
1771 #define ACX111_SCAN_RATE_12 0x0A
1772 #define ACX111_SCAN_RATE_18 0x0E
1773 #define ACX111_SCAN_RATE_24 0x09
1774 #define ACX111_SCAN_RATE_36 0x0D
1775 #define ACX111_SCAN_RATE_48 0x08
1776 #define ACX111_SCAN_RATE_54 0x0C
1777 #define ACX111_SCAN_OPT_5GHZ 0x04 /* else 2.4GHZ */
1778 #define ACX111_SCAN_MOD_SHORTPRE 0x01 /* you can combine SHORTPRE and PBCC */
1779 #define ACX111_SCAN_MOD_PBCC 0x80
1780 #define ACX111_SCAN_MOD_OFDM 0x40
1781 typedef struct acx111_scan {
1782 u16 count; /* number of scans to do */
1783 u8 channel_list_select; /* 0: scan all channels, 1: from chan_list only */
1784 u16 reserved1;
1785 u8 reserved2;
1786 u8 rate; /* rate for probe requests (if active scan) */
1787 u8 options; /* bit mask, see defines above */
1788 u16 chan_duration; /* min time to wait for reply on one channel (in TU) */
1789 /* (active scan only) (802.11 section 11.1.3.2.2) */
1790 u16 max_probe_delay; /* max time to wait for reply on one channel (active scan) */
1791 /* time to listen on a channel (passive scan) */
1792 u8 modulation;
1793 u8 channel_list[26]; /* bits 7:0 first byte: channels 8:1 */
1794 /* bits 7:0 second byte: channels 16:9 */
1795 /* 26 bytes is enough to cover 802.11a */
1796 } ACX_PACKED acx111_scan_t;
1799 ** Radio calibration command structure
1801 typedef struct acx111_cmd_radiocalib {
1802 /* 0x80000000 == automatic calibration by firmware, according to interval;
1803 * bits 0..3: select calibration methods to go through:
1804 * calib based on DC, AfeDC, Tx mismatch, Tx equilization */
1805 u32 methods;
1806 u32 interval;
1807 } ACX_PACKED acx111_cmd_radiocalib_t;
1810 ** Packet template structures
1812 ** Packet templates store contents of Beacon, Probe response, Probe request,
1813 ** Null data frame, and TIM data frame. Firmware automatically transmits
1814 ** contents of template at appropriate time:
1815 ** - Beacon: when configured as AP or Ad-hoc
1816 ** - Probe response: when configured as AP or Ad-hoc, whenever
1817 ** a Probe request frame is received
1818 ** - Probe request: when host issues SCAN command (active)
1819 ** - Null data frame: when entering 802.11 power save mode
1820 ** - TIM data: at the end of Beacon frames (if no TIM template
1821 ** is configured, then transmits default TIM)
1822 ** NB:
1823 ** - size field must be set to size of actual template
1824 ** (NOT sizeof(struct) - templates are variable in length),
1825 ** size field is not itself counted.
1826 ** - members flagged with an asterisk must be initialized with host,
1827 ** rest must be zero filled.
1828 ** - variable length fields shown only in comments */
1829 typedef struct acx_template_tim {
1830 u16 size;
1831 u8 tim_eid; /* 00 1 TIM IE ID * */
1832 u8 len; /* 01 1 Length * */
1833 u8 dtim_cnt; /* 02 1 DTIM Count */
1834 u8 dtim_period; /* 03 1 DTIM Period */
1835 u8 bitmap_ctrl; /* 04 1 Bitmap Control * (except bit0) */
1836 /* 05 n Partial Virtual Bitmap * */
1837 u8 variable[0x100 - 1-1-1-1-1];
1838 } ACX_PACKED acx_template_tim_t;
1840 typedef struct acx_template_probereq {
1841 u16 size;
1842 u16 fc; /* 00 2 fc * */
1843 u16 dur; /* 02 2 Duration */
1844 u8 da[6]; /* 04 6 Destination Address * */
1845 u8 sa[6]; /* 0A 6 Source Address * */
1846 u8 bssid[6]; /* 10 6 BSSID * */
1847 u16 seq; /* 16 2 Sequence Control */
1848 /* 18 n SSID * */
1849 /* nn n Supported Rates * */
1850 u8 variable[0x44 - 2-2-6-6-6-2];
1851 } ACX_PACKED acx_template_probereq_t;
1853 typedef struct acx_template_proberesp {
1854 u16 size;
1855 u16 fc; /* 00 2 fc * (bits [15:12] and [10:8] per 802.11 section 7.1.3.1) */
1856 u16 dur; /* 02 2 Duration */
1857 u8 da[6]; /* 04 6 Destination Address */
1858 u8 sa[6]; /* 0A 6 Source Address */
1859 u8 bssid[6]; /* 10 6 BSSID */
1860 u16 seq; /* 16 2 Sequence Control */
1861 u8 timestamp[8];/* 18 8 Timestamp */
1862 u16 beacon_interval; /* 20 2 Beacon Interval * */
1863 u16 cap; /* 22 2 Capability Information * */
1864 /* 24 n SSID * */
1865 /* nn n Supported Rates * */
1866 /* nn 1 DS Parameter Set * */
1867 u8 variable[0x54 - 2-2-6-6-6-2-8-2-2];
1868 } ACX_PACKED acx_template_proberesp_t;
1869 #define acx_template_beacon_t acx_template_proberesp_t
1870 #define acx_template_beacon acx_template_proberesp
1872 typedef struct acx_template_nullframe {
1873 u16 size;
1874 struct ieee80211_hdr hdr;
1875 } ACX_PACKED acx_template_nullframe_t;
1879 ** JOIN command structure
1881 ** as opposed to acx100, acx111 dtim interval is AFTER rates_basic111.
1882 ** NOTE: took me about an hour to get !@#$%^& packing right --> struct packing is eeeeevil... */
1883 typedef struct acx_joinbss {
1884 u8 bssid[ETH_ALEN];
1885 u16 beacon_interval;
1886 union {
1887 struct {
1888 u8 dtim_interval;
1889 u8 rates_basic;
1890 u8 rates_supported;
1891 } ACX_PACKED acx100;
1892 struct {
1893 u16 rates_basic;
1894 u8 dtim_interval;
1895 } ACX_PACKED acx111;
1896 } ACX_PACKED u;
1897 u8 genfrm_txrate; /* generated frame (bcn, proberesp, RTS, PSpoll) tx rate */
1898 u8 genfrm_mod_pre; /* generated frame modulation/preamble:
1899 ** bit7: PBCC, bit6: OFDM (else CCK/DQPSK/DBPSK)
1900 ** bit5: short pre */
1901 u8 macmode; /* BSS Type, must be one of ACX_MODE_xxx */
1902 u8 channel;
1903 u8 essid_len;
1904 char essid[IW_ESSID_MAX_SIZE];
1905 } ACX_PACKED acx_joinbss_t;
1907 #define JOINBSS_RATES_1 0x01
1908 #define JOINBSS_RATES_2 0x02
1909 #define JOINBSS_RATES_5 0x04
1910 #define JOINBSS_RATES_11 0x08
1911 #define JOINBSS_RATES_22 0x10
1913 /* Looks like missing bits are used to indicate 11g rates!
1914 ** (it follows from the fact that constants below match 1:1 to RATE111_nn)
1915 ** This was actually seen! Look at that Assoc Request sent by acx111,
1916 ** it _does_ contain 11g rates in basic set:
1917 01:30:20.070772 Beacon (xxx) [1.0* 2.0* 5.5* 11.0* 6.0* 9.0* 12.0* 18.0* 24.0* 36.0* 48.0* 54.0* Mbit] ESS CH: 1
1918 01:30:20.074425 Authentication (Open System)-1: Succesful
1919 01:30:20.076539 Authentication (Open System)-2:
1920 01:30:20.076620 Acknowledgment
1921 01:30:20.088546 Assoc Request (xxx) [1.0* 2.0* 5.5* 6.0* 9.0* 11.0* 12.0* 18.0* 24.0* 36.0* 48.0* 54.0* Mbit]
1922 01:30:20.122413 Assoc Response AID(1) :: Succesful
1923 01:30:20.122679 Acknowledgment
1924 01:30:20.173204 Beacon (xxx) [1.0* 2.0* 5.5* 11.0* 6.0* 9.0* 12.0* 18.0* 24.0* 36.0* 48.0* 54.0* Mbit] ESS CH: 1
1926 #define JOINBSS_RATES_BASIC111_1 0x0001
1927 #define JOINBSS_RATES_BASIC111_2 0x0002
1928 #define JOINBSS_RATES_BASIC111_5 0x0004
1929 #define JOINBSS_RATES_BASIC111_11 0x0020
1930 #define JOINBSS_RATES_BASIC111_22 0x0100
1933 /***********************************************************************
1935 typedef struct mem_read_write {
1936 u16 addr;
1937 u16 type; /* 0x0 int. RAM / 0xffff MAC reg. / 0x81 PHY RAM / 0x82 PHY reg.; or maybe it's actually 0x30 for MAC? Better verify it by writing and reading back and checking whether the value holds! */
1938 u32 len;
1939 u32 data;
1940 } ACX_PACKED mem_read_write_t;
1942 typedef struct firmware_image {
1943 u32 chksum;
1944 u32 size;
1945 u8 data[1]; /* the byte array of the actual firmware... */
1946 } ACX_PACKED firmware_image_t;
1948 typedef struct acx_cmd_radioinit {
1949 u32 offset;
1950 u32 len;
1951 } ACX_PACKED acx_cmd_radioinit_t;
1953 typedef struct acx100_ie_wep_options {
1954 u16 type;
1955 u16 len;
1956 u16 NumKeys; /* max # of keys */
1957 u8 WEPOption; /* 0 == decrypt default key only, 1 == override decrypt */
1958 u8 Pad; /* used only for acx111 */
1959 } ACX_PACKED acx100_ie_wep_options_t;
1961 typedef struct ie_dot11WEPDefaultKey {
1962 u16 type;
1963 u16 len;
1964 u8 action;
1965 u8 keySize;
1966 u8 defaultKeyNum;
1967 u8 key[29]; /* check this! was Key[19] */
1968 } ACX_PACKED ie_dot11WEPDefaultKey_t;
1970 typedef struct acx111WEPDefaultKey {
1971 u8 MacAddr[ETH_ALEN];
1972 u16 action; /* NOTE: this is a u16, NOT a u8!! */
1973 u16 reserved;
1974 u8 keySize;
1975 u8 type;
1976 u8 index;
1977 u8 defaultKeyNum;
1978 u8 counter[6];
1979 u8 key[32]; /* up to 32 bytes (for TKIP!) */
1980 } ACX_PACKED acx111WEPDefaultKey_t;
1982 typedef struct ie_dot11WEPDefaultKeyID {
1983 u16 type;
1984 u16 len;
1985 u8 KeyID;
1986 } ACX_PACKED ie_dot11WEPDefaultKeyID_t;
1988 typedef struct acx100_cmd_wep_mgmt {
1989 u8 MacAddr[ETH_ALEN];
1990 u16 Action;
1991 u16 KeySize;
1992 u8 Key[29]; /* 29*8 == 232bits == WEP256 */
1993 } ACX_PACKED acx100_cmd_wep_mgmt_t;
1995 typedef struct acx_ie_generic {
1996 u16 type;
1997 u16 len;
1998 union {
1999 /* Association ID IE: just a 16bit value: */
2000 u16 aid;
2001 /* generic member for quick implementation of commands */
2002 u8 bytes[32];
2003 } ACX_PACKED m;
2004 } ACX_PACKED acx_ie_generic_t;
2006 #define ACX_SEC_KEYSIZE 16
2007 /* Security algorithms. */
2008 enum {
2009 ACX_SEC_ALG,
2010 ACX_SEC_ALGO_NONE = 0, /* unencrypted, as of TX header. */
2011 ACX_SEC_ALGO_WEP,
2012 ACX_SEC_ALGO_UNKNOWN,
2013 ACX_SEC_ALGO_AES,
2014 ACX_SEC_ALGO_WEP104,
2015 ACX_SEC_ALGO_TKIP,
2017 /***********************************************************************
2019 #define CHECK_SIZEOF(type,size) { \
2020 extern void BUG_bad_size_for_##type(void); \
2021 if (sizeof(type)!=(size)) BUG_bad_size_for_##type(); \
2024 static inline void
2025 acx_struct_size_check(void)
2027 CHECK_SIZEOF(txdesc_t, 0x30);
2028 CHECK_SIZEOF(acx100_ie_memconfigoption_t, 24);
2029 CHECK_SIZEOF(acx100_ie_queueconfig_t, 0x20);
2030 CHECK_SIZEOF(acx_joinbss_t, 0x30);
2031 /* IEs need 4 bytes for (type,len) tuple */
2032 CHECK_SIZEOF(acx111_ie_configoption_t, ACX111_IE_CONFIG_OPTIONS_LEN + 4);
2036 /***********************************************************************
2037 ** Global data
2039 extern const u8 acx_bitpos2ratebyte[];
2040 extern const u8 acx_bitpos2rate100[];
2042 extern const u8 acx_reg_domain_ids[];
2043 extern const char * const acx_reg_domain_strings[];
2044 enum {
2045 acx_reg_domain_ids_len = 8
2048 //extern const struct iw_handler_def acx_ioctl_handler_def;