3 4/*- 5 * Copyright (c) 2006 6 * Damien Bergamini <damien.bergamini@free.fr> 7 * Copyright (c) 2006 Sam Leffler, Errno Consulting 8 * Copyright (c) 2008-2009 Weongyo Jeong <weongyo@freebsd.org> 9 * 10 * Permission to use, copy, modify, and distribute this software for any 11 * purpose with or without fee is hereby granted, provided that the above 12 * copyright notice and this permission notice appear in all copies. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 15 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 16 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 17 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21 */ 22 23enum { 24 UATH_INTR_RX, 25 UATH_INTR_TX, 26 UATH_BULK_RX, 27 UATH_BULK_TX, 28 UATH_N_XFERS = 4, 29}; 30 31#define UATH_ID_BSS 2 /* Connection ID */ 32 33#define UATH_RX_DATA_LIST_COUNT 128 34#define UATH_TX_DATA_LIST_COUNT 16 35#define UATH_CMD_LIST_COUNT 60 36 37#define UATH_DATA_TIMEOUT 10000 38#define UATH_CMD_TIMEOUT 1000 39 40/* flags for sending firmware commands */ 41#define UATH_CMD_FLAG_ASYNC (1 << 0) 42#define UATH_CMD_FLAG_READ (1 << 1) 43#define UATH_CMD_FLAG_MAGIC (1 << 2) 44 45struct uath_rx_radiotap_header { 46 struct ieee80211_radiotap_header wr_ihdr; 47 u_int64_t wr_tsf; 48 u_int8_t wr_flags; 49 u_int8_t wr_rate; 50 uint16_t wr_chan_freq; 51 uint16_t wr_chan_flags; 52 int8_t wr_antsignal; 53 int8_t wr_antnoise; 54 u_int8_t wr_antenna; 55} __packed __aligned(8); 56 57#define UATH_RX_RADIOTAP_PRESENT ( \ 58 (1 << IEEE80211_RADIOTAP_TSFT) | \ 59 (1 << IEEE80211_RADIOTAP_FLAGS) | \ 60 (1 << IEEE80211_RADIOTAP_RATE) | \ 61 (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 62 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 63 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 64 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ 65 0) 66 67struct uath_tx_radiotap_header { 68 struct ieee80211_radiotap_header wt_ihdr; 69 uint8_t wt_flags; 70 uint16_t wt_chan_freq; 71 uint16_t wt_chan_flags; 72} __packed __aligned(8); 73 74#define UATH_TX_RADIOTAP_PRESENT \ 75 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 76 (1 << IEEE80211_RADIOTAP_CHANNEL)) 77 78struct uath_data { 79 struct uath_softc *sc; 80 uint8_t *buf; 81 uint16_t buflen; 82 struct mbuf *m; 83 struct ieee80211_node *ni; /* NB: tx only */ 84 STAILQ_ENTRY(uath_data) next; 85}; 86typedef STAILQ_HEAD(, uath_data) uath_datahead; 87 88struct uath_cmd { 89 struct uath_softc *sc; 90 uint32_t flags; 91 uint32_t msgid; 92 uint8_t *buf; 93 uint16_t buflen; 94 void *odata; /* NB: tx only */ 95 int olen; /* space in odata */ 96 STAILQ_ENTRY(uath_cmd) next; 97}; 98typedef STAILQ_HEAD(, uath_cmd) uath_cmdhead; 99 100struct uath_wme_settings { 101 uint8_t aifsn; 102 uint8_t logcwmin; 103 uint8_t logcwmax; 104 uint16_t txop; 105#define UATH_TXOP_TO_US(txop) ((txop) << 5) 106 uint8_t acm; 107}; 108 109struct uath_devcap { 110 uint32_t targetVersion; 111 uint32_t targetRevision; 112 uint32_t macVersion; 113 uint32_t macRevision; 114 uint32_t phyRevision; 115 uint32_t analog5GhzRevision; 116 uint32_t analog2GhzRevision; 117 uint32_t regDomain; 118 uint32_t regCapBits; 119 uint32_t countryCode; 120 uint32_t keyCacheSize; 121 uint32_t numTxQueues; 122 uint32_t connectionIdMax; 123 uint32_t wirelessModes; 124#define UATH_WIRELESS_MODE_11A 0x01 125#define UATH_WIRELESS_MODE_TURBO 0x02 126#define UATH_WIRELESS_MODE_11B 0x04 127#define UATH_WIRELESS_MODE_11G 0x08 128#define UATH_WIRELESS_MODE_108G 0x10 129 uint32_t chanSpreadSupport; 130 uint32_t compressSupport; 131 uint32_t burstSupport; 132 uint32_t fastFramesSupport; 133 uint32_t chapTuningSupport; 134 uint32_t turboGSupport; 135 uint32_t turboPrimeSupport; 136 uint32_t deviceType; 137 uint32_t wmeSupport; 138 uint32_t low2GhzChan; 139 uint32_t high2GhzChan; 140 uint32_t low5GhzChan; 141 uint32_t high5GhzChan; 142 uint32_t supportCipherWEP; 143 uint32_t supportCipherAES_CCM; 144 uint32_t supportCipherTKIP; 145 uint32_t supportCipherMicAES_CCM; 146 uint32_t supportMicTKIP; 147 uint32_t twiceAntennaGain5G; 148 uint32_t twiceAntennaGain2G; 149}; 150 151struct uath_stat { 152 uint32_t st_badchunkseqnum; 153 uint32_t st_invalidlen; 154 uint32_t st_multichunk; 155 uint32_t st_toobigrxpkt; 156 uint32_t st_stopinprogress; 157 uint32_t st_crcerr; 158 uint32_t st_phyerr; 159 uint32_t st_decrypt_crcerr; 160 uint32_t st_decrypt_micerr; 161 uint32_t st_decomperr; 162 uint32_t st_keyerr; 163 uint32_t st_err; 164 /* CMD/RX/TX queues */ 165 uint32_t st_cmd_active; 166 uint32_t st_cmd_inactive; 167 uint32_t st_cmd_pending; 168 uint32_t st_cmd_waiting; 169 uint32_t st_rx_active; 170 uint32_t st_rx_inactive; 171 uint32_t st_tx_active; 172 uint32_t st_tx_inactive; 173 uint32_t st_tx_pending; 174}; 175#define UATH_STAT_INC(sc, var) (sc)->sc_stat.var++ 176#define UATH_STAT_DEC(sc, var) (sc)->sc_stat.var-- 177 178struct uath_vap { 179 struct ieee80211vap vap; 180 int (*newstate)(struct ieee80211vap *, 181 enum ieee80211_state, int); 182}; 183#define UATH_VAP(vap) ((struct uath_vap *)(vap)) 184 185struct uath_softc {
|