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.
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.
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]
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 #include <sys/types.h>
29 #include <sys/param.h>
33 * Data-Link Services Module
41 DATALINK_CLASS_PHYS
= 0x01,
42 DATALINK_CLASS_VLAN
= 0x02,
43 DATALINK_CLASS_AGGR
= 0x04,
44 DATALINK_CLASS_VNIC
= 0x08,
45 DATALINK_CLASS_ETHERSTUB
= 0x10,
46 DATALINK_CLASS_SIMNET
= 0x20,
47 DATALINK_CLASS_BRIDGE
= 0x40,
48 DATALINK_CLASS_IPTUN
= 0x80,
49 DATALINK_CLASS_PART
= 0x100
52 #define DATALINK_CLASS_ALL (DATALINK_CLASS_PHYS | \
53 DATALINK_CLASS_VLAN | DATALINK_CLASS_AGGR | DATALINK_CLASS_VNIC | \
54 DATALINK_CLASS_ETHERSTUB | DATALINK_CLASS_SIMNET | \
55 DATALINK_CLASS_BRIDGE | DATALINK_CLASS_IPTUN | DATALINK_CLASS_PART)
58 * A combination of flags and media.
59 * flags is the higher 32 bits, and if it is 0x01, it indicates all media
60 * types can be accepted; otherwise, only the given media type (specified
61 * in the lower 32 bits) is accepted.
63 typedef uint64_t datalink_media_t
;
65 #define DATALINK_ANY_MEDIATYPE \
66 ((datalink_media_t)(((datalink_media_t)0x01) << 32))
68 #define DATALINK_MEDIA_ACCEPTED(dmedia, media) \
69 (((uint32_t)(((dmedia) >> 32) & 0xfffffffful) & 0x01) ? \
70 B_TRUE : ((uint32_t)((dmedia) & 0xfffffffful) == (media)))
72 #define MAXLINKATTRLEN 32
73 #define MAXLINKATTRVALLEN 1024
76 * Link attributes used by the kernel.
79 * The major number and instance number of the underlying physical device
80 * are kept as FPHYMAJ and FPHYINST (major, instance + 1).
82 * Set for physical links only.
84 #define FPHYMAJ "phymaj" /* uint64_t */
85 #define FPHYINST "phyinst" /* uint64_t */
88 * The devname of the physical link. For example, bge0, ce1. Set for physical
91 #define FDEVNAME "devname" /* string */
94 * The door file for the dlmgmtd (data-link management) daemon.
96 #define DLMGMT_TMPFS_DIR "/etc/svc/volatile/dladm"
97 #define DLMGMT_DOOR DLMGMT_TMPFS_DIR "/dlmgmt_door"
100 * Door upcall commands.
102 #define DLMGMT_CMD_DLS_CREATE 1
103 #define DLMGMT_CMD_DLS_GETATTR 2
104 #define DLMGMT_CMD_DLS_DESTROY 3
105 #define DLMGMT_CMD_GETNAME 4
106 #define DLMGMT_CMD_GETLINKID 5
107 #define DLMGMT_CMD_GETNEXT 6
108 #define DLMGMT_CMD_DLS_UPDATE 7
109 #define DLMGMT_CMD_LINKPROP_INIT 8
110 #define DLMGMT_CMD_SETZONEID 9
111 #define DLMGMT_CMD_BASE 128
114 * Indicate the link mapping is active or persistent
116 #define DLMGMT_ACTIVE 0x01
117 #define DLMGMT_PERSIST 0x02
119 /* upcall argument */
120 typedef struct dlmgmt_door_arg
{
124 typedef struct dlmgmt_upcall_arg_create
{
126 datalink_class_t ld_class
;
128 boolean_t ld_persist
;
131 char ld_devname
[MAXNAMELEN
];
132 } dlmgmt_upcall_arg_create_t
;
135 * Note: ld_padding is necessary to keep the size of the structure the
136 * same on amd64 and i386. The same note applies to other ld_padding
137 * and lr_paddding fields in structures throughout this file.
139 typedef struct dlmgmt_upcall_arg_destroy
{
141 datalink_id_t ld_linkid
;
142 boolean_t ld_persist
;
144 } dlmgmt_upcall_arg_destroy_t
;
146 typedef struct dlmgmt_upcall_arg_update
{
148 boolean_t ld_novanity
;
151 char ld_devname
[MAXNAMELEN
];
152 } dlmgmt_upcall_arg_update_t
;
154 typedef struct dlmgmt_upcall_arg_getattr
{
156 datalink_id_t ld_linkid
;
157 char ld_attr
[MAXLINKATTRLEN
];
158 } dlmgmt_upcall_arg_getattr_t
;
160 typedef struct dlmgmt_door_getname
{
162 datalink_id_t ld_linkid
;
163 } dlmgmt_door_getname_t
;
165 typedef struct dlmgmt_door_getlinkid
{
167 char ld_link
[MAXLINKNAMELEN
];
168 } dlmgmt_door_getlinkid_t
;
170 typedef struct dlmgmt_door_getnext_s
{
172 datalink_id_t ld_linkid
;
173 datalink_class_t ld_class
;
175 datalink_media_t ld_dmedia
;
176 } dlmgmt_door_getnext_t
;
178 typedef struct dlmgmt_door_linkprop_init
{
180 datalink_id_t ld_linkid
;
181 } dlmgmt_door_linkprop_init_t
;
183 typedef struct dlmgmt_door_setzoneid
{
185 datalink_id_t ld_linkid
;
187 } dlmgmt_door_setzoneid_t
;
189 /* upcall return value */
190 typedef struct dlmgmt_retval_s
{
191 uint_t lr_err
; /* return error code */
194 typedef dlmgmt_retval_t dlmgmt_destroy_retval_t
,
195 dlmgmt_linkprop_init_retval_t
,
196 dlmgmt_setzoneid_retval_t
;
198 struct dlmgmt_linkid_retval_s
{
200 datalink_id_t lr_linkid
;
202 datalink_class_t lr_class
;
207 typedef struct dlmgmt_linkid_retval_s dlmgmt_create_retval_t
,
208 dlmgmt_update_retval_t
,
209 dlmgmt_getlinkid_retval_t
,
210 dlmgmt_getnext_retval_t
;
212 typedef struct dlmgmt_getname_retval_s
{
214 char lr_link
[MAXLINKNAMELEN
];
215 datalink_class_t lr_class
;
218 } dlmgmt_getname_retval_t
;
220 typedef struct dlmgmt_getattr_retval_s
{
225 char lr_attrval
[MAXLINKATTRVALLEN
];
226 } dlmgmt_getattr_retval_t
;
232 #endif /* _DLS_MGMT_H */