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