5 * acx_struct.h: common structures.
7 * Copyright (C) 2003-2008, the ACX100 Open Source Project.
9 * This file is licensed under the GPL version 2. See the README file for more
12 #include <linux/version.h>
13 #include "acx_commands.h"
16 * We must not even enter here if neither USB nor PCI support are enabled. This
17 * file will take care of that for us.
21 #include "acx_config.h"
22 #include "acx_mac80211.h"
23 #include "acx_debug.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 /***********************************************************************
43 /* The supported chip models */
44 #define CHIPTYPE_ACX100 1
45 #define CHIPTYPE_ACX111 2
47 #define IS_ACX100(adev) ((adev)->chip_type == CHIPTYPE_ACX100)
48 #define IS_ACX111(adev) ((adev)->chip_type == CHIPTYPE_ACX111)
50 #if defined(CONFIG_ACX_MAC80211_PCI)
51 #define IS_PCI(adev) (1)
52 #define IS_USB(adev) (0)
55 * If not PCI, it IS a USB device. We cannot have both at the same time.
57 #define IS_PCI(adev) (0)
58 #define IS_USB(adev) (1)
59 #endif /* !defined(CONFIG_ACX_MAC80211_PCI) */
62 #define DEFAULT_DTIM_INTERVAL 10
63 /* used to be 2048, but FreeBSD driver changed it to 4096 to work properly
65 #define DEFAULT_MSDU_LIFETIME 4096
66 #define DEFAULT_RTS_THRESHOLD 2312 /* max. size: disable RTS mechanism */
67 #define DEFAULT_BEACON_INTERVAL 100
69 #define ACX100_BAP_DATALEN_MAX 4096
70 #define ACX100_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */
71 #define ACX100_RIDDATA_MAXLEN ACX100_RID_GUESSING_MAXLEN
73 /* Support Constants */
74 /* Radio type names, found in Win98 driver's TIACXLN.INF */
75 #define RADIO_MAXIM_0D 0x0d
76 #define RADIO_RFMD_11 0x11
77 #define RADIO_RALINK_15 0x15
78 /* used in ACX111 cards (WG311v2, WL-121, ...): */
79 #define RADIO_RADIA_16 0x16
80 /* most likely *sometimes* used in ACX111 cards: */
81 #define RADIO_UNKNOWN_17 0x17
82 /* FwRad19.bin was found in a Safecom driver; must be an ACX111 radio: */
83 #define RADIO_UNKNOWN_19 0x19
84 #define RADIO_UNKNOWN_1B 0x1b /* radio in SafeCom SWLUT-54125 USB adapter; entirely unknown!! */
86 /* Controller Commands */
87 /* can be found in table cmdTable in firmware "Rev. 1.5.0" (FW150) */
88 #define ACX1xx_CMD_RESET 0x00
89 #define ACX1xx_CMD_INTERROGATE 0x01
90 #define ACX1xx_CMD_CONFIGURE 0x02
91 #define ACX1xx_CMD_ENABLE_RX 0x03
92 #define ACX1xx_CMD_ENABLE_TX 0x04
93 #define ACX1xx_CMD_DISABLE_RX 0x05
94 #define ACX1xx_CMD_DISABLE_TX 0x06
95 #define ACX1xx_CMD_FLUSH_QUEUE 0x07
96 #define ACX1xx_CMD_SCAN 0x08
97 #define ACX1xx_CMD_STOP_SCAN 0x09
98 #define ACX1xx_CMD_CONFIG_TIM 0x0a
99 #define ACX1xx_CMD_JOIN 0x0b
100 #define ACX1xx_CMD_WEP_MGMT 0x0c
101 #ifdef OLD_FIRMWARE_VERSIONS
102 #define ACX100_CMD_HALT 0x0e /* mapped to unknownCMD in FW150 */
104 #define ACX1xx_CMD_MEM_READ 0x0d
105 #define ACX1xx_CMD_MEM_WRITE 0x0e
107 #define ACX1xx_CMD_SLEEP 0x0f
108 #define ACX1xx_CMD_WAKE 0x10
109 #define ACX1xx_CMD_UNKNOWN_11 0x11 /* mapped to unknownCMD in FW150 */
110 #define ACX100_CMD_INIT_MEMORY 0x12
111 #define ACX1FF_CMD_DISABLE_RADIO 0x12 /* new firmware? TNETW1450? */
112 #define ACX1xx_CMD_CONFIG_BEACON 0x13
113 #define ACX1xx_CMD_CONFIG_PROBE_RESPONSE 0x14
114 #define ACX1xx_CMD_CONFIG_NULL_DATA 0x15
115 #define ACX1xx_CMD_CONFIG_PROBE_REQUEST 0x16
116 #define ACX1xx_CMD_FCC_TEST 0x17
117 #define ACX1xx_CMD_RADIOINIT 0x18
118 #define ACX111_CMD_RADIOCALIB 0x19
119 #define ACX1FF_CMD_NOISE_HISTOGRAM 0x1c /* new firmware? TNETW1450? */
120 #define ACX1FF_CMD_RX_RESET 0x1d /* new firmware? TNETW1450? */
121 #define ACX1FF_CMD_LNA_CONTROL 0x20 /* new firmware? TNETW1450? */
122 #define ACX1FF_CMD_CONTROL_DBG_TRACE 0x21 /* new firmware? TNETW1450? */
124 /***********************************************************************
125 ** Tx/Rx buffer sizes and watermarks
127 ** This will alloc and use DMAable buffers of
128 ** WLAN_A4FR_MAXLEN_WEP_FCS * (RX_CNT + TX_CNT) bytes
129 ** RX/TX_CNT=32 -> ~150k DMA buffers
130 ** RX/TX_CNT=16 -> ~75k DMA buffers
132 ** 2005-10-10: reduced memory usage by lowering both to 16
137 /* we clean up txdescs when we have N free txdesc: */
138 #define TX_CLEAN_BACKLOG (TX_CNT/4)
139 #define TX_START_CLEAN (TX_CNT - TX_CLEAN_BACKLOG)
140 #define TX_EMERG_CLEAN 2
141 /* we stop queue if we have < N free txbufs: */
142 #define TX_STOP_QUEUE 3
143 /* we start queue if we have >= N free txbufs: */
144 #define TX_START_QUEUE 5
147 /***********************************************************************
148 **Information Frames Structures
151 /* Used in beacon frames and the like */
152 #define DOT11RATEBYTE_1 (1*2)
153 #define DOT11RATEBYTE_2 (2*2)
154 #define DOT11RATEBYTE_5_5 (5*2+1)
155 #define DOT11RATEBYTE_11 (11*2)
156 #define DOT11RATEBYTE_22 (22*2)
157 #define DOT11RATEBYTE_6_G (6*2)
158 #define DOT11RATEBYTE_9_G (9*2)
159 #define DOT11RATEBYTE_12_G (12*2)
160 #define DOT11RATEBYTE_18_G (18*2)
161 #define DOT11RATEBYTE_24_G (24*2)
162 #define DOT11RATEBYTE_36_G (36*2)
163 #define DOT11RATEBYTE_48_G (48*2)
164 #define DOT11RATEBYTE_54_G (54*2)
165 #define DOT11RATEBYTE_BASIC 0x80 /* flags rates included in basic rate set */
168 /***********************************************************************
171 ** This is the format of rx data returned by acx
174 /* I've hoped it's a 802.11 PHY header, but no...
175 * so far, I've seen on acx111:
176 * 0000 3a00 0000 0000 IBSS Beacons
177 * 0000 3c00 0000 0000 ESS Beacons
178 * 0000 2700 0000 0000 Probe requests
181 typedef struct phy_hdr
{
183 u8 acx111_unknown
[4];
184 } __attribute__ ((packed
)) phy_hdr_t
;
186 /* seems to be a bit similar to hfa384x_rx_frame.
187 * These fields are still not quite obvious, though.
188 * Some seem to have different meanings... */
190 #define RXBUF_HDRSIZE 12
191 #define RXBUF_BYTES_RCVD(adev, rxbuf) \
192 ((le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0xfff) - (adev)->phy_header_len)
193 #define RXBUF_BYTES_USED(rxbuf) \
194 ((le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0xfff) + RXBUF_HDRSIZE)
196 #define RXBUF_IS_TXSTAT(rxbuf) (le16_to_cpu((rxbuf)->mac_cnt_rcvd) & 0x8000)
199 12 bits: length of frame from control field to first byte of FCS
201 1 bit: 1 = it's a tx status info, not a rx packet (USB only)
204 6 bits: number of memory block used to store frame in adapter memory
205 1 bit: Traffic Indicator bit in TIM of received Beacon was set
207 mac_status: 1 byte (bitmap):
210 5 BDCST Address 1 field is a broadcast
211 4 VBM received beacon frame has more than one set bit (?!)
212 3 TIM Set bit representing this station is set in TIM of received beacon
213 2 GROUP Address 1 is a multicast
214 1 ADDR1 Address 1 matches our MAC
217 phy_stat_baseband: 1 byte (bitmap):
218 7 Preamble frame had a long preamble
219 6 PLCP Error CRC16 error in PLCP header
220 5 Unsup_Mod unsupported modulation
221 4 Selected Antenna antenna 1 was used to receive this frame
222 3 PBCC/CCK frame used: 1=PBCC, 0=CCK modulation
223 2 OFDM frame used OFDM modulation
224 1 TI Protection protection frame was detected
227 phy_plcp_signal: 1 byte:
228 Receive PLCP Signal field from the Baseband Processor
231 receive AGC gain level (can be used to measure receive signal strength)
234 estimated noise power of equalized receive signal
235 at input of FEC decoder (can be used to measure receive signal quality)
238 timestamp sampled from either the Access Manager TSF counter
239 or free-running microsecond counter when the MAC receives
240 first byte of PLCP header.
243 typedef struct rxbuffer
{
244 u16 mac_cnt_rcvd
; /* only 12 bits are len! (0xfff) */
247 u8 phy_stat_baseband
; /* bit 0x80: used LNA (Low-Noise Amplifier) */
249 u8 phy_level
; /* PHY stat */
250 u8 phy_snr
; /* PHY stat */
251 u32 time
; /* timestamp upon MAC rcv first byte */
252 /* 4-byte (acx100) or 8-byte (acx111) phy header will be here
253 ** if RX_CFG1_INCLUDE_PHY_HDR is in effect:
255 struct ieee80211_hdr hdr_a3
;
256 /* maximally sized data part of wlan packet */
257 u8 data_a3
[30 + 2312 + 4 - 24]; /*WLAN_A4FR_MAXLEN_WEP_FCS - WLAN_HDR_A3_LEN]*/
258 /* can add hdr/data_a4 if needed */
259 } __attribute__ ((packed
)) rxbuffer_t
;
262 /*--- Firmware statistics ----------------------------------------------------*/
264 /* define a random 100 bytes more to catch firmware versions which
265 * provide a bigger struct */
266 #define FW_STATS_FUTURE_EXTENSION 100
268 typedef struct fw_stats_tx
{
270 } __attribute__ ((packed
)) fw_stats_tx_t
;
272 typedef struct fw_stats_rx
{
275 u32 rx_hw_stuck
; /* old: u32 rx_hdr_use_next */
276 u32 rx_dropped_frame
;
277 u32 rx_frame_ptr_err
;
278 u32 rx_xfr_hint_trig
;
279 u32 rx_aci_events
; /* later versions only */
280 u32 rx_aci_resets
; /* later versions only */
281 } __attribute__ ((packed
)) fw_stats_rx_t
;
283 typedef struct fw_stats_dma
{
288 } __attribute__ ((packed
)) fw_stats_dma_t
;
290 typedef struct fw_stats_irq
{
305 u32 hw_pm_mode_changes
;
309 } __attribute__ ((packed
)) fw_stats_irq_t
;
311 typedef struct fw_stats_wep
{
313 u32 wep_default_key_count
;
314 u32 dot11_def_key_mib
;
315 u32 wep_key_not_found
;
316 u32 wep_decrypt_fail
;
318 u32 wep_decrypt_irqs
;
319 } __attribute__ ((packed
)) fw_stats_wep_t
;
321 typedef struct fw_stats_pwr
{
323 u32 no_ps_tx_too_short
;
325 u32 no_ps_rx_too_short
;
327 u32 no_lppd_too_noisy
;
328 u32 no_lppd_too_short
;
329 u32 no_lppd_matching_frame
;
330 } __attribute__ ((packed
)) fw_stats_pwr_t
;
332 typedef struct fw_stats_mic
{
335 } __attribute__ ((packed
)) fw_stats_mic_t
;
337 typedef struct fw_stats_aes
{
344 } __attribute__ ((packed
)) fw_stats_aes_t
;
346 typedef struct fw_stats_event
{
355 } __attribute__ ((packed
)) fw_stats_event_t
;
357 /* mainly for size calculation only */
358 typedef struct fw_stats
{
369 fw_stats_event_t evt
;
370 u8 _padding
[FW_STATS_FUTURE_EXTENSION
];
373 /* Firmware version struct */
375 typedef struct fw_ver
{
380 } __attribute__ ((packed
)) fw_ver_t
;
382 #define FW_ID_SIZE 20
385 /*--- WEP stuff --------------------------------------------------------------*/
386 #define DOT11_MAX_DEFAULT_WEP_KEYS 4
388 /* non-firmware struct, no packing necessary */
389 typedef struct wep_key
{
390 size_t size
; /* most often used member first */
394 } wep_key_t
; /* size = 264 bytes (33*8) */
395 /* FIXME: We don't have size 264! Or is there 2 bytes beyond the key
396 * (strange_filler)? */
398 /* non-firmware struct, no packing necessary */
399 typedef struct key_struct
{
400 u8 addr
[ETH_ALEN
]; /* 0x00 */
401 u16 filler1
; /* 0x06 */
402 u32 filler2
; /* 0x08 */
403 u32 index
; /* 0x0c */
405 u8 key
[29]; /* 0x12; is this long enough??? */
406 } key_struct_t
; /* size = 276. FIXME: where is the remaining space?? */
409 /*--- Client (peer) info -----------------------------------------------------*/
410 /* adev->sta_list[] is used for:
411 ** accumulating and processing of scan results
412 ** keeping client info in AP mode
413 ** keeping AP info in STA mode (AP is the only one 'client')
414 ** keeping peer info in ad-hoc mode
415 ** non-firmware struct --> no packing necessary */
417 CLIENT_EMPTY_SLOT_0
= 0,
419 CLIENT_AUTHENTICATED_2
= 2,
420 CLIENT_ASSOCIATED_3
= 3,
421 CLIENT_JOIN_CANDIDATE
= 4
424 /* most frequent access first */
425 u8 used
; /* misnamed, more like 'status' */
427 unsigned long mtime
; /* last time we heard it, in jiffies */
428 size_t essid_len
; /* length of ESSID (without '\0') */
429 u32 sir
; /* Standard IR */
430 u32 snr
; /* Signal to Noise Ratio */
431 u16 aid
; /* association ID */
432 u16 seq
; /* from client's auth req */
433 u16 auth_alg
; /* from client's auth req */
434 u16 cap_info
; /* from client's assoc req */
435 u16 rate_cap
; /* what client supports (all rates) */
436 u16 rate_bas
; /* what client supports (basic rates) */
437 u16 rate_cfg
; /* what is allowed (by iwconfig etc) */
438 u16 rate_cur
; /* currently used rate mask */
439 u8 rate_100
; /* currently used rate byte (acx100 only) */
440 u8 address
[ETH_ALEN
];
441 u8 bssid
[ETH_ALEN
]; /* ad-hoc hosts can have bssid != mac */
447 char essid
[IW_ESSID_MAX_SIZE
+ 1]; /* ESSID and trailing '\0' */
448 /* FIXME: this one is too damn big */
449 char challenge_text
[128]; /*WLAN_CHALLENGE_LEN*/
453 /***********************************************************************
454 ** Hardware structures
457 /* An opaque typesafe helper type
459 * Some hardware fields are actually pointers,
460 * but they have to remain u32, since using ptr instead
461 * (8 bytes on 64bit systems!) would disrupt the fixed descriptor
462 * format the acx firmware expects in the non-user area.
463 * Since we cannot cram an 8 byte ptr into 4 bytes, we need to
464 * enforce that pointed to data remains in low memory
465 * (address value needs to fit in 4 bytes) on 64bit systems.
467 * This is easy to get wrong, thus we are using a small struct
468 * and special macros to access it. Macros will check for
469 * attempts to overflow an acx_ptr with value > 0xffffffff.
471 * Attempts to use acx_ptr without macros result in compile-time errors */
475 } __attribute__ ((packed
)) acx_ptr
;
478 #define CHECK32(n) BUG_ON(sizeof(n)>4 && (long)(n)>0xffffff00)
480 #define CHECK32(n) ((void)0)
483 /* acx_ptr <-> integer conversion */
484 #define cpu2acx(n) ({ CHECK32(n); ((acx_ptr){ .v = cpu_to_le32(n) }); })
485 #define acx2cpu(a) (le32_to_cpu(a.v))
487 /* acx_ptr <-> pointer conversion */
488 #define ptr2acx(p) ({ CHECK32(p); ((acx_ptr){ .v = cpu_to_le32((u32)(long)(p)) }); })
489 #define acx2ptr(a) ((void*)le32_to_cpu(a.v))
491 /* Values for rate field (acx100 only) */
495 #define RATE100_11 110
496 #define RATE100_22 220
497 /* This bit denotes use of PBCC:
498 ** (PBCC encoding is usable with 11 and 22 Mbps speeds only) */
499 #define RATE100_PBCC511 0x80
501 /* Bit values for rate111 field */
502 #define RATE111_1 0x0001 /* DBPSK */
503 #define RATE111_2 0x0002 /* DQPSK */
504 #define RATE111_5 0x0004 /* CCK or PBCC */
505 #define RATE111_6 0x0008 /* CCK-OFDM or OFDM */
506 #define RATE111_9 0x0010 /* CCK-OFDM or OFDM */
507 #define RATE111_11 0x0020 /* CCK or PBCC */
508 #define RATE111_12 0x0040 /* CCK-OFDM or OFDM */
509 #define RATE111_18 0x0080 /* CCK-OFDM or OFDM */
510 #define RATE111_22 0x0100 /* PBCC */
511 #define RATE111_24 0x0200 /* CCK-OFDM or OFDM */
512 #define RATE111_36 0x0400 /* CCK-OFDM or OFDM */
513 #define RATE111_48 0x0800 /* CCK-OFDM or OFDM */
514 #define RATE111_54 0x1000 /* CCK-OFDM or OFDM */
515 #define RATE111_RESERVED 0x2000
516 #define RATE111_PBCC511 0x4000 /* PBCC mod at 5.5 or 11Mbit (else CCK) */
517 #define RATE111_SHORTPRE 0x8000 /* short preamble */
518 /* Special 'try everything' value */
519 #define RATE111_ALL 0x1fff
520 /* These bits denote acx100 compatible settings */
521 #define RATE111_ACX100_COMPAT 0x0127
522 /* These bits denote 802.11b compatible settings */
523 #define RATE111_80211B_COMPAT 0x0027
525 /* Descriptor Ctl field bits
526 * init value is 0x8e, "idle" value is 0x82 (in idle tx descs)
528 #define DESC_CTL_SHORT_PREAMBLE 0x01 /* preamble type: 0 = long; 1 = short */
529 #define DESC_CTL_FIRSTFRAG 0x02 /* this is the 1st frag of the frame */
530 #define DESC_CTL_AUTODMA 0x04
531 #define DESC_CTL_RECLAIM 0x08 /* ready to reuse */
532 #define DESC_CTL_HOSTDONE 0x20 /* host has finished processing */
533 #define DESC_CTL_ACXDONE 0x40 /* acx has finished processing */
534 /* host owns the desc [has to be released last, AFTER modifying all other desc fields!] */
535 #define DESC_CTL_HOSTOWN 0x80
536 #define DESC_CTL_ACXDONE_HOSTOWN (DESC_CTL_ACXDONE | DESC_CTL_HOSTOWN)
538 /* Descriptor Status field
540 #define DESC_STATUS_FULL (1 << 31)
542 /* NB: some bits may be interesting for Monitor mode tx (aka Raw tx): */
543 #define DESC_CTL2_SEQ 0x01 /* don't increase sequence field */
544 #define DESC_CTL2_FCS 0x02 /* don't add the FCS */
545 #define DESC_CTL2_MORE_FRAG 0x04
546 #define DESC_CTL2_RETRY 0x08 /* don't increase retry field */
547 #define DESC_CTL2_POWER 0x10 /* don't increase power mgmt. field */
548 #define DESC_CTL2_RTS 0x20 /* do RTS/CTS magic before sending */
549 #define DESC_CTL2_WEP 0x40 /* encrypt this frame */
550 #define DESC_CTL2_DUR 0x80 /* don't increase duration field */
552 /***********************************************************************
556 /* Outside of "#ifdef PCI" because USB needs to know sizeof()
557 ** of txdesc and rxdesc: */
559 acx_ptr pNextDesc
; /* pointer to next txdesc */
560 acx_ptr HostMemPtr
; /* 0x04 */
561 acx_ptr AcxMemPtr
; /* 0x08 */
562 u32 tx_time
; /* 0x0c */
563 u16 total_length
; /* 0x10 */
564 u16 Reserved
; /* 0x12 */
566 /* The following 16 bytes do not change when acx100 owns the descriptor */
567 /* BUG: fw clears last byte of this area which is supposedly reserved
568 ** for driver use. amd64 blew up. We dare not use it now */
571 u8 Ctl_8
; /* 0x24, 8bit value */
572 u8 Ctl2_8
; /* 0x25, 8bit value */
574 u8 ack_failures
; /* 0x27 */
575 u8 rts_failures
; /* 0x28 */
576 u8 rts_ok
; /* 0x29 */
580 u8 queue_ctrl
; /* 0x2b */
581 } __attribute__ ((packed
)) r1
;
583 u16 rate111
; /* 0x2a */
584 } __attribute__ ((packed
)) r2
;
585 } __attribute__ ((packed
)) u
;
586 u32 queue_info
; /* 0x2c (acx100, reserved on acx111) */
587 } __attribute__ ((packed
)); /* size : 48 = 0x30 */
588 /* NB: acx111 txdesc structure is 4 byte larger */
589 /* All these 4 extra bytes are reserved. tx alloc code takes them into account */
592 acx_ptr pNextDesc
; /* 0x00 */
593 acx_ptr HostMemPtr
; /* 0x04 */
594 acx_ptr ACXMemPtr
; /* 0x08 */
595 u32 rx_time
; /* 0x0c */
596 u16 total_length
; /* 0x10 */
597 u16 WEP_length
; /* 0x12 */
598 u32 WEP_ofs
; /* 0x14 */
600 /* the following 16 bytes do not change when acx100 owns the descriptor */
601 u8 driverWorkspace
[16]; /* 0x18 */
606 u8 SNR
; /* Signal-to-Noise Ratio */
611 } __attribute__ ((packed
)); /* size 52 = 0x34 */
613 /***********************************************************************
614 ** USB structures and constants
616 #ifdef ACX_MAC80211_USB
618 /* Used for usb_txbuffer.desc field */
619 #define USB_TXBUF_TXDESC 0xA
620 /* Size of header (everything up to data[]) */
621 #define USB_TXBUF_HDRSIZE 14
622 typedef struct usb_txbuffer
{
631 /* wlan packet content is placed here: */
632 u8 data
[30 + 2312 + 4]; /*WLAN_A4FR_MAXLEN_WEP_FCS]*/
633 } __attribute__ ((packed
)) usb_txbuffer_t
;
635 /* USB returns either rx packets (see rxbuffer) or
636 ** these "tx status" structs: */
637 typedef struct usb_txstatus
{
638 u16 mac_cnt_rcvd
; /* only 12 bits are len! (0xfff) */
640 u8 mac_status
; /* seen 0x20 on tx failure */
646 // struct ieee80211_tx_status txstatus;
647 // struct sk_buff *skb;
648 } __attribute__ ((packed
)) usb_txstatus_t
;
650 typedef struct usb_tx
{
654 /* actual USB bulk output data block is here: */
655 usb_txbuffer_t bulkout
;
658 struct usb_rx_plain
{
665 typedef struct usb_rx
{
670 /* Make entire structure 4k */
671 u8 padding
[4*1024 - sizeof(struct usb_rx_plain
)];
676 /* Config Option structs */
678 typedef struct co_antennas
{
682 } __attribute__ ((packed
)) co_antennas_t
;
684 typedef struct co_powerlevels
{
688 } __attribute__ ((packed
)) co_powerlevels_t
;
690 typedef struct co_datarates
{
694 } __attribute__ ((packed
)) co_datarates_t
;
696 typedef struct co_domains
{
700 } __attribute__ ((packed
)) co_domains_t
;
702 typedef struct co_product_id
{
706 } __attribute__ ((packed
)) co_product_id_t
;
708 typedef struct co_manuf_id
{
712 } __attribute__ ((packed
)) co_manuf_t
;
714 typedef struct co_fixed
{
716 /* u16 NVS_vendor_offs; ACX111-only */
717 /* u16 unknown; ACX111-only */
718 u8 MAC
[6]; /* ACX100-only */
719 u16 probe_delay
; /* ACX100-only */
723 u8 dot11ShortPreambleOption
;
725 u8 dot11ChannelAgility
;
726 u8 dot11PhyType
; /* FIXME: does 802.11 call it "dot11PHYType"? */
729 } __attribute__ ((packed
)) co_fixed_t
;
731 typedef struct acx111_ie_configoption
{
734 /* Do not access below members directly, they are in fact variable length */
736 co_antennas_t antennas
;
737 co_powerlevels_t power_levels
;
738 co_datarates_t data_rates
;
739 co_domains_t domains
;
740 co_product_id_t product_id
;
741 co_manuf_t manufacturer
;
743 } __attribute__ ((packed
)) acx111_ie_configoption_t
;
745 /***********************************************************************
746 ** Main acx per-device data structure
748 #define ACX_STATE_FW_LOADED 0x01
749 #define ACX_STATE_IFACE_UP 0x02
751 /* MAC mode (BSS type) defines
752 * Note that they shouldn't be redefined, since they are also used
753 * during communication with firmware */
754 #define ACX_MODE_0_ADHOC 0
755 #define ACX_MODE_1_UNUSED 1
756 #define ACX_MODE_2_STA 2
757 #define ACX_MODE_3_AP 3
758 /* These are our own inventions. Sending these to firmware
759 ** makes it stop emitting beacons, which is exactly what we want
760 ** for these modes */
761 #define ACX_MODE_MONITOR 0xfe
762 #define ACX_MODE_OFF 0xff
763 /* 'Submode': identifies exact status of ADHOC/STA host */
764 #define ACX_STATUS_0_STOPPED 0
765 #define ACX_STATUS_1_SCANNING 1
766 #define ACX_STATUS_2_WAIT_AUTH 2
767 #define ACX_STATUS_3_AUTHENTICATED 3
768 #define ACX_STATUS_4_ASSOCIATED 4
770 /* FIXME: this should be named something like struct acx_priv (typedef'd to
773 /* non-firmware struct, no packing necessary */
775 /* most frequent accesses first (dereferencing and cache line!) */
786 /* The IRQ we have inherited */
788 /* Are IRQs currently activated? FIXME: should get rid of this */
790 /* The interrupts we can acknowledge (see acx_irq.h) */
792 /* The mask of IRQs saved by the IRQ top half routine */
795 * FIXME: these ones should disappear
797 unsigned int irq_loops_this_jiffy
;
798 unsigned long irq_last_jiffies
;
799 /* Barely used in USB case (FIXME?) */
801 int irq_reason
; /* FIXME: should be u16 */
802 /* Mask of jobs we have to schedule post interrupt */
803 u8 after_interrupt_jobs
;
805 * Work queue for the bottom half. FIXME: only one, consider a
806 * delayed_work struct some day?
808 struct work_struct after_interrupt_task
;
809 #if defined(PARANOID_LOCKING) /* Lock debugging */
810 const char *last_sem
;
811 const char *last_lock
;
812 unsigned long sem_time
;
813 unsigned long lock_time
;
816 /*** Linux network device ***/
817 //struct device *dev; /* pointer to linux netdevice */
819 /*** Device statistics ***/
820 struct ieee80211_low_level_stats ieee_stats
; /* wireless device statistics */
822 /*** Device statistics ***/
823 struct net_device_stats stats
; /* net device statistics */
826 // struct iw_statistics wstats; /* wireless statistics */
828 struct ieee80211_hw
*ieee
;
829 struct ieee80211_hw_mode modes
[2];
830 struct ieee80211_rx_status rx_status
;
832 struct ieee80211_vif
*vif
;
834 /*** Power managment ***/
835 struct pm_dev
*pm
; /* PM crap */
837 /*** Management timer ***/
838 struct timer_list mgmt_timer
;
840 /*** Hardware identification ***/
841 const char *chip_name
;
847 /*** Config retrieved from EEPROM ***/
849 u16 cfgopt_NVS_vendor_offs
;
851 u16 cfgopt_probe_delay
;
852 u32 cfgopt_eof_memory
;
853 u8 cfgopt_dot11CCAModes
;
854 u8 cfgopt_dot11Diversity
;
855 u8 cfgopt_dot11ShortPreambleOption
;
856 u8 cfgopt_dot11PBCCOption
;
857 u8 cfgopt_dot11ChannelAgility
;
858 u8 cfgopt_dot11PhyType
;
859 u8 cfgopt_dot11TempType
;
860 co_antennas_t cfgopt_antennas
;
861 co_powerlevels_t cfgopt_power_levels
;
862 co_datarates_t cfgopt_data_rates
;
863 co_domains_t cfgopt_domains
;
864 co_product_id_t cfgopt_product_id
;
865 co_manuf_t cfgopt_manufacturer
;
867 /*** Firmware identification ***/
868 char firmware_version
[FW_ID_SIZE
+1];
872 const u16
*ie_len_dot11
;
874 /*** Device state ***/
876 u8 led_power
; /* power LED status */
877 u32 get_mask
; /* mask of settings to fetch from the card */
878 u32 set_mask
; /* mask of settings to write to the card */
883 u16 scan_count
; /* number of times to do channel scan */
884 u8 scan_mode
; /* 0 == active, 1 == passive, 2 == background */
887 u16 scan_probe_delay
;
888 #if WIRELESS_EXT > 15
889 // struct iw_spy_data spy_data; /* FIXME: needs to be implemented! */
892 /*** Virtual interface struct ***/
893 struct acx_interface interface
;
895 /*** Wireless network settings ***/
896 /* copy of the device address (ifconfig hw ether) that we actually use
897 ** for 802.11; copied over from the network device's MAC address
898 ** (ifconfig) when it makes sense only */
899 u8 dev_addr
[MAX_ADDR_LEN
];
900 u8 bssid
[ETH_ALEN
]; /* the BSSID after having joined */
901 u8 ap
[ETH_ALEN
]; /* The AP we want, FF:FF:FF:FF:FF:FF is any */
902 u16 aid
; /* The Association ID sent from the AP / last used AID if we're an AP */
903 u16 mode
; /* mode from iwconfig */
904 int monitor_type
; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
905 u16 status
; /* 802.11 association status */
906 u8 essid_active
; /* specific ESSID active, or select any? */
907 u8 essid_len
; /* to avoid dozens of strlen() */
908 /* INCLUDES \0 termination for easy printf - but many places
909 ** simply want the string data memcpy'd plus a length indicator!
910 ** Keep that in mind... */
911 char essid
[IW_ESSID_MAX_SIZE
+1];
912 /* essid we are going to use for association, in case of "essid 'any'"
913 ** and in case of hidden ESSID (use configured ESSID then) */
914 char essid_for_assoc
[IW_ESSID_MAX_SIZE
+1];
915 char nick
[IW_ESSID_MAX_SIZE
+1]; /* see essid! */
917 u8 reg_dom_id
; /* reg domain setting */
918 u16 reg_dom_chanmask
;
919 u16 auth_or_assoc_retries
;
921 unsigned long scan_start
; /* YES, jiffies is defined as "unsigned long" */
924 /* MAC80211 Template Reference */
925 struct sk_buff
*beacon_cache
;
926 /* stations known to us (if we're an ap) */
927 // client_t sta_list[32]; /* tab is larger than list, so that */
928 // client_t *sta_hash_tab[64]; /* hash collisions are not likely */
929 // client_t *ap_client; /* this one is our AP (STA mode only) */
933 unsigned long dup_msg_expiry
;
934 u16 last_seq_ctrl
; /* duplicate packet detection */
936 /* 802.11 power save mode */
938 u8 ps_listen_interval
;
940 u8 ps_hangover_period
;
941 u32 ps_enhanced_transition_time
;
942 u32 ps_beacon_rx_time
;
944 /*** PHY settings ***/
945 u8 fallback_threshold
;
951 u8 rate_auto
; /* false if "iwconfig rate N" (WITHOUT 'auto'!) */
952 u8 preamble_mode
; /* 0 == Long Preamble, 1 == Short, 2 == Auto */
957 /* u8 tx_level_val; */
958 /* u8 tx_level_auto; whether to do automatic power adjustment */
960 unsigned long recalib_time_last_success
;
961 unsigned long recalib_time_last_attempt
;
962 int recalib_failure_count
;
963 int recalib_msg_ratelimit
;
964 int retry_errors_msg_ratelimit
;
966 unsigned long brange_time_last_state_change
; /* time the power LED was last changed */
967 u8 brange_last_state
; /* last state of the LED */
968 u8 brange_max_quality
; /* maximum quality that equates to full speed */
971 u8 antenna
; /* antenna settings */
972 u8 ed_threshold
; /* energy detect threshold */
973 u8 cca
; /* clear channel assessment */
980 u16 listen_interval
; /* given in units of beacon interval */
984 u8 rate_supported_len
;
985 u8 rate_supported
[13];
987 /*** Encryption settings (WEP) ***/
988 u32 auth_alg
; /* used in transmit_authen1 */
991 u8 wep_current_index
;
992 wep_key_t wep_keys
[DOT11_MAX_DEFAULT_WEP_KEYS
]; /* the default WEP keys */
994 key_struct_t wep_key_struct
[10];
996 /*** Encryption Replacement for mac80211 ***/
997 struct acx_key key
[54];
1005 /*** Card Rx/Tx management ***/
1009 unsigned int tx_free
;
1010 unsigned int tx_head
; /* keep as close as possible to Tx stuff below (cache line) */
1013 /*************************************************************************
1014 *** PCI/USB/... must be last or else hw agnostic code breaks horribly ***
1015 *************************************************************************/
1017 /* hack to let common code compile. FIXME */
1018 dma_addr_t rxhostdesc_startphy
;
1021 #ifdef ACX_MAC80211_PCI
1022 /* pointers to tx buffers, tx host descriptors (in host memory)
1023 ** and tx descs in device memory */
1024 unsigned int tx_tail
;
1026 txhostdesc_t
*txhostdesc_start
;
1027 txdesc_t
*txdesc_start
; /* points to PCI-mapped memory */
1028 dma_addr_t txbuf_startphy
;
1029 dma_addr_t txhostdesc_startphy
;
1030 /* sizes of above host memory areas */
1031 unsigned int txbuf_area_size
;
1032 unsigned int txhostdesc_area_size
;
1034 unsigned int txdesc_size
; /* size of txdesc; ACX111 = ACX100 + 4 */
1035 client_t
*txc
[TX_CNT
];
1039 unsigned int rx_tail
;
1040 rxbuffer_t
*rxbuf_start
;
1041 rxhostdesc_t
*rxhostdesc_start
;
1042 rxdesc_t
*rxdesc_start
;
1043 /* physical addresses of above host memory areas */
1044 dma_addr_t rxbuf_startphy
;
1045 /* dma_addr_t rxhostdesc_startphy; */
1046 unsigned int rxbuf_area_size
;
1047 unsigned int rxhostdesc_area_size
;
1051 const u16
*io
; /* points to ACX100 or ACX111 PCI I/O register address set */
1054 struct pci_dev
*pdev
;
1057 struct vlynq_device
*vdev
;
1059 struct device
*bus_dev
;
1060 unsigned long membase
;
1061 unsigned long membase2
;
1062 void __iomem
*iobase
;
1063 void __iomem
*iobase2
;
1064 /* command interface */
1065 u8 __iomem
*cmd_area
;
1066 u8 __iomem
*info_area
;
1071 #ifdef ACX_MAC80211_USB
1072 struct usb_device
*usbdev
;
1074 rxbuffer_t rxtruncbuf
;
1079 int bulkinep
; /* bulk-in endpoint */
1080 int bulkoutep
; /* bulk-out endpoint */
1087 #define ieee2adev(ieee80211_hw) ((ieee80211_hw)->priv)
1089 /* For use with ACX1xx_IE_RXCONFIG */
1091 * 13 include additional header (length etc.) *required*
1092 * struct is defined in 'struct rxbuffer'
1093 * is this bit acx100 only? does acx111 always put the header,
1094 * and bit setting is irrelevant? --vda
1095 * 10 receive frames only with SSID used in last join cmd
1096 * 9 discard broadcast
1097 * 8 receive packets for multicast address 1
1098 * 7 receive packets for multicast address 0
1099 * 6 discard all multicast packets
1100 * 5 discard frames from foreign BSSID
1101 * 4 discard frames with foreign destination MAC address
1102 * 3 promiscuous mode (receive ALL frames, disable filter)
1104 * 1 include phy header
1107 #define RX_CFG1_INCLUDE_RXBUF_HDR 0x2000 /* ACX100 only */
1108 #define RX_CFG1_FILTER_SSID 0x0400
1109 #define RX_CFG1_FILTER_BCAST 0x0200
1110 #define RX_CFG1_RCV_MC_ADDR1 0x0100
1111 #define RX_CFG1_RCV_MC_ADDR0 0x0080
1112 #define RX_CFG1_FILTER_ALL_MULTI 0x0040
1113 #define RX_CFG1_FILTER_BSSID 0x0020
1114 #define RX_CFG1_FILTER_MAC 0x0010
1115 #define RX_CFG1_RCV_PROMISCUOUS 0x0008
1116 #define RX_CFG1_INCLUDE_FCS 0x0004
1117 #define RX_CFG1_INCLUDE_PHY_HDR (WANT_PHY_HDR ? 0x0002 : 0)
1119 * 11 receive association requests etc.
1120 * 10 receive authentication frames
1121 * 9 receive beacon frames
1122 * 8 receive contention free packets
1123 * 7 receive control frames
1124 * 6 receive data frames
1125 * 5 receive broken frames
1126 * 4 receive management frames
1127 * 3 receive probe requests
1128 * 2 receive probe responses
1129 * 1 receive RTS/CTS/ACK frames
1132 #define RX_CFG2_RCV_ASSOC_REQ 0x0800
1133 #define RX_CFG2_RCV_AUTH_FRAMES 0x0400
1134 #define RX_CFG2_RCV_BEACON_FRAMES 0x0200
1135 #define RX_CFG2_RCV_CONTENTION_FREE 0x0100
1136 #define RX_CFG2_RCV_CTRL_FRAMES 0x0080
1137 #define RX_CFG2_RCV_DATA_FRAMES 0x0040
1138 #define RX_CFG2_RCV_BROKEN_FRAMES 0x0020
1139 #define RX_CFG2_RCV_MGMT_FRAMES 0x0010
1140 #define RX_CFG2_RCV_PROBE_REQ 0x0008
1141 #define RX_CFG2_RCV_PROBE_RESP 0x0004
1142 #define RX_CFG2_RCV_ACK_FRAMES 0x0002
1143 #define RX_CFG2_RCV_OTHER 0x0001
1145 /* For use with ACX1xx_IE_FEATURE_CONFIG */
1146 #define FEATURE1_80MHZ_CLOCK 0x00000040L
1147 #define FEATURE1_4X 0x00000020L
1148 #define FEATURE1_LOW_RX 0x00000008L
1149 #define FEATURE1_EXTRA_LOW_RX 0x00000001L
1151 #define FEATURE2_SNIFFER 0x00000080L
1152 #define FEATURE2_NO_TXCRYPT 0x00000001L
1154 /*-- get and set mask values --*/
1155 #define GETSET_LED_POWER 0x00000001L
1156 #define GETSET_STATION_ID 0x00000002L
1157 #define SET_TEMPLATES 0x00000004L
1158 #define SET_STA_LIST 0x00000008L
1159 #define GETSET_TX 0x00000010L
1160 #define GETSET_RX 0x00000020L
1161 #define SET_RXCONFIG 0x00000040L
1162 #define GETSET_ANTENNA 0x00000080L
1163 #define GETSET_SENSITIVITY 0x00000100L
1164 #define GETSET_TXPOWER 0x00000200L
1165 #define GETSET_ED_THRESH 0x00000400L
1166 #define GETSET_CCA 0x00000800L
1167 #define GETSET_POWER_80211 0x00001000L
1168 #define GETSET_RETRY 0x00002000L
1169 #define GETSET_REG_DOMAIN 0x00004000L
1170 #define GETSET_CHANNEL 0x00008000L
1171 /* Used when ESSID changes etc and we need to scan for AP anew */
1172 #define GETSET_RESCAN 0x00010000L
1173 #define GETSET_MODE 0x00020000L
1174 #define GETSET_WEP 0x00040000L
1175 #define SET_WEP_OPTIONS 0x00080000L
1176 #define SET_MSDU_LIFETIME 0x00100000L
1177 #define SET_RATE_FALLBACK 0x00200000L
1179 /* keep in sync with the above */
1180 #define GETSET_ALL (0 \
1181 /* GETSET_LED_POWER */ | 0x00000001L \
1182 /* GETSET_STATION_ID */ | 0x00000002L \
1183 /* SET_TEMPLATES */ | 0x00000004L \
1184 /* SET_STA_LIST */ | 0x00000008L \
1185 /* GETSET_TX */ | 0x00000010L \
1186 /* GETSET_RX */ | 0x00000020L \
1187 /* SET_RXCONFIG */ | 0x00000040L \
1188 /* GETSET_ANTENNA */ | 0x00000080L \
1189 /* GETSET_SENSITIVITY */| 0x00000100L \
1190 /* GETSET_TXPOWER */ | 0x00000200L \
1191 /* GETSET_ED_THRESH */ | 0x00000400L \
1192 /* GETSET_CCA */ | 0x00000800L \
1193 /* GETSET_POWER_80211 */| 0x00001000L \
1194 /* GETSET_RETRY */ | 0x00002000L \
1195 /* GETSET_REG_DOMAIN */ | 0x00004000L \
1196 /* GETSET_CHANNEL */ | 0x00008000L \
1197 /* GETSET_RESCAN */ | 0x00010000L \
1198 /* GETSET_MODE */ | 0x00020000L \
1199 /* GETSET_WEP */ | 0x00040000L \
1200 /* SET_WEP_OPTIONS */ | 0x00080000L \
1201 /* SET_MSDU_LIFETIME */ | 0x00100000L \
1202 /* SET_RATE_FALLBACK */ | 0x00200000L \
1205 /***********************************************************************
1207 typedef struct acx100_ie_memblocksize
{
1211 } __attribute__ ((packed
)) acx100_ie_memblocksize_t
;
1213 typedef struct acx100_ie_queueconfig
{
1220 u8 NumRxDesc
; /* for USB only */
1223 u32 HostQueueEnd
; /* QueueEnd2 */
1228 } __attribute__ ((packed
)) acx100_ie_queueconfig_t
;
1230 typedef struct acx111_ie_queueconfig
{
1233 u32 tx_memory_block_address
;
1234 u32 rx_memory_block_address
;
1235 u32 rx1_queue_address
;
1237 u32 tx1_queue_address
;
1241 } __attribute__ ((packed
)) acx111_ie_queueconfig_t
;
1243 typedef struct acx100_ie_memconfigoption
{
1247 acx_ptr pRxHostDesc
;
1252 } __attribute__ ((packed
)) acx100_ie_memconfigoption_t
;
1254 typedef struct acx111_ie_memoryconfig
{
1258 u16 memory_block_size
;
1259 u8 tx_rx_memory_block_allocation
;
1267 /* start of rx1 block */
1268 u8 rx_queue1_count_descs
;
1269 u8 rx_queue1_reserved1
;
1270 u8 rx_queue1_type
; /* must be set to 7 */
1271 u8 rx_queue1_prio
; /* must be set to 0 */
1272 acx_ptr rx_queue1_host_rx_start
;
1273 /* end of rx1 block */
1275 /* start of tx1 block */
1276 u8 tx_queue1_count_descs
;
1277 u8 tx_queue1_reserved1
;
1278 u8 tx_queue1_reserved2
;
1279 u8 tx_queue1_attributes
;
1280 /* end of tx1 block */
1281 } __attribute__ ((packed
)) acx111_ie_memoryconfig_t
;
1283 typedef struct acx_ie_memmap
{
1290 u32 PacketTemplateStart
;
1291 u32 PacketTemplateEnd
;
1296 } __attribute__ ((packed
)) acx_ie_memmap_t
;
1298 typedef struct acx111_ie_feature_config
{
1301 u32 feature_options
;
1302 u32 data_flow_options
;
1303 } __attribute__ ((packed
)) acx111_ie_feature_config_t
;
1305 typedef struct acx111_ie_tx_level
{
1309 } __attribute__ ((packed
)) acx111_ie_tx_level_t
;
1311 #define PS_CFG_ENABLE 0x80
1312 #define PS_CFG_PENDING 0x40 /* status flag when entering PS */
1313 #define PS_CFG_WAKEUP_MODE_MASK 0x07
1314 #define PS_CFG_WAKEUP_BY_HOST 0x03
1315 #define PS_CFG_WAKEUP_EACH_ITVL 0x02
1316 #define PS_CFG_WAKEUP_ON_DTIM 0x01
1317 #define PS_CFG_WAKEUP_ALL_BEAC 0x00
1319 /* Enhanced PS mode: sleep until Rx Beacon w/ the STA's AID bit set
1320 ** in the TIM; newer firmwares only(?) */
1321 #define PS_OPT_ENA_ENHANCED_PS 0x04
1322 #define PS_OPT_TX_PSPOLL 0x02 /* send PSPoll frame to fetch waiting frames from AP (on frame with matching AID) */
1323 #define PS_OPT_STILL_RCV_BCASTS 0x01
1325 typedef struct acx100_ie_powersave
{
1329 u8 listen_interval
; /* for EACH_ITVL: wake up every "beacon units" interval */
1331 u8 hangover_period
; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1332 u16 enhanced_ps_transition_time
; /* rem. wake time for Enh. PS */
1333 } __attribute__ ((packed
)) acx100_ie_powersave_t
;
1335 typedef struct acx111_ie_powersave
{
1339 u8 listen_interval
; /* for EACH_ITVL: wake up every "beacon units" interval */
1341 u8 hangover_period
; /* remaining wake time after Tx MPDU w/ PS bit, in values of 1/1024 seconds */
1343 u32 enhanced_ps_transition_time
; /* rem. wake time for Enh. PS */
1344 } __attribute__ ((packed
)) acx111_ie_powersave_t
;
1347 /***********************************************************************
1348 ** Commands and template structures
1352 ** SCAN command structure
1354 ** even though acx100 scan rates match RATE100 constants,
1355 ** acx111 ones do not match! Therefore we do not use RATE100 #defines */
1356 #define ACX_SCAN_RATE_1 10
1357 #define ACX_SCAN_RATE_2 20
1358 #define ACX_SCAN_RATE_5 55
1359 #define ACX_SCAN_RATE_11 110
1360 #define ACX_SCAN_RATE_22 220
1361 #define ACX_SCAN_RATE_PBCC 0x80 /* OR with this if needed */
1362 #define ACX_SCAN_OPT_ACTIVE 0x00 /* a bit mask */
1363 #define ACX_SCAN_OPT_PASSIVE 0x01
1364 /* Background scan: we go into Power Save mode (by transmitting
1365 ** NULL data frame to AP with the power mgmt bit set), do the scan,
1366 ** and then exit Power Save mode. A plus is that AP buffers frames
1367 ** for us while we do background scan. Thus we avoid frame losses.
1368 ** Background scan can be active or passive, just like normal one */
1369 #define ACX_SCAN_OPT_BACKGROUND 0x02
1370 typedef struct acx100_scan
{
1371 u16 count
; /* number of scans to do, 0xffff == continuous */
1373 u16 flags
; /* channel list mask; 0x8000 == all channels? */
1374 u8 max_rate
; /* max. probe rate */
1375 u8 options
; /* bit mask, see defines above */
1377 u16 max_probe_delay
;
1378 } __attribute__ ((packed
)) acx100_scan_t
; /* length 0xc */
1380 #define ACX111_SCAN_RATE_6 0x0B
1381 #define ACX111_SCAN_RATE_9 0x0F
1382 #define ACX111_SCAN_RATE_12 0x0A
1383 #define ACX111_SCAN_RATE_18 0x0E
1384 #define ACX111_SCAN_RATE_24 0x09
1385 #define ACX111_SCAN_RATE_36 0x0D
1386 #define ACX111_SCAN_RATE_48 0x08
1387 #define ACX111_SCAN_RATE_54 0x0C
1388 #define ACX111_SCAN_OPT_5GHZ 0x04 /* else 2.4GHZ */
1389 #define ACX111_SCAN_MOD_SHORTPRE 0x01 /* you can combine SHORTPRE and PBCC */
1390 #define ACX111_SCAN_MOD_PBCC 0x80
1391 #define ACX111_SCAN_MOD_OFDM 0x40
1392 typedef struct acx111_scan
{
1393 u16 count
; /* number of scans to do */
1394 u8 channel_list_select
; /* 0: scan all channels, 1: from chan_list only */
1397 u8 rate
; /* rate for probe requests (if active scan) */
1398 u8 options
; /* bit mask, see defines above */
1399 u16 chan_duration
; /* min time to wait for reply on one channel (in TU) */
1400 /* (active scan only) (802.11 section 11.1.3.2.2) */
1401 u16 max_probe_delay
; /* max time to wait for reply on one channel (active scan) */
1402 /* time to listen on a channel (passive scan) */
1404 u8 channel_list
[26]; /* bits 7:0 first byte: channels 8:1 */
1405 /* bits 7:0 second byte: channels 16:9 */
1406 /* 26 bytes is enough to cover 802.11a */
1407 } __attribute__ ((packed
)) acx111_scan_t
;
1410 ** Radio calibration command structure
1412 typedef struct acx111_cmd_radiocalib
{
1413 /* 0x80000000 == automatic calibration by firmware, according to interval;
1414 * bits 0..3: select calibration methods to go through:
1415 * calib based on DC, AfeDC, Tx mismatch, Tx equilization */
1418 } __attribute__ ((packed
)) acx111_cmd_radiocalib_t
;
1421 ** Packet template structures
1423 ** Packet templates store contents of Beacon, Probe response, Probe request,
1424 ** Null data frame, and TIM data frame. Firmware automatically transmits
1425 ** contents of template at appropriate time:
1426 ** - Beacon: when configured as AP or Ad-hoc
1427 ** - Probe response: when configured as AP or Ad-hoc, whenever
1428 ** a Probe request frame is received
1429 ** - Probe request: when host issues SCAN command (active)
1430 ** - Null data frame: when entering 802.11 power save mode
1431 ** - TIM data: at the end of Beacon frames (if no TIM template
1432 ** is configured, then transmits default TIM)
1434 ** - size field must be set to size of actual template
1435 ** (NOT sizeof(struct) - templates are variable in length),
1436 ** size field is not itself counted.
1437 ** - members flagged with an asterisk must be initialized with host,
1438 ** rest must be zero filled.
1439 ** - variable length fields shown only in comments */
1440 typedef struct acx_template_tim
{
1442 u8 tim_eid
; /* 00 1 TIM IE ID * */
1443 u8 len
; /* 01 1 Length * */
1444 u8 dtim_cnt
; /* 02 1 DTIM Count */
1445 u8 dtim_period
; /* 03 1 DTIM Period */
1446 u8 bitmap_ctrl
; /* 04 1 Bitmap Control * (except bit0) */
1447 /* 05 n Partial Virtual Bitmap * */
1448 u8 variable
[0x100 - 1-1-1-1-1];
1449 } __attribute__ ((packed
)) acx_template_tim_t
;
1451 typedef struct acx_template_probereq
{
1453 u16 fc
; /* 00 2 fc * */
1454 u16 dur
; /* 02 2 Duration */
1455 u8 da
[6]; /* 04 6 Destination Address * */
1456 u8 sa
[6]; /* 0A 6 Source Address * */
1457 u8 bssid
[6]; /* 10 6 BSSID * */
1458 u16 seq
; /* 16 2 Sequence Control */
1460 /* nn n Supported Rates * */
1461 u8 variable
[0x44 - 2-2-6-6-6-2];
1462 } __attribute__ ((packed
)) acx_template_probereq_t
;
1464 typedef struct acx_template_proberesp
{
1466 u16 fc
; /* 00 2 fc * (bits [15:12] and [10:8] per 802.11 section 7.1.3.1) */
1467 u16 dur
; /* 02 2 Duration */
1468 u8 da
[6]; /* 04 6 Destination Address */
1469 u8 sa
[6]; /* 0A 6 Source Address */
1470 u8 bssid
[6]; /* 10 6 BSSID */
1471 u16 seq
; /* 16 2 Sequence Control */
1472 u8 timestamp
[8];/* 18 8 Timestamp */
1473 u16 beacon_interval
; /* 20 2 Beacon Interval * */
1474 u16 cap
; /* 22 2 Capability Information * */
1476 /* nn n Supported Rates * */
1477 /* nn 1 DS Parameter Set * */
1478 u8 variable
[0x54 - 2-2-6-6-6-2-8-2-2];
1479 } __attribute__ ((packed
)) acx_template_proberesp_t
;
1480 #define acx_template_beacon_t acx_template_proberesp_t
1481 #define acx_template_beacon acx_template_proberesp
1483 typedef struct acx_template_nullframe
{
1485 struct ieee80211_hdr hdr
;
1486 } __attribute__ ((packed
)) acx_template_nullframe_t
;
1490 ** JOIN command structure
1492 ** as opposed to acx100, acx111 dtim interval is AFTER rates_basic111.
1493 ** NOTE: took me about an hour to get !@#$%^& packing right --> struct packing is eeeeevil... */
1494 typedef struct acx_joinbss
{
1496 u16 beacon_interval
;
1502 } __attribute__ ((packed
)) acx100
;
1506 } __attribute__ ((packed
)) acx111
;
1507 } __attribute__ ((packed
)) u
;
1508 u8 genfrm_txrate
; /* generated frame (bcn, proberesp, RTS, PSpoll) tx rate */
1509 u8 genfrm_mod_pre
; /* generated frame modulation/preamble:
1510 ** bit7: PBCC, bit6: OFDM (else CCK/DQPSK/DBPSK)
1511 ** bit5: short pre */
1512 u8 macmode
; /* BSS Type, must be one of ACX_MODE_xxx */
1515 char essid
[IW_ESSID_MAX_SIZE
];
1516 } __attribute__ ((packed
)) acx_joinbss_t
;
1518 #define JOINBSS_RATES_1 0x01
1519 #define JOINBSS_RATES_2 0x02
1520 #define JOINBSS_RATES_5 0x04
1521 #define JOINBSS_RATES_11 0x08
1522 #define JOINBSS_RATES_22 0x10
1524 /* Looks like missing bits are used to indicate 11g rates!
1525 ** (it follows from the fact that constants below match 1:1 to RATE111_nn)
1526 ** This was actually seen! Look at that Assoc Request sent by acx111,
1527 ** it _does_ contain 11g rates in basic set:
1528 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
1529 01:30:20.074425 Authentication (Open System)-1: Succesful
1530 01:30:20.076539 Authentication (Open System)-2:
1531 01:30:20.076620 Acknowledgment
1532 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]
1533 01:30:20.122413 Assoc Response AID(1) :: Succesful
1534 01:30:20.122679 Acknowledgment
1535 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
1537 #define JOINBSS_RATES_BASIC111_1 0x0001
1538 #define JOINBSS_RATES_BASIC111_2 0x0002
1539 #define JOINBSS_RATES_BASIC111_5 0x0004
1540 #define JOINBSS_RATES_BASIC111_11 0x0020
1541 #define JOINBSS_RATES_BASIC111_22 0x0100
1544 /***********************************************************************
1546 typedef struct mem_read_write
{
1548 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! */
1551 } __attribute__ ((packed
)) mem_read_write_t
;
1553 typedef struct firmware_image
{
1556 u8 data
[1]; /* the byte array of the actual firmware... */
1557 } __attribute__ ((packed
)) firmware_image_t
;
1559 typedef struct acx_cmd_radioinit
{
1562 } __attribute__ ((packed
)) acx_cmd_radioinit_t
;
1564 typedef struct acx100_ie_wep_options
{
1567 u16 NumKeys
; /* max # of keys */
1568 u8 WEPOption
; /* 0 == decrypt default key only, 1 == override decrypt */
1569 u8 Pad
; /* used only for acx111 */
1570 } __attribute__ ((packed
)) acx100_ie_wep_options_t
;
1572 typedef struct ie_dot11WEPDefaultKey
{
1578 u8 key
[29]; /* check this! was Key[19] */
1579 } __attribute__ ((packed
)) ie_dot11WEPDefaultKey_t
;
1581 typedef struct acx111WEPDefaultKey
{
1582 u8 MacAddr
[ETH_ALEN
];
1583 u16 action
; /* NOTE: this is a u16, NOT a u8!! */
1590 u8 key
[32]; /* up to 32 bytes (for TKIP!) */
1591 } __attribute__ ((packed
)) acx111WEPDefaultKey_t
;
1593 typedef struct ie_dot11WEPDefaultKeyID
{
1597 } __attribute__ ((packed
)) ie_dot11WEPDefaultKeyID_t
;
1599 typedef struct acx100_cmd_wep_mgmt
{
1600 u8 MacAddr
[ETH_ALEN
];
1603 u8 Key
[29]; /* 29*8 == 232bits == WEP256 */
1604 } __attribute__ ((packed
)) acx100_cmd_wep_mgmt_t
;
1606 typedef struct acx_ie_generic
{
1610 /* Association ID IE: just a 16bit value: */
1612 /* generic member for quick implementation of commands */
1614 } __attribute__ ((packed
)) m
;
1615 } __attribute__ ((packed
)) acx_ie_generic_t
;
1617 #define ACX_SEC_KEYSIZE 16
1618 /* Security algorithms. */
1621 ACX_SEC_ALGO_NONE
= 0, /* unencrypted, as of TX header. */
1623 ACX_SEC_ALGO_UNKNOWN
,
1625 ACX_SEC_ALGO_WEP104
,
1628 /***********************************************************************
1630 #define CHECK_SIZEOF(type,size) { \
1631 extern void BUG_bad_size_for_##type(void); \
1632 if (sizeof(type)!=(size)) BUG_bad_size_for_##type(); \
1636 acx_struct_size_check(void)
1638 CHECK_SIZEOF(txdesc_t
, 0x30);
1639 CHECK_SIZEOF(acx100_ie_memconfigoption_t
, 24);
1640 CHECK_SIZEOF(acx100_ie_queueconfig_t
, 0x20);
1641 CHECK_SIZEOF(acx_joinbss_t
, 0x30);
1642 /* IEs need 4 bytes for (type,len) tuple */
1643 CHECK_SIZEOF(acx111_ie_configoption_t
, ACX111_IE_CONFIG_OPTIONS_LEN
+ 4);
1647 /***********************************************************************
1650 extern const u8 acx_bitpos2ratebyte
[];
1651 extern const u8 acx_bitpos2rate100
[];
1653 extern const u8 acx_reg_domain_ids
[];
1654 extern const char * const acx_reg_domain_strings
[];
1656 acx_reg_domain_ids_len
= 8
1659 //extern const struct iw_handler_def acx_ioctl_handler_def;
1661 #endif /* _ACX_STRUCT_H_ */