1/* $FreeBSD: head/sys/dev/usb2/wlan/if_rumvar.h 187378 2009-01-18 05:35:58Z thompsa $ */
| 1/* $FreeBSD: head/sys/dev/usb2/wlan/if_rumvar.h 188417 2009-02-09 22:12:47Z thompsa $ */
|
2 3/*- 4 * Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org> 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, 2006 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org> 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 rum_node { 21 struct ieee80211_node ni; 22 struct ieee80211_amrr_node amn; 23};
| 20#define RUM_TX_LIST_COUNT 8
|
24
| 21
|
25#define RUM_NODE(ni) ((struct rum_node *)(ni)) 26 27struct rum_vap { 28 struct ieee80211vap vap; 29 struct ieee80211_beacon_offsets bo; 30 struct ieee80211_amrr amrr; 31 32 int (*newstate) (struct ieee80211vap *, 33 enum ieee80211_state, int); 34}; 35 36#define RUM_VAP(vap) ((struct rum_vap *)(vap)) 37 38struct rum_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; 47}; 48 49struct rum_config_copy_bss { 50 uint16_t ni_intval; 51 uint8_t ni_bssid[IEEE80211_ADDR_LEN]; 52 uint8_t fixed_rate_none; 53}; 54 55struct rum_config_copy { 56 struct rum_config_copy_chan ic_curchan; 57 struct rum_config_copy_chan ic_bsschan; 58 struct rum_config_copy_bss iv_bss; 59 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]; 69}; 70
| |
71struct rum_rx_radiotap_header { 72 struct ieee80211_radiotap_header wr_ihdr;
| 22struct rum_rx_radiotap_header { 23 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;
| 24 uint8_t wr_flags; 25 uint8_t wr_rate; 26 uint16_t wr_chan_freq; 27 uint16_t wr_chan_flags; 28 uint8_t wr_antenna; 29 uint8_t wr_antsignal;
|
79}; 80
| 30}; 31
|
81#define RT2573_RX_RADIOTAP_PRESENT \
| 32#define RT2573_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 rum_tx_radiotap_header { 89 struct ieee80211_radiotap_header wt_ihdr;
| 33 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 34 (1 << IEEE80211_RADIOTAP_RATE) | \ 35 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 36 (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 37 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)) 38 39struct rum_tx_radiotap_header { 40 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;
| 41 uint8_t wt_flags; 42 uint8_t wt_rate; 43 uint16_t wt_chan_freq; 44 uint16_t wt_chan_flags; 45 uint8_t wt_antenna;
|
95}; 96
| 46}; 47
|
97#define RT2573_TX_RADIOTAP_PRESENT \
| 48#define RT2573_TX_RADIOTAP_PRESENT \
|
98 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 99 (1 << IEEE80211_RADIOTAP_RATE) | \ 100 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 101 (1 << IEEE80211_RADIOTAP_ANTENNA)) 102
| 49 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 50 (1 << IEEE80211_RADIOTAP_RATE) | \ 51 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 52 (1 << IEEE80211_RADIOTAP_ANTENNA)) 53
|
103struct rum_bbp_prom { 104 uint8_t val; 105 uint8_t reg; 106} __packed;
| 54struct rum_softc;
|
107
| 55
|
108struct rum_ifq { 109 struct mbuf *ifq_head; 110 struct mbuf *ifq_tail; 111 uint16_t ifq_len;
| 56struct rum_task { 57 struct usb2_proc_msg hdr; 58 struct rum_softc *sc;
|
112}; 113
| 59}; 60
|
| 61struct rum_tx_data { 62 STAILQ_ENTRY(rum_tx_data) next; 63 struct rum_softc *sc; 64 struct rum_tx_desc desc; 65 struct mbuf *m; 66 struct ieee80211_node *ni; 67 int rate; 68}; 69typedef STAILQ_HEAD(, rum_tx_data) rum_txdhead; 70 71struct rum_node { 72 struct ieee80211_node ni; 73 struct ieee80211_amrr_node amn; 74}; 75#define RUM_NODE(ni) ((struct rum_node *)(ni)) 76 77struct rum_vap { 78 struct ieee80211vap vap; 79 struct rum_softc *sc; 80 struct ieee80211_beacon_offsets bo; 81 struct ieee80211_amrr amrr; 82 struct usb2_callout amrr_ch; 83 struct rum_task amrr_task[2]; 84 85 int (*newstate)(struct ieee80211vap *, 86 enum ieee80211_state, int); 87}; 88#define RUM_VAP(vap) ((struct rum_vap *)(vap)) 89
|
114enum {
| 90enum {
|
115 RUM_BULK_DT_WR, 116 RUM_BULK_DT_RD, 117 RUM_BULK_CS_WR, 118 RUM_BULK_CS_RD, 119 RUM_N_TRANSFER = 4,
| 91 RUM_BULK_WR, 92 RUM_BULK_RD, 93 RUM_N_TRANSFER = 2,
|
120}; 121 122struct rum_softc {
| 94}; 95 96struct rum_softc {
|
123 struct ifnet *sc_ifp;
| 97 struct ifnet *sc_ifp; 98 device_t sc_dev; 99 struct usb2_device *sc_udev; 100 struct usb2_process sc_tq;
|
124
| 101
|
125 struct rum_ifq sc_tx_queue; 126 struct usb2_config_td sc_config_td; 127 struct rum_tx_desc sc_tx_desc; 128 struct rum_rx_desc sc_rx_desc; 129 struct mtx sc_mtx; 130 struct usb2_callout sc_watchdog; 131 struct rum_bbp_prom sc_bbp_prom[16]; 132 struct rum_rx_radiotap_header sc_rxtap; 133 struct rum_tx_radiotap_header sc_txtap; 134 135 struct usb2_xfer *sc_xfer[RUM_N_TRANSFER]; 136 struct usb2_device *sc_udev;
| |
137 const struct ieee80211_rate_table *sc_rates;
| 102 const struct ieee80211_rate_table *sc_rates;
|
| 103 struct usb2_xfer *sc_xfer[RUM_N_TRANSFER];
|
138
| 104
|
139 int (*sc_newstate) 140 (struct ieee80211com *, enum ieee80211_state, int);
| 105 uint8_t rf_rev; 106 uint8_t rffreq;
|
141
| 107
|
142 enum ieee80211_state sc_ns_state; 143 uint32_t sc_sta[6]; 144 uint32_t sc_unit; 145 int sc_ns_arg;
| 108 enum ieee80211_state sc_state; 109 int sc_arg; 110 struct rum_task sc_synctask[2]; 111 struct rum_task sc_task[2]; 112 struct rum_task sc_promisctask[2]; 113 struct rum_task sc_scantask[2]; 114 int sc_scan_action; 115#define RUM_SCAN_START 0 116#define RUM_SCAN_END 1 117#define RUM_SET_CHANNEL 2
|
146
| 118
|
147 uint16_t sc_flags; 148#define RUM_FLAG_READ_STALL 0x0001 149#define RUM_FLAG_WRITE_STALL 0x0002 150#define RUM_FLAG_LL_READY 0x0008 151#define RUM_FLAG_HL_READY 0x0010 152#define RUM_FLAG_WAIT_COMMAND 0x0020 153 uint16_t sc_txtap_len; 154 uint16_t sc_rxtap_len; 155 uint16_t sc_last_chan;
| 119 struct rum_tx_data tx_data[RUM_TX_LIST_COUNT]; 120 rum_txdhead tx_q; 121 rum_txdhead tx_free; 122 int tx_nfree; 123 struct rum_rx_desc sc_rx_desc;
|
156
| 124
|
157 uint8_t sc_txpow[44]; 158 uint8_t sc_rf_rev; 159 uint8_t sc_rffreq; 160 uint8_t sc_ftype; 161 uint8_t sc_rx_ant; 162 uint8_t sc_tx_ant; 163 uint8_t sc_nb_ant; 164 uint8_t sc_ext_2ghz_lna; 165 uint8_t sc_ext_5ghz_lna; 166 uint8_t sc_sifs; 167 uint8_t sc_bbp17; 168 uint8_t sc_hw_radio; 169 uint8_t sc_amrr_timer; 170 uint8_t sc_beacon_buf[0x800]; 171 uint8_t sc_myaddr[IEEE80211_ADDR_LEN];
| 125 struct mtx sc_mtx;
|
172
| 126
|
173 int8_t sc_rssi_2ghz_corr; 174 int8_t sc_rssi_5ghz_corr;
| 127 uint32_t sta[6]; 128 uint32_t rf_regs[4]; 129 uint8_t txpow[44]; 130 uint8_t sc_bssid[6];
|
175
| 131
|
176 char sc_name[32];
| 132 struct { 133 uint8_t val; 134 uint8_t reg; 135 } __packed bbp_prom[16]; 136 137 int hw_radio; 138 int rx_ant; 139 int tx_ant; 140 int nb_ant; 141 int ext_2ghz_lna; 142 int ext_5ghz_lna; 143 int rssi_2ghz_corr; 144 int rssi_5ghz_corr; 145 uint8_t bbp17; 146 147 struct rum_rx_radiotap_header sc_rxtap; 148 int sc_rxtap_len; 149 150 struct rum_tx_radiotap_header sc_txtap; 151 int sc_txtap_len;
|
177};
| 152};
|
| 153 154#define RUM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) 155#define RUM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) 156#define RUM_LOCK_ASSERT(sc, t) mtx_assert(&(sc)->sc_mtx, t)
|
| |