xref: /titanic_50/usr/src/uts/common/sys/dld.h (revision 24dd95375a09d43fe4f6b55f6d5188f4bac4f68d)
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_WPA
128 } dld_secobj_class_t;
129 
130 #define	DLD_SECOBJ_OPT_CREATE	0x00000001
131 #define	DLD_SECOBJ_NAME_MAX	32
132 #define	DLD_SECOBJ_VAL_MAX	256
133 typedef struct dld_secobj {
134 	char			so_name[DLD_SECOBJ_NAME_MAX];
135 	dld_secobj_class_t	so_class;
136 	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
137 	uint_t			so_len;
138 } dld_secobj_t;
139 
140 #define	DLDIOCSECOBJSET		(DLDIOC | 0x05)
141 typedef struct dld_ioc_secobj_set {
142 	dld_secobj_t		ss_obj;
143 	uint_t			ss_flags;
144 } dld_ioc_secobj_set_t;
145 
146 #define	DLDIOCSECOBJGET		(DLDIOC | 0x06)
147 typedef struct dld_ioc_secobj_get {
148 	dld_secobj_t		sg_obj;
149 	uint_t			sg_count;
150 } dld_ioc_secobj_get_t;
151 
152 #define	DLDIOCSECOBJUNSET	(DLDIOC | 0x07)
153 typedef struct dld_ioc_secobj_unset {
154 	char			su_name[DLD_SECOBJ_NAME_MAX];
155 } dld_ioc_secobj_unset_t;
156 
157 /*
158  * DLDIOCHOLDVLAN/DLDIOCRELEVLAN are added to support a "hold/release"
159  * operation on a VLAN. A hold will cause a VLAN to be created or the
160  * reference count will be increased, release will do the reverse.
161  */
162 #define	DLDIOCHOLDVLAN  (DLDIOC | 0x08)
163 
164 #define	DLDIOCRELEVLAN  (DLDIOC | 0x09)
165 
166 #define	DLDIOCZIDGET	(DLDIOC | 0x0a)
167 
168 #ifdef _KERNEL
169 int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
170 int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
171 int	dld_close(queue_t *);
172 void	dld_wput(queue_t *, mblk_t *);
173 void	dld_wsrv(queue_t *);
174 void	dld_init_ops(struct dev_ops *, const char *);
175 void	dld_fini_ops(struct dev_ops *);
176 #endif
177 
178 #ifdef	__cplusplus
179 }
180 #endif
181 
182 #endif	/* _SYS_DLD_H */
183