1/* $OpenBSD: if_iwivar.h,v 1.26 2016/09/05 08:17:48 tedu Exp $ */ 2 3/*- 4 * Copyright (c) 2004-2006 5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 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 iwi_rx_radiotap_header { 21 struct ieee80211_radiotap_header wr_ihdr; 22 uint8_t wr_flags; 23 uint8_t wr_rate; 24 uint16_t wr_chan_freq; 25 uint16_t wr_chan_flags; 26 uint8_t wr_antsignal; 27 uint8_t wr_antenna; 28} __packed; 29 30#define IWI_RX_RADIOTAP_PRESENT \ 31 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 32 (1 << IEEE80211_RADIOTAP_RATE) | \ 33 (1 << IEEE80211_RADIOTAP_CHANNEL) | \ 34 (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ 35 (1 << IEEE80211_RADIOTAP_ANTENNA)) 36 37struct iwi_tx_radiotap_header { 38 struct ieee80211_radiotap_header wt_ihdr; 39 uint8_t wt_flags; 40 uint16_t wt_chan_freq; 41 uint16_t wt_chan_flags; 42} __packed; 43 44#define IWI_TX_RADIOTAP_PRESENT \ 45 ((1 << IEEE80211_RADIOTAP_FLAGS) | \ 46 (1 << IEEE80211_RADIOTAP_CHANNEL)) 47 48 49struct iwi_cmd_ring { 50 bus_dmamap_t map; 51 bus_dma_segment_t seg; 52 struct iwi_cmd_desc *desc; 53 int queued; 54 int cur; 55 int next; 56}; 57 58struct iwi_tx_data { 59 bus_dmamap_t map; 60 struct mbuf *m; 61 struct ieee80211_node *ni; 62}; 63 64struct iwi_tx_ring { 65 bus_dmamap_t map; 66 bus_dma_segment_t seg; 67 bus_size_t csr_ridx; 68 bus_size_t csr_widx; 69 struct iwi_tx_desc *desc; 70 struct iwi_tx_data data[IWI_TX_RING_COUNT]; 71 int queued; 72 int cur; 73 int next; 74}; 75 76struct iwi_rx_data { 77 bus_dmamap_t map; 78 struct mbuf *m; 79 uint32_t reg; 80}; 81 82struct iwi_rx_ring { 83 struct iwi_rx_data data[IWI_RX_RING_COUNT]; 84 int cur; 85}; 86 87struct iwi_softc { 88 struct device sc_dev; 89 90 struct ieee80211com sc_ic; 91 int (*sc_newstate)(struct ieee80211com *, 92 enum ieee80211_state, int); 93 94 struct rwlock sc_rwlock; 95 96 bus_dma_tag_t sc_dmat; 97 98 struct iwi_cmd_ring cmdq; 99 struct iwi_tx_ring txq[4]; 100 struct iwi_rx_ring rxq; 101 102#define IWI_MAX_NODE 32 103 uint8_t sta[IWI_MAX_NODE][IEEE80211_ADDR_LEN]; 104 uint8_t nsta; 105 106 bus_space_tag_t sc_st; 107 bus_space_handle_t sc_sh; 108 void *sc_ih; 109 pci_chipset_tag_t sc_pct; 110 pcitag_t sc_pcitag; 111 bus_size_t sc_sz; 112 113 struct task init_task; 114 115 int sc_tx_timer; 116 117#if NBPFILTER > 0 118 caddr_t sc_drvbpf; 119 120 union { 121 struct iwi_rx_radiotap_header th; 122 uint8_t pad[64]; 123 } sc_rxtapu; 124#define sc_rxtap sc_rxtapu.th 125 int sc_rxtap_len; 126 127 union { 128 struct iwi_tx_radiotap_header th; 129 uint8_t pad[64]; 130 } sc_txtapu; 131#define sc_txtap sc_txtapu.th 132 int sc_txtap_len; 133#endif 134}; 135