xref: /titanic_41/usr/src/uts/common/sys/dld.h (revision 70025d765b044c6d8594bb965a2247a61e991a99)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_DLD_H
28 #define	_SYS_DLD_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Data-Link Driver (public header).
34  */
35 
36 #include <sys/types.h>
37 #include <sys/stream.h>
38 #include <sys/mac.h>
39 #include <sys/dls.h>
40 #include <net/if.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 /*
47  * Data-Link Driver Information (text emitted by modinfo(1m))
48  */
49 #define	DLD_INFO	"Data-Link Driver v%I%"
50 
51 #define	DLD_MAX_PPA	999
52 #define	DLD_MAX_MINOR	(DLD_MAX_PPA + 1)
53 
54 /*
55  * Options: To enable an option set the property name to a non-zero value
56  *	    in kernel/drv/dld.conf.
57  */
58 
59 /*
60  * Prevent use of the IP fast-path (direct M_DATA transmit).
61  */
62 #define	DLD_PROP_NO_FASTPATH	"no-fastpath"
63 
64 /*
65  * Prevent advertising of the DL_CAPAB_POLL capability.
66  */
67 #define	DLD_PROP_NO_POLL	"no-poll"
68 
69 /*
70  * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
71  */
72 #define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"
73 
74 /*
75  * The name of the driver.
76  */
77 #define	DLD_DRIVER_NAME		"dld"
78 
79 /*
80  * The name of the control minor node of dld.
81  */
82 #define	DLD_CONTROL_MINOR_NAME	"ctl"
83 #define	DLD_CONTROL_MINOR	0
84 #define	DLD_CONTROL_DEV		"/devices/pseudo/" DLD_DRIVER_NAME "@0:" \
85 				DLD_CONTROL_MINOR_NAME
86 
87 /*
88  * IOCTL codes and data structures.
89  */
90 #define	DLDIOC		('D' << 24 | 'L' << 16 | 'D' << 8)
91 
92 #define	DLDIOCATTR	(DLDIOC | 0x03)
93 
94 typedef struct dld_ioc_attr {
95 	char		dia_name[IFNAMSIZ];
96 	char		dia_dev[MAXNAMELEN];
97 	uint_t		dia_max_sdu;
98 	uint_t		dia_port;
99 	uint16_t	dia_vid;
100 } dld_ioc_attr_t;
101 
102 #define	DLDIOCVLAN	(DLDIOC | 0x04)
103 
104 typedef struct dld_ioc_vlan {
105 	char		div_name[IFNAMSIZ];
106 	uint_t		div_port;
107 	uint_t		div_count;
108 } dld_ioc_vlan_t;
109 
110 typedef struct dld_vlan_info {
111 	char		dvi_name[IFNAMSIZ];
112 } dld_vlan_info_t;
113 
114 #ifdef _KERNEL
115 int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
116 int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
117 int	dld_close(queue_t *);
118 void	dld_wput(queue_t *, mblk_t *);
119 void	dld_wsrv(queue_t *);
120 void	dld_init_ops(struct dev_ops *, const char *);
121 void	dld_fini_ops(struct dev_ops *);
122 #endif
123 
124 #ifdef	__cplusplus
125 }
126 #endif
127 
128 #endif	/* _SYS_DLD_H */
129