xref: /titanic_52/usr/src/uts/common/sys/vnic.h (revision 71269a2275bf5a143dad6461eee2710a344e7261)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_VNIC_H
27 #define	_SYS_VNIC_H
28 
29 #include <sys/types.h>
30 #include <sys/ethernet.h>
31 #include <sys/param.h>
32 #include <sys/mac.h>
33 #include <sys/dld_ioc.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * Note that the datastructures defined here define an ioctl interface
41  * that is shared betwen user and kernel space.  The vnic driver thus
42  * assumes that the structures have identical layout and size when
43  * compiled in either IPL32 or LP64.
44  */
45 
46 /*
47  * For now, we support only MAC addresses specified by value.
48  */
49 
50 typedef enum {
51 	VNIC_MAC_ADDR_TYPE_FIXED
52 } vnic_mac_addr_type_t;
53 
54 #define	VNIC_IOC_CREATE		VNICIOC(1)
55 
56 typedef struct vnic_ioc_create {
57 	datalink_id_t	vc_vnic_id;
58 	datalink_id_t	vc_link_id;
59 	uint_t		vc_mac_len;
60 	vnic_mac_addr_type_t vc_mac_addr_type;
61 	uchar_t		vc_mac_addr[MAXMACADDRLEN];
62 } vnic_ioc_create_t;
63 
64 #define	VNIC_IOC_DELETE		VNICIOC(2)
65 
66 typedef struct vnic_ioc_delete {
67 	datalink_id_t	vd_vnic_id;
68 } vnic_ioc_delete_t;
69 
70 #define	VNIC_IOC_INFO		VNICIOC(3)
71 
72 typedef struct vnic_ioc_info_vnic {
73 	datalink_id_t	vn_vnic_id;
74 	datalink_id_t	vn_link_id;
75 	uint32_t	vn_mac_len;
76 	uchar_t		vn_mac_addr[MAXMACADDRLEN];
77 	vnic_mac_addr_type_t vn_mac_addr_type;
78 } vnic_ioc_info_vnic_t;
79 
80 typedef struct vnic_ioc_info {
81 	uint_t		vi_nvnics;
82 	uint_t		vi_size;
83 	datalink_id_t	vi_vnic_id;	/* DATALINK_ALL_LINKID returns all */
84 	datalink_id_t	vi_linkid;
85 } vnic_ioc_info_t;
86 
87 #define	VNIC_IOC_MODIFY		VNICIOC(4)
88 
89 #define	VNIC_IOC_MODIFY_ADDR		0x01
90 
91 typedef struct vnic_ioc_modify {
92 	datalink_id_t	vm_vnic_id;
93 	uint_t		vm_modify_mask;
94 	uchar_t		vm_mac_addr[MAXMACADDRLEN];
95 	vnic_mac_addr_type_t vm_mac_addr_type;
96 	uint_t		vm_mac_len;
97 } vnic_ioc_modify_t;
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif	/* _SYS_VNIC_H */
104