xref: /titanic_41/usr/src/uts/common/sys/dld.h (revision d75e6a5d480f559280524b60d52730c76a25524f)
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_DLD_H
27 #define	_SYS_DLD_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Data-Link Driver (public header).
33  */
34 
35 #include <sys/types.h>
36 #include <sys/stream.h>
37 #include <sys/mac.h>
38 #include <sys/dls.h>
39 #include <net/if.h>
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /*
46  * Data-Link Driver Information (text emitted by modinfo(1m))
47  */
48 #define	DLD_INFO	"Data-Link Driver v%I%"
49 
50 #define	DLD_MAX_PPA	999
51 #define	DLD_MAX_MINOR	(DLD_MAX_PPA + 1)
52 
53 /*
54  * Options: To enable an option set the property name to a non-zero value
55  *	    in kernel/drv/dld.conf.
56  */
57 
58 /*
59  * Prevent use of the IP fast-path (direct M_DATA transmit).
60  */
61 #define	DLD_PROP_NO_FASTPATH	"no-fastpath"
62 
63 /*
64  * Prevent advertising of the DL_CAPAB_POLL capability.
65  */
66 #define	DLD_PROP_NO_POLL	"no-poll"
67 
68 /*
69  * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
70  */
71 #define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"
72 
73 /*
74  * Prevent advertising of the DL_CAPAB_SOFTRING capability.
75  */
76 #define	DLD_PROP_NO_SOFTRING	"no-softring"
77 
78 /*
79  * The name of the driver.
80  */
81 #define	DLD_DRIVER_NAME		"dld"
82 
83 /*
84  * The name of the control minor node of dld.
85  */
86 #define	DLD_CONTROL_MINOR_NAME	"ctl"
87 #define	DLD_CONTROL_MINOR	0
88 #define	DLD_CONTROL_DEV		"/devices/pseudo/" DLD_DRIVER_NAME "@0:" \
89 				DLD_CONTROL_MINOR_NAME
90 
91 /*
92  * IOCTL codes and data structures.
93  */
94 #define	DLDIOC		('D' << 24 | 'L' << 16 | 'D' << 8)
95 
96 #define	DLDIOCATTR	(DLDIOC | 0x03)
97 
98 typedef struct dld_ioc_attr {
99 	char		dia_name[IFNAMSIZ];
100 	char		dia_dev[MAXNAMELEN];
101 	uint_t		dia_max_sdu;
102 	uint16_t	dia_vid;
103 } dld_ioc_attr_t;
104 
105 #define	DLDIOCVLAN	(DLDIOC | 0x04)
106 
107 typedef struct dld_ioc_vlan {
108 	char		div_name[IFNAMSIZ];
109 	uint_t		div_count;
110 } dld_ioc_vlan_t;
111 
112 typedef struct dld_vlan_info {
113 	char		dvi_name[IFNAMSIZ];
114 } dld_vlan_info_t;
115 
116 typedef struct dld_hold_vlan {
117 	char		dhv_name[IFNAMSIZ];
118 	zoneid_t	dhv_zid;
119 	boolean_t	dhv_docheck;
120 } dld_hold_vlan_t;
121 
122 /*
123  * Secure objects ioctls
124  */
125 typedef enum {
126 	DLD_SECOBJ_CLASS_WEP = 1
127 } dld_secobj_class_t;
128 
129 #define	DLD_SECOBJ_OPT_CREATE	0x00000001
130 #define	DLD_SECOBJ_NAME_MAX	32
131 #define	DLD_SECOBJ_VAL_MAX	256
132 typedef struct dld_secobj {
133 	char			so_name[DLD_SECOBJ_NAME_MAX];
134 	dld_secobj_class_t	so_class;
135 	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
136 	uint_t			so_len;
137 } dld_secobj_t;
138 
139 #define	DLDIOCSECOBJSET		(DLDIOC | 0x05)
140 typedef struct dld_ioc_secobj_set {
141 	dld_secobj_t		ss_obj;
142 	uint_t			ss_flags;
143 } dld_ioc_secobj_set_t;
144 
145 #define	DLDIOCSECOBJGET		(DLDIOC | 0x06)
146 typedef struct dld_ioc_secobj_get {
147 	dld_secobj_t		sg_obj;
148 	uint_t			sg_count;
149 } dld_ioc_secobj_get_t;
150 
151 #define	DLDIOCSECOBJUNSET	(DLDIOC | 0x07)
152 typedef struct dld_ioc_secobj_unset {
153 	char			su_name[DLD_SECOBJ_NAME_MAX];
154 } dld_ioc_secobj_unset_t;
155 
156 /*
157  * DLDIOCHOLDVLAN/DLDIOCRELEVLAN are added to support a "hold/release"
158  * operation on a VLAN. A hold will cause a VLAN to be created or the
159  * reference count will be increased, release will do the reverse.
160  */
161 #define	DLDIOCHOLDVLAN  (DLDIOC | 0x08)
162 
163 #define	DLDIOCRELEVLAN  (DLDIOC | 0x09)
164 
165 #define	DLDIOCZIDGET	(DLDIOC | 0x0a)
166 
167 #ifdef _KERNEL
168 int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
169 int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
170 int	dld_close(queue_t *);
171 void	dld_wput(queue_t *, mblk_t *);
172 void	dld_wsrv(queue_t *);
173 void	dld_init_ops(struct dev_ops *, const char *);
174 void	dld_fini_ops(struct dev_ops *);
175 #endif
176 
177 #ifdef	__cplusplus
178 }
179 #endif
180 
181 #endif	/* _SYS_DLD_H */
182