xref: /illumos-gate/usr/src/uts/common/sys/vnic_impl.h (revision 9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_VNIC_IMPL_H
27 #define	_SYS_VNIC_IMPL_H
28 
29 #include <sys/cred.h>
30 #include <sys/mac_provider.h>
31 #include <sys/mac_client.h>
32 #include <sys/mac_client_priv.h>
33 #include <sys/vnic.h>
34 #include <sys/mac_flow.h>
35 #include <sys/ksynch.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 typedef struct vnic_s {
42 	datalink_id_t		vn_id;
43 	uint32_t
44 				vn_enabled : 1,
45 				vn_pad_to_bit_31 : 31;
46 
47 	mac_handle_t		vn_mh;
48 	mac_handle_t		vn_lower_mh;
49 	mac_client_handle_t	vn_mch;
50 	mac_unicast_handle_t	vn_muh;
51 	uint32_t		vn_margin;
52 	int			vn_slot_id;
53 	vnic_mac_addr_type_t	vn_addr_type;
54 	uint8_t			vn_addr[MAXMACADDRLEN];
55 	size_t			vn_addr_len;
56 	uint16_t		vn_vid;
57 	boolean_t		vn_force;
58 	datalink_id_t		vn_link_id;
59 	mac_notify_handle_t	vn_mnh;
60 
61 	uint32_t		vn_hcksum_txflags;
62 } vnic_t;
63 
64 #define	vn_madd_naddr		vn_mma_capab.maddr_naddr
65 #define	vn_maddr_naddrfree	vn_mma_capab.maddr_naddrfree
66 #define	vn_maddr_flag		vn_mma_capab.maddr_flag
67 #define	vn_maddr_handle		vn_mma_capab.maddr_handle
68 #define	vn_maddr_reserve	vn_mma_capab.maddr_reserve
69 #define	vn_maddr_add		vn_mma_capab.maddr_add
70 #define	vn_maddr_remove		vn_mma_capab.maddr_remove
71 #define	vn_maddr_modify		vn_mma_capab.maddr_modify
72 #define	vn_maddr_get		vn_mma_capab.maddr_get
73 
74 extern int vnic_dev_create(datalink_id_t, datalink_id_t, vnic_mac_addr_type_t *,
75     int *, uchar_t *, int *, uint_t, uint16_t, mac_resource_props_t *,
76     uint32_t, vnic_ioc_diag_t *, cred_t *);
77 extern int vnic_dev_modify(datalink_id_t, uint_t, vnic_mac_addr_type_t,
78     uint_t, uchar_t *, uint_t, mac_resource_props_t *);
79 extern int vnic_dev_delete(datalink_id_t, uint32_t, cred_t *);
80 
81 extern void vnic_dev_init(void);
82 extern void vnic_dev_fini(void);
83 extern uint_t vnic_dev_count(void);
84 extern dev_info_t *vnic_get_dip(void);
85 
86 extern int vnic_info(vnic_info_t *, cred_t *);
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif	/* _SYS_VNIC_IMPL_H */
93