Cleanups, Changelog additions, new release numbering scheme
[acx-mac80211.git] / acx_struct.h
blobd3a1d528de9f721fdf2f36445f4c8ee12988e91e
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_hw_mode modes[2];
923 struct ieee80211_rx_status rx_status;
925 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
926 struct ieee80211_vif *vif;
927 #endif
929 /*** Power managment ***/
930 struct pm_dev *pm; /* PM crap */
932 /*** Management timer ***/
933 struct timer_list mgmt_timer;
935 /*** Hardware identification ***/
936 const char *chip_name;
937 u8 dev_type;
938 u8 chip_type;
939 u8 form_factor;
940 u8 radio_type;
941 u8 eeprom_version;
943 /*** Config retrieved from EEPROM ***/
944 char cfgopt_NVSv[8];
945 u16 cfgopt_NVS_vendor_offs;
946 u8 cfgopt_MAC[6];
947 u16 cfgopt_probe_delay;
948 u32 cfgopt_eof_memory;
949 u8 cfgopt_dot11CCAModes;
950 u8 cfgopt_dot11Diversity;
951 u8 cfgopt_dot11ShortPreambleOption;
952 u8 cfgopt_dot11PBCCOption;
953 u8 cfgopt_dot11ChannelAgility;
954 u8 cfgopt_dot11PhyType;
955 u8 cfgopt_dot11TempType;
956 co_antennas_t cfgopt_antennas;
957 co_powerlevels_t cfgopt_power_levels;
958 co_datarates_t cfgopt_data_rates;
959 co_domains_t cfgopt_domains;
960 co_product_id_t cfgopt_product_id;
961 co_manuf_t cfgopt_manufacturer;
963 /*** Firmware identification ***/
964 char firmware_version[FW_ID_SIZE+1];
965 u32 firmware_numver;
966 u32 firmware_id;
967 const u16 *ie_len;
968 const u16 *ie_len_dot11;
970 /*** Device state ***/
971 u16 dev_state_mask;
972 u8 led_power; /* power LED status */
973 u32 get_mask; /* mask of settings to fetch from the card */
974 u32 set_mask; /* mask of settings to write to the card */
975 u32 initialized:1;
976 /* Barely used in USB case */
977 u16 irq_status;
978 int irq_savedstate;
979 int irq_reason;
980 u8 after_interrupt_jobs; /* mini job list for doing actions after an interrupt occurred */
981 struct work_struct after_interrupt_task; /* our task for after interrupt actions */
983 unsigned int irq;
985 /*** scanning ***/
986 u16 scan_count; /* number of times to do channel scan */
987 u8 scan_mode; /* 0 == active, 1 == passive, 2 == background */
988 u8 scan_rate;
989 u16 scan_duration;
990 u16 scan_probe_delay;
991 #if WIRELESS_EXT > 15
992 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
993 #endif
995 /*** Virtual interface struct ***/
996 struct acx_interface interface;
998 /*** Wireless network settings ***/
999 /* copy of the device address (ifconfig hw ether) that we actually use
1000 ** for 802.11; copied over from the network device's MAC address
1001 ** (ifconfig) when it makes sense only */
1002 u8 dev_addr[MAX_ADDR_LEN];
1003 u8 bssid[ETH_ALEN]; /* the BSSID after having joined */
1004 u8 ap[ETH_ALEN]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
1005 u16 aid; /* The Association ID sent from the AP / last used AID if we're an AP */
1006 u16 mode; /* mode from iwconfig */
1007 int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
1008 u16 status; /* 802.11 association status */
1009 u8 essid_active; /* specific ESSID active, or select any? */
1010 u8 essid_len; /* to avoid dozens of strlen() */
1011 /* INCLUDES \0 termination for easy printf - but many places
1012 ** simply want the string data memcpy'd plus a length indicator!
1013 ** Keep that in mind... */
1014 char essid[IW_ESSID_MAX_SIZE+1];
1015 /* essid we are going to use for association, in case of "essid 'any'"
1016 ** and in case of hidden ESSID (use configured ESSID then) */
1017 char essid_for_assoc[IW_ESSID_MAX_SIZE+1];
1018 char nick[IW_ESSID_MAX_SIZE+1]; /* see essid! */
1019 u8 channel;
1020 u8 reg_dom_id; /* reg domain setting */
1021 u16 reg_dom_chanmask;
1022 u16 auth_or_assoc_retries;
1023 u16 scan_retries;
1024 unsigned long scan_start; /* YES, jiffies is defined as "unsigned long" */
1027 /* MAC80211 Template Reference */
1028 struct sk_buff *beacon_cache;
1029 /* stations known to us (if we're an ap) */
1030 // client_t sta_list[32]; /* tab is larger than list, so that */
1031 // client_t *sta_hash_tab[64]; /* hash collisions are not likely */
1032 // client_t *ap_client; /* this one is our AP (STA mode only) */
1034 int dup_count;
1035 int nondup_count;
1036 unsigned long dup_msg_expiry;
1037 u16 last_seq_ctrl; /* duplicate packet detection */
1039 /* 802.11 power save mode */
1040 u8 ps_wakeup_cfg;
1041 u8 ps_listen_interval;
1042 u8 ps_options;
1043 u8 ps_hangover_period;
1044 u32 ps_enhanced_transition_time;
1045 u32 ps_beacon_rx_time;
1047 /*** PHY settings ***/
1048 u8 fallback_threshold;
1049 u8 stepup_threshold;
1050 u16 rate_basic;
1051 u16 rate_oper;
1052 u16 rate_bcast;
1053 u16 rate_bcast100;
1054 u8 rate_auto; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
1055 u8 preamble_mode; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
1056 u8 preamble_cur;
1058 u8 tx_disabled;
1059 u8 tx_level_dbm;
1060 /* u8 tx_level_val; */
1061 /* u8 tx_level_auto; whether to do automatic power adjustment */
1063 unsigned long recalib_time_last_success;
1064 unsigned long recalib_time_last_attempt;
1065 int recalib_failure_count;
1066 int recalib_msg_ratelimit;
1067 int retry_errors_msg_ratelimit;
1069 unsigned long brange_time_last_state_change; /* time the power LED was last changed */
1070 u8 brange_last_state; /* last state of the LED */
1071 u8 brange_max_quality; /* maximum quality that equates to full speed */
1073 u8 sensitivity;
1074 u8 antenna; /* antenna settings */
1075 u8 ed_threshold; /* energy detect threshold */
1076 u8 cca; /* clear channel assessment */
1078 u16 rts_threshold;
1079 u16 frag_threshold;
1080 u32 short_retry;
1081 u32 long_retry;
1082 u16 msdu_lifetime;
1083 u16 listen_interval; /* given in units of beacon interval */
1084 u32 beacon_interval;
1086 u16 capabilities;
1087 u8 rate_supported_len;
1088 u8 rate_supported[13];
1090 /*** Encryption settings (WEP) ***/
1091 u32 auth_alg; /* used in transmit_authen1 */
1092 u8 wep_enabled;
1093 u8 wep_restricted;
1094 u8 wep_current_index;
1095 wep_key_t wep_keys[DOT11_MAX_DEFAULT_WEP_KEYS]; /* the default WEP keys */
1097 key_struct_t wep_key_struct[10];
1099 /*** Encryption Replacement for mac80211 ***/
1100 struct acx_key key[54];
1101 u16 security_offset;
1102 u8 default_key_idx;
1105 /*** Unknown ***/
1106 u8 dtim_interval;
1108 /*** Card Rx/Tx management ***/
1109 u16 rx_config_1;
1110 u16 rx_config_2;
1111 u16 memblocksize;
1112 unsigned int tx_free;
1113 unsigned int tx_head; /* keep as close as possible to Tx stuff below (cache line) */
1114 u16 phy_header_len;
1116 /*************************************************************************
1117 *** PCI/USB/... must be last or else hw agnostic code breaks horribly ***
1118 *************************************************************************/
1120 /* hack to let common code compile. FIXME */
1121 dma_addr_t rxhostdesc_startphy;
1123 /*** PCI stuff ***/
1124 #ifdef ACX_MAC80211_PCI
1125 /* pointers to tx buffers, tx host descriptors (in host memory)
1126 ** and tx descs in device memory */
1127 unsigned int tx_tail;
1128 u8 *txbuf_start;
1129 txhostdesc_t *txhostdesc_start;
1130 txdesc_t *txdesc_start; /* points to PCI-mapped memory */
1131 dma_addr_t txbuf_startphy;
1132 dma_addr_t txhostdesc_startphy;
1133 /* sizes of above host memory areas */
1134 unsigned int txbuf_area_size;
1135 unsigned int txhostdesc_area_size;
1137 unsigned int txdesc_size; /* size of txdesc; ACX111 = ACX100 + 4 */
1138 client_t *txc[TX_CNT];
1139 u16 txr[TX_CNT];
1141 /* same for rx */
1142 unsigned int rx_tail;
1143 rxbuffer_t *rxbuf_start;
1144 rxhostdesc_t *rxhostdesc_start;
1145 rxdesc_t *rxdesc_start;
1146 /* physical addresses of above host memory areas */
1147 dma_addr_t rxbuf_startphy;
1148 /* dma_addr_t rxhostdesc_startphy; */
1149 unsigned int rxbuf_area_size;
1150 unsigned int rxhostdesc_area_size;
1152 u8 need_radio_fw;
1153 u8 irqs_active; /* whether irq sending is activated */
1155 const u16 *io; /* points to ACX100 or ACX111 PCI I/O register address set */
1157 #ifdef CONFIG_PCI
1158 struct pci_dev *pdev;
1159 #endif
1160 #ifdef CONFIG_VLYNQ
1161 struct vlynq_device *vdev;
1162 #endif
1163 struct device *bus_dev;
1164 unsigned long membase;
1165 unsigned long membase2;
1166 void __iomem *iobase;
1167 void __iomem *iobase2;
1168 /* command interface */
1169 u8 __iomem *cmd_area;
1170 u8 __iomem *info_area;
1172 u16 irq_mask; /* interrupt types to mask out (not wanted) with many IRQs activated */
1173 u16 irq_mask_off; /* interrupt types to mask out (not wanted) with IRQs off */
1174 unsigned int irq_loops_this_jiffy;
1175 unsigned long irq_last_jiffies;
1176 #endif
1178 /*** USB stuff ***/
1179 #ifdef ACX_MAC80211_USB
1180 struct usb_device *usbdev;
1182 rxbuffer_t rxtruncbuf;
1184 usb_tx_t *usb_tx;
1185 usb_rx_t *usb_rx;
1187 int bulkinep; /* bulk-in endpoint */
1188 int bulkoutep; /* bulk-out endpoint */
1189 int rxtruncsize;
1190 #endif
1196 static inline
1197 acx_device_t * ieee2adev(struct ieee80211_hw *hw)
1199 return hw->priv;
1203 /* For use with ACX1xx_IE_RXCONFIG */
1204 /* bit description
1205 * 13 include additional header (length etc.) *required*
1206 * struct is defined in 'struct rxbuffer'
1207 * is this bit acx100 only? does acx111 always put the header,
1208 * and bit setting is irrelevant? --vda
1209 * 10 receive frames only with SSID used in last join cmd
1210 * 9 discard broadcast
1211 * 8 receive packets for multicast address 1
1212 * 7 receive packets for multicast address 0
1213 * 6 discard all multicast packets
1214 * 5 discard frames from foreign BSSID
1215 * 4 discard frames with foreign destination MAC address
1216 * 3 promiscuous mode (receive ALL frames, disable filter)
1217 * 2 include FCS
1218 * 1 include phy header
1219 * 0 ???
1221 #define RX_CFG1_INCLUDE_RXBUF_HDR 0x2000 /* ACX100 only */
1222 #define RX_CFG1_FILTER_SSID 0x0400
1223 #define RX_CFG1_FILTER_BCAST 0x0200
1224 #define RX_CFG1_RCV_MC_ADDR1 0x0100
1225 #define RX_CFG1_RCV_MC_ADDR0 0x0080
1226 #define RX_CFG1_FILTER_ALL_MULTI 0x0040
1227 #define RX_CFG1_FILTER_BSSID 0x0020
1228 #define RX_CFG1_FILTER_MAC 0x0010
1229 #define RX_CFG1_RCV_PROMISCUOUS 0x0008
1230 #define RX_CFG1_INCLUDE_FCS 0x0004
1231 #define RX_CFG1_INCLUDE_PHY_HDR (WANT_PHY_HDR ? 0x0002 : 0)
1232 /* bit description
1233 * 11 receive association requests etc.
1234 * 10 receive authentication frames
1235 * 9 receive beacon frames
1236 * 8 receive contention free packets
1237 * 7 receive control frames
1238 * 6 receive data frames
1239 * 5 receive broken frames
1240 * 4 receive management frames
1241 * 3 receive probe requests
1242 * 2 receive probe responses
1243 * 1 receive RTS/CTS/ACK frames
1244 * 0 receive other
1246 #define RX_CFG2_RCV_ASSOC_REQ 0x0800
1247 #define RX_CFG2_RCV_AUTH_FRAMES 0x0400
1248 #define RX_CFG2_RCV_BEACON_FRAMES 0x0200
1249 #define RX_CFG2_RCV_CONTENTION_FREE 0x0100
1250 #define RX_CFG2_RCV_CTRL_FRAMES 0x0080
1251 #define RX_CFG2_RCV_DATA_FRAMES 0x0040
1252 #define RX_CFG2_RCV_BROKEN_FRAMES 0x0020
1253 #define RX_CFG2_RCV_MGMT_FRAMES 0x0010
1254 #define RX_CFG2_RCV_PROBE_REQ 0x0008
1255 #define RX_CFG2_RCV_PROBE_RESP 0x0004
1256 #define RX_CFG2_RCV_ACK_FRAMES 0x0002
1257 #define RX_CFG2_RCV_OTHER 0x0001
1259 /* For use with ACX1xx_IE_FEATURE_CONFIG */
1260 #define FEATURE1_80MHZ_CLOCK 0x00000040L
1261 #define FEATURE1_4X 0x00000020L
1262 #define FEATURE1_LOW_RX 0x00000008L
1263 #define FEATURE1_EXTRA_LOW_RX 0x00000001L
1265 #define FEATURE2_SNIFFER 0x00000080L
1266 #define FEATURE2_NO_TXCRYPT 0x00000001L
1268 /*-- get and set mask values --*/
1269 #define GETSET_LED_POWER 0x00000001L
1270 #define GETSET_STATION_ID 0x00000002L
1271 #define SET_TEMPLATES 0x00000004L
1272 #define SET_STA_LIST 0x00000008L
1273 #define GETSET_TX 0x00000010L
1274 #define GETSET_RX 0x00000020L
1275 #define SET_RXCONFIG 0x00000040L
1276 #define GETSET_ANTENNA 0x00000080L
1277 #define GETSET_SENSITIVITY 0x00000100L
1278 #define GETSET_TXPOWER 0x00000200L
1279 #define GETSET_ED_THRESH 0x00000400L
1280 #define GETSET_CCA 0x00000800L
1281 #define GETSET_POWER_80211 0x00001000L
1282 #define GETSET_RETRY 0x00002000L
1283 #define GETSET_REG_DOMAIN 0x00004000L
1284 #define GETSET_CHANNEL 0x00008000L
1285 /* Used when ESSID changes etc and we need to scan for AP anew */
1286 #define GETSET_RESCAN 0x00010000L
1287 #define GETSET_MODE 0x00020000L
1288 #define GETSET_WEP 0x00040000L
1289 #define SET_WEP_OPTIONS 0x00080000L
1290 #define SET_MSDU_LIFETIME 0x00100000L
1291 #define SET_RATE_FALLBACK 0x00200000L
1293 /* keep in sync with the above */
1294 #define GETSET_ALL (0 \
1295 /* GETSET_LED_POWER */ | 0x00000001L \
1296 /* GETSET_STATION_ID */ | 0x00000002L \
1297 /* SET_TEMPLATES */ | 0x00000004L \
1298 /* SET_STA_LIST */ | 0x00000008L \
1299 /* GETSET_TX */ | 0x00000010L \
1300 /* GETSET_RX */ | 0x00000020L \
1301 /* SET_RXCONFIG */ | 0x00000040L \
1302 /* GETSET_ANTENNA */ | 0x00000080L \
1303 /* GETSET_SENSITIVITY */| 0x00000100L \
1304 /* GETSET_TXPOWER */ | 0x00000200L \
1305 /* GETSET_ED_THRESH */ | 0x00000400L \
1306 /* GETSET_CCA */ | 0x00000800L \
1307 /* GETSET_POWER_80211 */| 0x00001000L \
1308 /* GETSET_RETRY */ | 0x00002000L \
1309 /* GETSET_REG_DOMAIN */ | 0x00004000L \
1310 /* GETSET_CHANNEL */ | 0x00008000L \
1311 /* GETSET_RESCAN */ | 0x00010000L \
1312 /* GETSET_MODE */ | 0x00020000L \
1313 /* GETSET_WEP */ | 0x00040000L \
1314 /* SET_WEP_OPTIONS */ | 0x00080000L \
1315 /* SET_MSDU_LIFETIME */ | 0x00100000L \
1316 /* SET_RATE_FALLBACK */ | 0x00200000L \
1319 /***********************************************************************
1321 typedef struct acx100_ie_memblocksize {
1322 u16 type;
1323 u16 len;
1324 u16 size;
1325 } ACX_PACKED acx100_ie_memblocksize_t;
1327 typedef struct acx100_ie_queueconfig {
1328 u16 type;
1329 u16 len;
1330 u32 AreaSize;
1331 u32 RxQueueStart;
1332 u8 QueueOptions;
1333 u8 NumTxQueues;
1334 u8 NumRxDesc; /* for USB only */
1335 u8 pad1;
1336 u32 QueueEnd;
1337 u32 HostQueueEnd; /* QueueEnd2 */
1338 u32 TxQueueStart;
1339 u8 TxQueuePri;
1340 u8 NumTxDesc;
1341 u16 pad2;
1342 } ACX_PACKED acx100_ie_queueconfig_t;
1344 typedef struct acx111_ie_queueconfig {
1345 u16 type;
1346 u16 len;
1347 u32 tx_memory_block_address;
1348 u32 rx_memory_block_address;
1349 u32 rx1_queue_address;
1350 u32 reserved1;
1351 u32 tx1_queue_address;
1352 u8 tx1_attributes;
1353 u16 reserved2;
1354 u8 reserved3;
1355 } ACX_PACKED acx111_ie_queueconfig_t;
1357 typedef struct acx100_ie_memconfigoption {
1358 u16 type;
1359 u16 len;
1360 u32 DMA_config;
1361 acx_ptr pRxHostDesc;
1362 u32 rx_mem;
1363 u32 tx_mem;
1364 u16 RxBlockNum;
1365 u16 TxBlockNum;
1366 } ACX_PACKED acx100_ie_memconfigoption_t;
1368 typedef struct acx111_ie_memoryconfig {
1369 u16 type;
1370 u16 len;
1371 u16 no_of_stations;
1372 u16 memory_block_size;
1373 u8 tx_rx_memory_block_allocation;
1374 u8 count_rx_queues;
1375 u8 count_tx_queues;
1376 u8 options;
1377 u8 fragmentation;
1378 u16 reserved1;
1379 u8 reserved2;
1381 /* start of rx1 block */
1382 u8 rx_queue1_count_descs;
1383 u8 rx_queue1_reserved1;
1384 u8 rx_queue1_type; /* must be set to 7 */
1385 u8 rx_queue1_prio; /* must be set to 0 */
1386 acx_ptr rx_queue1_host_rx_start;
1387 /* end of rx1 block */
1389 /* start of tx1 block */
1390 u8 tx_queue1_count_descs;
1391 u8 tx_queue1_reserved1;
1392 u8 tx_queue1_reserved2;
1393 u8 tx_queue1_attributes;
1394 /* end of tx1 block */
1395 } ACX_PACKED acx111_ie_memoryconfig_t;
1397 typedef struct acx_ie_memmap {
1398 u16 type;
1399 u16 len;
1400 u32 CodeStart;
1401 u32 CodeEnd;
1402 u32 WEPCacheStart;
1403 u32 WEPCacheEnd;
1404 u32 PacketTemplateStart;
1405 u32 PacketTemplateEnd;
1406 u32 QueueStart;
1407 u32 QueueEnd;
1408 u32 PoolStart;
1409 u32 PoolEnd;
1410 } ACX_PACKED acx_ie_memmap_t;
1412 typedef struct acx111_ie_feature_config {
1413 u16 type;
1414 u16 len;
1415 u32 feature_options;
1416 u32 data_flow_options;
1417 } ACX_PACKED acx111_ie_feature_config_t;
1419 typedef struct acx111_ie_tx_level {
1420 u16 type;
1421 u16 len;
1422 u8 level;
1423 } ACX_PACKED acx111_ie_tx_level_t;
1425 #define PS_CFG_ENABLE 0x80
1426 #define PS_CFG_PENDING 0x40 /* status flag when entering PS */
1427 #define PS_CFG_WAKEUP_MODE_MASK 0x07
1428 #define PS_CFG_WAKEUP_BY_HOST 0x03
1429 #define PS_CFG_WAKEUP_EACH_ITVL 0x02
1430 #define PS_CFG_WAKEUP_ON_DTIM 0x01
1431 #define PS_CFG_WAKEUP_ALL_BEAC 0x00
1433 /* Enhanced PS mode: sleep until Rx Beacon w/ the STA's AID bit set
1434 ** in the TIM; newer firmwares only(?) */
1435 #define PS_OPT_ENA_ENHANCED_PS 0x04
1436 #define PS_OPT_TX_PSPOLL 0x02 /* send PSPoll frame to fetch waiting frames from AP (on frame with matching AID) */
1437 #define PS_OPT_STILL_RCV_BCASTS 0x01
1439 typedef struct acx100_ie_powersave {
1440 u16 type;
1441 u16 len;
1442 u8 wakeup_cfg;
1443 u8 listen_interval; /* for EACH_ITVL: wake up every "beacon units" interval */
1444 u8 options;
1445 u8 hangover_period; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1446 u16 enhanced_ps_transition_time; /* rem. wake time for Enh. PS */
1447 } ACX_PACKED acx100_ie_powersave_t;
1449 typedef struct acx111_ie_powersave {
1450 u16 type;
1451 u16 len;
1452 u8 wakeup_cfg;
1453 u8 listen_interval; /* for EACH_ITVL: wake up every "beacon units" interval */
1454 u8 options;
1455 u8 hangover_period; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1456 u32 beacon_rx_time;
1457 u32 enhanced_ps_transition_time; /* rem. wake time for Enh. PS */
1458 } ACX_PACKED acx111_ie_powersave_t;
1461 /***********************************************************************
1462 ** Commands and template structures
1466 ** SCAN command structure
1468 ** even though acx100 scan rates match RATE100 constants,
1469 ** acx111 ones do not match! Therefore we do not use RATE100 #defines */
1470 #define ACX_SCAN_RATE_1 10
1471 #define ACX_SCAN_RATE_2 20
1472 #define ACX_SCAN_RATE_5 55
1473 #define ACX_SCAN_RATE_11 110
1474 #define ACX_SCAN_RATE_22 220
1475 #define ACX_SCAN_RATE_PBCC 0x80 /* OR with this if needed */
1476 #define ACX_SCAN_OPT_ACTIVE 0x00 /* a bit mask */
1477 #define ACX_SCAN_OPT_PASSIVE 0x01
1478 /* Background scan: we go into Power Save mode (by transmitting
1479 ** NULL data frame to AP with the power mgmt bit set), do the scan,
1480 ** and then exit Power Save mode. A plus is that AP buffers frames
1481 ** for us while we do background scan. Thus we avoid frame losses.
1482 ** Background scan can be active or passive, just like normal one */
1483 #define ACX_SCAN_OPT_BACKGROUND 0x02
1484 typedef struct acx100_scan {
1485 u16 count; /* number of scans to do, 0xffff == continuous */
1486 u16 start_chan;
1487 u16 flags; /* channel list mask; 0x8000 == all channels? */
1488 u8 max_rate; /* max. probe rate */
1489 u8 options; /* bit mask, see defines above */
1490 u16 chan_duration;
1491 u16 max_probe_delay;
1492 } ACX_PACKED acx100_scan_t; /* length 0xc */
1494 #define ACX111_SCAN_RATE_6 0x0B
1495 #define ACX111_SCAN_RATE_9 0x0F
1496 #define ACX111_SCAN_RATE_12 0x0A
1497 #define ACX111_SCAN_RATE_18 0x0E
1498 #define ACX111_SCAN_RATE_24 0x09
1499 #define ACX111_SCAN_RATE_36 0x0D
1500 #define ACX111_SCAN_RATE_48 0x08
1501 #define ACX111_SCAN_RATE_54 0x0C
1502 #define ACX111_SCAN_OPT_5GHZ 0x04 /* else 2.4GHZ */
1503 #define ACX111_SCAN_MOD_SHORTPRE 0x01 /* you can combine SHORTPRE and PBCC */
1504 #define ACX111_SCAN_MOD_PBCC 0x80
1505 #define ACX111_SCAN_MOD_OFDM 0x40
1506 typedef struct acx111_scan {
1507 u16 count; /* number of scans to do */
1508 u8 channel_list_select; /* 0: scan all channels, 1: from chan_list only */
1509 u16 reserved1;
1510 u8 reserved2;
1511 u8 rate; /* rate for probe requests (if active scan) */
1512 u8 options; /* bit mask, see defines above */
1513 u16 chan_duration; /* min time to wait for reply on one channel (in TU) */
1514 /* (active scan only) (802.11 section 11.1.3.2.2) */
1515 u16 max_probe_delay; /* max time to wait for reply on one channel (active scan) */
1516 /* time to listen on a channel (passive scan) */
1517 u8 modulation;
1518 u8 channel_list[26]; /* bits 7:0 first byte: channels 8:1 */
1519 /* bits 7:0 second byte: channels 16:9 */
1520 /* 26 bytes is enough to cover 802.11a */
1521 } ACX_PACKED acx111_scan_t;
1524 ** Radio calibration command structure
1526 typedef struct acx111_cmd_radiocalib {
1527 /* 0x80000000 == automatic calibration by firmware, according to interval;
1528 * bits 0..3: select calibration methods to go through:
1529 * calib based on DC, AfeDC, Tx mismatch, Tx equilization */
1530 u32 methods;
1531 u32 interval;
1532 } ACX_PACKED acx111_cmd_radiocalib_t;
1535 ** Packet template structures
1537 ** Packet templates store contents of Beacon, Probe response, Probe request,
1538 ** Null data frame, and TIM data frame. Firmware automatically transmits
1539 ** contents of template at appropriate time:
1540 ** - Beacon: when configured as AP or Ad-hoc
1541 ** - Probe response: when configured as AP or Ad-hoc, whenever
1542 ** a Probe request frame is received
1543 ** - Probe request: when host issues SCAN command (active)
1544 ** - Null data frame: when entering 802.11 power save mode
1545 ** - TIM data: at the end of Beacon frames (if no TIM template
1546 ** is configured, then transmits default TIM)
1547 ** NB:
1548 ** - size field must be set to size of actual template
1549 ** (NOT sizeof(struct) - templates are variable in length),
1550 ** size field is not itself counted.
1551 ** - members flagged with an asterisk must be initialized with host,
1552 ** rest must be zero filled.
1553 ** - variable length fields shown only in comments */
1554 typedef struct acx_template_tim {
1555 u16 size;
1556 u8 tim_eid; /* 00 1 TIM IE ID * */
1557 u8 len; /* 01 1 Length * */
1558 u8 dtim_cnt; /* 02 1 DTIM Count */
1559 u8 dtim_period; /* 03 1 DTIM Period */
1560 u8 bitmap_ctrl; /* 04 1 Bitmap Control * (except bit0) */
1561 /* 05 n Partial Virtual Bitmap * */
1562 u8 variable[0x100 - 1-1-1-1-1];
1563 } ACX_PACKED acx_template_tim_t;
1565 typedef struct acx_template_probereq {
1566 u16 size;
1567 u16 fc; /* 00 2 fc * */
1568 u16 dur; /* 02 2 Duration */
1569 u8 da[6]; /* 04 6 Destination Address * */
1570 u8 sa[6]; /* 0A 6 Source Address * */
1571 u8 bssid[6]; /* 10 6 BSSID * */
1572 u16 seq; /* 16 2 Sequence Control */
1573 /* 18 n SSID * */
1574 /* nn n Supported Rates * */
1575 u8 variable[0x44 - 2-2-6-6-6-2];
1576 } ACX_PACKED acx_template_probereq_t;
1578 typedef struct acx_template_proberesp {
1579 u16 size;
1580 u16 fc; /* 00 2 fc * (bits [15:12] and [10:8] per 802.11 section 7.1.3.1) */
1581 u16 dur; /* 02 2 Duration */
1582 u8 da[6]; /* 04 6 Destination Address */
1583 u8 sa[6]; /* 0A 6 Source Address */
1584 u8 bssid[6]; /* 10 6 BSSID */
1585 u16 seq; /* 16 2 Sequence Control */
1586 u8 timestamp[8];/* 18 8 Timestamp */
1587 u16 beacon_interval; /* 20 2 Beacon Interval * */
1588 u16 cap; /* 22 2 Capability Information * */
1589 /* 24 n SSID * */
1590 /* nn n Supported Rates * */
1591 /* nn 1 DS Parameter Set * */
1592 u8 variable[0x54 - 2-2-6-6-6-2-8-2-2];
1593 } ACX_PACKED acx_template_proberesp_t;
1594 #define acx_template_beacon_t acx_template_proberesp_t
1595 #define acx_template_beacon acx_template_proberesp
1597 typedef struct acx_template_nullframe {
1598 u16 size;
1599 struct ieee80211_hdr hdr;
1600 } ACX_PACKED acx_template_nullframe_t;
1604 ** JOIN command structure
1606 ** as opposed to acx100, acx111 dtim interval is AFTER rates_basic111.
1607 ** NOTE: took me about an hour to get !@#$%^& packing right --> struct packing is eeeeevil... */
1608 typedef struct acx_joinbss {
1609 u8 bssid[ETH_ALEN];
1610 u16 beacon_interval;
1611 union {
1612 struct {
1613 u8 dtim_interval;
1614 u8 rates_basic;
1615 u8 rates_supported;
1616 } ACX_PACKED acx100;
1617 struct {
1618 u16 rates_basic;
1619 u8 dtim_interval;
1620 } ACX_PACKED acx111;
1621 } ACX_PACKED u;
1622 u8 genfrm_txrate; /* generated frame (bcn, proberesp, RTS, PSpoll) tx rate */
1623 u8 genfrm_mod_pre; /* generated frame modulation/preamble:
1624 ** bit7: PBCC, bit6: OFDM (else CCK/DQPSK/DBPSK)
1625 ** bit5: short pre */
1626 u8 macmode; /* BSS Type, must be one of ACX_MODE_xxx */
1627 u8 channel;
1628 u8 essid_len;
1629 char essid[IW_ESSID_MAX_SIZE];
1630 } ACX_PACKED acx_joinbss_t;
1632 #define JOINBSS_RATES_1 0x01
1633 #define JOINBSS_RATES_2 0x02
1634 #define JOINBSS_RATES_5 0x04
1635 #define JOINBSS_RATES_11 0x08
1636 #define JOINBSS_RATES_22 0x10
1638 /* Looks like missing bits are used to indicate 11g rates!
1639 ** (it follows from the fact that constants below match 1:1 to RATE111_nn)
1640 ** This was actually seen! Look at that Assoc Request sent by acx111,
1641 ** it _does_ contain 11g rates in basic set:
1642 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
1643 01:30:20.074425 Authentication (Open System)-1: Succesful
1644 01:30:20.076539 Authentication (Open System)-2:
1645 01:30:20.076620 Acknowledgment
1646 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]
1647 01:30:20.122413 Assoc Response AID(1) :: Succesful
1648 01:30:20.122679 Acknowledgment
1649 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
1651 #define JOINBSS_RATES_BASIC111_1 0x0001
1652 #define JOINBSS_RATES_BASIC111_2 0x0002
1653 #define JOINBSS_RATES_BASIC111_5 0x0004
1654 #define JOINBSS_RATES_BASIC111_11 0x0020
1655 #define JOINBSS_RATES_BASIC111_22 0x0100
1658 /***********************************************************************
1660 typedef struct mem_read_write {
1661 u16 addr;
1662 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! */
1663 u32 len;
1664 u32 data;
1665 } ACX_PACKED mem_read_write_t;
1668 typedef struct acx_cmd_radioinit {
1669 u32 offset;
1670 u32 len;
1671 } ACX_PACKED acx_cmd_radioinit_t;
1673 typedef struct acx100_ie_wep_options {
1674 u16 type;
1675 u16 len;
1676 u16 NumKeys; /* max # of keys */
1677 u8 WEPOption; /* 0 == decrypt default key only, 1 == override decrypt */
1678 u8 Pad; /* used only for acx111 */
1679 } ACX_PACKED acx100_ie_wep_options_t;
1681 typedef struct ie_dot11WEPDefaultKey {
1682 u16 type;
1683 u16 len;
1684 u8 action;
1685 u8 keySize;
1686 u8 defaultKeyNum;
1687 u8 key[29]; /* check this! was Key[19] */
1688 } ACX_PACKED ie_dot11WEPDefaultKey_t;
1690 typedef struct acx111WEPDefaultKey {
1691 u8 MacAddr[ETH_ALEN];
1692 u16 action; /* NOTE: this is a u16, NOT a u8!! */
1693 u16 reserved;
1694 u8 keySize;
1695 u8 type;
1696 u8 index;
1697 u8 defaultKeyNum;
1698 u8 counter[6];
1699 u8 key[32]; /* up to 32 bytes (for TKIP!) */
1700 } ACX_PACKED acx111WEPDefaultKey_t;
1702 typedef struct ie_dot11WEPDefaultKeyID {
1703 u16 type;
1704 u16 len;
1705 u8 KeyID;
1706 } ACX_PACKED ie_dot11WEPDefaultKeyID_t;
1708 typedef struct acx100_cmd_wep_mgmt {
1709 u8 MacAddr[ETH_ALEN];
1710 u16 Action;
1711 u16 KeySize;
1712 u8 Key[29]; /* 29*8 == 232bits == WEP256 */
1713 } ACX_PACKED acx100_cmd_wep_mgmt_t;
1715 typedef struct acx_ie_generic {
1716 u16 type;
1717 u16 len;
1718 union {
1719 /* Association ID IE: just a 16bit value: */
1720 u16 aid;
1721 /* generic member for quick implementation of commands */
1722 u8 bytes[32];
1723 } ACX_PACKED m;
1724 } ACX_PACKED acx_ie_generic_t;
1726 #define ACX_SEC_KEYSIZE 16
1727 /* Security algorithms. */
1728 enum {
1729 ACX_SEC_ALG,
1730 ACX_SEC_ALGO_NONE = 0, /* unencrypted, as of TX header. */
1731 ACX_SEC_ALGO_WEP,
1732 ACX_SEC_ALGO_UNKNOWN,
1733 ACX_SEC_ALGO_AES,
1734 ACX_SEC_ALGO_WEP104,
1735 ACX_SEC_ALGO_TKIP,
1737 /***********************************************************************
1739 #define CHECK_SIZEOF(type,size) { \
1740 extern void BUG_bad_size_for_##type(void); \
1741 if (sizeof(type)!=(size)) BUG_bad_size_for_##type(); \
1744 static inline void
1745 acx_struct_size_check(void)
1747 CHECK_SIZEOF(txdesc_t, 0x30);
1748 CHECK_SIZEOF(acx100_ie_memconfigoption_t, 24);
1749 CHECK_SIZEOF(acx100_ie_queueconfig_t, 0x20);
1750 CHECK_SIZEOF(acx_joinbss_t, 0x30);
1751 /* IEs need 4 bytes for (type,len) tuple */
1752 CHECK_SIZEOF(acx111_ie_configoption_t, ACX111_IE_CONFIG_OPTIONS_LEN + 4);
1756 /***********************************************************************
1757 ** Global data
1759 extern const u8 acx_bitpos2ratebyte[];
1760 extern const u8 acx_bitpos2rate100[];
1762 extern const u8 acx_reg_domain_ids[];
1763 extern const char * const acx_reg_domain_strings[];
1764 enum {
1765 acx_reg_domain_ids_len = 8
1768 //extern const struct iw_handler_def acx_ioctl_handler_def;
1770 #endif /* _ACX_STRUCT_H_ */