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 2006 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 "@(#)vnic.h 1.17 06/12/06 SMI"
|
---|
30 |
|
---|
31 | #include <sys/types.h>
|
---|
32 | #include <sys/ethernet.h>
|
---|
33 | #include <sys/param.h>
|
---|
34 | #include <sys/mac.h>
|
---|
35 | #include <sys/flow.h>
|
---|
36 | #include <inet/ip.h>
|
---|
37 | #include <inet/ip6.h>
|
---|
38 |
|
---|
39 | #ifdef __cplusplus
|
---|
40 | extern "C" {
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | /* control interface name */
|
---|
44 | #define VNIC_CTL_NODE_NAME "ctl"
|
---|
45 | #define VNIC_CTL_NODE_MINOR 1 /* control interface minor */
|
---|
46 |
|
---|
47 | #define VNIC_IOC(x) (('v' << 24) | ('n' << 16) | ('i' << 8) | (x))
|
---|
48 |
|
---|
49 | /*
|
---|
50 | * Allowed VNIC MAC address types.
|
---|
51 | *
|
---|
52 | * - VNIC_MAC_ADDR_TYPE_FIXED, VNIC_MAC_ADDR_TYPE_RANDOM:
|
---|
53 | * The MAC address is specified by value by the caller, which
|
---|
54 | * itself can obtain it from the user directly,
|
---|
55 | * or pick it in a random fashion. Which method is used by the
|
---|
56 | * caller is irrelevant to the VNIC driver. However two different
|
---|
57 | * types are provided so that the information can be made available
|
---|
58 | * back to user-space when listing the kernel defined VNICs.
|
---|
59 | *
|
---|
60 | * When a VNIC is created, the address in passed through the
|
---|
61 | * vc_mac_addr and vc_mac_len fields of the vnic_ioc_create_t
|
---|
62 | * structure.
|
---|
63 | *
|
---|
64 | * - VNIC_MAC_ADDR_TYPE_FACTORY: the MAC address is obtained from
|
---|
65 | * one of the MAC factory MAC addresses of the underyling NIC.
|
---|
66 | *
|
---|
67 | * - VNIC_MAC_ADDR_TYPE_AUTO: the VNIC driver attempts to
|
---|
68 | * obtain the address from one of the factory MAC addresses of
|
---|
69 | * the underlying NIC. If none is available, the specified
|
---|
70 | * MAC address value is used.
|
---|
71 | */
|
---|
72 |
|
---|
73 | typedef enum {
|
---|
74 | VNIC_MAC_ADDR_TYPE_FIXED,
|
---|
75 | VNIC_MAC_ADDR_TYPE_RANDOM,
|
---|
76 | VNIC_MAC_ADDR_TYPE_FACTORY,
|
---|
77 | VNIC_MAC_ADDR_TYPE_AUTO
|
---|
78 | } vnic_mac_addr_type_t;
|
---|
79 |
|
---|
80 | #define VNIC_IOC_CREATE VNIC_IOC(1)
|
---|
81 |
|
---|
82 | typedef struct vnic_ioc_create {
|
---|
83 | uint_t vc_vnic_id;
|
---|
84 | uchar_t vc_dev_name[MAXNAMELEN];
|
---|
85 | vnic_mac_addr_type_t vc_mac_addr_type;
|
---|
86 | uint_t vc_mac_len;
|
---|
87 | uchar_t vc_mac_addr[MAXMACADDRLEN];
|
---|
88 | char vc_pad[4];
|
---|
89 | uint_t vc_mac_slot;
|
---|
90 | net_resource_ctl_t vc_resource_ctl;
|
---|
91 | net_bind_cpu_t vc_bind_cpu;
|
---|
92 | } vnic_ioc_create_t;
|
---|
93 |
|
---|
94 | #ifdef _SYSCALL32
|
---|
95 |
|
---|
96 | typedef struct vnic_ioc_create32 {
|
---|
97 | uint32_t vc_vnic_id;
|
---|
98 | uchar_t vc_dev_name[MAXNAMELEN];
|
---|
99 | vnic_mac_addr_type_t vc_mac_addr_type;
|
---|
100 | uint32_t vc_mac_len;
|
---|
101 | uchar_t vc_mac_addr[MAXMACADDRLEN];
|
---|
102 | char vc_pad[4];
|
---|
103 | uint32_t vc_mac_slot;
|
---|
104 | net_resource_ctl_t vc_resource_ctl;
|
---|
105 | net_bind_cpu_t vc_bind_cpu;
|
---|
106 | } vnic_ioc_create32_t;
|
---|
107 |
|
---|
108 | #endif /* _SYSCALL32 */
|
---|
109 |
|
---|
110 | #define VNIC_IOC_DELETE VNIC_IOC(2)
|
---|
111 |
|
---|
112 | typedef struct vnic_ioc_delete {
|
---|
113 | uint_t vd_vnic_id;
|
---|
114 | } vnic_ioc_delete_t;
|
---|
115 |
|
---|
116 | #ifdef _SYSCALL32
|
---|
117 |
|
---|
118 | typedef struct vnic_ioc_delete32 {
|
---|
119 | uint32_t vd_vnic_id;
|
---|
120 | } vnic_ioc_delete32_t;
|
---|
121 |
|
---|
122 | #endif /* _SYSCALL32 */
|
---|
123 |
|
---|
124 | #define VNIC_IOC_INFO VNIC_IOC(3)
|
---|
125 |
|
---|
126 | typedef struct vnic_ioc_info_vnic {
|
---|
127 | uint32_t vn_vnic_id;
|
---|
128 | uchar_t vn_mac_addr[MAXMACADDRLEN];
|
---|
129 | char vn_dev_name[MAXNAMELEN];
|
---|
130 | flow_desc_t vn_flow_desc;
|
---|
131 | net_resource_ctl_t vn_resource_ctl;
|
---|
132 | } vnic_ioc_info_vnic_t;
|
---|
133 |
|
---|
134 | typedef struct vnic_ioc_info {
|
---|
135 | uint_t vi_nvnics;
|
---|
136 | uint_t vi_vnic_id; /* 0 returns all */
|
---|
137 | char vi_dev_name[MAXNAMELEN];
|
---|
138 | } vnic_ioc_info_t;
|
---|
139 |
|
---|
140 | #ifdef _SYSCALL32
|
---|
141 |
|
---|
142 | typedef struct vnic_ioc_info32 {
|
---|
143 | uint32_t vi_nvnics;
|
---|
144 | uint32_t vi_vnic_id; /* 0 returns all */
|
---|
145 | char vi_dev_name[MAXNAMELEN];
|
---|
146 | } vnic_ioc_info32_t;
|
---|
147 |
|
---|
148 | #endif /* _SYSCALL32 */
|
---|
149 |
|
---|
150 | #define VNIC_IOC_MODIFY VNIC_IOC(4)
|
---|
151 |
|
---|
152 | #define VNIC_IOC_MODIFY_ADDR 0x01
|
---|
153 | #define VNIC_IOC_MODIFY_RESOURCE_CTL 0x02
|
---|
154 |
|
---|
155 | typedef struct vnic_ioc_modify {
|
---|
156 | uint_t vm_vnic_id;
|
---|
157 | uint_t vm_modify_mask;
|
---|
158 | uint_t vm_mac_len;
|
---|
159 | uint_t vm_mac_slot;
|
---|
160 | uchar_t vm_mac_addr[MAXMACADDRLEN];
|
---|
161 | vnic_mac_addr_type_t vm_mac_addr_type;
|
---|
162 | net_resource_ctl_t vm_resource_ctl;
|
---|
163 | } vnic_ioc_modify_t;
|
---|
164 |
|
---|
165 | #ifdef _SYSCALL32
|
---|
166 |
|
---|
167 | typedef struct vnic_ioc_modify32 {
|
---|
168 | uint32_t vm_vnic_id;
|
---|
169 | uint32_t vm_modify_mask;
|
---|
170 | uint32_t vm_mac_len;
|
---|
171 | uint32_t vm_mac_slot;
|
---|
172 | uchar_t vm_mac_addr[MAXMACADDRLEN];
|
---|
173 | vnic_mac_addr_type_t vm_mac_addr_type;
|
---|
174 | net_resource_ctl_t vm_resource_ctl;
|
---|
175 | } vnic_ioc_modify32_t;
|
---|
176 |
|
---|
177 | #endif /* _SYSCALL32 */
|
---|
178 |
|
---|
179 | #ifdef __cplusplus
|
---|
180 | }
|
---|
181 | #endif
|
---|
182 |
|
---|
183 | #endif /* _SYS_VNIC_H */
|
---|