if_wpivar.h revision 1.2
1/* $NetBSD: if_wpivar.h,v 1.2 2006/10/31 21:53:41 joerg Exp $ */ 2 3/*- 4 * Copyright (c) 2006 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 wpi_rx_radiotap_header { 21 struct ieee80211_radiotap_header wr_ihdr; 22 uint64_t wr_tsft; 23 uint8_t wr_flags; 24 uint8_t wr_rate; 25 uint16_t wr_chan_freq; 26 uint16_t wr_chan_flags; 27 int8_t wr_dbm_antsignal; 28 int8_t wr_dbm_antnoise; 29 uint8_t wr_antenna; 30}; 31 32#define WPI_RX_RADIOTAP_PRESENT \ 33 ((1 << IEEE80211_RADIOTAP_TSFT) | \ 34 (1 << IEEE80211_RADIOTAP_FLAGS) | \ 35 (1 << IEEE80211_RADIOTAP_RATE) | \ 36 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 37 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 38 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ 39 (1 << IEEE80211_RADIOTAP_ANTENNA)) 40 41struct wpi_tx_radiotap_header { 42 struct ieee80211_radiotap_header wt_ihdr; 43 uint8_t wt_flags; 44 uint8_t wt_rate; 45 uint16_t wt_chan_freq; 46 uint16_t wt_chan_flags; 47 uint8_t wt_hwqueue; 48}; 49 50#define WPI_TX_RADIOTAP_PRESENT \ 51 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 52 (1 << IEEE80211_RADIOTAP_RATE) | \ 53 (1 << IEEE80211_RADIOTAP_CHANNEL)) 54 55struct wpi_dma_info { 56 bus_dmamap_t map; 57 bus_dma_segment_t seg; 58 bus_addr_t paddr; 59 caddr_t vaddr; 60 bus_size_t size; 61}; 62 63struct wpi_tx_data { 64 bus_dmamap_t map; 65 struct mbuf *m; 66 struct ieee80211_node *ni; 67}; 68 69struct wpi_tx_ring { 70 struct wpi_dma_info desc_dma; 71 struct wpi_dma_info cmd_dma; 72 struct wpi_tx_desc *desc; 73 struct wpi_tx_cmd *cmd; 74 struct wpi_tx_data *data; 75 int qid; 76 int count; 77 int queued; 78 int cur; 79}; 80 81struct wpi_rx_data { 82 bus_dmamap_t map; 83 struct mbuf *m; 84}; 85 86struct wpi_rx_ring { 87 struct wpi_dma_info desc_dma; 88 uint32_t *desc; 89 struct wpi_rx_data data[WPI_RX_RING_COUNT]; 90 int cur; 91}; 92 93struct wpi_node { 94 struct ieee80211_node ni; /* must be the first */ 95 struct ieee80211_amrr_node amn; 96}; 97 98struct wpi_softc { 99 struct device sc_dev; 100 struct ethercom sc_ec; 101 struct ieee80211com sc_ic; 102 int (*sc_newstate)(struct ieee80211com *, 103 enum ieee80211_state, int); 104 struct ieee80211_amrr amrr; 105 106 uint32_t flags; 107#define WPI_FLAG_FW_INITED (1 << 0) 108 109 bus_dma_tag_t sc_dmat; 110 111 /* shared area */ 112 struct wpi_dma_info shared_dma; 113 struct wpi_shared *shared; 114 115 struct wpi_tx_ring txq[4]; 116 struct wpi_tx_ring cmdq; 117 struct wpi_tx_ring svcq; 118 struct wpi_rx_ring rxq; 119 120 bus_space_tag_t sc_st; 121 bus_space_handle_t sc_sh; 122 void *sc_ih; 123 pci_chipset_tag_t sc_pct; 124 pcitag_t sc_pcitag; 125 bus_size_t sc_sz; 126 127 struct callout amrr_ch; 128 129 struct wpi_config config; 130 uint16_t pwr1[14]; 131 uint16_t pwr2[14]; 132 133 int sc_tx_timer; 134 void *powerhook; 135 136#if NBPFILTER > 0 137 caddr_t sc_drvbpf; 138 139 union { 140 struct wpi_rx_radiotap_header th; 141 uint8_t pad[IEEE80211_RADIOTAP_HDRLEN]; 142 } sc_rxtapu; 143#define sc_rxtap sc_rxtapu.th 144 int sc_rxtap_len; 145 146 union { 147 struct wpi_tx_radiotap_header th; 148 uint8_t pad[IEEE80211_RADIOTAP_HDRLEN]; 149 } sc_txtapu; 150#define sc_txtap sc_txtapu.th 151 int sc_txtap_len; 152#endif 153}; 154