1 /* $OpenBSD: if_nfevar.h,v 1.11 2006/02/19 13:57:02 damien Exp $ */ 2 3 /*- 4 * Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * $FreeBSD$ 19 */ 20 21 struct nfe_tx_data { 22 bus_dmamap_t tx_data_map; 23 struct mbuf *m; 24 }; 25 26 struct nfe_tx_ring { 27 bus_dma_tag_t tx_desc_tag; 28 bus_dmamap_t tx_desc_map; 29 bus_addr_t physaddr; 30 struct nfe_desc32 *desc32; 31 struct nfe_desc64 *desc64; 32 bus_dma_tag_t tx_data_tag; 33 struct nfe_tx_data data[NFE_TX_RING_COUNT]; 34 int queued; 35 int cur; 36 int next; 37 }; 38 39 struct nfe_rx_data { 40 bus_dmamap_t rx_data_map; 41 bus_addr_t paddr; 42 struct mbuf *m; 43 }; 44 45 struct nfe_rx_ring { 46 bus_dma_tag_t rx_desc_tag; 47 bus_dmamap_t rx_desc_map; 48 bus_addr_t physaddr; 49 struct nfe_desc32 *desc32; 50 struct nfe_desc64 *desc64; 51 bus_dma_tag_t rx_data_tag; 52 bus_dmamap_t rx_spare_map; 53 struct nfe_rx_data data[NFE_RX_RING_COUNT]; 54 int cur; 55 int next; 56 }; 57 58 struct nfe_jrx_ring { 59 bus_dma_tag_t jrx_desc_tag; 60 bus_dmamap_t jrx_desc_map; 61 bus_dma_tag_t jrx_jumbo_tag; 62 bus_dmamap_t jrx_jumbo_map; 63 bus_addr_t jphysaddr; 64 struct nfe_desc32 *jdesc32; 65 struct nfe_desc64 *jdesc64; 66 bus_dma_tag_t jrx_data_tag; 67 bus_dmamap_t jrx_spare_map; 68 struct nfe_rx_data jdata[NFE_JUMBO_RX_RING_COUNT]; 69 int jcur; 70 int jnext; 71 }; 72 73 struct nfe_hw_stats { 74 uint64_t rx_octets; 75 uint32_t rx_frame_errors; 76 uint32_t rx_extra_bytes; 77 uint32_t rx_late_cols; 78 uint32_t rx_runts; 79 uint32_t rx_jumbos; 80 uint32_t rx_fifo_overuns; 81 uint32_t rx_crc_errors; 82 uint32_t rx_fae; 83 uint32_t rx_len_errors; 84 uint32_t rx_unicast; 85 uint32_t rx_multicast; 86 uint32_t rx_broadcast; 87 uint32_t rx_pause; 88 uint32_t rx_drops; 89 uint64_t tx_octets; 90 uint32_t tx_zero_rexmits; 91 uint32_t tx_one_rexmits; 92 uint32_t tx_multi_rexmits; 93 uint32_t tx_late_cols; 94 uint32_t tx_fifo_underuns; 95 uint32_t tx_carrier_losts; 96 uint32_t tx_excess_deferals; 97 uint32_t tx_retry_errors; 98 uint32_t tx_deferals; 99 uint32_t tx_frames; 100 uint32_t tx_pause; 101 uint32_t tx_unicast; 102 uint32_t tx_multicast; 103 uint32_t tx_broadcast; 104 }; 105 106 struct nfe_softc { 107 if_t nfe_ifp; 108 device_t nfe_dev; 109 uint16_t nfe_devid; 110 uint16_t nfe_revid; 111 device_t nfe_miibus; 112 struct mtx nfe_mtx; 113 struct resource *nfe_res[1]; 114 struct resource *nfe_msix_res; 115 struct resource *nfe_msix_pba_res; 116 struct resource *nfe_irq[NFE_MSI_MESSAGES]; 117 void *nfe_intrhand[NFE_MSI_MESSAGES]; 118 struct callout nfe_stat_ch; 119 int nfe_watchdog_timer; 120 121 bus_dma_tag_t nfe_parent_tag; 122 123 int nfe_if_flags; 124 uint32_t nfe_flags; 125 #define NFE_JUMBO_SUP 0x0001 126 #define NFE_40BIT_ADDR 0x0002 127 #define NFE_HW_CSUM 0x0004 128 #define NFE_HW_VLAN 0x0008 129 #define NFE_PWR_MGMT 0x0010 130 #define NFE_CORRECT_MACADDR 0x0020 131 #define NFE_TX_FLOW_CTRL 0x0040 132 #define NFE_MIB_V1 0x0080 133 #define NFE_MIB_V2 0x0100 134 #define NFE_MIB_V3 0x0200 135 int nfe_jumbo_disable; 136 uint32_t rxtxctl; 137 uint8_t mii_phyaddr; 138 uint8_t eaddr[ETHER_ADDR_LEN]; 139 struct nfe_hw_stats nfe_stats; 140 struct taskqueue *nfe_tq; 141 struct task nfe_int_task; 142 int nfe_link; 143 int nfe_suspended; 144 int nfe_framesize; 145 int nfe_process_limit; 146 int nfe_force_tx; 147 uint32_t nfe_irq_status; 148 uint32_t nfe_irq_mask; 149 uint32_t nfe_intrs; 150 uint32_t nfe_nointrs; 151 uint32_t nfe_msi; 152 uint32_t nfe_msix; 153 154 struct nfe_tx_ring txq; 155 struct nfe_rx_ring rxq; 156 struct nfe_jrx_ring jrxq; 157 }; 158 159 struct nfe_type { 160 uint16_t vid_id; 161 uint16_t dev_id; 162 char *name; 163 }; 164