Deleted Added
sdiff udiff text old ( 187378 ) new ( 188417 )
full compact
1/* $FreeBSD: head/sys/dev/usb2/wlan/if_uralvar.h 188417 2009-02-09 22:12:47Z thompsa $ */
2
3/*-
4 * Copyright (c) 2005
5 * Damien Bergamini <damien.bergamini@free.fr>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#define RAL_TX_LIST_COUNT 8
21
22#define URAL_SCAN_START 1
23#define URAL_SCAN_END 2
24#define URAL_SET_CHANNEL 3
25
26
27struct ural_rx_radiotap_header {
28 struct ieee80211_radiotap_header wr_ihdr;
29 uint8_t wr_flags;
30 uint8_t wr_rate;
31 uint16_t wr_chan_freq;
32 uint16_t wr_chan_flags;
33 uint8_t wr_antenna;
34 uint8_t wr_antsignal;
35};
36
37#define RAL_RX_RADIOTAP_PRESENT \
38 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
39 (1 << IEEE80211_RADIOTAP_RATE) | \
40 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
41 (1 << IEEE80211_RADIOTAP_ANTENNA) | \
42 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
43
44struct ural_tx_radiotap_header {
45 struct ieee80211_radiotap_header wt_ihdr;
46 uint8_t wt_flags;
47 uint8_t wt_rate;
48 uint16_t wt_chan_freq;
49 uint16_t wt_chan_flags;
50 uint8_t wt_antenna;
51};
52
53#define RAL_TX_RADIOTAP_PRESENT \
54 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
55 (1 << IEEE80211_RADIOTAP_RATE) | \
56 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
57 (1 << IEEE80211_RADIOTAP_ANTENNA))
58
59struct ural_softc;
60
61struct ural_task {
62 struct usb2_proc_msg hdr;
63 struct ural_softc *sc;
64};
65
66struct ural_tx_data {
67 STAILQ_ENTRY(ural_tx_data) next;
68 struct ural_softc *sc;
69 struct ural_tx_desc desc;
70 struct mbuf *m;
71 struct ieee80211_node *ni;
72 int rate;
73};
74typedef STAILQ_HEAD(, ural_tx_data) ural_txdhead;
75
76struct ural_node {
77 struct ieee80211_node ni;
78 struct ieee80211_amrr_node amn;
79};
80#define URAL_NODE(ni) ((struct ural_node *)(ni))
81
82struct ural_vap {
83 struct ieee80211vap vap;
84 struct ural_softc *sc;
85 struct ieee80211_beacon_offsets bo;
86 struct ieee80211_amrr amrr;
87 struct usb2_callout amrr_ch;
88 struct ural_task amrr_task[2];
89
90 int (*newstate)(struct ieee80211vap *,
91 enum ieee80211_state, int);
92};
93#define URAL_VAP(vap) ((struct ural_vap *)(vap))
94
95enum {
96 URAL_BULK_WR,
97 URAL_BULK_RD,
98 URAL_N_TRANSFER = 2,
99};
100
101struct ural_softc {
102 struct ifnet *sc_ifp;
103 device_t sc_dev;
104 struct usb2_device *sc_udev;
105 struct usb2_process sc_tq;
106
107 const struct ieee80211_rate_table *sc_rates;
108
109 uint32_t asic_rev;
110 uint8_t rf_rev;
111
112 struct usb2_xfer *sc_xfer[URAL_N_TRANSFER];
113
114 enum ieee80211_state sc_state;
115 int sc_arg;
116 int sc_scan_action; /* should be an enum */
117 struct ural_task sc_synctask[2];
118 struct ural_task sc_task[2];
119 struct ural_task sc_promisctask[2];
120 struct ural_task sc_scantask[2];
121
122 struct ural_tx_data tx_data[RAL_TX_LIST_COUNT];
123 ural_txdhead tx_q;
124 ural_txdhead tx_free;
125 int tx_nfree;
126 struct ural_rx_desc sc_rx_desc;
127
128 struct mtx sc_mtx;
129
130 uint16_t sta[11];
131 uint32_t rf_regs[4];
132 uint8_t txpow[14];
133 uint8_t sc_bssid[6];
134
135 struct {
136 uint8_t val;
137 uint8_t reg;
138 } __packed bbp_prom[16];
139
140 int led_mode;
141 int hw_radio;
142 int rx_ant;
143 int tx_ant;
144 int nb_ant;
145
146 struct ural_rx_radiotap_header sc_rxtap;
147 int sc_rxtap_len;
148
149 struct ural_tx_radiotap_header sc_txtap;
150 int sc_txtap_len;
151};
152
153#define RAL_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
154#define RAL_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
155#define RAL_LOCK_ASSERT(sc, t) mtx_assert(&(sc)->sc_mtx, t)