5 * Damien Bergamini <damien.bergamini@free.fr>
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.
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.
20 #define RAL_RX_LIST_COUNT 1
21 #define RAL_TX_LIST_COUNT 1
23 struct ural_rx_radiotap_header {
24 struct ieee80211_radiotap_header wr_ihdr;
26 uint16_t wr_chan_freq;
27 uint16_t wr_chan_flags;
32 #define RAL_RX_RADIOTAP_PRESENT \
33 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
34 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
35 (1 << IEEE80211_RADIOTAP_ANTENNA) | \
36 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
38 struct ural_tx_radiotap_header {
39 struct ieee80211_radiotap_header wt_ihdr;
42 uint16_t wt_chan_freq;
43 uint16_t wt_chan_flags;
47 #define RAL_TX_RADIOTAP_PRESENT \
48 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
49 (1 << IEEE80211_RADIOTAP_RATE) | \
50 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
51 (1 << IEEE80211_RADIOTAP_ANTENNA))
56 struct ural_softc *sc;
57 usbd_xfer_handle xfer;
60 struct ieee80211_node *ni;
64 struct ural_softc *sc;
65 usbd_xfer_handle xfer;
72 struct ieee80211com sc_ic;
73 int (*sc_newstate)(struct ieee80211com *,
74 enum ieee80211_state, int);
76 usbd_device_handle sc_udev;
77 usbd_interface_handle sc_iface;
85 usbd_pipe_handle sc_rx_pipeh;
86 usbd_pipe_handle sc_tx_pipeh;
88 enum ieee80211_state sc_state;
89 struct usb_task sc_task;
91 struct ural_rx_data rx_data[RAL_RX_LIST_COUNT];
92 struct ural_tx_data tx_data[RAL_TX_LIST_COUNT];
95 struct ieee80211_beacon_offsets sc_bo;
99 struct callout scan_ch;
109 } __packed bbp_prom[16];
117 struct bpf_if *sc_drvbpf;
120 struct ural_rx_radiotap_header th;
123 #define sc_rxtap sc_rxtapu.th
127 struct ural_tx_radiotap_header th;
130 #define sc_txtap sc_txtapu.th
135 #define RAL_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
136 #define RAL_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
138 #define RAL_LOCK(sc) do { ((sc) = (sc)); mtx_lock(&Giant); } while (0)
139 #define RAL_UNLOCK(sc) mtx_unlock(&Giant)