1b22a70abSPatrick Mooney /*
2b22a70abSPatrick Mooney  * Copyright (c) 2013  Chris Torek <torek @ torek net>
3b22a70abSPatrick Mooney  * All rights reserved.
4b22a70abSPatrick Mooney  *
5b22a70abSPatrick Mooney  * Redistribution and use in source and binary forms, with or without
6b22a70abSPatrick Mooney  * modification, are permitted provided that the following conditions
7b22a70abSPatrick Mooney  * are met:
8b22a70abSPatrick Mooney  * 1. Redistributions of source code must retain the above copyright
9b22a70abSPatrick Mooney  *    notice, this list of conditions and the following disclaimer.
10b22a70abSPatrick Mooney  * 2. Redistributions in binary form must reproduce the above copyright
11b22a70abSPatrick Mooney  *    notice, this list of conditions and the following disclaimer in the
12b22a70abSPatrick Mooney  *    documentation and/or other materials provided with the distribution.
13b22a70abSPatrick Mooney  *
14b22a70abSPatrick Mooney  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15b22a70abSPatrick Mooney  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16b22a70abSPatrick Mooney  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17b22a70abSPatrick Mooney  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18b22a70abSPatrick Mooney  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19b22a70abSPatrick Mooney  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20b22a70abSPatrick Mooney  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21b22a70abSPatrick Mooney  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22b22a70abSPatrick Mooney  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23b22a70abSPatrick Mooney  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24b22a70abSPatrick Mooney  * SUCH DAMAGE.
25b22a70abSPatrick Mooney  */
26b22a70abSPatrick Mooney /*
27b22a70abSPatrick Mooney  * This file and its contents are supplied under the terms of the
28b22a70abSPatrick Mooney  * Common Development and Distribution License ("CDDL"), version 1.0.
29b22a70abSPatrick Mooney  * You may only use this file in accordance with the terms of version
30b22a70abSPatrick Mooney  * 1.0 of the CDDL.
31b22a70abSPatrick Mooney  *
32b22a70abSPatrick Mooney  * A full copy of the text of the CDDL should have accompanied this
33b22a70abSPatrick Mooney  * source.  A copy of the CDDL is also available via the Internet at
34b22a70abSPatrick Mooney  * http://www.illumos.org/license/CDDL.
35b22a70abSPatrick Mooney  *
36b22a70abSPatrick Mooney  * Copyright 2015 Pluribus Networks Inc.
37b22a70abSPatrick Mooney  * Copyright 2019 Joyent, Inc.
38427f9b9aSPatrick Mooney  * Copyright 2021 Oxide Computer Company
39b22a70abSPatrick Mooney  */
40b22a70abSPatrick Mooney 
41b22a70abSPatrick Mooney #ifndef	_VIONA_IMPL_H
42b22a70abSPatrick Mooney #define	_VIONA_IMPL_H
43b22a70abSPatrick Mooney 
44b22a70abSPatrick Mooney #include <sys/ddi.h>
45b22a70abSPatrick Mooney #include <sys/list.h>
46b22a70abSPatrick Mooney #include <sys/sunddi.h>
47b22a70abSPatrick Mooney #include <sys/sunndi.h>
48b22a70abSPatrick Mooney #include <sys/strsun.h>
49b22a70abSPatrick Mooney #include <sys/sysmacros.h>
50b22a70abSPatrick Mooney #include <sys/uio.h>
51b22a70abSPatrick Mooney 
52b22a70abSPatrick Mooney #include <sys/mac_client.h>
53b22a70abSPatrick Mooney #include <sys/mac_provider.h>
54b22a70abSPatrick Mooney #include <sys/mac_client_priv.h>
55b22a70abSPatrick Mooney #include <sys/neti.h>
56b22a70abSPatrick Mooney #include <inet/ip.h>
57b22a70abSPatrick Mooney #include <inet/tcp.h>
58b22a70abSPatrick Mooney 
59b22a70abSPatrick Mooney #include <sys/vmm_drv.h>
60b22a70abSPatrick Mooney #include <sys/viona_io.h>
61b22a70abSPatrick Mooney 
62b22a70abSPatrick Mooney struct viona_link;
63b22a70abSPatrick Mooney typedef struct viona_link viona_link_t;
64b22a70abSPatrick Mooney struct viona_desb;
65b22a70abSPatrick Mooney typedef struct viona_desb viona_desb_t;
66b22a70abSPatrick Mooney struct viona_net;
67b22a70abSPatrick Mooney typedef struct viona_neti viona_neti_t;
68b22a70abSPatrick Mooney 
69b22a70abSPatrick Mooney enum viona_ring_state {
70b22a70abSPatrick Mooney 	VRS_RESET	= 0x0,	/* just allocated or reset */
71b22a70abSPatrick Mooney 	VRS_SETUP	= 0x1,	/* addrs setup and starting worker thread */
72b22a70abSPatrick Mooney 	VRS_INIT	= 0x2,	/* worker thread started & waiting to run */
73b22a70abSPatrick Mooney 	VRS_RUN		= 0x3,	/* running work routine */
74b22a70abSPatrick Mooney 	VRS_STOP	= 0x4,	/* worker is exiting */
75b22a70abSPatrick Mooney };
76b22a70abSPatrick Mooney enum viona_ring_state_flags {
77b22a70abSPatrick Mooney 	VRSF_REQ_START	= 0x1,	/* start running from INIT state */
78b22a70abSPatrick Mooney 	VRSF_REQ_STOP	= 0x2,	/* stop running, clean up, goto RESET state */
79b22a70abSPatrick Mooney 	VRSF_RENEW	= 0x4,	/* ring renewing lease */
80b22a70abSPatrick Mooney };
81b22a70abSPatrick Mooney 
82b22a70abSPatrick Mooney typedef struct viona_vring {
83b22a70abSPatrick Mooney 	viona_link_t	*vr_link;
84b22a70abSPatrick Mooney 
85b22a70abSPatrick Mooney 	kmutex_t	vr_lock;
86b22a70abSPatrick Mooney 	kcondvar_t	vr_cv;
87b22a70abSPatrick Mooney 	uint16_t	vr_state;
88b22a70abSPatrick Mooney 	uint16_t	vr_state_flags;
89b22a70abSPatrick Mooney 	uint_t		vr_xfer_outstanding;
90b22a70abSPatrick Mooney 	kthread_t	*vr_worker_thread;
91b22a70abSPatrick Mooney 	vmm_lease_t	*vr_lease;
92b22a70abSPatrick Mooney 
93b22a70abSPatrick Mooney 	/* ring-sized resources for TX activity */
94b22a70abSPatrick Mooney 	viona_desb_t	*vr_txdesb;
95b22a70abSPatrick Mooney 	struct iovec	*vr_txiov;
96b22a70abSPatrick Mooney 
97b22a70abSPatrick Mooney 	uint_t		vr_intr_enabled;
98b22a70abSPatrick Mooney 	uint64_t	vr_msi_addr;
99b22a70abSPatrick Mooney 	uint64_t	vr_msi_msg;
100b22a70abSPatrick Mooney 
101b22a70abSPatrick Mooney 	/* Internal ring-related state */
102b22a70abSPatrick Mooney 	kmutex_t	vr_a_mutex;	/* sync consumers of 'avail' */
103b22a70abSPatrick Mooney 	kmutex_t	vr_u_mutex;	/* sync consumers of 'used' */
104b22a70abSPatrick Mooney 	uint64_t	vr_pa;
105b22a70abSPatrick Mooney 	uint16_t	vr_size;
106b22a70abSPatrick Mooney 	uint16_t	vr_mask;	/* cached from vr_size */
107b22a70abSPatrick Mooney 	uint16_t	vr_cur_aidx;	/* trails behind 'avail_idx' */
108427f9b9aSPatrick Mooney 	uint16_t	vr_cur_uidx;	/* drives 'used_idx' */
109b22a70abSPatrick Mooney 
110427f9b9aSPatrick Mooney 	/* Reference to guest pages holding virtqueue */
111427f9b9aSPatrick Mooney 	void		**vr_map_pages;
112db9aa506SPatrick Mooney 	vmm_page_t	*vr_map_hold;
113b22a70abSPatrick Mooney 
114b22a70abSPatrick Mooney 	/* Per-ring error condition statistics */
115b22a70abSPatrick Mooney 	struct viona_ring_stats {
116b22a70abSPatrick Mooney 		uint64_t	rs_ndesc_too_high;
117b22a70abSPatrick Mooney 		uint64_t	rs_bad_idx;
118b22a70abSPatrick Mooney 		uint64_t	rs_indir_bad_len;
119b22a70abSPatrick Mooney 		uint64_t	rs_indir_bad_nest;
120b22a70abSPatrick Mooney 		uint64_t	rs_indir_bad_next;
121b22a70abSPatrick Mooney 		uint64_t	rs_no_space;
122b22a70abSPatrick Mooney 		uint64_t	rs_too_many_desc;
123b22a70abSPatrick Mooney 		uint64_t	rs_desc_bad_len;
124b22a70abSPatrick Mooney 
125b22a70abSPatrick Mooney 		uint64_t	rs_bad_ring_addr;
126b22a70abSPatrick Mooney 
127b22a70abSPatrick Mooney 		uint64_t	rs_fail_hcksum;
128b22a70abSPatrick Mooney 		uint64_t	rs_fail_hcksum6;
129b22a70abSPatrick Mooney 		uint64_t	rs_fail_hcksum_proto;
130b22a70abSPatrick Mooney 
131b22a70abSPatrick Mooney 		uint64_t	rs_bad_rx_frame;
132b22a70abSPatrick Mooney 		uint64_t	rs_rx_merge_overrun;
133b22a70abSPatrick Mooney 		uint64_t	rs_rx_merge_underrun;
134b22a70abSPatrick Mooney 		uint64_t	rs_rx_pad_short;
135b22a70abSPatrick Mooney 		uint64_t	rs_rx_mcast_check;
136b22a70abSPatrick Mooney 		uint64_t	rs_too_short;
137b22a70abSPatrick Mooney 		uint64_t	rs_tx_absent;
138b22a70abSPatrick Mooney 
139b22a70abSPatrick Mooney 		uint64_t	rs_rx_hookdrop;
140b22a70abSPatrick Mooney 		uint64_t	rs_tx_hookdrop;
141b22a70abSPatrick Mooney 	} vr_stats;
142b22a70abSPatrick Mooney } viona_vring_t;
143b22a70abSPatrick Mooney 
144b22a70abSPatrick Mooney struct viona_link {
145b22a70abSPatrick Mooney 	vmm_hold_t		*l_vm_hold;
146b22a70abSPatrick Mooney 	boolean_t		l_destroyed;
147b22a70abSPatrick Mooney 
148b22a70abSPatrick Mooney 	viona_vring_t		l_vrings[VIONA_VQ_MAX];
149b22a70abSPatrick Mooney 
150b22a70abSPatrick Mooney 	uint32_t		l_features;
151b22a70abSPatrick Mooney 	uint32_t		l_features_hw;
152b22a70abSPatrick Mooney 	uint32_t		l_cap_csum;
153b22a70abSPatrick Mooney 
1540e1453c3SPatrick Mooney 	uint16_t		l_notify_ioport;
155b22a70abSPatrick Mooney 	void			*l_notify_cookie;
156b22a70abSPatrick Mooney 
157b22a70abSPatrick Mooney 	datalink_id_t		l_linkid;
158b22a70abSPatrick Mooney 	mac_handle_t		l_mh;
159b22a70abSPatrick Mooney 	mac_client_handle_t	l_mch;
160b22a70abSPatrick Mooney 	mac_promisc_handle_t	l_mph;
161b22a70abSPatrick Mooney 
162b22a70abSPatrick Mooney 	pollhead_t		l_pollhead;
163b22a70abSPatrick Mooney 
164b22a70abSPatrick Mooney 	viona_neti_t		*l_neti;
165b22a70abSPatrick Mooney };
166b22a70abSPatrick Mooney 
167b22a70abSPatrick Mooney typedef struct viona_nethook {
168b22a70abSPatrick Mooney 	net_handle_t		vnh_neti;
169b22a70abSPatrick Mooney 	hook_family_t		vnh_family;
170b22a70abSPatrick Mooney 	hook_event_t		vnh_event_in;
171b22a70abSPatrick Mooney 	hook_event_t		vnh_event_out;
172b22a70abSPatrick Mooney 	hook_event_token_t	vnh_token_in;
173b22a70abSPatrick Mooney 	hook_event_token_t	vnh_token_out;
174b22a70abSPatrick Mooney 	boolean_t		vnh_hooked;
175b22a70abSPatrick Mooney } viona_nethook_t;
176b22a70abSPatrick Mooney 
177b22a70abSPatrick Mooney struct viona_neti {
178b22a70abSPatrick Mooney 	list_node_t		vni_node;
179b22a70abSPatrick Mooney 
180b22a70abSPatrick Mooney 	netid_t			vni_netid;
181b22a70abSPatrick Mooney 	zoneid_t		vni_zid;
182b22a70abSPatrick Mooney 
183b22a70abSPatrick Mooney 	viona_nethook_t		vni_nethook;
184b22a70abSPatrick Mooney 
185b22a70abSPatrick Mooney 	kmutex_t		vni_lock;	/* Protects remaining members */
186b22a70abSPatrick Mooney 	kcondvar_t		vni_ref_change; /* Protected by vni_lock */
187b22a70abSPatrick Mooney 	uint_t			vni_ref;	/* Protected by vni_lock */
188b22a70abSPatrick Mooney 	list_t			vni_dev_list;	/* Protected by vni_lock */
189b22a70abSPatrick Mooney };
190b22a70abSPatrick Mooney 
191b22a70abSPatrick Mooney typedef struct used_elem {
192b22a70abSPatrick Mooney 	uint16_t	id;
193b22a70abSPatrick Mooney 	uint32_t	len;
194b22a70abSPatrick Mooney } used_elem_t;
195b22a70abSPatrick Mooney 
196b22a70abSPatrick Mooney typedef struct viona_soft_state {
197b22a70abSPatrick Mooney 	kmutex_t		ss_lock;
198b22a70abSPatrick Mooney 	viona_link_t		*ss_link;
199b22a70abSPatrick Mooney 	list_node_t		ss_node;
200b22a70abSPatrick Mooney } viona_soft_state_t;
201b22a70abSPatrick Mooney 
202b22a70abSPatrick Mooney #pragma pack(1)
203b22a70abSPatrick Mooney struct virtio_desc {
204b22a70abSPatrick Mooney 	uint64_t	vd_addr;
205b22a70abSPatrick Mooney 	uint32_t	vd_len;
206b22a70abSPatrick Mooney 	uint16_t	vd_flags;
207b22a70abSPatrick Mooney 	uint16_t	vd_next;
208b22a70abSPatrick Mooney };
209b22a70abSPatrick Mooney 
210b22a70abSPatrick Mooney struct virtio_used {
211b22a70abSPatrick Mooney 	uint32_t	vu_idx;
212b22a70abSPatrick Mooney 	uint32_t	vu_tlen;
213b22a70abSPatrick Mooney };
214b22a70abSPatrick Mooney 
215b22a70abSPatrick Mooney struct virtio_net_mrgrxhdr {
216b22a70abSPatrick Mooney 	uint8_t		vrh_flags;
217b22a70abSPatrick Mooney 	uint8_t		vrh_gso_type;
218b22a70abSPatrick Mooney 	uint16_t	vrh_hdr_len;
219b22a70abSPatrick Mooney 	uint16_t	vrh_gso_size;
220b22a70abSPatrick Mooney 	uint16_t	vrh_csum_start;
221b22a70abSPatrick Mooney 	uint16_t	vrh_csum_offset;
222b22a70abSPatrick Mooney 	uint16_t	vrh_bufs;
223b22a70abSPatrick Mooney };
224b22a70abSPatrick Mooney 
225b22a70abSPatrick Mooney struct virtio_net_hdr {
226b22a70abSPatrick Mooney 	uint8_t		vrh_flags;
227b22a70abSPatrick Mooney 	uint8_t		vrh_gso_type;
228b22a70abSPatrick Mooney 	uint16_t	vrh_hdr_len;
229b22a70abSPatrick Mooney 	uint16_t	vrh_gso_size;
230b22a70abSPatrick Mooney 	uint16_t	vrh_csum_start;
231b22a70abSPatrick Mooney 	uint16_t	vrh_csum_offset;
232b22a70abSPatrick Mooney };
233b22a70abSPatrick Mooney #pragma pack()
234b22a70abSPatrick Mooney 
235b22a70abSPatrick Mooney #define	VRING_NEED_BAIL(ring, proc)					\
236b22a70abSPatrick Mooney 		(((ring)->vr_state_flags & VRSF_REQ_STOP) != 0 ||	\
237b22a70abSPatrick Mooney 		((proc)->p_flag & SEXITING) != 0)
238b22a70abSPatrick Mooney 
239b22a70abSPatrick Mooney 
240b22a70abSPatrick Mooney #define	VNETHOOK_INTERESTED_IN(neti) \
241b22a70abSPatrick Mooney 	(neti)->vni_nethook.vnh_event_in.he_interested
242b22a70abSPatrick Mooney #define	VNETHOOK_INTERESTED_OUT(neti) \
243b22a70abSPatrick Mooney 	(neti)->vni_nethook.vnh_event_out.he_interested
244b22a70abSPatrick Mooney 
245b22a70abSPatrick Mooney 
246b22a70abSPatrick Mooney #define	VIONA_PROBE(name)	DTRACE_PROBE(viona__##name)
247b22a70abSPatrick Mooney #define	VIONA_PROBE1(name, arg1, arg2)	\
248b22a70abSPatrick Mooney 	DTRACE_PROBE1(viona__##name, arg1, arg2)
249b22a70abSPatrick Mooney #define	VIONA_PROBE2(name, arg1, arg2, arg3, arg4)	\
250b22a70abSPatrick Mooney 	DTRACE_PROBE2(viona__##name, arg1, arg2, arg3, arg4)
251b22a70abSPatrick Mooney #define	VIONA_PROBE3(name, arg1, arg2, arg3, arg4, arg5, arg6)	\
252b22a70abSPatrick Mooney 	DTRACE_PROBE3(viona__##name, arg1, arg2, arg3, arg4, arg5, arg6)
253b22a70abSPatrick Mooney #define	VIONA_PROBE5(name, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, \
254b22a70abSPatrick Mooney 	arg9, arg10) \
255b22a70abSPatrick Mooney 	DTRACE_PROBE5(viona__##name, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
256b22a70abSPatrick Mooney 	arg8, arg9, arg10)
257b22a70abSPatrick Mooney #define	VIONA_PROBE_BAD_RING_ADDR(r, a)		\
258b22a70abSPatrick Mooney 	VIONA_PROBE2(bad_ring_addr, viona_vring_t *, r, void *, (void *)(a))
259b22a70abSPatrick Mooney 
260b22a70abSPatrick Mooney #define	VIONA_RING_STAT_INCR(r, name)	\
261b22a70abSPatrick Mooney 	(((r)->vr_stats.rs_ ## name)++)
262b22a70abSPatrick Mooney 
263b22a70abSPatrick Mooney 
264b22a70abSPatrick Mooney #define	VIONA_MAX_HDRS_LEN	(sizeof (struct ether_vlan_header) + \
265b22a70abSPatrick Mooney 	IP_MAX_HDR_LENGTH + TCP_MAX_HDR_LENGTH)
266b22a70abSPatrick Mooney 
267b22a70abSPatrick Mooney #define	VRING_AVAIL_F_NO_INTERRUPT	1
268b22a70abSPatrick Mooney #define	VRING_USED_F_NO_NOTIFY		1
269b22a70abSPatrick Mooney 
270b22a70abSPatrick Mooney #define	VRING_DESC_F_NEXT	(1 << 0)
271b22a70abSPatrick Mooney #define	VRING_DESC_F_WRITE	(1 << 1)
272b22a70abSPatrick Mooney #define	VRING_DESC_F_INDIRECT	(1 << 2)
273b22a70abSPatrick Mooney 
274b22a70abSPatrick Mooney #define	VIRTIO_NET_HDR_F_NEEDS_CSUM	(1 << 0)
275b22a70abSPatrick Mooney #define	VIRTIO_NET_HDR_F_DATA_VALID	(1 << 1)
276b22a70abSPatrick Mooney 
277b22a70abSPatrick Mooney #define	VIRTIO_NET_HDR_GSO_NONE		0
278b22a70abSPatrick Mooney #define	VIRTIO_NET_HDR_GSO_TCPV4	1
279b22a70abSPatrick Mooney 
280b22a70abSPatrick Mooney #define	VIRTIO_NET_F_CSUM		(1 << 0)
281b22a70abSPatrick Mooney #define	VIRTIO_NET_F_GUEST_CSUM		(1 << 1)
282b22a70abSPatrick Mooney #define	VIRTIO_NET_F_MAC		(1 << 5) /* host supplies MAC */
283b22a70abSPatrick Mooney #define	VIRTIO_NET_F_GUEST_TSO4		(1 << 7) /* guest can accept TSO */
284b22a70abSPatrick Mooney #define	VIRTIO_NET_F_HOST_TSO4		(1 << 11) /* host can accept TSO */
285b22a70abSPatrick Mooney #define	VIRTIO_NET_F_MRG_RXBUF		(1 << 15) /* host can merge RX bufs */
286b22a70abSPatrick Mooney #define	VIRTIO_NET_F_STATUS		(1 << 16) /* cfg status field present */
287b22a70abSPatrick Mooney #define	VIRTIO_F_RING_NOTIFY_ON_EMPTY	(1 << 24)
288b22a70abSPatrick Mooney #define	VIRTIO_F_RING_INDIRECT_DESC	(1 << 28)
289b22a70abSPatrick Mooney #define	VIRTIO_F_RING_EVENT_IDX		(1 << 29)
290b22a70abSPatrick Mooney 
291b22a70abSPatrick Mooney 
292b22a70abSPatrick Mooney void viona_ring_alloc(viona_link_t *, viona_vring_t *);
293b22a70abSPatrick Mooney void viona_ring_free(viona_vring_t *);
294b22a70abSPatrick Mooney int viona_ring_reset(viona_vring_t *, boolean_t);
295b22a70abSPatrick Mooney int viona_ring_init(viona_link_t *, uint16_t, uint16_t, uint64_t);
296b22a70abSPatrick Mooney boolean_t viona_ring_lease_renew(viona_vring_t *);
297db9aa506SPatrick Mooney 
298db9aa506SPatrick Mooney int vq_popchain(viona_vring_t *, struct iovec *, uint_t, uint16_t *,
299db9aa506SPatrick Mooney     vmm_page_t **);
300b22a70abSPatrick Mooney void vq_pushchain(viona_vring_t *, uint32_t, uint16_t);
301b22a70abSPatrick Mooney void vq_pushchain_many(viona_vring_t *, uint_t, used_elem_t *);
302db9aa506SPatrick Mooney 
303427f9b9aSPatrick Mooney void viona_intr_ring(viona_vring_t *ring, boolean_t);
304427f9b9aSPatrick Mooney void viona_ring_set_no_notify(viona_vring_t *, boolean_t);
305427f9b9aSPatrick Mooney void viona_ring_disable_notify(viona_vring_t *);
306427f9b9aSPatrick Mooney void viona_ring_enable_notify(viona_vring_t *);
307427f9b9aSPatrick Mooney uint16_t viona_ring_num_avail(viona_vring_t *);
308b22a70abSPatrick Mooney 
309db9aa506SPatrick Mooney 
310b22a70abSPatrick Mooney void viona_rx_init(void);
311b22a70abSPatrick Mooney void viona_rx_fini(void);
312b22a70abSPatrick Mooney int viona_rx_set(viona_link_t *);
313b22a70abSPatrick Mooney void viona_rx_clear(viona_link_t *);
314b22a70abSPatrick Mooney void viona_worker_rx(viona_vring_t *, viona_link_t *);
315b22a70abSPatrick Mooney 
316b22a70abSPatrick Mooney extern kmutex_t viona_force_copy_lock;
317b22a70abSPatrick Mooney void viona_worker_tx(viona_vring_t *, viona_link_t *);
318b22a70abSPatrick Mooney void viona_tx_ring_alloc(viona_vring_t *, const uint16_t);
319b22a70abSPatrick Mooney void viona_tx_ring_free(viona_vring_t *, const uint16_t);
320b22a70abSPatrick Mooney 
321b22a70abSPatrick Mooney void viona_neti_attach(void);
322b22a70abSPatrick Mooney void viona_neti_detach(void);
323b22a70abSPatrick Mooney viona_neti_t *viona_neti_lookup_by_zid(zoneid_t);
324b22a70abSPatrick Mooney void viona_neti_rele(viona_neti_t *);
325b22a70abSPatrick Mooney int viona_hook(viona_link_t *, viona_vring_t *, mblk_t **, boolean_t);
326b22a70abSPatrick Mooney 
327b22a70abSPatrick Mooney #endif	/* _VIONA_IMPL_H */
328