xref: /titanic_44/usr/src/uts/common/sys/dld.h (revision b81bb599d2182818b41e3bbe6d4d1771b9d484d4)
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 #ifdef _KERNEL
112 int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
113 int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
114 int	dld_close(queue_t *);
115 void	dld_wput(queue_t *, mblk_t *);
116 void	dld_wsrv(queue_t *);
117 void	dld_init_ops(struct dev_ops *, const char *);
118 void	dld_fini_ops(struct dev_ops *);
119 #endif
120 
121 #ifdef	__cplusplus
122 }
123 #endif
124 
125 #endif	/* _SYS_DLD_H */
126