xref: /titanic_52/usr/src/uts/common/sys/dld.h (revision 0ba2cbe97e0678a691742f98d2532caed0a2c4aa)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5ba2e4443Sseb  * Common Development and Distribution License (the "License").
6ba2e4443Sseb  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22ba2e4443Sseb  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_DLD_H
277c478bd9Sstevel@tonic-gate #define	_SYS_DLD_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Data-Link Driver (public header).
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <sys/stream.h>
377c478bd9Sstevel@tonic-gate #include <sys/mac.h>
387c478bd9Sstevel@tonic-gate #include <sys/dls.h>
397c478bd9Sstevel@tonic-gate #include <net/if.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Data-Link Driver Information (text emitted by modinfo(1m))
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate #define	DLD_INFO	"Data-Link Driver v%I%"
497c478bd9Sstevel@tonic-gate 
50210db224Sericheng #define	DLD_MAX_PPA	999
51210db224Sericheng #define	DLD_MAX_MINOR	(DLD_MAX_PPA + 1)
52210db224Sericheng 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Options: To enable an option set the property name to a non-zero value
557c478bd9Sstevel@tonic-gate  *	    in kernel/drv/dld.conf.
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * Prevent use of the IP fast-path (direct M_DATA transmit).
607c478bd9Sstevel@tonic-gate  */
617c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_FASTPATH	"no-fastpath"
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_POLL capability.
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_POLL	"no-poll"
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * The name of the driver.
757c478bd9Sstevel@tonic-gate  */
767c478bd9Sstevel@tonic-gate #define	DLD_DRIVER_NAME		"dld"
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /*
797c478bd9Sstevel@tonic-gate  * The name of the control minor node of dld.
807c478bd9Sstevel@tonic-gate  */
817c478bd9Sstevel@tonic-gate #define	DLD_CONTROL_MINOR_NAME	"ctl"
827c478bd9Sstevel@tonic-gate #define	DLD_CONTROL_MINOR	0
837c478bd9Sstevel@tonic-gate #define	DLD_CONTROL_DEV		"/devices/pseudo/" DLD_DRIVER_NAME "@0:" \
847c478bd9Sstevel@tonic-gate 				DLD_CONTROL_MINOR_NAME
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * IOCTL codes and data structures.
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate #define	DLDIOC		('D' << 24 | 'L' << 16 | 'D' << 8)
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #define	DLDIOCATTR	(DLDIOC | 0x03)
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate typedef struct dld_ioc_attr {
947c478bd9Sstevel@tonic-gate 	char		dia_name[IFNAMSIZ];
957c478bd9Sstevel@tonic-gate 	char		dia_dev[MAXNAMELEN];
96210db224Sericheng 	uint_t		dia_max_sdu;
977c478bd9Sstevel@tonic-gate 	uint16_t	dia_vid;
987c478bd9Sstevel@tonic-gate } dld_ioc_attr_t;
997c478bd9Sstevel@tonic-gate 
100210db224Sericheng #define	DLDIOCVLAN	(DLDIOC | 0x04)
101210db224Sericheng 
102210db224Sericheng typedef struct dld_ioc_vlan {
103aae21359Skrgopi 	char		div_name[IFNAMSIZ];
104210db224Sericheng 	uint_t		div_count;
105210db224Sericheng } dld_ioc_vlan_t;
106210db224Sericheng 
107210db224Sericheng typedef struct dld_vlan_info {
108210db224Sericheng 	char		dvi_name[IFNAMSIZ];
109210db224Sericheng } dld_vlan_info_t;
110210db224Sericheng 
111*0ba2cbe9Sxc151355 /*
112*0ba2cbe9Sxc151355  * Secure objects ioctls
113*0ba2cbe9Sxc151355  */
114*0ba2cbe9Sxc151355 typedef enum {
115*0ba2cbe9Sxc151355 	DLD_SECOBJ_CLASS_WEP = 1
116*0ba2cbe9Sxc151355 } dld_secobj_class_t;
117*0ba2cbe9Sxc151355 
118*0ba2cbe9Sxc151355 #define	DLD_SECOBJ_OPT_CREATE	0x00000001
119*0ba2cbe9Sxc151355 #define	DLD_SECOBJ_NAME_MAX	32
120*0ba2cbe9Sxc151355 #define	DLD_SECOBJ_VAL_MAX	256
121*0ba2cbe9Sxc151355 typedef struct dld_secobj {
122*0ba2cbe9Sxc151355 	char			so_name[DLD_SECOBJ_NAME_MAX];
123*0ba2cbe9Sxc151355 	dld_secobj_class_t	so_class;
124*0ba2cbe9Sxc151355 	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
125*0ba2cbe9Sxc151355 	uint_t			so_len;
126*0ba2cbe9Sxc151355 } dld_secobj_t;
127*0ba2cbe9Sxc151355 
128*0ba2cbe9Sxc151355 #define	DLDIOCSECOBJSET		(DLDIOC | 0x05)
129*0ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_set {
130*0ba2cbe9Sxc151355 	dld_secobj_t		ss_obj;
131*0ba2cbe9Sxc151355 	uint_t			ss_flags;
132*0ba2cbe9Sxc151355 } dld_ioc_secobj_set_t;
133*0ba2cbe9Sxc151355 
134*0ba2cbe9Sxc151355 #define	DLDIOCSECOBJGET		(DLDIOC | 0x06)
135*0ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_get {
136*0ba2cbe9Sxc151355 	dld_secobj_t		sg_obj;
137*0ba2cbe9Sxc151355 	uint_t			sg_count;
138*0ba2cbe9Sxc151355 } dld_ioc_secobj_get_t;
139*0ba2cbe9Sxc151355 
140*0ba2cbe9Sxc151355 #define	DLDIOCSECOBJUNSET	(DLDIOC | 0x07)
141*0ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_unset {
142*0ba2cbe9Sxc151355 	char			su_name[DLD_SECOBJ_NAME_MAX];
143*0ba2cbe9Sxc151355 } dld_ioc_secobj_unset_t;
144*0ba2cbe9Sxc151355 
145210db224Sericheng #ifdef _KERNEL
146210db224Sericheng int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
147210db224Sericheng int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
148210db224Sericheng int	dld_close(queue_t *);
149210db224Sericheng void	dld_wput(queue_t *, mblk_t *);
150210db224Sericheng void	dld_wsrv(queue_t *);
151210db224Sericheng void	dld_init_ops(struct dev_ops *, const char *);
152210db224Sericheng void	dld_fini_ops(struct dev_ops *);
153210db224Sericheng #endif
154210db224Sericheng 
1557c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1567c478bd9Sstevel@tonic-gate }
1577c478bd9Sstevel@tonic-gate #endif
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate #endif	/* _SYS_DLD_H */
160