xref: /freebsd/sys/dev/vmware/vmxnet3/if_vmxvar.h (revision c02d19b6b6176999ceb8b5607f11bfb62a67174f)
1e3c97c2cSBryan Venteicher /*-
2e3c97c2cSBryan Venteicher  * Copyright (c) 2013 Tsubai Masanari
3e3c97c2cSBryan Venteicher  * Copyright (c) 2013 Bryan Venteicher <bryanv@FreeBSD.org>
4e3c97c2cSBryan Venteicher  *
5e3c97c2cSBryan Venteicher  * Permission to use, copy, modify, and distribute this software for any
6e3c97c2cSBryan Venteicher  * purpose with or without fee is hereby granted, provided that the above
7e3c97c2cSBryan Venteicher  * copyright notice and this permission notice appear in all copies.
8e3c97c2cSBryan Venteicher  *
9e3c97c2cSBryan Venteicher  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10e3c97c2cSBryan Venteicher  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11e3c97c2cSBryan Venteicher  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12e3c97c2cSBryan Venteicher  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13e3c97c2cSBryan Venteicher  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14e3c97c2cSBryan Venteicher  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15e3c97c2cSBryan Venteicher  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16e3c97c2cSBryan Venteicher  *
17e3c97c2cSBryan Venteicher  * $FreeBSD$
18e3c97c2cSBryan Venteicher  */
19e3c97c2cSBryan Venteicher 
20e3c97c2cSBryan Venteicher #ifndef _IF_VMXVAR_H
21e3c97c2cSBryan Venteicher #define _IF_VMXVAR_H
22e3c97c2cSBryan Venteicher 
23e3c97c2cSBryan Venteicher struct vmxnet3_softc;
24e3c97c2cSBryan Venteicher 
25e3c97c2cSBryan Venteicher struct vmxnet3_dma_alloc {
26e3c97c2cSBryan Venteicher 	bus_addr_t		dma_paddr;
27e3c97c2cSBryan Venteicher 	caddr_t			dma_vaddr;
28e3c97c2cSBryan Venteicher 	bus_dma_tag_t		dma_tag;
29e3c97c2cSBryan Venteicher 	bus_dmamap_t		dma_map;
30e3c97c2cSBryan Venteicher 	bus_size_t		dma_size;
31e3c97c2cSBryan Venteicher };
32e3c97c2cSBryan Venteicher 
33e3c97c2cSBryan Venteicher /*
34e3c97c2cSBryan Venteicher  * The number of Rx/Tx queues this driver supports.
35e3c97c2cSBryan Venteicher  */
36e3c97c2cSBryan Venteicher #define VMXNET3_RX_QUEUES	1
37e3c97c2cSBryan Venteicher #define VMXNET3_TX_QUEUES	1
38e3c97c2cSBryan Venteicher 
39e3c97c2cSBryan Venteicher /*
40e3c97c2cSBryan Venteicher  * The number of Rx rings in each Rx queue.
41e3c97c2cSBryan Venteicher  */
42e3c97c2cSBryan Venteicher #define VMXNET3_RXRINGS_PERQ	2
43e3c97c2cSBryan Venteicher 
44e3c97c2cSBryan Venteicher /*
453c5dfe89SBryan Venteicher  * The number of descriptors in each Rx/Tx ring.
46e3c97c2cSBryan Venteicher  */
473c5dfe89SBryan Venteicher #define VMXNET3_DEF_TX_NDESC		512
483c5dfe89SBryan Venteicher #define VMXNET3_MAX_TX_NDESC		4096
493c5dfe89SBryan Venteicher #define VMXNET3_MIN_TX_NDESC		32
503c5dfe89SBryan Venteicher #define VMXNET3_MASK_TX_NDESC		0x1F
513c5dfe89SBryan Venteicher #define VMXNET3_DEF_RX_NDESC		256
523c5dfe89SBryan Venteicher #define VMXNET3_MAX_RX_NDESC		2048
533c5dfe89SBryan Venteicher #define VMXNET3_MIN_RX_NDESC		32
543c5dfe89SBryan Venteicher #define VMXNET3_MASK_RX_NDESC		0x1F
553c5dfe89SBryan Venteicher 
56e3c97c2cSBryan Venteicher #define VMXNET3_MAX_TX_NCOMPDESC	VMXNET3_MAX_TX_NDESC
57e3c97c2cSBryan Venteicher #define VMXNET3_MAX_RX_NCOMPDESC \
58e3c97c2cSBryan Venteicher     (VMXNET3_MAX_RX_NDESC * VMXNET3_RXRINGS_PERQ)
59e3c97c2cSBryan Venteicher 
60e3c97c2cSBryan Venteicher struct vmxnet3_txbuf {
61e3c97c2cSBryan Venteicher 	bus_dmamap_t		 vtxb_dmamap;
62e3c97c2cSBryan Venteicher 	struct mbuf		*vtxb_m;
63e3c97c2cSBryan Venteicher };
64e3c97c2cSBryan Venteicher 
65e3c97c2cSBryan Venteicher struct vmxnet3_txring {
66e3c97c2cSBryan Venteicher 	struct vmxnet3_txbuf	*vxtxr_txbuf;
67e3c97c2cSBryan Venteicher 	u_int			 vxtxr_head;
68e3c97c2cSBryan Venteicher 	u_int			 vxtxr_next;
69e3c97c2cSBryan Venteicher 	u_int			 vxtxr_ndesc;
70e3c97c2cSBryan Venteicher 	int			 vxtxr_gen;
71e3c97c2cSBryan Venteicher 	bus_dma_tag_t		 vxtxr_txtag;
72e3c97c2cSBryan Venteicher 	struct vmxnet3_txdesc	*vxtxr_txd;
73e3c97c2cSBryan Venteicher 	struct vmxnet3_dma_alloc vxtxr_dma;
74e3c97c2cSBryan Venteicher };
75e3c97c2cSBryan Venteicher 
76e3c97c2cSBryan Venteicher static inline int
77e3c97c2cSBryan Venteicher VMXNET3_TXRING_AVAIL(struct vmxnet3_txring *txr)
78e3c97c2cSBryan Venteicher {
79e3c97c2cSBryan Venteicher 	int avail = txr->vxtxr_next - txr->vxtxr_head - 1;
80e3c97c2cSBryan Venteicher 	return (avail < 0 ? txr->vxtxr_ndesc + avail : avail);
81e3c97c2cSBryan Venteicher }
82e3c97c2cSBryan Venteicher 
83e3c97c2cSBryan Venteicher struct vmxnet3_rxbuf {
84e3c97c2cSBryan Venteicher 	bus_dmamap_t		 vrxb_dmamap;
85e3c97c2cSBryan Venteicher 	struct mbuf		*vrxb_m;
86e3c97c2cSBryan Venteicher };
87e3c97c2cSBryan Venteicher 
88e3c97c2cSBryan Venteicher struct vmxnet3_rxring {
89e3c97c2cSBryan Venteicher 	struct vmxnet3_rxbuf	*vxrxr_rxbuf;
90e3c97c2cSBryan Venteicher 	struct vmxnet3_rxdesc	*vxrxr_rxd;
91e3c97c2cSBryan Venteicher 	u_int			 vxrxr_fill;
92e3c97c2cSBryan Venteicher 	u_int			 vxrxr_ndesc;
93e3c97c2cSBryan Venteicher 	int			 vxrxr_gen;
94e3c97c2cSBryan Venteicher 	int			 vxrxr_rid;
95e3c97c2cSBryan Venteicher 	bus_dma_tag_t		 vxrxr_rxtag;
96e3c97c2cSBryan Venteicher 	struct vmxnet3_dma_alloc vxrxr_dma;
97e3c97c2cSBryan Venteicher 	bus_dmamap_t		 vxrxr_spare_dmap;
98e3c97c2cSBryan Venteicher };
99e3c97c2cSBryan Venteicher 
100e3c97c2cSBryan Venteicher static inline void
101e3c97c2cSBryan Venteicher vmxnet3_rxr_increment_fill(struct vmxnet3_rxring *rxr)
102e3c97c2cSBryan Venteicher {
103e3c97c2cSBryan Venteicher 
104e3c97c2cSBryan Venteicher 	if (++rxr->vxrxr_fill == rxr->vxrxr_ndesc) {
105e3c97c2cSBryan Venteicher 		rxr->vxrxr_fill = 0;
106e3c97c2cSBryan Venteicher 		rxr->vxrxr_gen ^= 1;
107e3c97c2cSBryan Venteicher 	}
108e3c97c2cSBryan Venteicher }
109e3c97c2cSBryan Venteicher 
110e3c97c2cSBryan Venteicher struct vmxnet3_comp_ring {
111e3c97c2cSBryan Venteicher 	union {
112e3c97c2cSBryan Venteicher 		struct vmxnet3_txcompdesc *txcd;
113e3c97c2cSBryan Venteicher 		struct vmxnet3_rxcompdesc *rxcd;
114e3c97c2cSBryan Venteicher 	}			 vxcr_u;
115e3c97c2cSBryan Venteicher 	u_int			 vxcr_next;
116e3c97c2cSBryan Venteicher 	u_int			 vxcr_ndesc;
117e3c97c2cSBryan Venteicher 	int			 vxcr_gen;
118e3c97c2cSBryan Venteicher 	struct vmxnet3_dma_alloc vxcr_dma;
119e3c97c2cSBryan Venteicher };
120e3c97c2cSBryan Venteicher 
121e3c97c2cSBryan Venteicher struct vmxnet3_txq_stats {
122e3c97c2cSBryan Venteicher 	uint64_t		vtxrs_full;
123e3c97c2cSBryan Venteicher 	uint64_t		vtxrs_offload_failed;
124e3c97c2cSBryan Venteicher };
125e3c97c2cSBryan Venteicher 
126e3c97c2cSBryan Venteicher struct vmxnet3_txqueue {
127e3c97c2cSBryan Venteicher 	struct mtx			 vxtxq_mtx;
128e3c97c2cSBryan Venteicher 	struct vmxnet3_softc		*vxtxq_sc;
129e3c97c2cSBryan Venteicher 	int				 vxtxq_id;
130e3c97c2cSBryan Venteicher 	int				 vxtxq_intr_idx;
131e3c97c2cSBryan Venteicher 	int				 vxtxq_watchdog;
132e3c97c2cSBryan Venteicher 	struct vmxnet3_txring		 vxtxq_cmd_ring;
133e3c97c2cSBryan Venteicher 	struct vmxnet3_comp_ring	 vxtxq_comp_ring;
134e3c97c2cSBryan Venteicher 	struct vmxnet3_txq_stats	 vxtxq_stats;
135e3c97c2cSBryan Venteicher 	struct vmxnet3_txq_shared	*vxtxq_ts;
136e3c97c2cSBryan Venteicher 	struct sysctl_oid_list		*vxtxq_sysctl;
137e3c97c2cSBryan Venteicher 	char				 vxtxq_name[16];
138e3c97c2cSBryan Venteicher };
139e3c97c2cSBryan Venteicher 
140e3c97c2cSBryan Venteicher #define VMXNET3_TXQ_LOCK(_txq)		mtx_lock(&(_txq)->vxtxq_mtx)
141e3c97c2cSBryan Venteicher #define VMXNET3_TXQ_TRYLOCK(_txq)	mtx_trylock(&(_txq)->vxtxq_mtx)
142e3c97c2cSBryan Venteicher #define VMXNET3_TXQ_UNLOCK(_txq)	mtx_unlock(&(_txq)->vxtxq_mtx)
143e3c97c2cSBryan Venteicher #define VMXNET3_TXQ_LOCK_ASSERT(_txq)		\
144e3c97c2cSBryan Venteicher     mtx_assert(&(_txq)->vxtxq_mtx, MA_OWNED)
145e3c97c2cSBryan Venteicher #define VMXNET3_TXQ_LOCK_ASSERT_NOTOWNED(_txq)	\
146e3c97c2cSBryan Venteicher     mtx_assert(&(_txq)->vxtxq_mtx, MA_NOTOWNED)
147e3c97c2cSBryan Venteicher 
148e3c97c2cSBryan Venteicher struct vmxnet3_rxq_stats {
149e3c97c2cSBryan Venteicher 
150e3c97c2cSBryan Venteicher };
151e3c97c2cSBryan Venteicher 
152e3c97c2cSBryan Venteicher struct vmxnet3_rxqueue {
153e3c97c2cSBryan Venteicher 	struct mtx			 vxrxq_mtx;
154e3c97c2cSBryan Venteicher 	struct vmxnet3_softc		*vxrxq_sc;
155e3c97c2cSBryan Venteicher 	int				 vxrxq_id;
156e3c97c2cSBryan Venteicher 	int				 vxrxq_intr_idx;
157e3c97c2cSBryan Venteicher 	struct vmxnet3_rxring		 vxrxq_cmd_ring[VMXNET3_RXRINGS_PERQ];
158e3c97c2cSBryan Venteicher 	struct vmxnet3_comp_ring	 vxrxq_comp_ring;
159e3c97c2cSBryan Venteicher 	struct vmxnet3_rxq_stats	 vxrxq_stats;
160e3c97c2cSBryan Venteicher 	struct vmxnet3_rxq_shared	*vxrxq_rs;
161e3c97c2cSBryan Venteicher 	struct sysctl_oid_list		*vxrxq_sysctl;
162e3c97c2cSBryan Venteicher 	char				 vxrxq_name[16];
163e3c97c2cSBryan Venteicher };
164e3c97c2cSBryan Venteicher 
165e3c97c2cSBryan Venteicher #define VMXNET3_RXQ_LOCK(_rxq)		mtx_lock(&(_rxq)->vxrxq_mtx)
166e3c97c2cSBryan Venteicher #define VMXNET3_RXQ_UNLOCK(_rxq)	mtx_unlock(&(_rxq)->vxrxq_mtx)
167e3c97c2cSBryan Venteicher #define VMXNET3_RXQ_LOCK_ASSERT(_rxq)		\
168e3c97c2cSBryan Venteicher     mtx_assert(&(_rxq)->vxrxq_mtx, MA_OWNED)
169e3c97c2cSBryan Venteicher #define VMXNET3_RXQ_LOCK_ASSERT_NOTOWNED(_rxq)	\
170e3c97c2cSBryan Venteicher     mtx_assert(&(_rxq)->vxrxq_mtx, MA_NOTOWNED)
171e3c97c2cSBryan Venteicher 
172e3c97c2cSBryan Venteicher struct vmxnet3_statistics {
173e3c97c2cSBryan Venteicher 	uint32_t		vmst_collapsed;
174e3c97c2cSBryan Venteicher 	uint32_t		vmst_mgetcl_failed;
175e3c97c2cSBryan Venteicher 	uint32_t		vmst_mbuf_load_failed;
176e3c97c2cSBryan Venteicher 
177e3c97c2cSBryan Venteicher };
178e3c97c2cSBryan Venteicher 
179e3c97c2cSBryan Venteicher struct vmxnet3_interrupt {
180e3c97c2cSBryan Venteicher 	struct resource		*vmxi_irq;
181e3c97c2cSBryan Venteicher 	int			 vmxi_rid;
182e3c97c2cSBryan Venteicher 	void			*vmxi_handler;
183e3c97c2cSBryan Venteicher };
184e3c97c2cSBryan Venteicher 
185e3c97c2cSBryan Venteicher struct vmxnet3_softc {
186e3c97c2cSBryan Venteicher 	device_t			 vmx_dev;
187e3c97c2cSBryan Venteicher 	struct ifnet			*vmx_ifp;
188e3c97c2cSBryan Venteicher 	struct vmxnet3_driver_shared	*vmx_ds;
189e3c97c2cSBryan Venteicher 	uint32_t			 vmx_flags;
190e3c97c2cSBryan Venteicher #define VMXNET3_FLAG_NO_MSIX	0x0001
191e3c97c2cSBryan Venteicher 
192e3c97c2cSBryan Venteicher 	struct vmxnet3_rxqueue		*vmx_rxq;
193e3c97c2cSBryan Venteicher 	struct vmxnet3_txqueue		*vmx_txq;
194e3c97c2cSBryan Venteicher 
195e3c97c2cSBryan Venteicher 	struct resource			*vmx_res0;
196e3c97c2cSBryan Venteicher 	bus_space_tag_t			 vmx_iot0;
197e3c97c2cSBryan Venteicher 	bus_space_handle_t		 vmx_ioh0;
198e3c97c2cSBryan Venteicher 	struct resource			*vmx_res1;
199e3c97c2cSBryan Venteicher 	bus_space_tag_t			 vmx_iot1;
200e3c97c2cSBryan Venteicher 	bus_space_handle_t		 vmx_ioh1;
201e3c97c2cSBryan Venteicher 	struct resource			*vmx_msix_res;
202e3c97c2cSBryan Venteicher 
203e3c97c2cSBryan Venteicher 	int				 vmx_link_active;
204e3c97c2cSBryan Venteicher 	int				 vmx_link_speed;
205e3c97c2cSBryan Venteicher 	int				 vmx_if_flags;
206e3c97c2cSBryan Venteicher 	int				 vmx_ntxqueues;
207e3c97c2cSBryan Venteicher 	int				 vmx_nrxqueues;
208e3c97c2cSBryan Venteicher 	int				 vmx_ntxdescs;
209e3c97c2cSBryan Venteicher 	int				 vmx_nrxdescs;
210e3c97c2cSBryan Venteicher 	int				 vmx_max_rxsegs;
211e3c97c2cSBryan Venteicher 	int				 vmx_rx_max_chain;
212e3c97c2cSBryan Venteicher 
213e3c97c2cSBryan Venteicher 	struct vmxnet3_statistics	 vmx_stats;
214e3c97c2cSBryan Venteicher 
215e3c97c2cSBryan Venteicher 	int				 vmx_intr_type;
216e3c97c2cSBryan Venteicher 	int				 vmx_intr_mask_mode;
217e3c97c2cSBryan Venteicher 	int				 vmx_event_intr_idx;
218e3c97c2cSBryan Venteicher 	int				 vmx_nintrs;
219e3c97c2cSBryan Venteicher 	struct vmxnet3_interrupt	 vmx_intrs[VMXNET3_MAX_INTRS];
220e3c97c2cSBryan Venteicher 
221e3c97c2cSBryan Venteicher 	struct mtx			 vmx_mtx;
222e3c97c2cSBryan Venteicher 	uint8_t				*vmx_mcast;
223e3c97c2cSBryan Venteicher 	void				*vmx_qs;
224e3c97c2cSBryan Venteicher 	struct callout			 vmx_tick;
225e3c97c2cSBryan Venteicher 	struct vmxnet3_dma_alloc	 vmx_ds_dma;
226e3c97c2cSBryan Venteicher 	struct vmxnet3_dma_alloc	 vmx_qs_dma;
227e3c97c2cSBryan Venteicher 	struct vmxnet3_dma_alloc	 vmx_mcast_dma;
228e3c97c2cSBryan Venteicher 	struct ifmedia			 vmx_media;
229e3c97c2cSBryan Venteicher 	eventhandler_tag		 vmx_vlan_attach;
230e3c97c2cSBryan Venteicher 	eventhandler_tag		 vmx_vlan_detach;
231*c02d19b6SBryan Venteicher 	uint32_t			 vmx_vlan_filter[4096/32];
232e3c97c2cSBryan Venteicher 	uint8_t				 vmx_lladdr[ETHER_ADDR_LEN];
233e3c97c2cSBryan Venteicher };
234e3c97c2cSBryan Venteicher 
235e3c97c2cSBryan Venteicher #define VMXNET3_CORE_LOCK_INIT(_sc, _name) \
236e3c97c2cSBryan Venteicher     mtx_init(&(_sc)->vmx_mtx, _name, "VMXNET3 Lock", MTX_DEF)
237e3c97c2cSBryan Venteicher #define VMXNET3_CORE_LOCK_DESTROY(_sc)	mtx_destroy(&(_sc)->vmx_mtx)
238e3c97c2cSBryan Venteicher #define VMXNET3_CORE_LOCK(_sc)		mtx_lock(&(_sc)->vmx_mtx)
239e3c97c2cSBryan Venteicher #define VMXNET3_CORE_UNLOCK(_sc)	mtx_unlock(&(_sc)->vmx_mtx)
240e3c97c2cSBryan Venteicher #define VMXNET3_CORE_LOCK_ASSERT(_sc)	mtx_assert(&(_sc)->vmx_mtx, MA_OWNED)
241e3c97c2cSBryan Venteicher #define VMXNET3_CORE_LOCK_ASSERT_NOTOWNED(_sc) \
242e3c97c2cSBryan Venteicher     mtx_assert(&(_sc)->vmx_mtx, MA_NOTOWNED)
243e3c97c2cSBryan Venteicher 
244e3c97c2cSBryan Venteicher /*
245e3c97c2cSBryan Venteicher  * Our driver version we report to the hypervisor; we just keep
246e3c97c2cSBryan Venteicher  * this value constant.
247e3c97c2cSBryan Venteicher  */
248e3c97c2cSBryan Venteicher #define VMXNET3_DRIVER_VERSION 0x00010000
249e3c97c2cSBryan Venteicher 
250e3c97c2cSBryan Venteicher /*
251e3c97c2cSBryan Venteicher  * Convert the FreeBSD version in to something the hypervisor
252e3c97c2cSBryan Venteicher  * understands. This is apparently what VMware's driver reports
253e3c97c2cSBryan Venteicher  * so mimic it even though it probably is not required.
254e3c97c2cSBryan Venteicher  */
255e3c97c2cSBryan Venteicher #define VMXNET3_GUEST_OS_VERSION \
256e3c97c2cSBryan Venteicher    (((__FreeBSD_version / 100000) << 14)	| \
257e3c97c2cSBryan Venteicher     (((__FreeBSD_version / 1000) % 100)	<< 6 )	| \
258e3c97c2cSBryan Venteicher     (((__FreeBSD_version / 100) % 10) << 30)	| \
259e3c97c2cSBryan Venteicher     ((__FreeBSD_version % 100) << 22))
260e3c97c2cSBryan Venteicher 
261e3c97c2cSBryan Venteicher /*
262e3c97c2cSBryan Venteicher  * Max descriptors per Tx packet. We must limit the size of the
263e3c97c2cSBryan Venteicher  * any TSO packets based on the number of segments.
264e3c97c2cSBryan Venteicher  */
265e3c97c2cSBryan Venteicher #define VMXNET3_TX_MAXSEGS		32
266e3c97c2cSBryan Venteicher #define VMXNET3_TSO_MAXSIZE		65550
267e3c97c2cSBryan Venteicher 
268e3c97c2cSBryan Venteicher /*
269e3c97c2cSBryan Venteicher  * Maximum support Tx segments size. The length field in the
270e3c97c2cSBryan Venteicher  * Tx descriptor is 14 bits.
271e3c97c2cSBryan Venteicher  */
272e3c97c2cSBryan Venteicher #define VMXNET3_TX_MAXSEGSIZE		(1 << 14)
273e3c97c2cSBryan Venteicher 
274e3c97c2cSBryan Venteicher /*
2753c965775SBryan Venteicher  * The maximum number of Rx segments we accept. When LRO is enabled,
2763c965775SBryan Venteicher  * this allows us to receive the maximum sized frame with one MCLBYTES
2773c965775SBryan Venteicher  * cluster followed by 16 MJUMPAGESIZE clusters.
2783c965775SBryan Venteicher  */
2793c965775SBryan Venteicher #define VMXNET3_MAX_RX_SEGS		17
2803c965775SBryan Venteicher 
2813c965775SBryan Venteicher /*
282e3c97c2cSBryan Venteicher  * Predetermined size of the multicast MACs filter table. If the
283e3c97c2cSBryan Venteicher  * number of multicast addresses exceeds this size, then the
284e3c97c2cSBryan Venteicher  * ALL_MULTI mode is use instead.
285e3c97c2cSBryan Venteicher  */
286e3c97c2cSBryan Venteicher #define VMXNET3_MULTICAST_MAX		32
287e3c97c2cSBryan Venteicher 
288e3c97c2cSBryan Venteicher /*
289e3c97c2cSBryan Venteicher  * Our Tx watchdog timeout.
290e3c97c2cSBryan Venteicher  */
291e3c97c2cSBryan Venteicher #define VMXNET3_WATCHDOG_TIMEOUT	5
292e3c97c2cSBryan Venteicher 
293e3c97c2cSBryan Venteicher /*
294e3c97c2cSBryan Venteicher  * IP protocols that we can perform Tx checksum offloading of.
295e3c97c2cSBryan Venteicher  */
296e3c97c2cSBryan Venteicher #define VMXNET3_CSUM_OFFLOAD		(CSUM_TCP | CSUM_UDP)
297e3c97c2cSBryan Venteicher #define VMXNET3_CSUM_OFFLOAD_IPV6	(CSUM_TCP_IPV6 | CSUM_UDP_IPV6)
298e3c97c2cSBryan Venteicher 
299e3c97c2cSBryan Venteicher #define VMXNET3_CSUM_ALL_OFFLOAD	\
300e3c97c2cSBryan Venteicher     (VMXNET3_CSUM_OFFLOAD | VMXNET3_CSUM_OFFLOAD_IPV6 | CSUM_TSO)
301e3c97c2cSBryan Venteicher 
302e3c97c2cSBryan Venteicher /*
303e3c97c2cSBryan Venteicher  * Compat macros to keep this driver compiling on old releases.
304e3c97c2cSBryan Venteicher  */
305e3c97c2cSBryan Venteicher 
306e3c97c2cSBryan Venteicher #if !defined(SYSCTL_ADD_UQUAD)
307e3c97c2cSBryan Venteicher #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
308e3c97c2cSBryan Venteicher #endif
309e3c97c2cSBryan Venteicher 
310e3c97c2cSBryan Venteicher #if !defined(IFCAP_TXCSUM_IPV6)
311e3c97c2cSBryan Venteicher #define IFCAP_TXCSUM_IPV6 0
312e3c97c2cSBryan Venteicher #endif
313e3c97c2cSBryan Venteicher 
314e3c97c2cSBryan Venteicher #if !defined(IFCAP_RXCSUM_IPV6)
315e3c97c2cSBryan Venteicher #define IFCAP_RXCSUM_IPV6 0
316e3c97c2cSBryan Venteicher #endif
317e3c97c2cSBryan Venteicher 
318e3c97c2cSBryan Venteicher #if !defined(CSUM_TCP_IPV6)
319e3c97c2cSBryan Venteicher #define CSUM_TCP_IPV6 0
320e3c97c2cSBryan Venteicher #endif
321e3c97c2cSBryan Venteicher 
322e3c97c2cSBryan Venteicher #if !defined(CSUM_UDP_IPV6)
323e3c97c2cSBryan Venteicher #define CSUM_UDP_IPV6	0
324e3c97c2cSBryan Venteicher #endif
325e3c97c2cSBryan Venteicher 
326e3c97c2cSBryan Venteicher #endif /* _IF_VMXVAR_H */
327