1/* $FreeBSD: head/sys/dev/usb2/wlan/if_uralvar.h 187378 2009-01-18 05:35:58Z thompsa $ */
| 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
| 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
|
20struct ural_node { 21 struct ieee80211_node ni; 22 struct ieee80211_amrr_node amn; 23};
| 20#define RAL_TX_LIST_COUNT 8
|
24
| 21
|
25#define URAL_NODE(ni) ((struct ural_node *)(ni))
| 22#define URAL_SCAN_START 1 23#define URAL_SCAN_END 2 24#define URAL_SET_CHANNEL 3
|
26
| 25
|
27struct ural_vap { 28 struct ieee80211vap vap; 29 struct ieee80211_beacon_offsets bo; 30 struct ieee80211_amrr amrr;
| |
31
| 26
|
32 int (*newstate) (struct ieee80211vap *, 33 enum ieee80211_state, int);
| 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;
|
34}; 35
| 35}; 36
|
36#define URAL_VAP(vap) ((struct ural_vap *)(vap))
| 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))
|
37
| 43
|
38struct ural_config_copy_chan { 39 uint32_t chan_to_ieee; 40 enum ieee80211_phymode chan_to_mode; 41 uint8_t chan_is_5ghz:1; 42 uint8_t chan_is_2ghz:1; 43 uint8_t chan_is_b:1; 44 uint8_t chan_is_a:1; 45 uint8_t chan_is_g:1; 46 uint8_t unused:3;
| 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;
|
47}; 48
| 51}; 52
|
49struct ural_config_copy_bss { 50 uint16_t ni_intval; 51 uint8_t ni_bssid[IEEE80211_ADDR_LEN]; 52 uint8_t fixed_rate_none; 53};
| 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))
|
54
| 58
|
55struct ural_config_copy { 56 struct ural_config_copy_chan ic_curchan; 57 struct ural_config_copy_chan ic_bsschan; 58 struct ural_config_copy_bss iv_bss;
| 59struct ural_softc;
|
59
| 60
|
60 enum ieee80211_opmode ic_opmode; 61 uint32_t ic_flags; 62 uint32_t if_flags; 63 64 uint16_t ic_txpowlimit; 65 uint16_t ic_curmode; 66 67 uint8_t ic_myaddr[IEEE80211_ADDR_LEN]; 68 uint8_t if_broadcastaddr[IEEE80211_ADDR_LEN];
| 61struct ural_task { 62 struct usb2_proc_msg hdr; 63 struct ural_softc *sc;
|
69}; 70
| 64}; 65
|
71struct ural_rx_radiotap_header { 72 struct ieee80211_radiotap_header wr_ihdr; 73 uint8_t wr_flags; 74 uint8_t wr_rate; 75 uint16_t wr_chan_freq; 76 uint16_t wr_chan_flags; 77 uint8_t wr_antenna; 78 uint8_t wr_antsignal;
| 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;
|
79};
| 73};
|
| 74typedef STAILQ_HEAD(, ural_tx_data) ural_txdhead;
|
80
| 75
|
81#define RAL_RX_RADIOTAP_PRESENT \ 82 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 83 (1 << IEEE80211_RADIOTAP_RATE) | \ 84 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 85 (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 86 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)) 87 88struct ural_tx_radiotap_header { 89 struct ieee80211_radiotap_header wt_ihdr; 90 uint8_t wt_flags; 91 uint8_t wt_rate; 92 uint16_t wt_chan_freq; 93 uint16_t wt_chan_flags; 94 uint8_t wt_antenna;
| 76struct ural_node { 77 struct ieee80211_node ni; 78 struct ieee80211_amrr_node amn;
|
95};
| 79};
|
| 80#define URAL_NODE(ni) ((struct ural_node *)(ni))
|
96
| 81
|
97#define RAL_TX_RADIOTAP_PRESENT \ 98 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 99 (1 << IEEE80211_RADIOTAP_RATE) | \ 100 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 101 (1 << IEEE80211_RADIOTAP_ANTENNA))
| 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];
|
102
| 89
|
103struct ural_bbp_prom { 104 uint8_t val; 105 uint8_t reg; 106} __packed; 107 108struct ural_ifq { 109 struct mbuf *ifq_head; 110 struct mbuf *ifq_tail; 111 uint16_t ifq_len;
| 90 int (*newstate)(struct ieee80211vap *, 91 enum ieee80211_state, int);
|
112};
| 92};
|
| 93#define URAL_VAP(vap) ((struct ural_vap *)(vap))
|
113 114enum {
| 94 95enum {
|
115 URAL_BULK_DT_WR, 116 URAL_BULK_DT_RD, 117 URAL_BULK_CS_WR, 118 URAL_BULK_CS_RD, 119 URAL_N_TRANSFER = 4,
| 96 URAL_BULK_WR, 97 URAL_BULK_RD, 98 URAL_N_TRANSFER = 2,
|
120}; 121 122struct ural_softc {
| 99}; 100 101struct ural_softc {
|
123 struct ifnet *sc_ifp;
| 102 struct ifnet *sc_ifp; 103 device_t sc_dev; 104 struct usb2_device *sc_udev; 105 struct usb2_process sc_tq;
|
124
| 106
|
125 struct ural_ifq sc_tx_queue; 126 struct usb2_config_td sc_config_td; 127 struct ural_tx_desc sc_tx_desc; 128 struct ural_rx_desc sc_rx_desc; 129 struct mtx sc_mtx; 130 struct usb2_callout sc_watchdog; 131 struct ural_bbp_prom sc_bbp_prom[16]; 132 struct ural_rx_radiotap_header sc_rxtap; 133 struct ural_tx_radiotap_header sc_txtap; 134 135 struct usb2_xfer *sc_xfer[URAL_N_TRANSFER]; 136 struct usb2_device *sc_udev;
| |
137 const struct ieee80211_rate_table *sc_rates; 138
| 107 const struct ieee80211_rate_table *sc_rates; 108
|
139 enum ieee80211_state sc_ns_state; 140 uint32_t sc_unit; 141 uint32_t sc_asic_rev; 142 uint32_t sc_rf_regs[4]; 143 int sc_ns_arg;
| 109 uint32_t asic_rev; 110 uint8_t rf_rev;
|
144
| 111
|
145 uint16_t sc_flags; 146#define URAL_FLAG_READ_STALL 0x0001 147#define URAL_FLAG_WRITE_STALL 0x0002 148#define URAL_FLAG_LL_READY 0x0004 149#define URAL_FLAG_HL_READY 0x0008 150#define URAL_FLAG_WAIT_COMMAND 0x0010 151 uint16_t sc_txtap_len; 152 uint16_t sc_rxtap_len; 153 uint16_t sc_sta[11];
| 112 struct usb2_xfer *sc_xfer[URAL_N_TRANSFER];
|
154
| 113
|
155 uint8_t sc_rf_rev; 156 uint8_t sc_txpow[14]; 157 uint8_t sc_led_mode; 158 uint8_t sc_hw_radio; 159 uint8_t sc_rx_ant; 160 uint8_t sc_tx_ant; 161 uint8_t sc_nb_ant; 162 uint8_t sc_amrr_timer; 163 uint8_t sc_myaddr[IEEE80211_ADDR_LEN];
| 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];
|
164
| 121
|
165 char sc_name[32];
| 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;
|
166};
| 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)
|
| |