xref: /illumos-gate/usr/src/uts/common/sys/vnic_impl.h (revision c61a1653)
1843e1988Sjohnlev /*
2843e1988Sjohnlev  * CDDL HEADER START
3843e1988Sjohnlev  *
4843e1988Sjohnlev  * The contents of this file are subject to the terms of the
5843e1988Sjohnlev  * Common Development and Distribution License (the "License").
6843e1988Sjohnlev  * You may not use this file except in compliance with the License.
7843e1988Sjohnlev  *
8843e1988Sjohnlev  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9843e1988Sjohnlev  * or http://www.opensolaris.org/os/licensing.
10843e1988Sjohnlev  * See the License for the specific language governing permissions
11843e1988Sjohnlev  * and limitations under the License.
12843e1988Sjohnlev  *
13843e1988Sjohnlev  * When distributing Covered Code, include this CDDL HEADER in each
14843e1988Sjohnlev  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15843e1988Sjohnlev  * If applicable, add the following below this CDDL HEADER, with the
16843e1988Sjohnlev  * fields enclosed by brackets "[]" replaced with your own identifying
17843e1988Sjohnlev  * information: Portions Copyright [yyyy] [name of copyright owner]
18843e1988Sjohnlev  *
19843e1988Sjohnlev  * CDDL HEADER END
20843e1988Sjohnlev  */
21843e1988Sjohnlev /*
220dc2366fSVenugopal Iyer  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23843e1988Sjohnlev  * Use is subject to license terms.
24*c61a1653SRyan Zezeski  * Copyright 2018 Joyent, Inc.
25843e1988Sjohnlev  */
26843e1988Sjohnlev 
27843e1988Sjohnlev #ifndef	_SYS_VNIC_IMPL_H
28843e1988Sjohnlev #define	_SYS_VNIC_IMPL_H
29843e1988Sjohnlev 
302b24ab6bSSebastien Roy #include <sys/cred.h>
31da14cebeSEric Cheng #include <sys/mac_provider.h>
32da14cebeSEric Cheng #include <sys/mac_client.h>
33da14cebeSEric Cheng #include <sys/mac_client_priv.h>
34843e1988Sjohnlev #include <sys/vnic.h>
35da14cebeSEric Cheng #include <sys/mac_flow.h>
36843e1988Sjohnlev #include <sys/ksynch.h>
37843e1988Sjohnlev 
38843e1988Sjohnlev #ifdef	__cplusplus
39843e1988Sjohnlev extern "C" {
40843e1988Sjohnlev #endif
41843e1988Sjohnlev 
42843e1988Sjohnlev typedef struct vnic_s {
43da14cebeSEric Cheng 	datalink_id_t		vn_id;
44843e1988Sjohnlev 	uint32_t
452c4ec682SEric Cheng 				vn_enabled : 1,
46da14cebeSEric Cheng 				vn_pad_to_bit_31 : 31;
47da14cebeSEric Cheng 
48da14cebeSEric Cheng 	mac_handle_t		vn_mh;
49da14cebeSEric Cheng 	mac_handle_t		vn_lower_mh;
501a41ca23SJerry Jelinek 	uint_t			vn_nhandles; /* # of secondary mac handles */
511a41ca23SJerry Jelinek 	/* The primary handle is always the first element in the array */
521a41ca23SJerry Jelinek 	mac_client_handle_t	vn_mc_handles[MPT_MAXMACADDR];
531a41ca23SJerry Jelinek 	mac_unicast_handle_t	vn_mu_handles[MPT_MAXMACADDR];
54da14cebeSEric Cheng 	uint32_t		vn_margin;
55da14cebeSEric Cheng 	int			vn_slot_id;
56da14cebeSEric Cheng 	vnic_mac_addr_type_t	vn_addr_type;
57da14cebeSEric Cheng 	uint8_t			vn_addr[MAXMACADDRLEN];
58da14cebeSEric Cheng 	size_t			vn_addr_len;
59da14cebeSEric Cheng 	uint16_t		vn_vid;
601cb875aeSCathy Zhou 	vrid_t			vn_vrid;
611cb875aeSCathy Zhou 	int			vn_af;
62da14cebeSEric Cheng 	boolean_t		vn_force;
63da14cebeSEric Cheng 	datalink_id_t		vn_link_id;
64da14cebeSEric Cheng 	mac_notify_handle_t	vn_mnh;
65da14cebeSEric Cheng 
66da14cebeSEric Cheng 	uint32_t		vn_hcksum_txflags;
67*c61a1653SRyan Zezeski 	mac_capab_lso_t		vn_cap_lso;
68a776d98eSRobert Mustacchi 	uint32_t		vn_mtu;
69a25df667SRobert Mustacchi 	link_state_t		vn_ls;
70843e1988Sjohnlev } vnic_t;
71843e1988Sjohnlev 
721a41ca23SJerry Jelinek #define	vn_mch	vn_mc_handles[0]
731a41ca23SJerry Jelinek #define	vn_muh	vn_mu_handles[0]
741a41ca23SJerry Jelinek 
75da14cebeSEric Cheng extern int vnic_dev_create(datalink_id_t, datalink_id_t, vnic_mac_addr_type_t *,
761cb875aeSCathy Zhou     int *, uchar_t *, int *, uint_t, uint16_t, vrid_t, int,
771cb875aeSCathy Zhou     mac_resource_props_t *, uint32_t, vnic_ioc_diag_t *, cred_t *);
78d62bc4baSyz extern int vnic_dev_modify(datalink_id_t, uint_t, vnic_mac_addr_type_t,
79da14cebeSEric Cheng     uint_t, uchar_t *, uint_t, mac_resource_props_t *);
802b24ab6bSSebastien Roy extern int vnic_dev_delete(datalink_id_t, uint32_t, cred_t *);
81843e1988Sjohnlev 
82843e1988Sjohnlev extern void vnic_dev_init(void);
83843e1988Sjohnlev extern void vnic_dev_fini(void);
84843e1988Sjohnlev extern uint_t vnic_dev_count(void);
85843e1988Sjohnlev extern dev_info_t *vnic_get_dip(void);
86843e1988Sjohnlev 
872b24ab6bSSebastien Roy extern int vnic_info(vnic_info_t *, cred_t *);
88843e1988Sjohnlev 
89843e1988Sjohnlev #ifdef	__cplusplus
90843e1988Sjohnlev }
91843e1988Sjohnlev #endif
92843e1988Sjohnlev 
93843e1988Sjohnlev #endif	/* _SYS_VNIC_IMPL_H */
94