add build support for kernel 2.6.26
[acx-mac80211.git] / acx_struct.h
bloba2e5214269c769791da5c141c5073c750c617120
1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
3 * The ACX100 Open Source Project <acx100-devel@lists.sourceforge.net>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _ACX_STRUCT_H_
19 #define _ACX_STRUCT_H_
21 #include <linux/version.h>
22 #include "acx_firmware.h"
23 #include "acx_commands.h"
25 /***********************************************************************
26 ** Forward declarations of types
28 typedef struct tx tx_t;
29 typedef struct acx_device acx_device_t;
30 typedef struct client client_t;
31 typedef struct rxdesc rxdesc_t;
32 typedef struct txdesc txdesc_t;
33 typedef struct rxhostdesc rxhostdesc_t;
34 typedef struct txhostdesc txhostdesc_t;
37 /***********************************************************************
38 ** Debug / log functionality
40 enum {
41 L_LOCK = (ACX_DEBUG>1)*0x0001, /* locking debug log */
42 L_INIT = (ACX_DEBUG>0)*0x0002, /* special card initialization logging */
43 L_IRQ = (ACX_DEBUG>0)*0x0004, /* interrupt stuff */
44 L_ASSOC = (ACX_DEBUG>0)*0x0008, /* assocation (network join) and station log */
45 L_FUNC = (ACX_DEBUG>1)*0x0020, /* logging of function enter / leave */
46 L_XFER = (ACX_DEBUG>1)*0x0080, /* logging of transfers and mgmt */
47 L_DATA = (ACX_DEBUG>1)*0x0100, /* logging of transfer data */
48 L_DEBUG = (ACX_DEBUG>1)*0x0200, /* log of debug info */
49 L_IOCTL = (ACX_DEBUG>0)*0x0400, /* log ioctl calls */
50 L_CTL = (ACX_DEBUG>1)*0x0800, /* log of low-level ctl commands */
51 L_BUFR = (ACX_DEBUG>1)*0x1000, /* debug rx buffer mgmt (ring buffer etc.) */
52 L_XFER_BEACON = (ACX_DEBUG>1)*0x2000, /* also log beacon packets */
53 L_BUFT = (ACX_DEBUG>1)*0x4000, /* debug tx buffer mgmt (ring buffer etc.) */
54 L_USBRXTX = (ACX_DEBUG>0)*0x8000, /* debug USB rx/tx operations */
55 L_BUF = L_BUFR + L_BUFT,
56 L_ANY = 0xffff
59 #if ACX_DEBUG
60 extern unsigned int acx_debug;
61 #else
62 enum { acx_debug = 0 };
63 #endif
66 /***********************************************************************
67 ** Random helpers
69 #define ACX_PACKED __attribute__ ((packed))
71 /***********************************************************************
72 ** Constants
74 #define OK 0
75 #define NOT_OK 1
77 /* The supported chip models */
78 #define CHIPTYPE_ACX100 1
79 #define CHIPTYPE_ACX111 2
81 #define IS_ACX100(adev) ((adev)->chip_type == CHIPTYPE_ACX100)
82 #define IS_ACX111(adev) ((adev)->chip_type == CHIPTYPE_ACX111)
84 /* Supported interfaces */
85 #define DEVTYPE_PCI 0
86 #define DEVTYPE_USB 1
88 #if !(defined(CONFIG_ACX_MAC80211_PCI) || defined(CONFIG_ACX_MAC80211_USB))
89 #error Driver must include PCI and/or USB support. You selected neither.
90 #endif
92 #if defined(CONFIG_ACX_MAC80211_PCI)
93 #if !defined(CONFIG_ACX_MAC80211_USB)
94 #define IS_PCI(adev) 1
95 #else
96 #define IS_PCI(adev) ((adev)->dev_type == DEVTYPE_PCI)
97 #endif
98 #else
99 #define IS_PCI(adev) 0
100 #endif
102 #if defined(CONFIG_ACX_MAC80211_USB)
103 #if !defined(CONFIG_ACX_MAC80211_PCI)
104 #define IS_USB(adev) 1
105 #else
106 #define IS_USB(adev) ((adev)->dev_type == DEVTYPE_USB)
107 #endif
108 #else
109 #define IS_USB(adev) 0
110 #endif
112 /* Driver defaults */
113 #define DEFAULT_DTIM_INTERVAL 10
114 /* used to be 2048, but FreeBSD driver changed it to 4096 to work properly
115 ** in noisy wlans */
116 #define DEFAULT_MSDU_LIFETIME 4096
117 #define DEFAULT_RTS_THRESHOLD 2312 /* max. size: disable RTS mechanism */
118 #define DEFAULT_BEACON_INTERVAL 100
120 #define ACX100_BAP_DATALEN_MAX 4096
121 #define ACX100_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */
122 #define ACX100_RIDDATA_MAXLEN ACX100_RID_GUESSING_MAXLEN
124 /* Support Constants */
125 /* Radio type names, found in Win98 driver's TIACXLN.INF */
126 #define RADIO_MAXIM_0D 0x0d
127 #define RADIO_RFMD_11 0x11
128 #define RADIO_RALINK_15 0x15
129 /* used in ACX111 cards (WG311v2, WL-121, ...): */
130 #define RADIO_RADIA_16 0x16
131 /* most likely *sometimes* used in ACX111 cards: */
132 #define RADIO_UNKNOWN_17 0x17
133 /* FwRad19.bin was found in a Safecom driver; must be an ACX111 radio: */
134 #define RADIO_UNKNOWN_19 0x19
135 #define RADIO_UNKNOWN_1B 0x1b /* radio in SafeCom SWLUT-54125 USB adapter; entirely unknown!! */
138 /***********************************************************************
139 ** Tx/Rx buffer sizes and watermarks
141 ** This will alloc and use DMAable buffers of
142 ** WLAN_A4FR_MAXLEN_WEP_FCS * (RX_CNT + TX_CNT) bytes
143 ** RX/TX_CNT=32 -> ~150k DMA buffers
144 ** RX/TX_CNT=16 -> ~75k DMA buffers
146 ** 2005-10-10: reduced memory usage by lowering both to 16
148 #define RX_CNT 16
149 #define TX_CNT 16
151 /* we clean up txdescs when we have N free txdesc: */
152 #define TX_CLEAN_BACKLOG (TX_CNT/4)
153 #define TX_START_CLEAN (TX_CNT - TX_CLEAN_BACKLOG)
154 #define TX_EMERG_CLEAN 2
155 /* we stop queue if we have < N free txbufs: */
156 #define TX_STOP_QUEUE 3
157 /* we start queue if we have >= N free txbufs: */
158 #define TX_START_QUEUE 5
161 /***********************************************************************
162 **Information Frames Structures
165 /* Used in beacon frames and the like */
166 #define DOT11RATEBYTE_1 (1*2)
167 #define DOT11RATEBYTE_2 (2*2)
168 #define DOT11RATEBYTE_5_5 (5*2+1)
169 #define DOT11RATEBYTE_11 (11*2)
170 #define DOT11RATEBYTE_22 (22*2)
171 #define DOT11RATEBYTE_6_G (6*2)
172 #define DOT11RATEBYTE_9_G (9*2)
173 #define DOT11RATEBYTE_12_G (12*2)
174 #define DOT11RATEBYTE_18_G (18*2)
175 #define DOT11RATEBYTE_24_G (24*2)
176 #define DOT11RATEBYTE_36_G (36*2)
177 #define DOT11RATEBYTE_48_G (48*2)
178 #define DOT11RATEBYTE_54_G (54*2)
179 #define DOT11RATEBYTE_BASIC 0x80 /* flags rates included in basic rate set */
183 /***********************************************************************
184 ** Hardware structures
187 /* An opaque typesafe helper type
189 * Some hardware fields are actually pointers,
190 * but they have to remain u32, since using ptr instead
191 * (8 bytes on 64bit systems!) would disrupt the fixed descriptor
192 * format the acx firmware expects in the non-user area.
193 * Since we cannot cram an 8 byte ptr into 4 bytes, we need to
194 * enforce that pointed to data remains in low memory
195 * (address value needs to fit in 4 bytes) on 64bit systems.
197 * This is easy to get wrong, thus we are using a small struct
198 * and special macros to access it. Macros will check for
199 * attempts to overflow an acx_ptr with value > 0xffffffff.
201 * Attempts to use acx_ptr without macros result in compile-time errors */
203 typedef struct {
204 u32 v;
205 } __attribute__ ((packed)) acx_ptr;
207 #if ACX_DEBUG
208 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
209 #else
210 #define CHECK32(n) ((void)0)
211 #endif
213 /* acx_ptr <-> integer conversion */
214 #define cpu2acx(n) ({ CHECK32(n); ((acx_ptr){ .v = cpu_to_le32(n) }); })
215 #define acx2cpu(a) (le32_to_cpu(a.v))
217 /* acx_ptr <-> pointer conversion */
218 #define ptr2acx(p) ({ CHECK32(p); ((acx_ptr){ .v = cpu_to_le32((u32)(long)(p)) }); })
219 #define acx2ptr(a) ((void*)le32_to_cpu(a.v))
221 /* Values for rate field (acx100 only) */
222 #define RATE100_1 10
223 #define RATE100_2 20
224 #define RATE100_5 55
225 #define RATE100_11 110
226 #define RATE100_22 220
227 /* This bit denotes use of PBCC:
228 ** (PBCC encoding is usable with 11 and 22 Mbps speeds only) */
229 #define RATE100_PBCC511 0x80
231 /* Bit values for rate111 field */
232 #define RATE111_1 0x0001 /* DBPSK */
233 #define RATE111_2 0x0002 /* DQPSK */
234 #define RATE111_5 0x0004 /* CCK or PBCC */
235 #define RATE111_6 0x0008 /* CCK-OFDM or OFDM */
236 #define RATE111_9 0x0010 /* CCK-OFDM or OFDM */
237 #define RATE111_11 0x0020 /* CCK or PBCC */
238 #define RATE111_12 0x0040 /* CCK-OFDM or OFDM */
239 #define RATE111_18 0x0080 /* CCK-OFDM or OFDM */
240 #define RATE111_22 0x0100 /* PBCC */
241 #define RATE111_24 0x0200 /* CCK-OFDM or OFDM */
242 #define RATE111_36 0x0400 /* CCK-OFDM or OFDM */
243 #define RATE111_48 0x0800 /* CCK-OFDM or OFDM */
244 #define RATE111_54 0x1000 /* CCK-OFDM or OFDM */
245 #define RATE111_RESERVED 0x2000
246 #define RATE111_PBCC511 0x4000 /* PBCC mod at 5.5 or 11Mbit (else CCK) */
247 #define RATE111_SHORTPRE 0x8000 /* short preamble */
248 /* Special 'try everything' value */
249 #define RATE111_ALL 0x1fff
250 /* These bits denote acx100 compatible settings */
251 #define RATE111_ACX100_COMPAT 0x0127
252 /* These bits denote 802.11b compatible settings */
253 #define RATE111_80211B_COMPAT 0x0027
255 /* Descriptor Ctl field bits
256 * init value is 0x8e, "idle" value is 0x82 (in idle tx descs)
258 #define DESC_CTL_SHORT_PREAMBLE 0x01 /* preamble type: 0 = long; 1 = short */
259 #define DESC_CTL_FIRSTFRAG 0x02 /* this is the 1st frag of the frame */
260 #define DESC_CTL_AUTODMA 0x04
261 #define DESC_CTL_RECLAIM 0x08 /* ready to reuse */
262 #define DESC_CTL_HOSTDONE 0x20 /* host has finished processing */
263 #define DESC_CTL_ACXDONE 0x40 /* acx has finished processing */
264 /* host owns the desc [has to be released last, AFTER modifying all other desc fields!] */
265 #define DESC_CTL_HOSTOWN 0x80
266 #define DESC_CTL_ACXDONE_HOSTOWN (DESC_CTL_ACXDONE | DESC_CTL_HOSTOWN)
268 /* Descriptor Status field
270 #define DESC_STATUS_FULL (1 << 31)
272 /* NB: some bits may be interesting for Monitor mode tx (aka Raw tx): */
273 #define DESC_CTL2_SEQ 0x01 /* don't increase sequence field */
274 #define DESC_CTL2_FCS 0x02 /* don't add the FCS */
275 #define DESC_CTL2_MORE_FRAG 0x04
276 #define DESC_CTL2_RETRY 0x08 /* don't increase retry field */
277 #define DESC_CTL2_POWER 0x10 /* don't increase power mgmt. field */
278 #define DESC_CTL2_RTS 0x20 /* do RTS/CTS magic before sending */
279 #define DESC_CTL2_WEP 0x40 /* encrypt this frame */
280 #define DESC_CTL2_DUR 0x80 /* don't increase duration field */
282 /***********************************************************************
283 ** PCI structures
286 /* Outside of "#ifdef PCI" because USB needs to know sizeof()
287 ** of txdesc and rxdesc: */
288 struct txdesc {
289 acx_ptr pNextDesc; /* pointer to next txdesc */
290 acx_ptr HostMemPtr; /* 0x04 */
291 acx_ptr AcxMemPtr; /* 0x08 */
292 u32 tx_time; /* 0x0c */
293 u16 total_length; /* 0x10 */
294 u16 Reserved; /* 0x12 */
296 /* The following 16 bytes do not change when acx100 owns the descriptor */
297 /* BUG: fw clears last byte of this area which is supposedly reserved
298 ** for driver use. amd64 blew up. We dare not use it now */
299 u32 dummy[4];
301 u8 Ctl_8; /* 0x24, 8bit value */
302 u8 Ctl2_8; /* 0x25, 8bit value */
303 u8 error; /* 0x26 */
304 u8 ack_failures; /* 0x27 */
305 u8 rts_failures; /* 0x28 */
306 u8 rts_ok; /* 0x29 */
307 union {
308 struct {
309 u8 rate; /* 0x2a */
310 u8 queue_ctrl; /* 0x2b */
311 } __attribute__ ((packed)) r1;
312 struct {
313 u16 rate111; /* 0x2a */
314 } __attribute__ ((packed)) r2;
315 } __attribute__ ((packed)) u;
316 u32 queue_info; /* 0x2c (acx100, reserved on acx111) */
317 } __attribute__ ((packed)); /* size : 48 = 0x30 */
318 /* NB: acx111 txdesc structure is 4 byte larger */
319 /* All these 4 extra bytes are reserved. tx alloc code takes them into account */
321 struct rxdesc {
322 acx_ptr pNextDesc; /* 0x00 */
323 acx_ptr HostMemPtr; /* 0x04 */
324 acx_ptr ACXMemPtr; /* 0x08 */
325 u32 rx_time; /* 0x0c */
326 u16 total_length; /* 0x10 */
327 u16 WEP_length; /* 0x12 */
328 u32 WEP_ofs; /* 0x14 */
330 /* the following 16 bytes do not change when acx100 owns the descriptor */
331 u8 driverWorkspace[16]; /* 0x18 */
333 u8 Ctl_8;
334 u8 rate;
335 u8 error;
336 u8 SNR; /* Signal-to-Noise Ratio */
337 u8 RxLevel;
338 u8 queue_ctrl;
339 u16 unknown;
340 u32 unknown2;
341 } __attribute__ ((packed)); /* size 52 = 0x34 */
343 /***********************************************************************
344 ** rxbuffer_t
346 ** This is the format of rx data returned by acx
349 /* I've hoped it's a 802.11 PHY header, but no...
350 * so far, I've seen on acx111:
351 * 0000 3a00 0000 0000 IBSS Beacons
352 * 0000 3c00 0000 0000 ESS Beacons
353 * 0000 2700 0000 0000 Probe requests
354 * --vda
356 typedef struct phy_hdr {
357 u8 unknown[4];
358 u8 acx111_unknown[4];
359 } ACX_PACKED phy_hdr_t;
361 /* seems to be a bit similar to hfa384x_rx_frame.
362 * These fields are still not quite obvious, though.
363 * Some seem to have different meanings... */
365 #define RXBUF_HDRSIZE 12
366 #define RXBUF_BYTES_RCVD(adev, rxbuf) \
367 ((le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0xfff) - (adev)->phy_header_len)
368 #define RXBUF_BYTES_USED(rxbuf) \
369 ((le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0xfff) + RXBUF_HDRSIZE)
370 /* USBism */
371 #define RXBUF_IS_TXSTAT(rxbuf) (le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0x8000)
373 mac_cnt_rcvd:
374 12 bits: length of frame from control field to first byte of FCS
375 3 bits: reserved
376 1 bit: 1 = it's a tx status info, not a rx packet (USB only)
378 mac_cnt_mblks:
379 6 bits: number of memory block used to store frame in adapter memory
380 1 bit: Traffic Indicator bit in TIM of received Beacon was set
382 mac_status: 1 byte (bitmap):
383 7 Matching BSSID
384 6 Matching SSID
385 5 BDCST Address 1 field is a broadcast
386 4 VBM received beacon frame has more than one set bit (?!)
387 3 TIM Set bit representing this station is set in TIM of received beacon
388 2 GROUP Address 1 is a multicast
389 1 ADDR1 Address 1 matches our MAC
390 0 FCSGD FSC is good
392 phy_stat_baseband: 1 byte (bitmap):
393 7 Preamble frame had a long preamble
394 6 PLCP Error CRC16 error in PLCP header
395 5 Unsup_Mod unsupported modulation
396 4 Selected Antenna antenna 1 was used to receive this frame
397 3 PBCC/CCK frame used: 1=PBCC, 0=CCK modulation
398 2 OFDM frame used OFDM modulation
399 1 TI Protection protection frame was detected
400 0 Reserved
402 phy_plcp_signal: 1 byte:
403 Receive PLCP Signal field from the Baseband Processor
405 phy_level: 1 byte:
406 receive AGC gain level (can be used to measure receive signal strength)
408 phy_snr: 1 byte:
409 estimated noise power of equalized receive signal
410 at input of FEC decoder (can be used to measure receive signal quality)
412 time: 4 bytes:
413 timestamp sampled from either the Access Manager TSF counter
414 or free-running microsecond counter when the MAC receives
415 first byte of PLCP header.
418 typedef struct rxbuffer {
419 u16 mac_cnt_rcvd; /* only 12 bits are len! (0xfff) */
420 u8 mac_cnt_mblks;
421 u8 mac_status;
422 u8 phy_stat_baseband; /* bit 0x80: used LNA (Low-Noise Amplifier) */
423 u8 phy_plcp_signal;
424 u8 phy_level; /* PHY stat */
425 u8 phy_snr; /* PHY stat */
426 u32 time; /* timestamp upon MAC rcv first byte */
427 /* 4-byte (acx100) or 8-byte (acx111) phy header will be here
428 ** if RX_CFG1_INCLUDE_PHY_HDR is in effect:
429 ** phy_hdr_t phy */
430 struct ieee80211_hdr hdr_a3;
431 /* maximally sized data part of wlan packet */
432 u8 data_a3[30 + 2312 + 4 - 24]; /*WLAN_A4FR_MAXLEN_WEP_FCS - WLAN_HDR_A3_LEN]*/
433 /* can add hdr/data_a4 if needed */
434 } ACX_PACKED rxbuffer_t;
437 /*--- Firmware statistics ----------------------------------------------------*/
439 /* define a random 100 bytes more to catch firmware versions which
440 * provide a bigger struct */
441 #define FW_STATS_FUTURE_EXTENSION 100
442 #define FW_ID_SIZE 20
445 /*--- WEP stuff --------------------------------------------------------------*/
446 #define DOT11_MAX_DEFAULT_WEP_KEYS 4
448 /* non-firmware struct, no packing necessary */
449 typedef struct wep_key {
450 size_t size; /* most often used member first */
451 u8 index;
452 u8 key[29];
453 u16 strange_filler;
454 } wep_key_t; /* size = 264 bytes (33*8) */
455 /* FIXME: We don't have size 264! Or is there 2 bytes beyond the key
456 * (strange_filler)? */
458 /* non-firmware struct, no packing necessary */
459 typedef struct key_struct {
460 u8 addr[ETH_ALEN]; /* 0x00 */
461 u16 filler1; /* 0x06 */
462 u32 filler2; /* 0x08 */
463 u32 index; /* 0x0c */
464 u16 len; /* 0x10 */
465 u8 key[29]; /* 0x12; is this long enough??? */
466 } key_struct_t; /* size = 276. FIXME: where is the remaining space?? */
469 /*--- Client (peer) info -----------------------------------------------------*/
470 /* adev->sta_list[] is used for:
471 ** accumulating and processing of scan results
472 ** keeping client info in AP mode
473 ** keeping AP info in STA mode (AP is the only one 'client')
474 ** keeping peer info in ad-hoc mode
475 ** non-firmware struct --> no packing necessary */
476 enum {
477 CLIENT_EMPTY_SLOT_0 = 0,
478 CLIENT_EXIST_1 = 1,
479 CLIENT_AUTHENTICATED_2 = 2,
480 CLIENT_ASSOCIATED_3 = 3,
481 CLIENT_JOIN_CANDIDATE = 4
483 struct client {
484 /* most frequent access first */
485 u8 used; /* misnamed, more like 'status' */
486 struct client* next;
487 unsigned long mtime; /* last time we heard it, in jiffies */
488 size_t essid_len; /* length of ESSID (without '\0') */
489 u32 sir; /* Standard IR */
490 u32 snr; /* Signal to Noise Ratio */
491 u16 aid; /* association ID */
492 u16 seq; /* from client's auth req */
493 u16 auth_alg; /* from client's auth req */
494 u16 cap_info; /* from client's assoc req */
495 u16 rate_cap; /* what client supports (all rates) */
496 u16 rate_bas; /* what client supports (basic rates) */
497 u16 rate_cfg; /* what is allowed (by iwconfig etc) */
498 u16 rate_cur; /* currently used rate mask */
499 u8 rate_100; /* currently used rate byte (acx100 only) */
500 u8 address[ETH_ALEN];
501 u8 bssid[ETH_ALEN]; /* ad-hoc hosts can have bssid != mac */
502 u8 channel;
503 u8 auth_step;
504 u8 ignore_count;
505 u8 fallback_count;
506 u8 stepup_count;
507 char essid[IW_ESSID_MAX_SIZE + 1]; /* ESSID and trailing '\0' */
508 /* FIXME: this one is too damn big */
509 char challenge_text[128]; /*WLAN_CHALLENGE_LEN*/
514 /* Config Option structs */
516 typedef struct co_antennas {
517 u8 type;
518 u8 len;
519 u8 list[2];
520 } __attribute__ ((packed)) co_antennas_t;
522 typedef struct co_powerlevels {
523 u8 type;
524 u8 len;
525 u16 list[8];
526 } __attribute__ ((packed)) co_powerlevels_t;
528 typedef struct co_datarates {
529 u8 type;
530 u8 len;
531 u8 list[8];
532 } __attribute__ ((packed)) co_datarates_t;
534 typedef struct co_domains {
535 u8 type;
536 u8 len;
537 u8 list[6];
538 } __attribute__ ((packed)) co_domains_t;
540 typedef struct co_product_id {
541 u8 type;
542 u8 len;
543 u8 list[128];
544 } __attribute__ ((packed)) co_product_id_t;
546 typedef struct co_manuf_id {
547 u8 type;
548 u8 len;
549 u8 list[128];
550 } __attribute__ ((packed)) co_manuf_t;
552 typedef struct co_fixed {
553 char NVSv[8];
554 /* u16 NVS_vendor_offs; ACX111-only */
555 /* u16 unknown; ACX111-only */
556 u8 MAC[6]; /* ACX100-only */
557 u16 probe_delay; /* ACX100-only */
558 u32 eof_memory;
559 u8 dot11CCAModes;
560 u8 dot11Diversity;
561 u8 dot11ShortPreambleOption;
562 u8 dot11PBCCOption;
563 u8 dot11ChannelAgility;
564 u8 dot11PhyType; /* FIXME: does 802.11 call it "dot11PHYType"? */
565 u8 dot11TempType;
566 u8 table_count;
567 } __attribute__ ((packed)) co_fixed_t;
569 typedef struct acx111_ie_configoption {
570 u16 type;
571 u16 len;
572 /* Do not access below members directly, they are in fact variable length */
573 co_fixed_t fixed;
574 co_antennas_t antennas;
575 co_powerlevels_t power_levels;
576 co_datarates_t data_rates;
577 co_domains_t domains;
578 co_product_id_t product_id;
579 co_manuf_t manufacturer;
580 u8 _padding[4];
581 } __attribute__ ((packed)) acx111_ie_configoption_t;
583 /***********************************************************************
584 ** Hardware structures
587 /* An opaque typesafe helper type
589 * Some hardware fields are actually pointers,
590 * but they have to remain u32, since using ptr instead
591 * (8 bytes on 64bit systems!) would disrupt the fixed descriptor
592 * format the acx firmware expects in the non-user area.
593 * Since we cannot cram an 8 byte ptr into 4 bytes, we need to
594 * enforce that pointed to data remains in low memory
595 * (address value needs to fit in 4 bytes) on 64bit systems.
597 * This is easy to get wrong, thus we are using a small struct
598 * and special macros to access it. Macros will check for
599 * attempts to overflow an acx_ptr with value > 0xffffffff.
601 * Attempts to use acx_ptr without macros result in compile-time errors */
603 #if ACX_DEBUG
604 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
605 #else
606 #define CHECK32(n) ((void)0)
607 #endif
609 /* acx_ptr <-> integer conversion */
610 #define cpu2acx(n) ({ CHECK32(n); ((acx_ptr){ .v = cpu_to_le32(n) }); })
611 #define acx2cpu(a) (le32_to_cpu(a.v))
613 /* acx_ptr <-> pointer conversion */
614 #define ptr2acx(p) ({ CHECK32(p); ((acx_ptr){ .v = cpu_to_le32((u32)(long)(p)) }); })
615 #define acx2ptr(a) ((void*)le32_to_cpu(a.v))
617 /* Values for rate field (acx100 only) */
618 #define RATE100_1 10
619 #define RATE100_2 20
620 #define RATE100_5 55
621 #define RATE100_11 110
622 #define RATE100_22 220
623 /* This bit denotes use of PBCC:
624 ** (PBCC encoding is usable with 11 and 22 Mbps speeds only) */
625 #define RATE100_PBCC511 0x80
627 /* Bit values for rate111 field */
628 #define RATE111_1 0x0001 /* DBPSK */
629 #define RATE111_2 0x0002 /* DQPSK */
630 #define RATE111_5 0x0004 /* CCK or PBCC */
631 #define RATE111_6 0x0008 /* CCK-OFDM or OFDM */
632 #define RATE111_9 0x0010 /* CCK-OFDM or OFDM */
633 #define RATE111_11 0x0020 /* CCK or PBCC */
634 #define RATE111_12 0x0040 /* CCK-OFDM or OFDM */
635 #define RATE111_18 0x0080 /* CCK-OFDM or OFDM */
636 #define RATE111_22 0x0100 /* PBCC */
637 #define RATE111_24 0x0200 /* CCK-OFDM or OFDM */
638 #define RATE111_36 0x0400 /* CCK-OFDM or OFDM */
639 #define RATE111_48 0x0800 /* CCK-OFDM or OFDM */
640 #define RATE111_54 0x1000 /* CCK-OFDM or OFDM */
641 #define RATE111_RESERVED 0x2000
642 #define RATE111_PBCC511 0x4000 /* PBCC mod at 5.5 or 11Mbit (else CCK) */
643 #define RATE111_SHORTPRE 0x8000 /* short preamble */
644 /* Special 'try everything' value */
645 #define RATE111_ALL 0x1fff
646 /* These bits denote acx100 compatible settings */
647 #define RATE111_ACX100_COMPAT 0x0127
648 /* These bits denote 802.11b compatible settings */
649 #define RATE111_80211B_COMPAT 0x0027
651 /* Descriptor Ctl field bits
652 * init value is 0x8e, "idle" value is 0x82 (in idle tx descs)
654 #define DESC_CTL_SHORT_PREAMBLE 0x01 /* preamble type: 0 = long; 1 = short */
655 #define DESC_CTL_FIRSTFRAG 0x02 /* this is the 1st frag of the frame */
656 #define DESC_CTL_AUTODMA 0x04
657 #define DESC_CTL_RECLAIM 0x08 /* ready to reuse */
658 #define DESC_CTL_HOSTDONE 0x20 /* host has finished processing */
659 #define DESC_CTL_ACXDONE 0x40 /* acx has finished processing */
660 /* host owns the desc [has to be released last, AFTER modifying all other desc fields!] */
661 #define DESC_CTL_HOSTOWN 0x80
662 #define DESC_CTL_ACXDONE_HOSTOWN (DESC_CTL_ACXDONE | DESC_CTL_HOSTOWN)
664 /* Descriptor Status field
666 #define DESC_STATUS_FULL (1 << 31)
668 /* NB: some bits may be interesting for Monitor mode tx (aka Raw tx): */
669 #define DESC_CTL2_SEQ 0x01 /* don't increase sequence field */
670 #define DESC_CTL2_FCS 0x02 /* don't add the FCS */
671 #define DESC_CTL2_MORE_FRAG 0x04
672 #define DESC_CTL2_RETRY 0x08 /* don't increase retry field */
673 #define DESC_CTL2_POWER 0x10 /* don't increase power mgmt. field */
674 #define DESC_CTL2_RTS 0x20 /* do RTS/CTS magic before sending */
675 #define DESC_CTL2_WEP 0x40 /* encrypt this frame */
676 #define DESC_CTL2_DUR 0x80 /* don't increase duration field */
678 /***********************************************************************
679 ** PCI structures
681 /* IRQ Constants
682 ** (outside of "#ifdef PCI" because USB (mis)uses HOST_INT_SCAN_COMPLETE)
683 ** descriptions taken from BSD driver */
684 #define HOST_INT_RX_DATA 0x0001 /* IN: packet transferred from remote host to device */
685 #define HOST_INT_TX_COMPLETE 0x0002 /* OUT: packet transferred from device to remote host */
686 #define HOST_INT_TX_XFER 0x0004 /* OUT: packet transferred from host to device */
687 #define HOST_INT_RX_COMPLETE 0x0008 /* IN: packet transferred from device to host */
688 #define HOST_INT_DTIM 0x0010 /* not documented yet */
689 #define HOST_INT_BEACON 0x0020 /* not documented yet */
690 #define HOST_INT_TIMER 0x0040 /* not documented yet - in BSD driver: ACX_DEV_INTF_UNKNOWN1 */
691 #define HOST_INT_KEY_NOT_FOUND 0x0080 /* not documented yet - in BSD driver: ACX_DEV_INTF_UNKNOWN2 */
692 #define HOST_INT_IV_ICV_FAILURE 0x0100 /* not documented yet */
693 #define HOST_INT_CMD_COMPLETE 0x0200 /* not documented yet */
694 #define HOST_INT_INFO 0x0400 /* not documented yet */
695 #define HOST_INT_OVERFLOW 0x0800 /* not documented yet - in BSD driver: ACX_DEV_INTF_UNKNOWN3 */
696 #define HOST_INT_PROCESS_ERROR 0x1000 /* not documented yet - in BSD driver: ACX_DEV_INTF_UNKNOWN4 */
697 #define HOST_INT_SCAN_COMPLETE 0x2000 /* not documented yet */
698 #define HOST_INT_FCS_THRESHOLD 0x4000 /* not documented yet - in BSD driver: ACX_DEV_INTF_BOOT ??? */
699 #define HOST_INT_UNKNOWN 0x8000 /* not documented yet - in BSD driver: ACX_DEV_INTF_UNKNOWN5 */
701 /* Outside of "#ifdef PCI" because USB needs to know sizeof()
702 ** of txdesc and rxdesc: */
703 #ifdef ACX_MAC80211_PCI
705 /* Register I/O offsets */
706 #define ACX100_EEPROM_ID_OFFSET 0x380
708 /* please add further ACX hardware register definitions only when
709 it turns out you need them in the driver, and please try to use
710 firmware functionality instead, since using direct I/O access instead
711 of letting the firmware do it might confuse the firmware's state
712 machine */
714 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
715 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
718 * NOTE about IO_ACX_IRQ_REASON: this register is CLEARED ON READ.
720 enum {
721 IO_ACX_SOFT_RESET = 0,
723 IO_ACX_SLV_MEM_ADDR,
724 IO_ACX_SLV_MEM_DATA,
725 IO_ACX_SLV_MEM_CTL,
726 IO_ACX_SLV_END_CTL,
728 IO_ACX_FEMR, /* Function Event Mask */
730 IO_ACX_INT_TRIG,
731 IO_ACX_IRQ_MASK,
732 IO_ACX_IRQ_STATUS_NON_DES,
733 IO_ACX_IRQ_REASON,
734 IO_ACX_IRQ_ACK,
735 IO_ACX_HINT_TRIG,
737 IO_ACX_ENABLE,
739 IO_ACX_EEPROM_CTL,
740 IO_ACX_EEPROM_ADDR,
741 IO_ACX_EEPROM_DATA,
742 IO_ACX_EEPROM_CFG,
744 IO_ACX_PHY_ADDR,
745 IO_ACX_PHY_DATA,
746 IO_ACX_PHY_CTL,
748 IO_ACX_GPIO_OE,
750 IO_ACX_GPIO_OUT,
752 IO_ACX_CMD_MAILBOX_OFFS,
753 IO_ACX_INFO_MAILBOX_OFFS,
754 IO_ACX_EEPROM_INFORMATION,
756 IO_ACX_EE_START,
757 IO_ACX_SOR_CFG,
758 IO_ACX_ECPU_CTRL
760 /* ***** ABSOLUTELY ALWAYS KEEP OFFSETS IN SYNC WITH THE INITIALIZATION
761 ** OF THE I/O ARRAYS!!!! (grep for '^IO_ACX') ***** */
763 /* Values for IO_ACX_INT_TRIG register: */
764 /* inform hw that rxdesc in queue needs processing */
765 #define INT_TRIG_RXPRC 0x08
766 /* inform hw that txdesc in queue needs processing */
767 #define INT_TRIG_TXPRC 0x04
768 /* ack that we received info from info mailbox */
769 #define INT_TRIG_INFOACK 0x02
770 /* inform hw that we have filled command mailbox */
771 #define INT_TRIG_CMD 0x01
773 struct txhostdesc {
774 acx_ptr data_phy; /* 0x00 [u8 *] */
775 u16 data_offset; /* 0x04 */
776 u16 reserved; /* 0x06 */
777 u16 Ctl_16; /* 16bit value, endianness!! */
778 u16 length; /* 0x0a */
779 acx_ptr desc_phy_next; /* 0x0c [txhostdesc *] */
780 acx_ptr pNext; /* 0x10 [txhostdesc *] */
781 u32 Status; /* 0x14, unused on Tx */
782 /* From here on you can use this area as you want (variable length, too!) */
783 u8 *data;
784 struct ieee80211_tx_status txstatus;
785 struct sk_buff *skb;
787 } ACX_PACKED;
789 struct rxhostdesc {
790 acx_ptr data_phy; /* 0x00 [rxbuffer_t *] */
791 u16 data_offset; /* 0x04 */
792 u16 reserved; /* 0x06 */
793 u16 Ctl_16; /* 0x08; 16bit value, endianness!! */
794 u16 length; /* 0x0a */
795 acx_ptr desc_phy_next; /* 0x0c [rxhostdesc_t *] */
796 acx_ptr pNext; /* 0x10 [rxhostdesc_t *] */
797 u32 Status; /* 0x14 */
798 /* From here on you can use this area as you want (variable length, too!) */
799 rxbuffer_t *data;
800 } ACX_PACKED;
802 #endif /* ACX_PCI */
805 /***********************************************************************
806 ** USB structures and constants
808 #ifdef ACX_MAC80211_USB
810 /* Used for usb_txbuffer.desc field */
811 #define USB_TXBUF_TXDESC 0xA
812 /* Size of header (everything up to data[]) */
813 #define USB_TXBUF_HDRSIZE 14
814 typedef struct usb_txbuffer {
815 u16 desc;
816 u16 mpdu_len;
817 u8 queue_index;
818 u8 rate;
819 u32 hostdata;
820 u8 ctrl1;
821 u8 ctrl2;
822 u16 data_len;
823 /* wlan packet content is placed here: */
824 u8 data[30 + 2312 + 4]; /*WLAN_A4FR_MAXLEN_WEP_FCS]*/
825 } ACX_PACKED usb_txbuffer_t;
827 /* USB returns either rx packets (see rxbuffer) or
828 ** these "tx status" structs: */
829 typedef struct usb_txstatus {
830 u16 mac_cnt_rcvd; /* only 12 bits are len! (0xfff) */
831 u8 queue_index;
832 u8 mac_status; /* seen 0x20 on tx failure */
833 u32 hostdata;
834 u8 rate;
835 u8 ack_failures;
836 u8 rts_failures;
837 u8 rts_ok;
838 // struct ieee80211_tx_status txstatus;
839 // struct sk_buff *skb;
840 } ACX_PACKED usb_txstatus_t;
842 typedef struct usb_tx {
843 unsigned busy:1;
844 struct urb *urb;
845 acx_device_t *adev;
846 /* actual USB bulk output data block is here: */
847 usb_txbuffer_t bulkout;
848 } usb_tx_t;
850 struct usb_rx_plain {
851 unsigned busy:1;
852 struct urb *urb;
853 acx_device_t *adev;
854 rxbuffer_t bulkin;
857 typedef struct usb_rx {
858 unsigned busy:1;
859 struct urb *urb;
860 acx_device_t *adev;
861 rxbuffer_t bulkin;
862 /* Make entire structure 4k */
863 u8 padding[4*1024 - sizeof(struct usb_rx_plain)];
864 } usb_rx_t;
865 #endif /* ACX_USB */
867 /***********************************************************************
868 ** Main acx per-device data structure
870 #define ACX_STATE_FW_LOADED 0x01
871 #define ACX_STATE_IFACE_UP 0x02
873 /* MAC mode (BSS type) defines
874 * Note that they shouldn't be redefined, since they are also used
875 * during communication with firmware */
876 #define ACX_MODE_0_ADHOC 0
877 #define ACX_MODE_1_UNUSED 1
878 #define ACX_MODE_2_STA 2
879 #define ACX_MODE_3_AP 3
880 /* These are our own inventions. Sending these to firmware
881 ** makes it stop emitting beacons, which is exactly what we want
882 ** for these modes */
883 #define ACX_MODE_MONITOR 0xfe
884 #define ACX_MODE_OFF 0xff
885 /* 'Submode': identifies exact status of ADHOC/STA host */
886 #define ACX_STATUS_0_STOPPED 0
887 #define ACX_STATUS_1_SCANNING 1
888 #define ACX_STATUS_2_WAIT_AUTH 2
889 #define ACX_STATUS_3_AUTHENTICATED 3
890 #define ACX_STATUS_4_ASSOCIATED 4
892 /* FIXME: this should be named something like struct acx_priv (typedef'd to
893 * acx_priv_t) */
895 /* non-firmware struct, no packing necessary */
896 struct acx_device {
897 /* most frequent accesses first (dereferencing and cache line!) */
899 /*** Locking ***/
900 struct mutex mutex;
901 spinlock_t spinlock;
902 #if defined(PARANOID_LOCKING) /* Lock debugging */
903 const char *last_sem;
904 const char *last_lock;
905 unsigned long sem_time;
906 unsigned long lock_time;
907 #endif
909 /*** Linux network device ***/
910 //struct device *dev; /* pointer to linux netdevice */
912 /*** Device statistics ***/
913 struct ieee80211_low_level_stats ieee_stats; /* wireless device statistics */
915 /*** Device statistics ***/
916 struct net_device_stats stats; /* net device statistics */
918 #ifdef WIRELESS_EXT
919 // struct iw_statistics wstats; /* wireless statistics */
920 #endif
921 struct ieee80211_hw *ieee;
922 struct ieee80211_rx_status rx_status;
924 struct ieee80211_vif *vif;
926 /*** Power managment ***/
927 struct pm_dev *pm; /* PM crap */
929 /*** Management timer ***/
930 struct timer_list mgmt_timer;
932 /*** Hardware identification ***/
933 const char *chip_name;
934 u8 dev_type;
935 u8 chip_type;
936 u8 form_factor;
937 u8 radio_type;
938 u8 eeprom_version;
940 /*** Config retrieved from EEPROM ***/
941 char cfgopt_NVSv[8];
942 u16 cfgopt_NVS_vendor_offs;
943 u8 cfgopt_MAC[6];
944 u16 cfgopt_probe_delay;
945 u32 cfgopt_eof_memory;
946 u8 cfgopt_dot11CCAModes;
947 u8 cfgopt_dot11Diversity;
948 u8 cfgopt_dot11ShortPreambleOption;
949 u8 cfgopt_dot11PBCCOption;
950 u8 cfgopt_dot11ChannelAgility;
951 u8 cfgopt_dot11PhyType;
952 u8 cfgopt_dot11TempType;
953 co_antennas_t cfgopt_antennas;
954 co_powerlevels_t cfgopt_power_levels;
955 co_datarates_t cfgopt_data_rates;
956 co_domains_t cfgopt_domains;
957 co_product_id_t cfgopt_product_id;
958 co_manuf_t cfgopt_manufacturer;
960 /*** Firmware identification ***/
961 char firmware_version[FW_ID_SIZE+1];
962 u32 firmware_numver;
963 u32 firmware_id;
964 const u16 *ie_len;
965 const u16 *ie_len_dot11;
967 /*** Device state ***/
968 u16 dev_state_mask;
969 u8 led_power; /* power LED status */
970 u32 get_mask; /* mask of settings to fetch from the card */
971 u32 set_mask; /* mask of settings to write to the card */
972 u32 initialized:1;
973 /* Barely used in USB case */
974 u16 irq_status;
975 int irq_savedstate;
976 int irq_reason;
977 u8 after_interrupt_jobs; /* mini job list for doing actions after an interrupt occurred */
978 struct work_struct after_interrupt_task; /* our task for after interrupt actions */
980 unsigned int irq;
982 /*** scanning ***/
983 u16 scan_count; /* number of times to do channel scan */
984 u8 scan_mode; /* 0 == active, 1 == passive, 2 == background */
985 u8 scan_rate;
986 u16 scan_duration;
987 u16 scan_probe_delay;
988 #if WIRELESS_EXT > 15
989 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
990 #endif
992 /*** Virtual interface struct ***/
993 struct acx_interface interface;
995 /*** Wireless network settings ***/
996 /* copy of the device address (ifconfig hw ether) that we actually use
997 ** for 802.11; copied over from the network device's MAC address
998 ** (ifconfig) when it makes sense only */
999 u8 dev_addr[MAX_ADDR_LEN];
1000 u8 bssid[ETH_ALEN]; /* the BSSID after having joined */
1001 u8 ap[ETH_ALEN]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
1002 u16 aid; /* The Association ID sent from the AP / last used AID if we're an AP */
1003 u16 mode; /* mode from iwconfig */
1004 int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
1005 u16 status; /* 802.11 association status */
1006 u8 essid_active; /* specific ESSID active, or select any? */
1007 u8 essid_len; /* to avoid dozens of strlen() */
1008 /* INCLUDES \0 termination for easy printf - but many places
1009 ** simply want the string data memcpy'd plus a length indicator!
1010 ** Keep that in mind... */
1011 char essid[IW_ESSID_MAX_SIZE+1];
1012 /* essid we are going to use for association, in case of "essid 'any'"
1013 ** and in case of hidden ESSID (use configured ESSID then) */
1014 char essid_for_assoc[IW_ESSID_MAX_SIZE+1];
1015 char nick[IW_ESSID_MAX_SIZE+1]; /* see essid! */
1016 u8 channel;
1017 u8 reg_dom_id; /* reg domain setting */
1018 u16 reg_dom_chanmask;
1019 u16 auth_or_assoc_retries;
1020 u16 scan_retries;
1021 unsigned long scan_start; /* YES, jiffies is defined as "unsigned long" */
1024 /* MAC80211 Template Reference */
1025 struct sk_buff *beacon_cache;
1026 /* stations known to us (if we're an ap) */
1027 // client_t sta_list[32]; /* tab is larger than list, so that */
1028 // client_t *sta_hash_tab[64]; /* hash collisions are not likely */
1029 // client_t *ap_client; /* this one is our AP (STA mode only) */
1031 int dup_count;
1032 int nondup_count;
1033 unsigned long dup_msg_expiry;
1034 u16 last_seq_ctrl; /* duplicate packet detection */
1036 /* 802.11 power save mode */
1037 u8 ps_wakeup_cfg;
1038 u8 ps_listen_interval;
1039 u8 ps_options;
1040 u8 ps_hangover_period;
1041 u32 ps_enhanced_transition_time;
1042 u32 ps_beacon_rx_time;
1044 /*** PHY settings ***/
1045 u8 fallback_threshold;
1046 u8 stepup_threshold;
1047 u16 rate_basic;
1048 u16 rate_oper;
1049 u16 rate_bcast;
1050 u16 rate_bcast100;
1051 u8 rate_auto; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
1052 u8 preamble_mode; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
1053 u8 preamble_cur;
1055 u8 tx_disabled;
1056 u8 tx_level_dbm;
1057 /* u8 tx_level_val; */
1058 /* u8 tx_level_auto; whether to do automatic power adjustment */
1060 unsigned long recalib_time_last_success;
1061 unsigned long recalib_time_last_attempt;
1062 int recalib_failure_count;
1063 int recalib_msg_ratelimit;
1064 int retry_errors_msg_ratelimit;
1066 unsigned long brange_time_last_state_change; /* time the power LED was last changed */
1067 u8 brange_last_state; /* last state of the LED */
1068 u8 brange_max_quality; /* maximum quality that equates to full speed */
1070 u8 sensitivity;
1071 u8 antenna; /* antenna settings */
1072 u8 ed_threshold; /* energy detect threshold */
1073 u8 cca; /* clear channel assessment */
1075 u16 rts_threshold;
1076 u16 frag_threshold;
1077 u32 short_retry;
1078 u32 long_retry;
1079 u16 msdu_lifetime;
1080 u16 listen_interval; /* given in units of beacon interval */
1081 u32 beacon_interval;
1083 u16 capabilities;
1084 u8 rate_supported_len;
1085 u8 rate_supported[13];
1087 /*** Encryption settings (WEP) ***/
1088 u32 auth_alg; /* used in transmit_authen1 */
1089 u8 wep_enabled;
1090 u8 wep_restricted;
1091 u8 wep_current_index;
1092 wep_key_t wep_keys[DOT11_MAX_DEFAULT_WEP_KEYS]; /* the default WEP keys */
1094 key_struct_t wep_key_struct[10];
1096 /*** Encryption Replacement for mac80211 ***/
1097 struct acx_key key[54];
1098 u16 security_offset;
1099 u8 default_key_idx;
1102 /*** Unknown ***/
1103 u8 dtim_interval;
1105 /*** Card Rx/Tx management ***/
1106 u16 rx_config_1;
1107 u16 rx_config_2;
1108 u16 memblocksize;
1109 unsigned int tx_free;
1110 unsigned int tx_head; /* keep as close as possible to Tx stuff below (cache line) */
1111 u16 phy_header_len;
1113 /*************************************************************************
1114 *** PCI/USB/... must be last or else hw agnostic code breaks horribly ***
1115 *************************************************************************/
1117 /* hack to let common code compile. FIXME */
1118 dma_addr_t rxhostdesc_startphy;
1120 /*** PCI stuff ***/
1121 #ifdef ACX_MAC80211_PCI
1122 /* pointers to tx buffers, tx host descriptors (in host memory)
1123 ** and tx descs in device memory */
1124 unsigned int tx_tail;
1125 u8 *txbuf_start;
1126 txhostdesc_t *txhostdesc_start;
1127 txdesc_t *txdesc_start; /* points to PCI-mapped memory */
1128 dma_addr_t txbuf_startphy;
1129 dma_addr_t txhostdesc_startphy;
1130 /* sizes of above host memory areas */
1131 unsigned int txbuf_area_size;
1132 unsigned int txhostdesc_area_size;
1134 unsigned int txdesc_size; /* size of txdesc; ACX111 = ACX100 + 4 */
1135 client_t *txc[TX_CNT];
1136 u16 txr[TX_CNT];
1138 /* same for rx */
1139 unsigned int rx_tail;
1140 rxbuffer_t *rxbuf_start;
1141 rxhostdesc_t *rxhostdesc_start;
1142 rxdesc_t *rxdesc_start;
1143 /* physical addresses of above host memory areas */
1144 dma_addr_t rxbuf_startphy;
1145 /* dma_addr_t rxhostdesc_startphy; */
1146 unsigned int rxbuf_area_size;
1147 unsigned int rxhostdesc_area_size;
1149 u8 need_radio_fw;
1150 u8 irqs_active; /* whether irq sending is activated */
1152 const u16 *io; /* points to ACX100 or ACX111 PCI I/O register address set */
1154 #ifdef CONFIG_PCI
1155 struct pci_dev *pdev;
1156 #endif
1157 #ifdef CONFIG_VLYNQ
1158 struct vlynq_device *vdev;
1159 #endif
1160 struct device *bus_dev;
1161 unsigned long membase;
1162 unsigned long membase2;
1163 void __iomem *iobase;
1164 void __iomem *iobase2;
1165 /* command interface */
1166 u8 __iomem *cmd_area;
1167 u8 __iomem *info_area;
1169 u16 irq_mask; /* interrupt types to mask out (not wanted) with many IRQs activated */
1170 u16 irq_mask_off; /* interrupt types to mask out (not wanted) with IRQs off */
1171 unsigned int irq_loops_this_jiffy;
1172 unsigned long irq_last_jiffies;
1173 #endif
1175 /*** USB stuff ***/
1176 #ifdef ACX_MAC80211_USB
1177 struct usb_device *usbdev;
1179 rxbuffer_t rxtruncbuf;
1181 usb_tx_t *usb_tx;
1182 usb_rx_t *usb_rx;
1184 int bulkinep; /* bulk-in endpoint */
1185 int bulkoutep; /* bulk-out endpoint */
1186 int rxtruncsize;
1187 #endif
1193 static inline
1194 acx_device_t * ieee2adev(struct ieee80211_hw *hw)
1196 return hw->priv;
1200 /* For use with ACX1xx_IE_RXCONFIG */
1201 /* bit description
1202 * 13 include additional header (length etc.) *required*
1203 * struct is defined in 'struct rxbuffer'
1204 * is this bit acx100 only? does acx111 always put the header,
1205 * and bit setting is irrelevant? --vda
1206 * 10 receive frames only with SSID used in last join cmd
1207 * 9 discard broadcast
1208 * 8 receive packets for multicast address 1
1209 * 7 receive packets for multicast address 0
1210 * 6 discard all multicast packets
1211 * 5 discard frames from foreign BSSID
1212 * 4 discard frames with foreign destination MAC address
1213 * 3 promiscuous mode (receive ALL frames, disable filter)
1214 * 2 include FCS
1215 * 1 include phy header
1216 * 0 ???
1218 #define RX_CFG1_INCLUDE_RXBUF_HDR 0x2000 /* ACX100 only */
1219 #define RX_CFG1_FILTER_SSID 0x0400
1220 #define RX_CFG1_FILTER_BCAST 0x0200
1221 #define RX_CFG1_RCV_MC_ADDR1 0x0100
1222 #define RX_CFG1_RCV_MC_ADDR0 0x0080
1223 #define RX_CFG1_FILTER_ALL_MULTI 0x0040
1224 #define RX_CFG1_FILTER_BSSID 0x0020
1225 #define RX_CFG1_FILTER_MAC 0x0010
1226 #define RX_CFG1_RCV_PROMISCUOUS 0x0008
1227 #define RX_CFG1_INCLUDE_FCS 0x0004
1228 #define RX_CFG1_INCLUDE_PHY_HDR (WANT_PHY_HDR ? 0x0002 : 0)
1229 /* bit description
1230 * 11 receive association requests etc.
1231 * 10 receive authentication frames
1232 * 9 receive beacon frames
1233 * 8 receive contention free packets
1234 * 7 receive control frames
1235 * 6 receive data frames
1236 * 5 receive broken frames
1237 * 4 receive management frames
1238 * 3 receive probe requests
1239 * 2 receive probe responses
1240 * 1 receive RTS/CTS/ACK frames
1241 * 0 receive other
1243 #define RX_CFG2_RCV_ASSOC_REQ 0x0800
1244 #define RX_CFG2_RCV_AUTH_FRAMES 0x0400
1245 #define RX_CFG2_RCV_BEACON_FRAMES 0x0200
1246 #define RX_CFG2_RCV_CONTENTION_FREE 0x0100
1247 #define RX_CFG2_RCV_CTRL_FRAMES 0x0080
1248 #define RX_CFG2_RCV_DATA_FRAMES 0x0040
1249 #define RX_CFG2_RCV_BROKEN_FRAMES 0x0020
1250 #define RX_CFG2_RCV_MGMT_FRAMES 0x0010
1251 #define RX_CFG2_RCV_PROBE_REQ 0x0008
1252 #define RX_CFG2_RCV_PROBE_RESP 0x0004
1253 #define RX_CFG2_RCV_ACK_FRAMES 0x0002
1254 #define RX_CFG2_RCV_OTHER 0x0001
1256 /* For use with ACX1xx_IE_FEATURE_CONFIG */
1257 #define FEATURE1_80MHZ_CLOCK 0x00000040L
1258 #define FEATURE1_4X 0x00000020L
1259 #define FEATURE1_LOW_RX 0x00000008L
1260 #define FEATURE1_EXTRA_LOW_RX 0x00000001L
1262 #define FEATURE2_SNIFFER 0x00000080L
1263 #define FEATURE2_NO_TXCRYPT 0x00000001L
1265 /*-- get and set mask values --*/
1266 #define GETSET_LED_POWER 0x00000001L
1267 #define GETSET_STATION_ID 0x00000002L
1268 #define SET_TEMPLATES 0x00000004L
1269 #define SET_STA_LIST 0x00000008L
1270 #define GETSET_TX 0x00000010L
1271 #define GETSET_RX 0x00000020L
1272 #define SET_RXCONFIG 0x00000040L
1273 #define GETSET_ANTENNA 0x00000080L
1274 #define GETSET_SENSITIVITY 0x00000100L
1275 #define GETSET_TXPOWER 0x00000200L
1276 #define GETSET_ED_THRESH 0x00000400L
1277 #define GETSET_CCA 0x00000800L
1278 #define GETSET_POWER_80211 0x00001000L
1279 #define GETSET_RETRY 0x00002000L
1280 #define GETSET_REG_DOMAIN 0x00004000L
1281 #define GETSET_CHANNEL 0x00008000L
1282 /* Used when ESSID changes etc and we need to scan for AP anew */
1283 #define GETSET_RESCAN 0x00010000L
1284 #define GETSET_MODE 0x00020000L
1285 #define GETSET_WEP 0x00040000L
1286 #define SET_WEP_OPTIONS 0x00080000L
1287 #define SET_MSDU_LIFETIME 0x00100000L
1288 #define SET_RATE_FALLBACK 0x00200000L
1290 /* keep in sync with the above */
1291 #define GETSET_ALL (0 \
1292 /* GETSET_LED_POWER */ | 0x00000001L \
1293 /* GETSET_STATION_ID */ | 0x00000002L \
1294 /* SET_TEMPLATES */ | 0x00000004L \
1295 /* SET_STA_LIST */ | 0x00000008L \
1296 /* GETSET_TX */ | 0x00000010L \
1297 /* GETSET_RX */ | 0x00000020L \
1298 /* SET_RXCONFIG */ | 0x00000040L \
1299 /* GETSET_ANTENNA */ | 0x00000080L \
1300 /* GETSET_SENSITIVITY */| 0x00000100L \
1301 /* GETSET_TXPOWER */ | 0x00000200L \
1302 /* GETSET_ED_THRESH */ | 0x00000400L \
1303 /* GETSET_CCA */ | 0x00000800L \
1304 /* GETSET_POWER_80211 */| 0x00001000L \
1305 /* GETSET_RETRY */ | 0x00002000L \
1306 /* GETSET_REG_DOMAIN */ | 0x00004000L \
1307 /* GETSET_CHANNEL */ | 0x00008000L \
1308 /* GETSET_RESCAN */ | 0x00010000L \
1309 /* GETSET_MODE */ | 0x00020000L \
1310 /* GETSET_WEP */ | 0x00040000L \
1311 /* SET_WEP_OPTIONS */ | 0x00080000L \
1312 /* SET_MSDU_LIFETIME */ | 0x00100000L \
1313 /* SET_RATE_FALLBACK */ | 0x00200000L \
1316 /***********************************************************************
1318 typedef struct acx100_ie_memblocksize {
1319 u16 type;
1320 u16 len;
1321 u16 size;
1322 } ACX_PACKED acx100_ie_memblocksize_t;
1324 typedef struct acx100_ie_queueconfig {
1325 u16 type;
1326 u16 len;
1327 u32 AreaSize;
1328 u32 RxQueueStart;
1329 u8 QueueOptions;
1330 u8 NumTxQueues;
1331 u8 NumRxDesc; /* for USB only */
1332 u8 pad1;
1333 u32 QueueEnd;
1334 u32 HostQueueEnd; /* QueueEnd2 */
1335 u32 TxQueueStart;
1336 u8 TxQueuePri;
1337 u8 NumTxDesc;
1338 u16 pad2;
1339 } ACX_PACKED acx100_ie_queueconfig_t;
1341 typedef struct acx111_ie_queueconfig {
1342 u16 type;
1343 u16 len;
1344 u32 tx_memory_block_address;
1345 u32 rx_memory_block_address;
1346 u32 rx1_queue_address;
1347 u32 reserved1;
1348 u32 tx1_queue_address;
1349 u8 tx1_attributes;
1350 u16 reserved2;
1351 u8 reserved3;
1352 } ACX_PACKED acx111_ie_queueconfig_t;
1354 typedef struct acx100_ie_memconfigoption {
1355 u16 type;
1356 u16 len;
1357 u32 DMA_config;
1358 acx_ptr pRxHostDesc;
1359 u32 rx_mem;
1360 u32 tx_mem;
1361 u16 RxBlockNum;
1362 u16 TxBlockNum;
1363 } ACX_PACKED acx100_ie_memconfigoption_t;
1365 typedef struct acx111_ie_memoryconfig {
1366 u16 type;
1367 u16 len;
1368 u16 no_of_stations;
1369 u16 memory_block_size;
1370 u8 tx_rx_memory_block_allocation;
1371 u8 count_rx_queues;
1372 u8 count_tx_queues;
1373 u8 options;
1374 u8 fragmentation;
1375 u16 reserved1;
1376 u8 reserved2;
1378 /* start of rx1 block */
1379 u8 rx_queue1_count_descs;
1380 u8 rx_queue1_reserved1;
1381 u8 rx_queue1_type; /* must be set to 7 */
1382 u8 rx_queue1_prio; /* must be set to 0 */
1383 acx_ptr rx_queue1_host_rx_start;
1384 /* end of rx1 block */
1386 /* start of tx1 block */
1387 u8 tx_queue1_count_descs;
1388 u8 tx_queue1_reserved1;
1389 u8 tx_queue1_reserved2;
1390 u8 tx_queue1_attributes;
1391 /* end of tx1 block */
1392 } ACX_PACKED acx111_ie_memoryconfig_t;
1394 typedef struct acx_ie_memmap {
1395 u16 type;
1396 u16 len;
1397 u32 CodeStart;
1398 u32 CodeEnd;
1399 u32 WEPCacheStart;
1400 u32 WEPCacheEnd;
1401 u32 PacketTemplateStart;
1402 u32 PacketTemplateEnd;
1403 u32 QueueStart;
1404 u32 QueueEnd;
1405 u32 PoolStart;
1406 u32 PoolEnd;
1407 } ACX_PACKED acx_ie_memmap_t;
1409 typedef struct acx111_ie_feature_config {
1410 u16 type;
1411 u16 len;
1412 u32 feature_options;
1413 u32 data_flow_options;
1414 } ACX_PACKED acx111_ie_feature_config_t;
1416 typedef struct acx111_ie_tx_level {
1417 u16 type;
1418 u16 len;
1419 u8 level;
1420 } ACX_PACKED acx111_ie_tx_level_t;
1422 #define PS_CFG_ENABLE 0x80
1423 #define PS_CFG_PENDING 0x40 /* status flag when entering PS */
1424 #define PS_CFG_WAKEUP_MODE_MASK 0x07
1425 #define PS_CFG_WAKEUP_BY_HOST 0x03
1426 #define PS_CFG_WAKEUP_EACH_ITVL 0x02
1427 #define PS_CFG_WAKEUP_ON_DTIM 0x01
1428 #define PS_CFG_WAKEUP_ALL_BEAC 0x00
1430 /* Enhanced PS mode: sleep until Rx Beacon w/ the STA's AID bit set
1431 ** in the TIM; newer firmwares only(?) */
1432 #define PS_OPT_ENA_ENHANCED_PS 0x04
1433 #define PS_OPT_TX_PSPOLL 0x02 /* send PSPoll frame to fetch waiting frames from AP (on frame with matching AID) */
1434 #define PS_OPT_STILL_RCV_BCASTS 0x01
1436 typedef struct acx100_ie_powersave {
1437 u16 type;
1438 u16 len;
1439 u8 wakeup_cfg;
1440 u8 listen_interval; /* for EACH_ITVL: wake up every "beacon units" interval */
1441 u8 options;
1442 u8 hangover_period; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1443 u16 enhanced_ps_transition_time; /* rem. wake time for Enh. PS */
1444 } ACX_PACKED acx100_ie_powersave_t;
1446 typedef struct acx111_ie_powersave {
1447 u16 type;
1448 u16 len;
1449 u8 wakeup_cfg;
1450 u8 listen_interval; /* for EACH_ITVL: wake up every "beacon units" interval */
1451 u8 options;
1452 u8 hangover_period; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1453 u32 beacon_rx_time;
1454 u32 enhanced_ps_transition_time; /* rem. wake time for Enh. PS */
1455 } ACX_PACKED acx111_ie_powersave_t;
1458 /***********************************************************************
1459 ** Commands and template structures
1463 ** SCAN command structure
1465 ** even though acx100 scan rates match RATE100 constants,
1466 ** acx111 ones do not match! Therefore we do not use RATE100 #defines */
1467 #define ACX_SCAN_RATE_1 10
1468 #define ACX_SCAN_RATE_2 20
1469 #define ACX_SCAN_RATE_5 55
1470 #define ACX_SCAN_RATE_11 110
1471 #define ACX_SCAN_RATE_22 220
1472 #define ACX_SCAN_RATE_PBCC 0x80 /* OR with this if needed */
1473 #define ACX_SCAN_OPT_ACTIVE 0x00 /* a bit mask */
1474 #define ACX_SCAN_OPT_PASSIVE 0x01
1475 /* Background scan: we go into Power Save mode (by transmitting
1476 ** NULL data frame to AP with the power mgmt bit set), do the scan,
1477 ** and then exit Power Save mode. A plus is that AP buffers frames
1478 ** for us while we do background scan. Thus we avoid frame losses.
1479 ** Background scan can be active or passive, just like normal one */
1480 #define ACX_SCAN_OPT_BACKGROUND 0x02
1481 typedef struct acx100_scan {
1482 u16 count; /* number of scans to do, 0xffff == continuous */
1483 u16 start_chan;
1484 u16 flags; /* channel list mask; 0x8000 == all channels? */
1485 u8 max_rate; /* max. probe rate */
1486 u8 options; /* bit mask, see defines above */
1487 u16 chan_duration;
1488 u16 max_probe_delay;
1489 } ACX_PACKED acx100_scan_t; /* length 0xc */
1491 #define ACX111_SCAN_RATE_6 0x0B
1492 #define ACX111_SCAN_RATE_9 0x0F
1493 #define ACX111_SCAN_RATE_12 0x0A
1494 #define ACX111_SCAN_RATE_18 0x0E
1495 #define ACX111_SCAN_RATE_24 0x09
1496 #define ACX111_SCAN_RATE_36 0x0D
1497 #define ACX111_SCAN_RATE_48 0x08
1498 #define ACX111_SCAN_RATE_54 0x0C
1499 #define ACX111_SCAN_OPT_5GHZ 0x04 /* else 2.4GHZ */
1500 #define ACX111_SCAN_MOD_SHORTPRE 0x01 /* you can combine SHORTPRE and PBCC */
1501 #define ACX111_SCAN_MOD_PBCC 0x80
1502 #define ACX111_SCAN_MOD_OFDM 0x40
1503 typedef struct acx111_scan {
1504 u16 count; /* number of scans to do */
1505 u8 channel_list_select; /* 0: scan all channels, 1: from chan_list only */
1506 u16 reserved1;
1507 u8 reserved2;
1508 u8 rate; /* rate for probe requests (if active scan) */
1509 u8 options; /* bit mask, see defines above */
1510 u16 chan_duration; /* min time to wait for reply on one channel (in TU) */
1511 /* (active scan only) (802.11 section 11.1.3.2.2) */
1512 u16 max_probe_delay; /* max time to wait for reply on one channel (active scan) */
1513 /* time to listen on a channel (passive scan) */
1514 u8 modulation;
1515 u8 channel_list[26]; /* bits 7:0 first byte: channels 8:1 */
1516 /* bits 7:0 second byte: channels 16:9 */
1517 /* 26 bytes is enough to cover 802.11a */
1518 } ACX_PACKED acx111_scan_t;
1521 ** Radio calibration command structure
1523 typedef struct acx111_cmd_radiocalib {
1524 /* 0x80000000 == automatic calibration by firmware, according to interval;
1525 * bits 0..3: select calibration methods to go through:
1526 * calib based on DC, AfeDC, Tx mismatch, Tx equilization */
1527 u32 methods;
1528 u32 interval;
1529 } ACX_PACKED acx111_cmd_radiocalib_t;
1532 ** Packet template structures
1534 ** Packet templates store contents of Beacon, Probe response, Probe request,
1535 ** Null data frame, and TIM data frame. Firmware automatically transmits
1536 ** contents of template at appropriate time:
1537 ** - Beacon: when configured as AP or Ad-hoc
1538 ** - Probe response: when configured as AP or Ad-hoc, whenever
1539 ** a Probe request frame is received
1540 ** - Probe request: when host issues SCAN command (active)
1541 ** - Null data frame: when entering 802.11 power save mode
1542 ** - TIM data: at the end of Beacon frames (if no TIM template
1543 ** is configured, then transmits default TIM)
1544 ** NB:
1545 ** - size field must be set to size of actual template
1546 ** (NOT sizeof(struct) - templates are variable in length),
1547 ** size field is not itself counted.
1548 ** - members flagged with an asterisk must be initialized with host,
1549 ** rest must be zero filled.
1550 ** - variable length fields shown only in comments */
1551 typedef struct acx_template_tim {
1552 u16 size;
1553 u8 tim_eid; /* 00 1 TIM IE ID * */
1554 u8 len; /* 01 1 Length * */
1555 u8 dtim_cnt; /* 02 1 DTIM Count */
1556 u8 dtim_period; /* 03 1 DTIM Period */
1557 u8 bitmap_ctrl; /* 04 1 Bitmap Control * (except bit0) */
1558 /* 05 n Partial Virtual Bitmap * */
1559 u8 variable[0x100 - 1-1-1-1-1];
1560 } ACX_PACKED acx_template_tim_t;
1562 typedef struct acx_template_probereq {
1563 u16 size;
1564 u16 fc; /* 00 2 fc * */
1565 u16 dur; /* 02 2 Duration */
1566 u8 da[6]; /* 04 6 Destination Address * */
1567 u8 sa[6]; /* 0A 6 Source Address * */
1568 u8 bssid[6]; /* 10 6 BSSID * */
1569 u16 seq; /* 16 2 Sequence Control */
1570 /* 18 n SSID * */
1571 /* nn n Supported Rates * */
1572 u8 variable[0x44 - 2-2-6-6-6-2];
1573 } ACX_PACKED acx_template_probereq_t;
1575 typedef struct acx_template_proberesp {
1576 u16 size;
1577 u16 fc; /* 00 2 fc * (bits [15:12] and [10:8] per 802.11 section 7.1.3.1) */
1578 u16 dur; /* 02 2 Duration */
1579 u8 da[6]; /* 04 6 Destination Address */
1580 u8 sa[6]; /* 0A 6 Source Address */
1581 u8 bssid[6]; /* 10 6 BSSID */
1582 u16 seq; /* 16 2 Sequence Control */
1583 u8 timestamp[8];/* 18 8 Timestamp */
1584 u16 beacon_interval; /* 20 2 Beacon Interval * */
1585 u16 cap; /* 22 2 Capability Information * */
1586 /* 24 n SSID * */
1587 /* nn n Supported Rates * */
1588 /* nn 1 DS Parameter Set * */
1589 u8 variable[0x54 - 2-2-6-6-6-2-8-2-2];
1590 } ACX_PACKED acx_template_proberesp_t;
1591 #define acx_template_beacon_t acx_template_proberesp_t
1592 #define acx_template_beacon acx_template_proberesp
1594 typedef struct acx_template_nullframe {
1595 u16 size;
1596 struct ieee80211_hdr hdr;
1597 } ACX_PACKED acx_template_nullframe_t;
1601 ** JOIN command structure
1603 ** as opposed to acx100, acx111 dtim interval is AFTER rates_basic111.
1604 ** NOTE: took me about an hour to get !@#$%^& packing right --> struct packing is eeeeevil... */
1605 typedef struct acx_joinbss {
1606 u8 bssid[ETH_ALEN];
1607 u16 beacon_interval;
1608 union {
1609 struct {
1610 u8 dtim_interval;
1611 u8 rates_basic;
1612 u8 rates_supported;
1613 } ACX_PACKED acx100;
1614 struct {
1615 u16 rates_basic;
1616 u8 dtim_interval;
1617 } ACX_PACKED acx111;
1618 } ACX_PACKED u;
1619 u8 genfrm_txrate; /* generated frame (bcn, proberesp, RTS, PSpoll) tx rate */
1620 u8 genfrm_mod_pre; /* generated frame modulation/preamble:
1621 ** bit7: PBCC, bit6: OFDM (else CCK/DQPSK/DBPSK)
1622 ** bit5: short pre */
1623 u8 macmode; /* BSS Type, must be one of ACX_MODE_xxx */
1624 u8 channel;
1625 u8 essid_len;
1626 char essid[IW_ESSID_MAX_SIZE];
1627 } ACX_PACKED acx_joinbss_t;
1629 #define JOINBSS_RATES_1 0x01
1630 #define JOINBSS_RATES_2 0x02
1631 #define JOINBSS_RATES_5 0x04
1632 #define JOINBSS_RATES_11 0x08
1633 #define JOINBSS_RATES_22 0x10
1635 /* Looks like missing bits are used to indicate 11g rates!
1636 ** (it follows from the fact that constants below match 1:1 to RATE111_nn)
1637 ** This was actually seen! Look at that Assoc Request sent by acx111,
1638 ** it _does_ contain 11g rates in basic set:
1639 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
1640 01:30:20.074425 Authentication (Open System)-1: Succesful
1641 01:30:20.076539 Authentication (Open System)-2:
1642 01:30:20.076620 Acknowledgment
1643 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]
1644 01:30:20.122413 Assoc Response AID(1) :: Succesful
1645 01:30:20.122679 Acknowledgment
1646 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
1648 #define JOINBSS_RATES_BASIC111_1 0x0001
1649 #define JOINBSS_RATES_BASIC111_2 0x0002
1650 #define JOINBSS_RATES_BASIC111_5 0x0004
1651 #define JOINBSS_RATES_BASIC111_11 0x0020
1652 #define JOINBSS_RATES_BASIC111_22 0x0100
1655 /***********************************************************************
1657 typedef struct mem_read_write {
1658 u16 addr;
1659 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! */
1660 u32 len;
1661 u32 data;
1662 } ACX_PACKED mem_read_write_t;
1665 typedef struct acx_cmd_radioinit {
1666 u32 offset;
1667 u32 len;
1668 } ACX_PACKED acx_cmd_radioinit_t;
1670 typedef struct acx100_ie_wep_options {
1671 u16 type;
1672 u16 len;
1673 u16 NumKeys; /* max # of keys */
1674 u8 WEPOption; /* 0 == decrypt default key only, 1 == override decrypt */
1675 u8 Pad; /* used only for acx111 */
1676 } ACX_PACKED acx100_ie_wep_options_t;
1678 typedef struct ie_dot11WEPDefaultKey {
1679 u16 type;
1680 u16 len;
1681 u8 action;
1682 u8 keySize;
1683 u8 defaultKeyNum;
1684 u8 key[29]; /* check this! was Key[19] */
1685 } ACX_PACKED ie_dot11WEPDefaultKey_t;
1687 typedef struct acx111WEPDefaultKey {
1688 u8 MacAddr[ETH_ALEN];
1689 u16 action; /* NOTE: this is a u16, NOT a u8!! */
1690 u16 reserved;
1691 u8 keySize;
1692 u8 type;
1693 u8 index;
1694 u8 defaultKeyNum;
1695 u8 counter[6];
1696 u8 key[32]; /* up to 32 bytes (for TKIP!) */
1697 } ACX_PACKED acx111WEPDefaultKey_t;
1699 typedef struct ie_dot11WEPDefaultKeyID {
1700 u16 type;
1701 u16 len;
1702 u8 KeyID;
1703 } ACX_PACKED ie_dot11WEPDefaultKeyID_t;
1705 typedef struct acx100_cmd_wep_mgmt {
1706 u8 MacAddr[ETH_ALEN];
1707 u16 Action;
1708 u16 KeySize;
1709 u8 Key[29]; /* 29*8 == 232bits == WEP256 */
1710 } ACX_PACKED acx100_cmd_wep_mgmt_t;
1712 typedef struct acx_ie_generic {
1713 u16 type;
1714 u16 len;
1715 union {
1716 /* Association ID IE: just a 16bit value: */
1717 u16 aid;
1718 /* generic member for quick implementation of commands */
1719 u8 bytes[32];
1720 } ACX_PACKED m;
1721 } ACX_PACKED acx_ie_generic_t;
1723 #define ACX_SEC_KEYSIZE 16
1724 /* Security algorithms. */
1725 enum {
1726 ACX_SEC_ALG,
1727 ACX_SEC_ALGO_NONE = 0, /* unencrypted, as of TX header. */
1728 ACX_SEC_ALGO_WEP,
1729 ACX_SEC_ALGO_UNKNOWN,
1730 ACX_SEC_ALGO_AES,
1731 ACX_SEC_ALGO_WEP104,
1732 ACX_SEC_ALGO_TKIP,
1734 /***********************************************************************
1736 #define CHECK_SIZEOF(type,size) { \
1737 extern void BUG_bad_size_for_##type(void); \
1738 if (sizeof(type)!=(size)) BUG_bad_size_for_##type(); \
1741 static inline void
1742 acx_struct_size_check(void)
1744 CHECK_SIZEOF(txdesc_t, 0x30);
1745 CHECK_SIZEOF(acx100_ie_memconfigoption_t, 24);
1746 CHECK_SIZEOF(acx100_ie_queueconfig_t, 0x20);
1747 CHECK_SIZEOF(acx_joinbss_t, 0x30);
1748 /* IEs need 4 bytes for (type,len) tuple */
1749 CHECK_SIZEOF(acx111_ie_configoption_t, ACX111_IE_CONFIG_OPTIONS_LEN + 4);
1753 /***********************************************************************
1754 ** Global data
1756 extern const u8 acx_bitpos2ratebyte[];
1757 extern const u8 acx_bitpos2rate100[];
1759 extern const u8 acx_reg_domain_ids[];
1760 extern const char * const acx_reg_domain_strings[];
1761 enum {
1762 acx_reg_domain_ids_len = 8
1765 //extern const struct iw_handler_def acx_ioctl_handler_def;
1767 #endif /* _ACX_STRUCT_H_ */