3 * Damien Bergamini <damien.bergamini@free.fr>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * $FreeBSD: src/sys/dev/ral/rt2661var.h,v 1.1 2006/03/05 20:36:56 damien Exp $
18 * $DragonFly: src/sys/dev/netif/ral/rt2661var.h,v 1.7 2007/05/07 14:14:21 sephe Exp $
21 #define RT2661_NCHAN_MAX 38
22 #define RT2661_KEY_MAX 64
24 struct rt2661_rx_radiotap_header
{
25 struct ieee80211_radiotap_header wr_ihdr
;
29 uint16_t wr_chan_freq
;
30 uint16_t wr_chan_flags
;
34 #define RT2661_RX_RADIOTAP_PRESENT \
35 ((1 << IEEE80211_RADIOTAP_TSFT) | \
36 (1 << IEEE80211_RADIOTAP_FLAGS) | \
37 (1 << IEEE80211_RADIOTAP_RATE) | \
38 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
39 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
41 struct rt2661_tx_radiotap_header
{
42 struct ieee80211_radiotap_header wt_ihdr
;
45 uint16_t wt_chan_freq
;
46 uint16_t wt_chan_flags
;
49 #define RT2661_TX_RADIOTAP_PRESENT \
50 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
51 (1 << IEEE80211_RADIOTAP_RATE) | \
52 (1 << IEEE80211_RADIOTAP_CHANNEL))
54 struct rt2661_tx_ratectl
{
55 struct ieee80211_node
*ni
;
58 STAILQ_ENTRY(rt2661_tx_ratectl
) link
;
66 struct rt2661_tx_ring
{
67 bus_dma_tag_t desc_dmat
;
68 bus_dma_tag_t data_dmat
;
69 bus_dmamap_t desc_map
;
71 struct rt2661_tx_desc
*desc
;
72 struct rt2661_data
*data
;
79 struct rt2661_rx_ring
{
80 bus_dma_tag_t desc_dmat
;
81 bus_dma_tag_t data_dmat
;
82 bus_dmamap_t desc_map
;
84 struct rt2661_rx_desc
*desc
;
85 struct rt2661_data
*data
;
92 struct ieee80211com sc_ic
;
93 bus_space_tag_t sc_st
;
94 bus_space_handle_t sc_sh
;
98 struct resource
*sc_irq
;
102 (struct ieee80211com
*,
103 enum ieee80211_state
, int);
106 (struct ieee80211com
*,
107 const struct ieee80211_key
*,
108 ieee80211_keyix
*, ieee80211_keyix
*);
111 (struct ieee80211com
*,
112 const struct ieee80211_key
*);
115 (struct ieee80211com
*,
116 const struct ieee80211_key
*,
117 const uint8_t[IEEE80211_ADDR_LEN
]);
119 struct callout scan_ch
;
124 struct ieee80211_channel
*sc_curchan
;
131 struct rt2661_tx_ring txq
[4];
132 struct rt2661_tx_ring mgtq
;
133 struct rt2661_rx_ring rxq
;
136 int8_t txpow
[RT2661_NCHAN_MAX
];
160 STAILQ_HEAD(, rt2661_tx_ratectl
) tx_ratectl
;
164 struct bpf_if
*sc_drvbpf
;
167 struct rt2661_rx_radiotap_header th
;
170 #define sc_rxtap sc_rxtapu.th
174 struct rt2661_tx_radiotap_header th
;
177 #define sc_txtap sc_txtapu.th
180 struct sysctl_ctx_list sysctl_ctx
;
181 struct sysctl_oid
*sysctl_tree
;
183 uint32_t sc_keymap
[2];
186 #define RT2661_KEY_ASSERT(keyix) \
187 KASSERT((keyix) < RT2661_KEY_MAX, ("invalid keyix %d\n", (keyix)))
189 #define RT2661_KEY_SET(sc, keyix) \
191 RT2661_KEY_ASSERT((keyix)); \
192 (sc)->sc_keymap[(keyix) / 32] |= (1 << ((keyix) % 32)); \
195 #define RT2661_KEY_CLR(sc, keyix) \
197 RT2661_KEY_ASSERT((keyix)); \
198 (sc)->sc_keymap[(keyix) / 32] &= ~(1 << ((keyix) % 32)); \
201 #define RT2661_KEY_ISSET(sc, keyix) \
202 ((sc)->sc_keymap[(keyix) / 32] & (1 << ((keyix) % 32)))
204 int rt2661_attach(device_t
, int);
205 int rt2661_detach(void *);
206 void rt2661_shutdown(void *);
207 void rt2661_suspend(void *);
208 void rt2661_resume(void *);