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
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
,
60 extern unsigned int acx_debug
;
62 enum { acx_debug
= 0 };
66 /***********************************************************************
69 #define ACX_PACKED __attribute__ ((packed))
71 /***********************************************************************
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 */
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.
92 #if defined(CONFIG_ACX_MAC80211_PCI)
93 #if !defined(CONFIG_ACX_MAC80211_USB)
94 #define IS_PCI(adev) 1
96 #define IS_PCI(adev) ((adev)->dev_type == DEVTYPE_PCI)
99 #define IS_PCI(adev) 0
102 #if defined(CONFIG_ACX_MAC80211_USB)
103 #if !defined(CONFIG_ACX_MAC80211_PCI)
104 #define IS_USB(adev) 1
106 #define IS_USB(adev) ((adev)->dev_type == DEVTYPE_USB)
109 #define IS_USB(adev) 0
112 /* Driver defaults */
113 #define DEFAULT_DTIM_INTERVAL 10
114 /* used to be 2048, but FreeBSD driver changed it to 4096 to work properly
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
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 */
205 } __attribute__ ((packed
)) acx_ptr
;
208 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
210 #define CHECK32(n) ((void)0)
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) */
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 /***********************************************************************
286 /* Outside of "#ifdef PCI" because USB needs to know sizeof()
287 ** of txdesc and rxdesc: */
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 */
301 u8 Ctl_8
; /* 0x24, 8bit value */
302 u8 Ctl2_8
; /* 0x25, 8bit value */
304 u8 ack_failures
; /* 0x27 */
305 u8 rts_failures
; /* 0x28 */
306 u8 rts_ok
; /* 0x29 */
310 u8 queue_ctrl
; /* 0x2b */
311 } __attribute__ ((packed
)) r1
;
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 */
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 */
336 u8 SNR
; /* Signal-to-Noise Ratio */
341 } __attribute__ ((packed
)); /* size 52 = 0x34 */
343 /***********************************************************************
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
356 typedef struct phy_hdr
{
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)
371 #define RXBUF_IS_TXSTAT(rxbuf) (le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0x8000)
374 12 bits: length of frame from control field to first byte of FCS
376 1 bit: 1 = it's a tx status info, not a rx packet (USB only)
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):
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
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
402 phy_plcp_signal: 1 byte:
403 Receive PLCP Signal field from the Baseband Processor
406 receive AGC gain level (can be used to measure receive signal strength)
409 estimated noise power of equalized receive signal
410 at input of FEC decoder (can be used to measure receive signal quality)
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) */
422 u8 phy_stat_baseband
; /* bit 0x80: used LNA (Low-Noise Amplifier) */
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:
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 */
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 */
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 */
477 CLIENT_EMPTY_SLOT_0
= 0,
479 CLIENT_AUTHENTICATED_2
= 2,
480 CLIENT_ASSOCIATED_3
= 3,
481 CLIENT_JOIN_CANDIDATE
= 4
484 /* most frequent access first */
485 u8 used
; /* misnamed, more like 'status' */
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 */
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
{
520 } __attribute__ ((packed
)) co_antennas_t
;
522 typedef struct co_powerlevels
{
526 } __attribute__ ((packed
)) co_powerlevels_t
;
528 typedef struct co_datarates
{
532 } __attribute__ ((packed
)) co_datarates_t
;
534 typedef struct co_domains
{
538 } __attribute__ ((packed
)) co_domains_t
;
540 typedef struct co_product_id
{
544 } __attribute__ ((packed
)) co_product_id_t
;
546 typedef struct co_manuf_id
{
550 } __attribute__ ((packed
)) co_manuf_t
;
552 typedef struct co_fixed
{
554 /* u16 NVS_vendor_offs; ACX111-only */
555 /* u16 unknown; ACX111-only */
556 u8 MAC
[6]; /* ACX100-only */
557 u16 probe_delay
; /* ACX100-only */
561 u8 dot11ShortPreambleOption
;
563 u8 dot11ChannelAgility
;
564 u8 dot11PhyType
; /* FIXME: does 802.11 call it "dot11PHYType"? */
567 } __attribute__ ((packed
)) co_fixed_t
;
569 typedef struct acx111_ie_configoption
{
572 /* Do not access below members directly, they are in fact variable length */
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
;
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 */
604 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
606 #define CHECK32(n) ((void)0)
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) */
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 /***********************************************************************
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
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.
721 IO_ACX_SOFT_RESET
= 0,
728 IO_ACX_FEMR
, /* Function Event Mask */
732 IO_ACX_IRQ_STATUS_NON_DES
,
752 IO_ACX_CMD_MAILBOX_OFFS
,
753 IO_ACX_INFO_MAILBOX_OFFS
,
754 IO_ACX_EEPROM_INFORMATION
,
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
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!) */
784 struct ieee80211_tx_status txstatus
;
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!) */
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
{
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) */
832 u8 mac_status
; /* seen 0x20 on tx failure */
838 // struct ieee80211_tx_status txstatus;
839 // struct sk_buff *skb;
840 } ACX_PACKED usb_txstatus_t
;
842 typedef struct usb_tx
{
846 /* actual USB bulk output data block is here: */
847 usb_txbuffer_t bulkout
;
850 struct usb_rx_plain
{
857 typedef struct usb_rx
{
862 /* Make entire structure 4k */
863 u8 padding
[4*1024 - sizeof(struct usb_rx_plain
)];
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
895 /* non-firmware struct, no packing necessary */
897 /* most frequent accesses first (dereferencing and cache line!) */
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
;
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 */
919 // struct iw_statistics wstats; /* wireless statistics */
921 struct ieee80211_hw
*ieee
;
922 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
923 struct ieee80211_hw_mode modes
[2];
925 struct ieee80211_rx_status rx_status
;
926 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
927 struct ieee80211_vif
*vif
;
930 /*** Power managment ***/
931 struct pm_dev
*pm
; /* PM crap */
933 /*** Management timer ***/
934 struct timer_list mgmt_timer
;
936 /*** Hardware identification ***/
937 const char *chip_name
;
944 /*** Config retrieved from EEPROM ***/
946 u16 cfgopt_NVS_vendor_offs
;
948 u16 cfgopt_probe_delay
;
949 u32 cfgopt_eof_memory
;
950 u8 cfgopt_dot11CCAModes
;
951 u8 cfgopt_dot11Diversity
;
952 u8 cfgopt_dot11ShortPreambleOption
;
953 u8 cfgopt_dot11PBCCOption
;
954 u8 cfgopt_dot11ChannelAgility
;
955 u8 cfgopt_dot11PhyType
;
956 u8 cfgopt_dot11TempType
;
957 co_antennas_t cfgopt_antennas
;
958 co_powerlevels_t cfgopt_power_levels
;
959 co_datarates_t cfgopt_data_rates
;
960 co_domains_t cfgopt_domains
;
961 co_product_id_t cfgopt_product_id
;
962 co_manuf_t cfgopt_manufacturer
;
964 /*** Firmware identification ***/
965 char firmware_version
[FW_ID_SIZE
+1];
969 const u16
*ie_len_dot11
;
971 /*** Device state ***/
973 u8 led_power
; /* power LED status */
974 u32 get_mask
; /* mask of settings to fetch from the card */
975 u32 set_mask
; /* mask of settings to write to the card */
977 /* Barely used in USB case */
981 u8 after_interrupt_jobs
; /* mini job list for doing actions after an interrupt occurred */
982 struct work_struct after_interrupt_task
; /* our task for after interrupt actions */
987 u16 scan_count
; /* number of times to do channel scan */
988 u8 scan_mode
; /* 0 == active, 1 == passive, 2 == background */
991 u16 scan_probe_delay
;
992 #if WIRELESS_EXT > 15
993 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
996 /*** Virtual interface struct ***/
997 struct acx_interface interface
;
999 /*** Wireless network settings ***/
1000 /* copy of the device address (ifconfig hw ether) that we actually use
1001 ** for 802.11; copied over from the network device's MAC address
1002 ** (ifconfig) when it makes sense only */
1003 u8 dev_addr
[MAX_ADDR_LEN
];
1004 u8 bssid
[ETH_ALEN
]; /* the BSSID after having joined */
1005 u8 ap
[ETH_ALEN
]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
1006 u16 aid
; /* The Association ID sent from the AP / last used AID if we're an AP */
1007 u16 mode
; /* mode from iwconfig */
1008 int monitor_type
; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
1009 u16 status
; /* 802.11 association status */
1010 u8 essid_active
; /* specific ESSID active, or select any? */
1011 u8 essid_len
; /* to avoid dozens of strlen() */
1012 /* INCLUDES \0 termination for easy printf - but many places
1013 ** simply want the string data memcpy'd plus a length indicator!
1014 ** Keep that in mind... */
1015 char essid
[IW_ESSID_MAX_SIZE
+1];
1016 /* essid we are going to use for association, in case of "essid 'any'"
1017 ** and in case of hidden ESSID (use configured ESSID then) */
1018 char essid_for_assoc
[IW_ESSID_MAX_SIZE
+1];
1019 char nick
[IW_ESSID_MAX_SIZE
+1]; /* see essid! */
1021 u8 reg_dom_id
; /* reg domain setting */
1022 u16 reg_dom_chanmask
;
1023 u16 auth_or_assoc_retries
;
1025 unsigned long scan_start
; /* YES, jiffies is defined as "unsigned long" */
1028 /* MAC80211 Template Reference */
1029 struct sk_buff
*beacon_cache
;
1030 /* stations known to us (if we're an ap) */
1031 // client_t sta_list[32]; /* tab is larger than list, so that */
1032 // client_t *sta_hash_tab[64]; /* hash collisions are not likely */
1033 // client_t *ap_client; /* this one is our AP (STA mode only) */
1037 unsigned long dup_msg_expiry
;
1038 u16 last_seq_ctrl
; /* duplicate packet detection */
1040 /* 802.11 power save mode */
1042 u8 ps_listen_interval
;
1044 u8 ps_hangover_period
;
1045 u32 ps_enhanced_transition_time
;
1046 u32 ps_beacon_rx_time
;
1048 /*** PHY settings ***/
1049 u8 fallback_threshold
;
1050 u8 stepup_threshold
;
1055 u8 rate_auto
; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
1056 u8 preamble_mode
; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
1061 /* u8 tx_level_val; */
1062 /* u8 tx_level_auto; whether to do automatic power adjustment */
1064 unsigned long recalib_time_last_success
;
1065 unsigned long recalib_time_last_attempt
;
1066 int recalib_failure_count
;
1067 int recalib_msg_ratelimit
;
1068 int retry_errors_msg_ratelimit
;
1070 unsigned long brange_time_last_state_change
; /* time the power LED was last changed */
1071 u8 brange_last_state
; /* last state of the LED */
1072 u8 brange_max_quality
; /* maximum quality that equates to full speed */
1075 u8 antenna
; /* antenna settings */
1076 u8 ed_threshold
; /* energy detect threshold */
1077 u8 cca
; /* clear channel assessment */
1084 u16 listen_interval
; /* given in units of beacon interval */
1085 u32 beacon_interval
;
1088 u8 rate_supported_len
;
1089 u8 rate_supported
[13];
1091 /*** Encryption settings (WEP) ***/
1092 u32 auth_alg
; /* used in transmit_authen1 */
1095 u8 wep_current_index
;
1096 wep_key_t wep_keys
[DOT11_MAX_DEFAULT_WEP_KEYS
]; /* the default WEP keys */
1098 key_struct_t wep_key_struct
[10];
1100 /*** Encryption Replacement for mac80211 ***/
1101 struct acx_key key
[54];
1102 u16 security_offset
;
1109 /*** Card Rx/Tx management ***/
1113 unsigned int tx_free
;
1114 unsigned int tx_head
; /* keep as close as possible to Tx stuff below (cache line) */
1117 /*************************************************************************
1118 *** PCI/USB/... must be last or else hw agnostic code breaks horribly ***
1119 *************************************************************************/
1121 /* hack to let common code compile. FIXME */
1122 dma_addr_t rxhostdesc_startphy
;
1125 #ifdef ACX_MAC80211_PCI
1126 /* pointers to tx buffers, tx host descriptors (in host memory)
1127 ** and tx descs in device memory */
1128 unsigned int tx_tail
;
1130 txhostdesc_t
*txhostdesc_start
;
1131 txdesc_t
*txdesc_start
; /* points to PCI-mapped memory */
1132 dma_addr_t txbuf_startphy
;
1133 dma_addr_t txhostdesc_startphy
;
1134 /* sizes of above host memory areas */
1135 unsigned int txbuf_area_size
;
1136 unsigned int txhostdesc_area_size
;
1138 unsigned int txdesc_size
; /* size of txdesc; ACX111 = ACX100 + 4 */
1139 client_t
*txc
[TX_CNT
];
1143 unsigned int rx_tail
;
1144 rxbuffer_t
*rxbuf_start
;
1145 rxhostdesc_t
*rxhostdesc_start
;
1146 rxdesc_t
*rxdesc_start
;
1147 /* physical addresses of above host memory areas */
1148 dma_addr_t rxbuf_startphy
;
1149 /* dma_addr_t rxhostdesc_startphy; */
1150 unsigned int rxbuf_area_size
;
1151 unsigned int rxhostdesc_area_size
;
1154 u8 irqs_active
; /* whether irq sending is activated */
1156 const u16
*io
; /* points to ACX100 or ACX111 PCI I/O register address set */
1159 struct pci_dev
*pdev
;
1162 struct vlynq_device
*vdev
;
1164 struct device
*bus_dev
;
1165 unsigned long membase
;
1166 unsigned long membase2
;
1167 void __iomem
*iobase
;
1168 void __iomem
*iobase2
;
1169 /* command interface */
1170 u8 __iomem
*cmd_area
;
1171 u8 __iomem
*info_area
;
1173 u16 irq_mask
; /* interrupt types to mask out (not wanted) with many IRQs activated */
1174 u16 irq_mask_off
; /* interrupt types to mask out (not wanted) with IRQs off */
1175 unsigned int irq_loops_this_jiffy
;
1176 unsigned long irq_last_jiffies
;
1180 #ifdef ACX_MAC80211_USB
1181 struct usb_device
*usbdev
;
1183 rxbuffer_t rxtruncbuf
;
1188 int bulkinep
; /* bulk-in endpoint */
1189 int bulkoutep
; /* bulk-out endpoint */
1198 acx_device_t
* ieee2adev(struct ieee80211_hw
*hw
)
1204 /* For use with ACX1xx_IE_RXCONFIG */
1206 * 13 include additional header (length etc.) *required*
1207 * struct is defined in 'struct rxbuffer'
1208 * is this bit acx100 only? does acx111 always put the header,
1209 * and bit setting is irrelevant? --vda
1210 * 10 receive frames only with SSID used in last join cmd
1211 * 9 discard broadcast
1212 * 8 receive packets for multicast address 1
1213 * 7 receive packets for multicast address 0
1214 * 6 discard all multicast packets
1215 * 5 discard frames from foreign BSSID
1216 * 4 discard frames with foreign destination MAC address
1217 * 3 promiscuous mode (receive ALL frames, disable filter)
1219 * 1 include phy header
1222 #define RX_CFG1_INCLUDE_RXBUF_HDR 0x2000 /* ACX100 only */
1223 #define RX_CFG1_FILTER_SSID 0x0400
1224 #define RX_CFG1_FILTER_BCAST 0x0200
1225 #define RX_CFG1_RCV_MC_ADDR1 0x0100
1226 #define RX_CFG1_RCV_MC_ADDR0 0x0080
1227 #define RX_CFG1_FILTER_ALL_MULTI 0x0040
1228 #define RX_CFG1_FILTER_BSSID 0x0020
1229 #define RX_CFG1_FILTER_MAC 0x0010
1230 #define RX_CFG1_RCV_PROMISCUOUS 0x0008
1231 #define RX_CFG1_INCLUDE_FCS 0x0004
1232 #define RX_CFG1_INCLUDE_PHY_HDR (WANT_PHY_HDR ? 0x0002 : 0)
1234 * 11 receive association requests etc.
1235 * 10 receive authentication frames
1236 * 9 receive beacon frames
1237 * 8 receive contention free packets
1238 * 7 receive control frames
1239 * 6 receive data frames
1240 * 5 receive broken frames
1241 * 4 receive management frames
1242 * 3 receive probe requests
1243 * 2 receive probe responses
1244 * 1 receive RTS/CTS/ACK frames
1247 #define RX_CFG2_RCV_ASSOC_REQ 0x0800
1248 #define RX_CFG2_RCV_AUTH_FRAMES 0x0400
1249 #define RX_CFG2_RCV_BEACON_FRAMES 0x0200
1250 #define RX_CFG2_RCV_CONTENTION_FREE 0x0100
1251 #define RX_CFG2_RCV_CTRL_FRAMES 0x0080
1252 #define RX_CFG2_RCV_DATA_FRAMES 0x0040
1253 #define RX_CFG2_RCV_BROKEN_FRAMES 0x0020
1254 #define RX_CFG2_RCV_MGMT_FRAMES 0x0010
1255 #define RX_CFG2_RCV_PROBE_REQ 0x0008
1256 #define RX_CFG2_RCV_PROBE_RESP 0x0004
1257 #define RX_CFG2_RCV_ACK_FRAMES 0x0002
1258 #define RX_CFG2_RCV_OTHER 0x0001
1260 /* For use with ACX1xx_IE_FEATURE_CONFIG */
1261 #define FEATURE1_80MHZ_CLOCK 0x00000040L
1262 #define FEATURE1_4X 0x00000020L
1263 #define FEATURE1_LOW_RX 0x00000008L
1264 #define FEATURE1_EXTRA_LOW_RX 0x00000001L
1266 #define FEATURE2_SNIFFER 0x00000080L
1267 #define FEATURE2_NO_TXCRYPT 0x00000001L
1269 /*-- get and set mask values --*/
1270 #define GETSET_LED_POWER 0x00000001L
1271 #define GETSET_STATION_ID 0x00000002L
1272 #define SET_TEMPLATES 0x00000004L
1273 #define SET_STA_LIST 0x00000008L
1274 #define GETSET_TX 0x00000010L
1275 #define GETSET_RX 0x00000020L
1276 #define SET_RXCONFIG 0x00000040L
1277 #define GETSET_ANTENNA 0x00000080L
1278 #define GETSET_SENSITIVITY 0x00000100L
1279 #define GETSET_TXPOWER 0x00000200L
1280 #define GETSET_ED_THRESH 0x00000400L
1281 #define GETSET_CCA 0x00000800L
1282 #define GETSET_POWER_80211 0x00001000L
1283 #define GETSET_RETRY 0x00002000L
1284 #define GETSET_REG_DOMAIN 0x00004000L
1285 #define GETSET_CHANNEL 0x00008000L
1286 /* Used when ESSID changes etc and we need to scan for AP anew */
1287 #define GETSET_RESCAN 0x00010000L
1288 #define GETSET_MODE 0x00020000L
1289 #define GETSET_WEP 0x00040000L
1290 #define SET_WEP_OPTIONS 0x00080000L
1291 #define SET_MSDU_LIFETIME 0x00100000L
1292 #define SET_RATE_FALLBACK 0x00200000L
1294 /* keep in sync with the above */
1295 #define GETSET_ALL (0 \
1296 /* GETSET_LED_POWER */ | 0x00000001L \
1297 /* GETSET_STATION_ID */ | 0x00000002L \
1298 /* SET_TEMPLATES */ | 0x00000004L \
1299 /* SET_STA_LIST */ | 0x00000008L \
1300 /* GETSET_TX */ | 0x00000010L \
1301 /* GETSET_RX */ | 0x00000020L \
1302 /* SET_RXCONFIG */ | 0x00000040L \
1303 /* GETSET_ANTENNA */ | 0x00000080L \
1304 /* GETSET_SENSITIVITY */| 0x00000100L \
1305 /* GETSET_TXPOWER */ | 0x00000200L \
1306 /* GETSET_ED_THRESH */ | 0x00000400L \
1307 /* GETSET_CCA */ | 0x00000800L \
1308 /* GETSET_POWER_80211 */| 0x00001000L \
1309 /* GETSET_RETRY */ | 0x00002000L \
1310 /* GETSET_REG_DOMAIN */ | 0x00004000L \
1311 /* GETSET_CHANNEL */ | 0x00008000L \
1312 /* GETSET_RESCAN */ | 0x00010000L \
1313 /* GETSET_MODE */ | 0x00020000L \
1314 /* GETSET_WEP */ | 0x00040000L \
1315 /* SET_WEP_OPTIONS */ | 0x00080000L \
1316 /* SET_MSDU_LIFETIME */ | 0x00100000L \
1317 /* SET_RATE_FALLBACK */ | 0x00200000L \
1320 /***********************************************************************
1322 typedef struct acx100_ie_memblocksize
{
1326 } ACX_PACKED acx100_ie_memblocksize_t
;
1328 typedef struct acx100_ie_queueconfig
{
1335 u8 NumRxDesc
; /* for USB only */
1338 u32 HostQueueEnd
; /* QueueEnd2 */
1343 } ACX_PACKED acx100_ie_queueconfig_t
;
1345 typedef struct acx111_ie_queueconfig
{
1348 u32 tx_memory_block_address
;
1349 u32 rx_memory_block_address
;
1350 u32 rx1_queue_address
;
1352 u32 tx1_queue_address
;
1356 } ACX_PACKED acx111_ie_queueconfig_t
;
1358 typedef struct acx100_ie_memconfigoption
{
1362 acx_ptr pRxHostDesc
;
1367 } ACX_PACKED acx100_ie_memconfigoption_t
;
1369 typedef struct acx111_ie_memoryconfig
{
1373 u16 memory_block_size
;
1374 u8 tx_rx_memory_block_allocation
;
1382 /* start of rx1 block */
1383 u8 rx_queue1_count_descs
;
1384 u8 rx_queue1_reserved1
;
1385 u8 rx_queue1_type
; /* must be set to 7 */
1386 u8 rx_queue1_prio
; /* must be set to 0 */
1387 acx_ptr rx_queue1_host_rx_start
;
1388 /* end of rx1 block */
1390 /* start of tx1 block */
1391 u8 tx_queue1_count_descs
;
1392 u8 tx_queue1_reserved1
;
1393 u8 tx_queue1_reserved2
;
1394 u8 tx_queue1_attributes
;
1395 /* end of tx1 block */
1396 } ACX_PACKED acx111_ie_memoryconfig_t
;
1398 typedef struct acx_ie_memmap
{
1405 u32 PacketTemplateStart
;
1406 u32 PacketTemplateEnd
;
1411 } ACX_PACKED acx_ie_memmap_t
;
1413 typedef struct acx111_ie_feature_config
{
1416 u32 feature_options
;
1417 u32 data_flow_options
;
1418 } ACX_PACKED acx111_ie_feature_config_t
;
1420 typedef struct acx111_ie_tx_level
{
1424 } ACX_PACKED acx111_ie_tx_level_t
;
1426 #define PS_CFG_ENABLE 0x80
1427 #define PS_CFG_PENDING 0x40 /* status flag when entering PS */
1428 #define PS_CFG_WAKEUP_MODE_MASK 0x07
1429 #define PS_CFG_WAKEUP_BY_HOST 0x03
1430 #define PS_CFG_WAKEUP_EACH_ITVL 0x02
1431 #define PS_CFG_WAKEUP_ON_DTIM 0x01
1432 #define PS_CFG_WAKEUP_ALL_BEAC 0x00
1434 /* Enhanced PS mode: sleep until Rx Beacon w/ the STA's AID bit set
1435 ** in the TIM; newer firmwares only(?) */
1436 #define PS_OPT_ENA_ENHANCED_PS 0x04
1437 #define PS_OPT_TX_PSPOLL 0x02 /* send PSPoll frame to fetch waiting frames from AP (on frame with matching AID) */
1438 #define PS_OPT_STILL_RCV_BCASTS 0x01
1440 typedef struct acx100_ie_powersave
{
1444 u8 listen_interval
; /* for EACH_ITVL: wake up every "beacon units" interval */
1446 u8 hangover_period
; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1447 u16 enhanced_ps_transition_time
; /* rem. wake time for Enh. PS */
1448 } ACX_PACKED acx100_ie_powersave_t
;
1450 typedef struct acx111_ie_powersave
{
1454 u8 listen_interval
; /* for EACH_ITVL: wake up every "beacon units" interval */
1456 u8 hangover_period
; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1458 u32 enhanced_ps_transition_time
; /* rem. wake time for Enh. PS */
1459 } ACX_PACKED acx111_ie_powersave_t
;
1462 /***********************************************************************
1463 ** Commands and template structures
1467 ** SCAN command structure
1469 ** even though acx100 scan rates match RATE100 constants,
1470 ** acx111 ones do not match! Therefore we do not use RATE100 #defines */
1471 #define ACX_SCAN_RATE_1 10
1472 #define ACX_SCAN_RATE_2 20
1473 #define ACX_SCAN_RATE_5 55
1474 #define ACX_SCAN_RATE_11 110
1475 #define ACX_SCAN_RATE_22 220
1476 #define ACX_SCAN_RATE_PBCC 0x80 /* OR with this if needed */
1477 #define ACX_SCAN_OPT_ACTIVE 0x00 /* a bit mask */
1478 #define ACX_SCAN_OPT_PASSIVE 0x01
1479 /* Background scan: we go into Power Save mode (by transmitting
1480 ** NULL data frame to AP with the power mgmt bit set), do the scan,
1481 ** and then exit Power Save mode. A plus is that AP buffers frames
1482 ** for us while we do background scan. Thus we avoid frame losses.
1483 ** Background scan can be active or passive, just like normal one */
1484 #define ACX_SCAN_OPT_BACKGROUND 0x02
1485 typedef struct acx100_scan
{
1486 u16 count
; /* number of scans to do, 0xffff == continuous */
1488 u16 flags
; /* channel list mask; 0x8000 == all channels? */
1489 u8 max_rate
; /* max. probe rate */
1490 u8 options
; /* bit mask, see defines above */
1492 u16 max_probe_delay
;
1493 } ACX_PACKED acx100_scan_t
; /* length 0xc */
1495 #define ACX111_SCAN_RATE_6 0x0B
1496 #define ACX111_SCAN_RATE_9 0x0F
1497 #define ACX111_SCAN_RATE_12 0x0A
1498 #define ACX111_SCAN_RATE_18 0x0E
1499 #define ACX111_SCAN_RATE_24 0x09
1500 #define ACX111_SCAN_RATE_36 0x0D
1501 #define ACX111_SCAN_RATE_48 0x08
1502 #define ACX111_SCAN_RATE_54 0x0C
1503 #define ACX111_SCAN_OPT_5GHZ 0x04 /* else 2.4GHZ */
1504 #define ACX111_SCAN_MOD_SHORTPRE 0x01 /* you can combine SHORTPRE and PBCC */
1505 #define ACX111_SCAN_MOD_PBCC 0x80
1506 #define ACX111_SCAN_MOD_OFDM 0x40
1507 typedef struct acx111_scan
{
1508 u16 count
; /* number of scans to do */
1509 u8 channel_list_select
; /* 0: scan all channels, 1: from chan_list only */
1512 u8 rate
; /* rate for probe requests (if active scan) */
1513 u8 options
; /* bit mask, see defines above */
1514 u16 chan_duration
; /* min time to wait for reply on one channel (in TU) */
1515 /* (active scan only) (802.11 section 11.1.3.2.2) */
1516 u16 max_probe_delay
; /* max time to wait for reply on one channel (active scan) */
1517 /* time to listen on a channel (passive scan) */
1519 u8 channel_list
[26]; /* bits 7:0 first byte: channels 8:1 */
1520 /* bits 7:0 second byte: channels 16:9 */
1521 /* 26 bytes is enough to cover 802.11a */
1522 } ACX_PACKED acx111_scan_t
;
1525 ** Radio calibration command structure
1527 typedef struct acx111_cmd_radiocalib
{
1528 /* 0x80000000 == automatic calibration by firmware, according to interval;
1529 * bits 0..3: select calibration methods to go through:
1530 * calib based on DC, AfeDC, Tx mismatch, Tx equilization */
1533 } ACX_PACKED acx111_cmd_radiocalib_t
;
1536 ** Packet template structures
1538 ** Packet templates store contents of Beacon, Probe response, Probe request,
1539 ** Null data frame, and TIM data frame. Firmware automatically transmits
1540 ** contents of template at appropriate time:
1541 ** - Beacon: when configured as AP or Ad-hoc
1542 ** - Probe response: when configured as AP or Ad-hoc, whenever
1543 ** a Probe request frame is received
1544 ** - Probe request: when host issues SCAN command (active)
1545 ** - Null data frame: when entering 802.11 power save mode
1546 ** - TIM data: at the end of Beacon frames (if no TIM template
1547 ** is configured, then transmits default TIM)
1549 ** - size field must be set to size of actual template
1550 ** (NOT sizeof(struct) - templates are variable in length),
1551 ** size field is not itself counted.
1552 ** - members flagged with an asterisk must be initialized with host,
1553 ** rest must be zero filled.
1554 ** - variable length fields shown only in comments */
1555 typedef struct acx_template_tim
{
1557 u8 tim_eid
; /* 00 1 TIM IE ID * */
1558 u8 len
; /* 01 1 Length * */
1559 u8 dtim_cnt
; /* 02 1 DTIM Count */
1560 u8 dtim_period
; /* 03 1 DTIM Period */
1561 u8 bitmap_ctrl
; /* 04 1 Bitmap Control * (except bit0) */
1562 /* 05 n Partial Virtual Bitmap * */
1563 u8 variable
[0x100 - 1-1-1-1-1];
1564 } ACX_PACKED acx_template_tim_t
;
1566 typedef struct acx_template_probereq
{
1568 u16 fc
; /* 00 2 fc * */
1569 u16 dur
; /* 02 2 Duration */
1570 u8 da
[6]; /* 04 6 Destination Address * */
1571 u8 sa
[6]; /* 0A 6 Source Address * */
1572 u8 bssid
[6]; /* 10 6 BSSID * */
1573 u16 seq
; /* 16 2 Sequence Control */
1575 /* nn n Supported Rates * */
1576 u8 variable
[0x44 - 2-2-6-6-6-2];
1577 } ACX_PACKED acx_template_probereq_t
;
1579 typedef struct acx_template_proberesp
{
1581 u16 fc
; /* 00 2 fc * (bits [15:12] and [10:8] per 802.11 section 7.1.3.1) */
1582 u16 dur
; /* 02 2 Duration */
1583 u8 da
[6]; /* 04 6 Destination Address */
1584 u8 sa
[6]; /* 0A 6 Source Address */
1585 u8 bssid
[6]; /* 10 6 BSSID */
1586 u16 seq
; /* 16 2 Sequence Control */
1587 u8 timestamp
[8];/* 18 8 Timestamp */
1588 u16 beacon_interval
; /* 20 2 Beacon Interval * */
1589 u16 cap
; /* 22 2 Capability Information * */
1591 /* nn n Supported Rates * */
1592 /* nn 1 DS Parameter Set * */
1593 u8 variable
[0x54 - 2-2-6-6-6-2-8-2-2];
1594 } ACX_PACKED acx_template_proberesp_t
;
1595 #define acx_template_beacon_t acx_template_proberesp_t
1596 #define acx_template_beacon acx_template_proberesp
1598 typedef struct acx_template_nullframe
{
1600 struct ieee80211_hdr hdr
;
1601 } ACX_PACKED acx_template_nullframe_t
;
1605 ** JOIN command structure
1607 ** as opposed to acx100, acx111 dtim interval is AFTER rates_basic111.
1608 ** NOTE: took me about an hour to get !@#$%^& packing right --> struct packing is eeeeevil... */
1609 typedef struct acx_joinbss
{
1611 u16 beacon_interval
;
1617 } ACX_PACKED acx100
;
1621 } ACX_PACKED acx111
;
1623 u8 genfrm_txrate
; /* generated frame (bcn, proberesp, RTS, PSpoll) tx rate */
1624 u8 genfrm_mod_pre
; /* generated frame modulation/preamble:
1625 ** bit7: PBCC, bit6: OFDM (else CCK/DQPSK/DBPSK)
1626 ** bit5: short pre */
1627 u8 macmode
; /* BSS Type, must be one of ACX_MODE_xxx */
1630 char essid
[IW_ESSID_MAX_SIZE
];
1631 } ACX_PACKED acx_joinbss_t
;
1633 #define JOINBSS_RATES_1 0x01
1634 #define JOINBSS_RATES_2 0x02
1635 #define JOINBSS_RATES_5 0x04
1636 #define JOINBSS_RATES_11 0x08
1637 #define JOINBSS_RATES_22 0x10
1639 /* Looks like missing bits are used to indicate 11g rates!
1640 ** (it follows from the fact that constants below match 1:1 to RATE111_nn)
1641 ** This was actually seen! Look at that Assoc Request sent by acx111,
1642 ** it _does_ contain 11g rates in basic set:
1643 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
1644 01:30:20.074425 Authentication (Open System)-1: Succesful
1645 01:30:20.076539 Authentication (Open System)-2:
1646 01:30:20.076620 Acknowledgment
1647 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]
1648 01:30:20.122413 Assoc Response AID(1) :: Succesful
1649 01:30:20.122679 Acknowledgment
1650 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
1652 #define JOINBSS_RATES_BASIC111_1 0x0001
1653 #define JOINBSS_RATES_BASIC111_2 0x0002
1654 #define JOINBSS_RATES_BASIC111_5 0x0004
1655 #define JOINBSS_RATES_BASIC111_11 0x0020
1656 #define JOINBSS_RATES_BASIC111_22 0x0100
1659 /***********************************************************************
1661 typedef struct mem_read_write
{
1663 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! */
1666 } ACX_PACKED mem_read_write_t
;
1669 typedef struct acx_cmd_radioinit
{
1672 } ACX_PACKED acx_cmd_radioinit_t
;
1674 typedef struct acx100_ie_wep_options
{
1677 u16 NumKeys
; /* max # of keys */
1678 u8 WEPOption
; /* 0 == decrypt default key only, 1 == override decrypt */
1679 u8 Pad
; /* used only for acx111 */
1680 } ACX_PACKED acx100_ie_wep_options_t
;
1682 typedef struct ie_dot11WEPDefaultKey
{
1688 u8 key
[29]; /* check this! was Key[19] */
1689 } ACX_PACKED ie_dot11WEPDefaultKey_t
;
1691 typedef struct acx111WEPDefaultKey
{
1692 u8 MacAddr
[ETH_ALEN
];
1693 u16 action
; /* NOTE: this is a u16, NOT a u8!! */
1700 u8 key
[32]; /* up to 32 bytes (for TKIP!) */
1701 } ACX_PACKED acx111WEPDefaultKey_t
;
1703 typedef struct ie_dot11WEPDefaultKeyID
{
1707 } ACX_PACKED ie_dot11WEPDefaultKeyID_t
;
1709 typedef struct acx100_cmd_wep_mgmt
{
1710 u8 MacAddr
[ETH_ALEN
];
1713 u8 Key
[29]; /* 29*8 == 232bits == WEP256 */
1714 } ACX_PACKED acx100_cmd_wep_mgmt_t
;
1716 typedef struct acx_ie_generic
{
1720 /* Association ID IE: just a 16bit value: */
1722 /* generic member for quick implementation of commands */
1725 } ACX_PACKED acx_ie_generic_t
;
1727 #define ACX_SEC_KEYSIZE 16
1728 /* Security algorithms. */
1731 ACX_SEC_ALGO_NONE
= 0, /* unencrypted, as of TX header. */
1733 ACX_SEC_ALGO_UNKNOWN
,
1735 ACX_SEC_ALGO_WEP104
,
1738 /***********************************************************************
1740 #define CHECK_SIZEOF(type,size) { \
1741 extern void BUG_bad_size_for_##type(void); \
1742 if (sizeof(type)!=(size)) BUG_bad_size_for_##type(); \
1746 acx_struct_size_check(void)
1748 CHECK_SIZEOF(txdesc_t
, 0x30);
1749 CHECK_SIZEOF(acx100_ie_memconfigoption_t
, 24);
1750 CHECK_SIZEOF(acx100_ie_queueconfig_t
, 0x20);
1751 CHECK_SIZEOF(acx_joinbss_t
, 0x30);
1752 /* IEs need 4 bytes for (type,len) tuple */
1753 CHECK_SIZEOF(acx111_ie_configoption_t
, ACX111_IE_CONFIG_OPTIONS_LEN
+ 4);
1757 /***********************************************************************
1760 extern const u8 acx_bitpos2ratebyte
[];
1761 extern const u8 acx_bitpos2rate100
[];
1763 extern const u8 acx_reg_domain_ids
[];
1764 extern const char * const acx_reg_domain_strings
[];
1766 acx_reg_domain_ids_len
= 8
1769 //extern const struct iw_handler_def acx_ioctl_handler_def;
1771 #endif /* _ACX_STRUCT_H_ */