xref: /netbsd-src/sys/dev/pci/igc/if_igc.h (revision ee357f8257b9c7d97e0408481c3c721ddb1d415f)
1*ee357f82Srin /*	$NetBSD: if_igc.h,v 1.3 2024/06/27 07:31:41 rin Exp $	*/
2d0d8f2a5Srin /*	$OpenBSD: if_igc.h,v 1.2 2022/01/09 05:42:50 jsg Exp $	*/
3d0d8f2a5Srin /*-
4d0d8f2a5Srin  * SPDX-License-Identifier: BSD-2-Clause
5d0d8f2a5Srin  *
6d0d8f2a5Srin  * Copyright (c) 2016 Nicole Graziano <nicole@nextbsd.org>
7d0d8f2a5Srin  * All rights reserved.
8d0d8f2a5Srin  * Copyright (c) 2021 Rubicon Communications, LLC (Netgate)
9d0d8f2a5Srin  *
10d0d8f2a5Srin  * Redistribution and use in source and binary forms, with or without
11d0d8f2a5Srin  * modification, are permitted provided that the following conditions
12d0d8f2a5Srin  * are met:
13d0d8f2a5Srin  * 1. Redistributions of source code must retain the above copyright
14d0d8f2a5Srin  *    notice, this list of conditions and the following disclaimer.
15d0d8f2a5Srin  * 2. Redistributions in binary form must reproduce the above copyright
16d0d8f2a5Srin  *    notice, this list of conditions and the following disclaimer in the
17d0d8f2a5Srin  *    documentation and/or other materials provided with the distribution.
18d0d8f2a5Srin  *
19d0d8f2a5Srin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20d0d8f2a5Srin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21d0d8f2a5Srin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22d0d8f2a5Srin  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23d0d8f2a5Srin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24d0d8f2a5Srin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25d0d8f2a5Srin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26d0d8f2a5Srin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27d0d8f2a5Srin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28d0d8f2a5Srin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29d0d8f2a5Srin  * SUCH DAMAGE.
30d0d8f2a5Srin  *
31d0d8f2a5Srin  * $FreeBSD$
32d0d8f2a5Srin  */
33d0d8f2a5Srin 
34d0d8f2a5Srin #ifndef _IGC_H_
35d0d8f2a5Srin #define _IGC_H_
36d0d8f2a5Srin 
37fb38d839Srin #ifdef _KERNEL_OPT
38fb38d839Srin #include "opt_if_igc.h"
39fb38d839Srin #endif
40fb38d839Srin 
41fb38d839Srin #include <sys/types.h>
42*ee357f82Srin #include <sys/atomic.h>
43fb38d839Srin #include <sys/pcq.h>
44fb38d839Srin #include <sys/workqueue.h>
45fb38d839Srin 
46fb38d839Srin #include <dev/pci/igc/igc_api.h>
47fb38d839Srin #include <dev/pci/igc/igc_i225.h>
48fb38d839Srin 
49*ee357f82Srin #ifdef __HAVE_ATOMIC64_LOADSTORE
50fb38d839Srin #define	IGC_EVENT_COUNTERS
51fb38d839Srin #endif
52d0d8f2a5Srin 
53d0d8f2a5Srin /*
54d0d8f2a5Srin  * IGC_MAX_TXD: Maximum number of Transmit Descriptors
55d0d8f2a5Srin  * Valid Range: 128-4096
56d0d8f2a5Srin  * Default Value: 1024
57d0d8f2a5Srin  *   This value is the number of transmit descriptors allocated by the driver.
58d0d8f2a5Srin  *   Increasing this value allows the driver to queue more transmits. Each
59d0d8f2a5Srin  *   descriptor is 16 bytes.
60d0d8f2a5Srin  *   Since TDLEN should be multiple of 128bytes, the number of transmit
61d0d8f2a5Srin  *   descriptors should meet the following condition.
62d0d8f2a5Srin  *      (num_tx_desc * sizeof(struct igc_tx_desc)) % 128 == 0
63d0d8f2a5Srin  */
64d0d8f2a5Srin #define IGC_MIN_TXD		128
65d0d8f2a5Srin #define IGC_MAX_TXD		4096
66d0d8f2a5Srin #define IGC_DEFAULT_TXD		1024
67d0d8f2a5Srin #define IGC_DEFAULT_MULTI_TXD	4096
68d0d8f2a5Srin #define IGC_MAX_TXD		4096
69d0d8f2a5Srin 
70d0d8f2a5Srin /*
71d0d8f2a5Srin  * IGC_MAX_RXD - Maximum number of receive Descriptors
72d0d8f2a5Srin  * Valid Range: 128-4096
73d0d8f2a5Srin  * Default Value: 1024
74d0d8f2a5Srin  *   This value is the number of receive descriptors allocated by the driver.
75d0d8f2a5Srin  *   Increasing this value allows the driver to buffer more incoming packets.
76d0d8f2a5Srin  *   Each descriptor is 16 bytes.  A receive buffer is also allocated for each
77d0d8f2a5Srin  *   descriptor. The maximum MTU size is 16110.
78d0d8f2a5Srin  *   Since TDLEN should be multiple of 128bytes, the number of transmit
79d0d8f2a5Srin  *   descriptors should meet the following condition.
80d0d8f2a5Srin  *      (num_tx_desc * sizeof(struct igc_tx_desc)) % 128 == 0
81d0d8f2a5Srin  */
82d0d8f2a5Srin #define IGC_MIN_RXD		128
83d0d8f2a5Srin #define IGC_MAX_RXD		4096
84d0d8f2a5Srin #define IGC_DEFAULT_RXD		1024
85d0d8f2a5Srin #define IGC_DEFAULT_MULTI_RXD	4096
86d0d8f2a5Srin #define IGC_MAX_RXD		4096
87d0d8f2a5Srin 
88d0d8f2a5Srin /*
89d0d8f2a5Srin  * IGC_TIDV_VAL - Transmit Interrupt Delay Value
90d0d8f2a5Srin  * Valid Range: 0-65535 (0=off)
91d0d8f2a5Srin  * Default Value: 64
92d0d8f2a5Srin  *   This value delays the generation of transmit interrupts in units of
93d0d8f2a5Srin  *   1.024 microseconds. Transmit interrupt reduction can improve CPU
94d0d8f2a5Srin  *   efficiency if properly tuned for specific network traffic. If the
95d0d8f2a5Srin  *   system is reporting dropped transmits, this value may be set too high
96d0d8f2a5Srin  *   causing the driver to run out of available transmit descriptors.
97d0d8f2a5Srin  */
98d0d8f2a5Srin #define IGC_TIDV_VAL		64
99d0d8f2a5Srin 
100d0d8f2a5Srin /*
101d0d8f2a5Srin  * IGC_TADV_VAL - Transmit Absolute Interrupt Delay Value
102d0d8f2a5Srin  * Valid Range: 0-65535 (0=off)
103d0d8f2a5Srin  * Default Value: 64
104d0d8f2a5Srin  *   This value, in units of 1.024 microseconds, limits the delay in which a
105d0d8f2a5Srin  *   transmit interrupt is generated. Useful only if IGC_TIDV is non-zero,
106d0d8f2a5Srin  *   this value ensures that an interrupt is generated after the initial
107d0d8f2a5Srin  *   packet is sent on the wire within the set amount of time.  Proper tuning,
108d0d8f2a5Srin  *   along with IGC_TIDV_VAL, may improve traffic throughput in specific
109d0d8f2a5Srin  *   network conditions.
110d0d8f2a5Srin  */
111d0d8f2a5Srin #define IGC_TADV_VAL		64
112d0d8f2a5Srin 
113d0d8f2a5Srin /*
114d0d8f2a5Srin  * IGC_RDTR_VAL - Receive Interrupt Delay Timer (Packet Timer)
115d0d8f2a5Srin  * Valid Range: 0-65535 (0=off)
116d0d8f2a5Srin  * Default Value: 0
117d0d8f2a5Srin  *   This value delays the generation of receive interrupts in units of 1.024
118d0d8f2a5Srin  *   microseconds.  Receive interrupt reduction can improve CPU efficiency if
119d0d8f2a5Srin  *   properly tuned for specific network traffic. Increasing this value adds
120d0d8f2a5Srin  *   extra latency to frame reception and can end up decreasing the throughput
121d0d8f2a5Srin  *   of TCP traffic. If the system is reporting dropped receives, this value
122d0d8f2a5Srin  *   may be set too high, causing the driver to run out of available receive
123d0d8f2a5Srin  *   descriptors.
124d0d8f2a5Srin  *
125d0d8f2a5Srin  *   CAUTION: When setting IGC_RDTR to a value other than 0, adapters
126d0d8f2a5Srin  *            may hang (stop transmitting) under certain network conditions.
127d0d8f2a5Srin  *            If this occurs a WATCHDOG message is logged in the system
128d0d8f2a5Srin  *            event log. In addition, the controller is automatically reset,
129d0d8f2a5Srin  *            restoring the network connection. To eliminate the potential
130d0d8f2a5Srin  *            for the hang ensure that IGC_RDTR is set to 0.
131d0d8f2a5Srin  */
132d0d8f2a5Srin #define IGC_RDTR_VAL		0
133d0d8f2a5Srin 
134d0d8f2a5Srin /*
135d0d8f2a5Srin  * Receive Interrupt Absolute Delay Timer
136d0d8f2a5Srin  * Valid Range: 0-65535 (0=off)
137d0d8f2a5Srin  * Default Value: 64
138d0d8f2a5Srin  *   This value, in units of 1.024 microseconds, limits the delay in which a
139d0d8f2a5Srin  *   receive interrupt is generated. Useful only if IGC_RDTR is non-zero,
140d0d8f2a5Srin  *   this value ensures that an interrupt is generated after the initial
141d0d8f2a5Srin  *   packet is received within the set amount of time.  Proper tuning,
142d0d8f2a5Srin  *   along with IGC_RDTR, may improve traffic throughput in specific network
143d0d8f2a5Srin  *   conditions.
144d0d8f2a5Srin  */
145d0d8f2a5Srin #define IGC_RADV_VAL		64
146d0d8f2a5Srin 
147d0d8f2a5Srin /*
148d0d8f2a5Srin  * This parameter controls whether or not autonegotiation is enabled.
149d0d8f2a5Srin  *              0 - Disable autonegotiation
150d0d8f2a5Srin  *              1 - Enable  autonegotiation
151d0d8f2a5Srin  */
152d0d8f2a5Srin #define DO_AUTO_NEG		true
153d0d8f2a5Srin 
154d0d8f2a5Srin #define AUTONEG_ADV_DEFAULT						\
155d0d8f2a5Srin 	(ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF |	\
156d0d8f2a5Srin 	ADVERTISE_100_FULL | ADVERTISE_1000_FULL | ADVERTISE_2500_FULL)
157d0d8f2a5Srin 
158d0d8f2a5Srin #define AUTO_ALL_MODES		0
159d0d8f2a5Srin 
160d0d8f2a5Srin /*
161d0d8f2a5Srin  * Miscellaneous constants
162d0d8f2a5Srin  */
163d0d8f2a5Srin #define MAX_NUM_MULTICAST_ADDRESSES	128
164d0d8f2a5Srin #define IGC_FC_PAUSE_TIME		0x0680
165d0d8f2a5Srin 
166d0d8f2a5Srin #define IGC_TXPBSIZE		20408
167d0d8f2a5Srin #define IGC_PKTTYPE_MASK	0x0000FFF0
168d0d8f2a5Srin #define IGC_DMCTLX_DCFLUSH_DIS	0x80000000	/* Disable DMA Coalesce Flush */
169d0d8f2a5Srin 
170d0d8f2a5Srin #define IGC_RX_PTHRESH		8
171d0d8f2a5Srin #define IGC_RX_HTHRESH		8
172d0d8f2a5Srin #define IGC_RX_WTHRESH		4
173d0d8f2a5Srin 
174d0d8f2a5Srin #define IGC_TX_PTHRESH		8
175d0d8f2a5Srin #define IGC_TX_HTHRESH		1
176d0d8f2a5Srin 
177d0d8f2a5Srin /*
178d0d8f2a5Srin  * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be
179d0d8f2a5Srin  * multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This will
180d0d8f2a5Srin  * also optimize cache line size effect. H/W supports up to cache line size 128.
181d0d8f2a5Srin  */
182d0d8f2a5Srin #define IGC_DBA_ALIGN		128
183d0d8f2a5Srin 
184d0d8f2a5Srin /*
185d0d8f2a5Srin  * This parameter controls the duration of transmit watchdog timer.
186d0d8f2a5Srin  */
187d0d8f2a5Srin #define IGC_TX_TIMEOUT		5	/* set to 5 seconds */
188d0d8f2a5Srin 
189d0d8f2a5Srin #define IGC_PCIREG		PCI_MAPREG_START
190d0d8f2a5Srin 
191d0d8f2a5Srin #define IGC_MAX_VECTORS		8
192d0d8f2a5Srin 
193d0d8f2a5Srin /* Enable/disable debugging statements in shared code */
194d0d8f2a5Srin #define DBG	0
195d0d8f2a5Srin 
196d0d8f2a5Srin #define DEBUGOUT(...)							\
197d0d8f2a5Srin 	do { if (DBG) printf(__VA_ARGS__); } while (0)
198d0d8f2a5Srin #define DEBUGOUT1(...)		DEBUGOUT(__VA_ARGS__)
199d0d8f2a5Srin #define DEBUGOUT2(...)		DEBUGOUT(__VA_ARGS__)
200d0d8f2a5Srin #define DEBUGOUT3(...)		DEBUGOUT(__VA_ARGS__)
201d0d8f2a5Srin #define DEBUGOUT7(...)		DEBUGOUT(__VA_ARGS__)
202d0d8f2a5Srin #define DEBUGFUNC(F)		DEBUGOUT(F "\n")
203d0d8f2a5Srin 
204d0d8f2a5Srin /* Compatibility glue. */
205d0d8f2a5Srin #define msec_delay(x)		DELAY(1000 * (x))
206d0d8f2a5Srin 
207d0d8f2a5Srin #define IGC_MAX_SCATTER		40
208d0d8f2a5Srin #define IGC_TSO_SIZE		65535
209d0d8f2a5Srin 
210d0d8f2a5Srin #define MAX_INTS_PER_SEC	8000
211d0d8f2a5Srin #define DEFAULT_ITR		(1000000000/(MAX_INTS_PER_SEC * 256))
212d0d8f2a5Srin 
213fb38d839Srin #define IGC_MAX_INTRS		(IGC_MAX_NQUEUES + 1)
214fb38d839Srin 
215d0d8f2a5Srin /* Forward declaration. */
216d0d8f2a5Srin struct igc_hw;
217d0d8f2a5Srin 
218d0d8f2a5Srin struct igc_osdep {
219d0d8f2a5Srin 	bus_dma_tag_t		os_dmat;
220d0d8f2a5Srin 	bus_space_tag_t		os_memt;
221d0d8f2a5Srin 	bus_space_handle_t	os_memh;
222d0d8f2a5Srin 
223d0d8f2a5Srin 	bus_size_t		os_memsize;
224d0d8f2a5Srin 	bus_addr_t		os_membase;
225d0d8f2a5Srin 
226d0d8f2a5Srin 	void			*os_sc;
227d0d8f2a5Srin 	struct pci_attach_args	os_pa;
228d0d8f2a5Srin };
229d0d8f2a5Srin 
230d0d8f2a5Srin 
231d0d8f2a5Srin struct igc_tx_buf {
232d0d8f2a5Srin 	uint32_t	eop_index;
233d0d8f2a5Srin 	struct mbuf	*m_head;
234d0d8f2a5Srin 	bus_dmamap_t	map;
235d0d8f2a5Srin };
236d0d8f2a5Srin 
237d0d8f2a5Srin struct igc_rx_buf {
238d0d8f2a5Srin 	struct mbuf	*buf;
239d0d8f2a5Srin 	struct mbuf	*fmp;	/* First mbuf pointers. */
240d0d8f2a5Srin 	bus_dmamap_t	map;
241d0d8f2a5Srin };
242d0d8f2a5Srin 
243d0d8f2a5Srin /*
244d0d8f2a5Srin  * Bus dma allocation structure used by igc_dma_malloc and igc_dma_free.
245d0d8f2a5Srin  */
246d0d8f2a5Srin struct igc_dma_alloc {
247fb38d839Srin 	void			*dma_vaddr;
248d0d8f2a5Srin 	bus_dma_tag_t		dma_tag;
249d0d8f2a5Srin 	bus_dmamap_t		dma_map;
250d0d8f2a5Srin 	bus_dma_segment_t	dma_seg;
251d0d8f2a5Srin 	bus_size_t		dma_size;
252d0d8f2a5Srin 	int			dma_nseg;
253d0d8f2a5Srin };
254d0d8f2a5Srin 
255d0d8f2a5Srin /*
256d0d8f2a5Srin  * Driver queue struct: this is the interrupt container
257d0d8f2a5Srin  * for the associated tx and rx ring.
258d0d8f2a5Srin  */
259d0d8f2a5Srin struct igc_queue {
260d0d8f2a5Srin 	struct igc_softc	*sc;
261d0d8f2a5Srin 	uint32_t		msix;
262d0d8f2a5Srin 	uint32_t		eims;
263d0d8f2a5Srin 	uint32_t		eitr_setting;
264d0d8f2a5Srin 	pci_intr_handle_t	ih;
265d0d8f2a5Srin 	void			*tag;
266d0d8f2a5Srin 	struct tx_ring		*txr;
267d0d8f2a5Srin 	struct rx_ring		*rxr;
268fb38d839Srin 
269fb38d839Srin 	void			*igcq_si;
270fb38d839Srin 	bool			igcq_workqueue;
271fb38d839Srin 	struct work		igcq_wq_cookie;
272fb38d839Srin 
273fb38d839Srin #ifdef IGC_EVENT_COUNTERS
274fb38d839Srin 	uint64_t		*igcq_driver_counters;
275fb38d839Srin 
276fb38d839Srin 	struct evcnt		*igcq_queue_evcnts;
277fb38d839Srin 	char			igcq_queue_evname[EVCNT_STRING_MAX];
278fb38d839Srin #endif
279d0d8f2a5Srin };
280d0d8f2a5Srin 
281d0d8f2a5Srin /*
282d0d8f2a5Srin  * The transmit ring, one per tx queue.
283d0d8f2a5Srin  */
284d0d8f2a5Srin struct tx_ring {
285d0d8f2a5Srin 	struct igc_softc	*sc;
286d0d8f2a5Srin 	struct ifqueue		*ifq;
287d0d8f2a5Srin 	uint32_t		me;
288d0d8f2a5Srin 	uint32_t		watchdog_timer;
289d0d8f2a5Srin 	union igc_adv_tx_desc	*tx_base;
290d0d8f2a5Srin 	struct igc_tx_buf	*tx_buffers;
291d0d8f2a5Srin 	struct igc_dma_alloc	txdma;
292d0d8f2a5Srin 	uint32_t		next_avail_desc;
293d0d8f2a5Srin 	uint32_t		next_to_clean;
294d0d8f2a5Srin 	bus_dma_tag_t		txtag;
295fb38d839Srin 
296fb38d839Srin 	pcq_t			*txr_interq;
297fb38d839Srin 
298fb38d839Srin 	kmutex_t		txr_lock;
299fb38d839Srin 
300fb38d839Srin 	struct igc_queue	*txr_igcq;
301d0d8f2a5Srin };
302d0d8f2a5Srin 
303d0d8f2a5Srin /*
304d0d8f2a5Srin  * The Receive ring, one per rx queue.
305d0d8f2a5Srin  */
306d0d8f2a5Srin struct rx_ring {
307d0d8f2a5Srin 	struct igc_softc	*sc;
308d0d8f2a5Srin 	uint32_t		me;
309d0d8f2a5Srin 	union igc_adv_rx_desc	*rx_base;
310d0d8f2a5Srin 	struct igc_rx_buf	*rx_buffers;
311d0d8f2a5Srin 	struct igc_dma_alloc	rxdma;
312d0d8f2a5Srin 	uint32_t		last_desc_filled;
313d0d8f2a5Srin 	uint32_t		next_to_check;
314fb38d839Srin #if IF_RXR
315d0d8f2a5Srin 	struct if_rxring	rx_ring;
316fb38d839Srin #endif
317fb38d839Srin 
318fb38d839Srin 	kmutex_t		rxr_lock;
319fb38d839Srin 
320fb38d839Srin 	struct igc_queue	*rxr_igcq;
321d0d8f2a5Srin };
322d0d8f2a5Srin 
323d0d8f2a5Srin /* Our adapter structure. */
324d0d8f2a5Srin struct igc_softc {
325fb38d839Srin 	device_t		sc_dev;
326fb38d839Srin 	struct ethercom		sc_ec;
327d0d8f2a5Srin 	struct ifmedia		media;
328fb38d839Srin #if 1
329fb38d839Srin 	pci_intr_type_t		sc_intr_type;
330fb38d839Srin 	int			sc_nintrs;
331fb38d839Srin 	pci_intr_handle_t	*sc_intrs;
332fb38d839Srin 	void			*sc_ihs[IGC_MAX_INTRS];
333fb38d839Srin #else
334d0d8f2a5Srin 	struct intrmap		*sc_intrmap;
335fb38d839Srin #endif
336d0d8f2a5Srin 
337d0d8f2a5Srin 	struct igc_osdep	osdep;
338d0d8f2a5Srin 	struct igc_hw		hw;
339d0d8f2a5Srin 
340fb38d839Srin 	uint16_t		sc_if_flags;
341d0d8f2a5Srin 	uint16_t		fc;
342d0d8f2a5Srin 	uint16_t		link_active;
343d0d8f2a5Srin 	uint16_t		link_speed;
344d0d8f2a5Srin 	uint16_t		link_duplex;
345d0d8f2a5Srin 	uint32_t		dmac;
346d0d8f2a5Srin 
347d0d8f2a5Srin 	int			num_tx_desc;
348d0d8f2a5Srin 	int			num_rx_desc;
349d0d8f2a5Srin 
350d0d8f2a5Srin 	uint32_t		max_frame_size;
351d0d8f2a5Srin 	uint32_t		rx_mbuf_sz;
352d0d8f2a5Srin 	uint32_t		linkvec;
353d0d8f2a5Srin 	uint32_t		msix_linkmask;
354d0d8f2a5Srin 	uint32_t		msix_queuesmask;
355d0d8f2a5Srin 
356fb38d839Srin 	struct if_percpuq	*sc_ipq;
357d0d8f2a5Srin 	unsigned int		sc_nqueues;
358d0d8f2a5Srin 	struct igc_queue	*queues;
359fb38d839Srin 	bool			sc_txrx_workqueue;
360fb38d839Srin 	struct workqueue	*sc_queue_wq;
361fb38d839Srin 
362fb38d839Srin 	u_int			sc_rx_intr_process_limit;
363fb38d839Srin 	u_int			sc_tx_intr_process_limit;
364fb38d839Srin 	u_int			sc_rx_process_limit;
365fb38d839Srin 	u_int			sc_tx_process_limit;
366d0d8f2a5Srin 
367d0d8f2a5Srin 	struct tx_ring		*tx_rings;
368d0d8f2a5Srin 	struct rx_ring		*rx_rings;
369d0d8f2a5Srin 
370d0d8f2a5Srin 	/* Multicast array memory */
371fb38d839Srin #define	IGC_MTA_LEN	(ETHER_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES)
372d0d8f2a5Srin 	uint8_t			*mta;
373fb38d839Srin 
374fb38d839Srin 	kmutex_t		sc_core_lock;
375fb38d839Srin 
376fb38d839Srin 	callout_t		sc_tick_ch;
377fb38d839Srin 	bool			sc_core_stopping;
378fb38d839Srin 
379fb38d839Srin #ifdef IGC_EVENT_COUNTERS
380fb38d839Srin 	struct evcnt		*sc_global_evcnts;
381fb38d839Srin 
382fb38d839Srin 	struct evcnt		*sc_driver_evcnts;
383fb38d839Srin 
384fb38d839Srin 	struct evcnt		*sc_mac_evcnts;
385fb38d839Srin 	char			sc_mac_evname[EVCNT_STRING_MAX];
386fb38d839Srin #endif
387d0d8f2a5Srin };
388d0d8f2a5Srin 
389d0d8f2a5Srin #define DEVNAME(_sc)    ((_sc)->sc_dev.dv_xname)
390d0d8f2a5Srin 
391d0d8f2a5Srin /* Register READ/WRITE macros */
392d0d8f2a5Srin #define IGC_WRITE_FLUSH(a)	IGC_READ_REG(a, IGC_STATUS)
393d0d8f2a5Srin #define IGC_READ_REG(a, reg)						\
394d0d8f2a5Srin         bus_space_read_4(((struct igc_osdep *)(a)->back)->os_memt,	\
395d0d8f2a5Srin         ((struct igc_osdep *)(a)->back)->os_memh, reg)
396d0d8f2a5Srin #define IGC_WRITE_REG(a, reg, value)					\
397d0d8f2a5Srin         bus_space_write_4(((struct igc_osdep *)(a)->back)->os_memt,	\
398d0d8f2a5Srin         ((struct igc_osdep *)(a)->back)->os_memh, reg, value)
399d0d8f2a5Srin #define IGC_READ_REG_ARRAY(a, reg, off)					\
400d0d8f2a5Srin         bus_space_read_4(((struct igc_osdep *)(a)->back)->os_memt,	\
401d0d8f2a5Srin         ((struct igc_osdep *)(a)->back)->os_memh, (reg + ((off) << 2)))
402d0d8f2a5Srin #define IGC_WRITE_REG_ARRAY(a, reg, off, value)				\
403d0d8f2a5Srin         bus_space_write_4(((struct igc_osdep *)(a)->back)->os_memt,	\
404d0d8f2a5Srin         ((struct igc_osdep *)(a)->back)->os_memh,			\
405d0d8f2a5Srin 	(reg + ((off) << 2)),value)
406d0d8f2a5Srin 
407d0d8f2a5Srin #endif /* _IGC_H_ */
408