xref: /titanic_52/usr/src/uts/common/sys/vnic.h (revision b02e9a2d4d2071d770e5aa9ae8f83f2bbe1f2ced)
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 2007 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/types.h>
32 #include <sys/ethernet.h>
33 #include <sys/param.h>
34 #include <sys/mac.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /* control interface name */
41 #define	VNIC_CTL_NODE_NAME	"ctl"
42 #define	VNIC_CTL_NODE_MINOR	1		/* control interface minor */
43 
44 #define	VNIC_IOC(x)	(('v' << 24) | ('n' << 16) | ('i' << 8) | (x))
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		VNIC_IOC(1)
55 
56 typedef struct vnic_ioc_create {
57 	uint_t		vc_vnic_id;
58 	uint_t		vc_mac_len;
59 	uchar_t		vc_dev_name[MAXNAMELEN];
60 	vnic_mac_addr_type_t vc_mac_addr_type;
61 	uchar_t		vc_mac_addr[MAXMACADDRLEN];
62 } vnic_ioc_create_t;
63 
64 #ifdef _SYSCALL32
65 
66 typedef struct vnic_ioc_create32 {
67 	uint32_t	vc_vnic_id;
68 	uint32_t	vc_mac_len;
69 	uchar_t		vc_dev_name[MAXNAMELEN];
70 	vnic_mac_addr_type_t vc_mac_addr_type;
71 	uchar_t		vc_mac_addr[MAXMACADDRLEN];
72 } vnic_ioc_create32_t;
73 
74 #endif /* _SYSCALL32 */
75 
76 #define	VNIC_IOC_DELETE		VNIC_IOC(2)
77 
78 typedef struct vnic_ioc_delete {
79 	uint_t		vd_vnic_id;
80 } vnic_ioc_delete_t;
81 
82 #ifdef _SYSCALL32
83 
84 typedef struct vnic_ioc_delete32 {
85 	uint32_t	vd_vnic_id;
86 } vnic_ioc_delete32_t;
87 
88 #endif /* _SYSCALL32 */
89 
90 #define	VNIC_IOC_INFO		VNIC_IOC(3)
91 
92 typedef struct vnic_ioc_info_vnic {
93 	uint32_t	vn_vnic_id;
94 	uint32_t	vn_mac_len;
95 	uchar_t		vn_mac_addr[MAXMACADDRLEN];
96 	char		vn_dev_name[MAXNAMELEN];
97 	vnic_mac_addr_type_t vn_mac_addr_type;
98 } vnic_ioc_info_vnic_t;
99 
100 typedef struct vnic_ioc_info {
101 	uint_t		vi_nvnics;
102 	uint_t		vi_vnic_id;	/* 0 returns all */
103 	char		vi_dev_name[MAXNAMELEN];
104 } vnic_ioc_info_t;
105 
106 #ifdef _SYSCALL32
107 
108 typedef struct vnic_ioc_info32 {
109 	uint32_t	vi_nvnics;
110 	uint32_t	vi_vnic_id;	/* 0 returns all */
111 	char		vi_dev_name[MAXNAMELEN];
112 } vnic_ioc_info32_t;
113 
114 #endif /* _SYSCALL32 */
115 
116 #define	VNIC_IOC_MODIFY		VNIC_IOC(4)
117 
118 #define	VNIC_IOC_MODIFY_ADDR		0x01
119 
120 typedef struct vnic_ioc_modify {
121 	uint_t		vm_vnic_id;
122 	uint_t		vm_modify_mask;
123 	uchar_t		vm_mac_addr[MAXMACADDRLEN];
124 	vnic_mac_addr_type_t vm_mac_addr_type;
125 	uint_t		vm_mac_len;
126 } vnic_ioc_modify_t;
127 
128 #ifdef _SYSCALL32
129 
130 typedef struct vnic_ioc_modify32 {
131 	uint32_t	vm_vnic_id;
132 	uint32_t	vm_modify_mask;
133 	uchar_t		vm_mac_addr[MAXMACADDRLEN];
134 	vnic_mac_addr_type_t vm_mac_addr_type;
135 	uint32_t	vm_mac_len;
136 } vnic_ioc_modify32_t;
137 
138 #endif /* _SYSCALL32 */
139 
140 #ifdef	__cplusplus
141 }
142 #endif
143 
144 #endif	/* _SYS_VNIC_H */
145