2 * Copyright (c) 2001-2011, Intel Corporation
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the Intel Corporation nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
38 * IGB_TXD: Maximum number of Transmit Descriptors
40 * This value is the number of transmit descriptors allocated by the driver.
41 * Increasing this value allows the driver to queue more transmits. Each
42 * descriptor is 16 bytes.
43 * Since TDLEN should be multiple of 128bytes, the number of transmit
44 * desscriptors should meet the following condition.
45 * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0
47 #define IGB_MIN_TXD 256
48 #define IGB_DEFAULT_TXD 1024
49 #define IGB_MAX_TXD 4096
52 * IGB_RXD: Maximum number of Transmit Descriptors
54 * This value is the number of receive descriptors allocated by the driver.
55 * Increasing this value allows the driver to buffer more incoming packets.
56 * Each descriptor is 16 bytes. A receive buffer is also allocated for each
57 * descriptor. The maximum MTU size is 16110.
58 * Since TDLEN should be multiple of 128bytes, the number of transmit
59 * desscriptors should meet the following condition.
60 * (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0
62 #define IGB_MIN_RXD 256
63 #define IGB_DEFAULT_RXD 1024
64 #define IGB_MAX_RXD 4096
67 * This parameter controls when the driver calls the routine to reclaim
68 * transmit descriptors. Cleaning earlier seems a win.
70 #define IGB_TX_CLEANUP_THRESHOLD(sc) ((sc)->num_tx_desc / 2)
73 * This parameter controls whether or not autonegotation is enabled.
74 * 0 - Disable autonegotiation
75 * 1 - Enable autonegotiation
80 * This parameter control whether or not the driver will wait for
81 * autonegotiation to complete.
82 * 1 - Wait for autonegotiation to complete
83 * 0 - Don't wait for autonegotiation to complete
85 #define WAIT_FOR_AUTO_NEG_DEFAULT 0
89 #define AUTONEG_ADV_DEFAULT (ADVERTISE_10_HALF | ADVERTISE_10_FULL | \
90 ADVERTISE_100_HALF | ADVERTISE_100_FULL | \
93 #define AUTO_ALL_MODES 0
95 /* PHY master/slave setting */
96 #define IGB_MASTER_SLAVE e1000_ms_hw_default
99 * Micellaneous constants
101 #define IGB_VENDOR_ID 0x8086
103 #define IGB_JUMBO_PBA 0x00000028
104 #define IGB_DEFAULT_PBA 0x00000030
105 #define IGB_SMARTSPEED_DOWNSHIFT 3
106 #define IGB_SMARTSPEED_MAX 15
107 #define IGB_MAX_LOOP 10
109 #define IGB_RX_PTHRESH (hw->mac.type <= e1000_82576 ? 16 : 8)
110 #define IGB_RX_HTHRESH 8
111 #define IGB_RX_WTHRESH 1
113 #define IGB_TX_PTHRESH 8
114 #define IGB_TX_HTHRESH 1
115 #define IGB_TX_WTHRESH ((hw->mac.type != e1000_82575 && \
116 sc->msix_mem) ? 1 : 16)
118 #define MAX_NUM_MULTICAST_ADDRESSES 128
119 #define IGB_FC_PAUSE_TIME 0x0680
121 #define IGB_INTR_RATE 10000
124 * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be
125 * multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This will
126 * also optimize cache line size effect. H/W supports up to cache line size 128.
128 #define IGB_DBA_ALIGN 128
130 /* PCI Config defines */
131 #define IGB_MSIX_BAR 3
133 #define IGB_MAX_SCATTER 64
134 #define IGB_VFTA_SIZE 128
135 #define IGB_TSO_SIZE (65535 + \
136 sizeof(struct ether_vlan_header))
137 #define IGB_TSO_SEG_SIZE 4096 /* Max dma segment size */
138 #define IGB_HDR_BUF 128
139 #define IGB_PKTTYPE_MASK 0x0000FFF0
141 #define IGB_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP)
142 #define IGB_IPVHL_SIZE 1 /* sizeof(ip.ip_vhl) */
143 #define IGB_TXCSUM_MINHL (ETHER_HDR_LEN + EVL_ENCAPLEN + \
149 * Bus dma information structure
152 bus_addr_t dma_paddr;
154 bus_dma_tag_t dma_tag;
155 bus_dmamap_t dma_map;
159 * Driver queue struct: this is the interrupt container
160 * for the associated tx and rx ring.
163 struct igb_softc *sc;
164 uint32_t msix; /* This queue's MSIX vector */
165 uint32_t eims; /* This queue's EIMS bit */
166 uint32_t eitr_setting;
167 struct resource *res;
169 struct igb_tx_ring *txr;
170 struct igb_rx_ring *rxr;
175 * Transmit ring: one per queue
178 struct igb_softc *sc;
180 struct igb_dma txdma;
181 struct e1000_tx_desc *tx_base;
182 uint32_t next_avail_desc;
183 uint32_t next_to_clean;
185 struct igb_tx_buf *tx_buf;
186 bus_dma_tag_t tx_tag;
188 u_long no_desc_avail;
191 u_long ctx_try_pullup;
195 u_long ctx_pullup1_failed;
197 u_long ctx_pullup2_failed;
201 * Receive ring: one per queue
204 struct igb_softc *sc;
206 struct igb_dma rxdma;
207 union e1000_adv_rx_desc *rx_base;
209 uint32_t next_to_check;
210 struct igb_rx_buf *rx_buf;
211 bus_dma_tag_t rx_tag;
212 bus_dmamap_t rx_sparemap;
215 * First/last mbuf pointers, for
216 * collecting multisegment RX packets.
226 struct arpcom arpcom;
229 struct e1000_osdep osdep;
232 bus_dma_tag_t parent_tag;
235 struct resource *mem_res;
237 struct resource *msix_mem;
245 struct ifmedia media;
246 struct callout timer;
249 int msix; /* total vectors allocated */
253 struct resource *intr_res;
261 uint16_t vf_ifp; /* a VF interface */
263 /* Management and WOL features */
267 /* Info about the interface */
270 uint16_t link_duplex;
272 uint32_t dma_coalesce;
276 /* Interface queues */
277 struct igb_queue *queues;
282 struct igb_tx_ring *tx_rings;
285 /* Multicast array pointer */
291 struct igb_rx_ring *rx_rings;
296 /* Misc stats maintained by the driver */
298 u_long mbuf_defrag_failed;
299 u_long no_tx_dma_setup;
300 u_long watchdog_events;
302 u_long device_control;
306 u_long packet_buf_alloc_rx;
307 u_long packet_buf_alloc_tx;
309 /* sysctl tree glue */
310 struct sysctl_ctx_list sysctl_ctx;
311 struct sysctl_oid *sysctl_tree;
317 int next_eop; /* Index of the desc to watch */
319 bus_dmamap_t map; /* bus_dma map for packet */
324 bus_dmamap_t map; /* bus_dma map for packet */
328 #define UPDATE_VF_REG(reg, last, cur) \
330 uint32_t new = E1000_READ_REG(hw, reg); \
332 cur += 0x100000000LL; \
334 cur &= 0xFFFFFFFF00000000LL; \
338 #endif /* _IF_IGB_H_ */