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 #define URAL_SCAN_START 1
24 #define URAL_SCAN_END 2
25 #define URAL_SET_CHANNEL 3
28 struct ural_rx_radiotap_header {
29 struct ieee80211_radiotap_header wr_ihdr;
32 uint16_t wr_chan_freq;
33 uint16_t wr_chan_flags;
38 #define RAL_RX_RADIOTAP_PRESENT \
39 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
40 (1 << IEEE80211_RADIOTAP_RATE) | \
41 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
42 (1 << IEEE80211_RADIOTAP_ANTENNA) | \
43 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL))
45 struct ural_tx_radiotap_header {
46 struct ieee80211_radiotap_header wt_ihdr;
49 uint16_t wt_chan_freq;
50 uint16_t wt_chan_flags;
54 #define RAL_TX_RADIOTAP_PRESENT \
55 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
56 (1 << IEEE80211_RADIOTAP_RATE) | \
57 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
58 (1 << IEEE80211_RADIOTAP_ANTENNA))
63 struct ural_softc *sc;
64 usbd_xfer_handle xfer;
67 struct ieee80211_node *ni;
71 struct ural_softc *sc;
72 usbd_xfer_handle xfer;
79 struct ieee80211com sc_ic;
80 int (*sc_newstate)(struct ieee80211com *,
81 enum ieee80211_state, int);
83 usbd_device_handle sc_udev;
84 usbd_interface_handle sc_iface;
92 usbd_xfer_handle amrr_xfer;
94 usbd_pipe_handle sc_rx_pipeh;
95 usbd_pipe_handle sc_tx_pipeh;
97 enum ieee80211_state sc_state;
99 int sc_scan_action; /* should be an enum */
100 struct usb_task sc_task;
101 struct usb_task sc_scantask;
103 struct ieee80211_amrr amrr;
104 struct ieee80211_amrr_node amn;
106 struct ural_rx_data rx_data[RAL_RX_LIST_COUNT];
107 struct ural_tx_data tx_data[RAL_TX_LIST_COUNT];
110 struct ieee80211_beacon_offsets sc_bo;
114 struct callout watchdog_ch;
115 struct callout amrr_ch;
125 } __packed bbp_prom[16];
133 struct bpf_if *sc_drvbpf;
136 struct ural_rx_radiotap_header th;
139 #define sc_rxtap sc_rxtapu.th
143 struct ural_tx_radiotap_header th;
146 #define sc_txtap sc_txtapu.th
151 #define RAL_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
152 #define RAL_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
154 #define RAL_LOCK(sc) do { ((sc) = (sc)); mtx_lock(&Giant); } while (0)
155 #define RAL_UNLOCK(sc) mtx_unlock(&Giant)