xref: /titanic_53/usr/src/uts/common/sys/vnic.h (revision 843e19887f64dde75055cf8842fc4db2171eff45)
1*843e1988Sjohnlev /*
2*843e1988Sjohnlev  * CDDL HEADER START
3*843e1988Sjohnlev  *
4*843e1988Sjohnlev  * The contents of this file are subject to the terms of the
5*843e1988Sjohnlev  * Common Development and Distribution License (the "License").
6*843e1988Sjohnlev  * You may not use this file except in compliance with the License.
7*843e1988Sjohnlev  *
8*843e1988Sjohnlev  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*843e1988Sjohnlev  * or http://www.opensolaris.org/os/licensing.
10*843e1988Sjohnlev  * See the License for the specific language governing permissions
11*843e1988Sjohnlev  * and limitations under the License.
12*843e1988Sjohnlev  *
13*843e1988Sjohnlev  * When distributing Covered Code, include this CDDL HEADER in each
14*843e1988Sjohnlev  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*843e1988Sjohnlev  * If applicable, add the following below this CDDL HEADER, with the
16*843e1988Sjohnlev  * fields enclosed by brackets "[]" replaced with your own identifying
17*843e1988Sjohnlev  * information: Portions Copyright [yyyy] [name of copyright owner]
18*843e1988Sjohnlev  *
19*843e1988Sjohnlev  * CDDL HEADER END
20*843e1988Sjohnlev  */
21*843e1988Sjohnlev /*
22*843e1988Sjohnlev  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*843e1988Sjohnlev  * Use is subject to license terms.
24*843e1988Sjohnlev  */
25*843e1988Sjohnlev 
26*843e1988Sjohnlev #ifndef	_SYS_VNIC_H
27*843e1988Sjohnlev #define	_SYS_VNIC_H
28*843e1988Sjohnlev 
29*843e1988Sjohnlev #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*843e1988Sjohnlev 
31*843e1988Sjohnlev #include <sys/types.h>
32*843e1988Sjohnlev #include <sys/ethernet.h>
33*843e1988Sjohnlev #include <sys/param.h>
34*843e1988Sjohnlev #include <sys/mac.h>
35*843e1988Sjohnlev 
36*843e1988Sjohnlev #ifdef	__cplusplus
37*843e1988Sjohnlev extern "C" {
38*843e1988Sjohnlev #endif
39*843e1988Sjohnlev 
40*843e1988Sjohnlev /* control interface name */
41*843e1988Sjohnlev #define	VNIC_CTL_NODE_NAME	"ctl"
42*843e1988Sjohnlev #define	VNIC_CTL_NODE_MINOR	1		/* control interface minor */
43*843e1988Sjohnlev 
44*843e1988Sjohnlev #define	VNIC_IOC(x)	(('v' << 24) | ('n' << 16) | ('i' << 8) | (x))
45*843e1988Sjohnlev 
46*843e1988Sjohnlev /*
47*843e1988Sjohnlev  * For now, we support only MAC addresses specified by value.
48*843e1988Sjohnlev  */
49*843e1988Sjohnlev 
50*843e1988Sjohnlev typedef enum {
51*843e1988Sjohnlev 	VNIC_MAC_ADDR_TYPE_FIXED
52*843e1988Sjohnlev } vnic_mac_addr_type_t;
53*843e1988Sjohnlev 
54*843e1988Sjohnlev #define	VNIC_IOC_CREATE		VNIC_IOC(1)
55*843e1988Sjohnlev 
56*843e1988Sjohnlev typedef struct vnic_ioc_create {
57*843e1988Sjohnlev 	uint_t		vc_vnic_id;
58*843e1988Sjohnlev 	uint_t		vc_mac_len;
59*843e1988Sjohnlev 	uchar_t		vc_dev_name[MAXNAMELEN];
60*843e1988Sjohnlev 	vnic_mac_addr_type_t vc_mac_addr_type;
61*843e1988Sjohnlev 	uchar_t		vc_mac_addr[MAXMACADDRLEN];
62*843e1988Sjohnlev } vnic_ioc_create_t;
63*843e1988Sjohnlev 
64*843e1988Sjohnlev #ifdef _SYSCALL32
65*843e1988Sjohnlev 
66*843e1988Sjohnlev typedef struct vnic_ioc_create32 {
67*843e1988Sjohnlev 	uint32_t	vc_vnic_id;
68*843e1988Sjohnlev 	uint32_t	vc_mac_len;
69*843e1988Sjohnlev 	uchar_t		vc_dev_name[MAXNAMELEN];
70*843e1988Sjohnlev 	vnic_mac_addr_type_t vc_mac_addr_type;
71*843e1988Sjohnlev 	uchar_t		vc_mac_addr[MAXMACADDRLEN];
72*843e1988Sjohnlev } vnic_ioc_create32_t;
73*843e1988Sjohnlev 
74*843e1988Sjohnlev #endif /* _SYSCALL32 */
75*843e1988Sjohnlev 
76*843e1988Sjohnlev #define	VNIC_IOC_DELETE		VNIC_IOC(2)
77*843e1988Sjohnlev 
78*843e1988Sjohnlev typedef struct vnic_ioc_delete {
79*843e1988Sjohnlev 	uint_t		vd_vnic_id;
80*843e1988Sjohnlev } vnic_ioc_delete_t;
81*843e1988Sjohnlev 
82*843e1988Sjohnlev #ifdef _SYSCALL32
83*843e1988Sjohnlev 
84*843e1988Sjohnlev typedef struct vnic_ioc_delete32 {
85*843e1988Sjohnlev 	uint32_t	vd_vnic_id;
86*843e1988Sjohnlev } vnic_ioc_delete32_t;
87*843e1988Sjohnlev 
88*843e1988Sjohnlev #endif /* _SYSCALL32 */
89*843e1988Sjohnlev 
90*843e1988Sjohnlev #define	VNIC_IOC_INFO		VNIC_IOC(3)
91*843e1988Sjohnlev 
92*843e1988Sjohnlev typedef struct vnic_ioc_info_vnic {
93*843e1988Sjohnlev 	uint32_t	vn_vnic_id;
94*843e1988Sjohnlev 	uint32_t	vn_mac_len;
95*843e1988Sjohnlev 	uchar_t		vn_mac_addr[MAXMACADDRLEN];
96*843e1988Sjohnlev 	char		vn_dev_name[MAXNAMELEN];
97*843e1988Sjohnlev 	vnic_mac_addr_type_t vn_mac_addr_type;
98*843e1988Sjohnlev } vnic_ioc_info_vnic_t;
99*843e1988Sjohnlev 
100*843e1988Sjohnlev typedef struct vnic_ioc_info {
101*843e1988Sjohnlev 	uint_t		vi_nvnics;
102*843e1988Sjohnlev 	uint_t		vi_vnic_id;	/* 0 returns all */
103*843e1988Sjohnlev 	char		vi_dev_name[MAXNAMELEN];
104*843e1988Sjohnlev } vnic_ioc_info_t;
105*843e1988Sjohnlev 
106*843e1988Sjohnlev #ifdef _SYSCALL32
107*843e1988Sjohnlev 
108*843e1988Sjohnlev typedef struct vnic_ioc_info32 {
109*843e1988Sjohnlev 	uint32_t	vi_nvnics;
110*843e1988Sjohnlev 	uint32_t	vi_vnic_id;	/* 0 returns all */
111*843e1988Sjohnlev 	char		vi_dev_name[MAXNAMELEN];
112*843e1988Sjohnlev } vnic_ioc_info32_t;
113*843e1988Sjohnlev 
114*843e1988Sjohnlev #endif /* _SYSCALL32 */
115*843e1988Sjohnlev 
116*843e1988Sjohnlev #define	VNIC_IOC_MODIFY		VNIC_IOC(4)
117*843e1988Sjohnlev 
118*843e1988Sjohnlev #define	VNIC_IOC_MODIFY_ADDR		0x01
119*843e1988Sjohnlev 
120*843e1988Sjohnlev typedef struct vnic_ioc_modify {
121*843e1988Sjohnlev 	uint_t		vm_vnic_id;
122*843e1988Sjohnlev 	uint_t		vm_modify_mask;
123*843e1988Sjohnlev 	uchar_t		vm_mac_addr[MAXMACADDRLEN];
124*843e1988Sjohnlev 	vnic_mac_addr_type_t vm_mac_addr_type;
125*843e1988Sjohnlev 	uint_t		vm_mac_len;
126*843e1988Sjohnlev } vnic_ioc_modify_t;
127*843e1988Sjohnlev 
128*843e1988Sjohnlev #ifdef _SYSCALL32
129*843e1988Sjohnlev 
130*843e1988Sjohnlev typedef struct vnic_ioc_modify32 {
131*843e1988Sjohnlev 	uint32_t	vm_vnic_id;
132*843e1988Sjohnlev 	uint32_t	vm_modify_mask;
133*843e1988Sjohnlev 	uchar_t		vm_mac_addr[MAXMACADDRLEN];
134*843e1988Sjohnlev 	vnic_mac_addr_type_t vm_mac_addr_type;
135*843e1988Sjohnlev 	uint32_t	vm_mac_len;
136*843e1988Sjohnlev } vnic_ioc_modify32_t;
137*843e1988Sjohnlev 
138*843e1988Sjohnlev #endif /* _SYSCALL32 */
139*843e1988Sjohnlev 
140*843e1988Sjohnlev #ifdef	__cplusplus
141*843e1988Sjohnlev }
142*843e1988Sjohnlev #endif
143*843e1988Sjohnlev 
144*843e1988Sjohnlev #endif	/* _SYS_VNIC_H */
145