xref: /illumos-gate/usr/src/uts/common/sys/dld.h (revision 4fceebdf03eeac0d7c58a4f70cc19b00a8c40a73)
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_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  * The name of the driver.
75  */
76 #define	DLD_DRIVER_NAME		"dld"
77 
78 /*
79  * The name of the control minor node of dld.
80  */
81 #define	DLD_CONTROL_MINOR_NAME	"ctl"
82 #define	DLD_CONTROL_MINOR	0
83 #define	DLD_CONTROL_DEV		"/devices/pseudo/" DLD_DRIVER_NAME "@0:" \
84 				DLD_CONTROL_MINOR_NAME
85 
86 /*
87  * IOCTL codes and data structures.
88  */
89 #define	DLDIOC		('D' << 24 | 'L' << 16 | 'D' << 8)
90 
91 #define	DLDIOCATTR	(DLDIOC | 0x03)
92 
93 typedef struct dld_ioc_attr {
94 	char		dia_name[IFNAMSIZ];
95 	char		dia_dev[MAXNAMELEN];
96 	uint_t		dia_max_sdu;
97 	uint16_t	dia_vid;
98 } dld_ioc_attr_t;
99 
100 #define	DLDIOCVLAN	(DLDIOC | 0x04)
101 
102 typedef struct dld_ioc_vlan {
103 	char		div_name[IFNAMSIZ];
104 	uint_t		div_count;
105 } dld_ioc_vlan_t;
106 
107 typedef struct dld_vlan_info {
108 	char		dvi_name[IFNAMSIZ];
109 } dld_vlan_info_t;
110 
111 /*
112  * Secure objects ioctls
113  */
114 typedef enum {
115 	DLD_SECOBJ_CLASS_WEP = 1
116 } dld_secobj_class_t;
117 
118 #define	DLD_SECOBJ_OPT_CREATE	0x00000001
119 #define	DLD_SECOBJ_NAME_MAX	32
120 #define	DLD_SECOBJ_VAL_MAX	256
121 typedef struct dld_secobj {
122 	char			so_name[DLD_SECOBJ_NAME_MAX];
123 	dld_secobj_class_t	so_class;
124 	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
125 	uint_t			so_len;
126 } dld_secobj_t;
127 
128 #define	DLDIOCSECOBJSET		(DLDIOC | 0x05)
129 typedef struct dld_ioc_secobj_set {
130 	dld_secobj_t		ss_obj;
131 	uint_t			ss_flags;
132 } dld_ioc_secobj_set_t;
133 
134 #define	DLDIOCSECOBJGET		(DLDIOC | 0x06)
135 typedef struct dld_ioc_secobj_get {
136 	dld_secobj_t		sg_obj;
137 	uint_t			sg_count;
138 } dld_ioc_secobj_get_t;
139 
140 #define	DLDIOCSECOBJUNSET	(DLDIOC | 0x07)
141 typedef struct dld_ioc_secobj_unset {
142 	char			su_name[DLD_SECOBJ_NAME_MAX];
143 } dld_ioc_secobj_unset_t;
144 
145 #ifdef _KERNEL
146 int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
147 int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
148 int	dld_close(queue_t *);
149 void	dld_wput(queue_t *, mblk_t *);
150 void	dld_wsrv(queue_t *);
151 void	dld_init_ops(struct dev_ops *, const char *);
152 void	dld_fini_ops(struct dev_ops *);
153 #endif
154 
155 #ifdef	__cplusplus
156 }
157 #endif
158 
159 #endif	/* _SYS_DLD_H */
160