xref: /titanic_53/usr/src/uts/common/sys/dld.h (revision f4b3ec61df05330d25f55a36b975b4d7519fdeb1)
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 /*
22*f4b3ec61Sdh155122  * Copyright 2007 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*f4b3ec61Sdh155122 typedef struct dld_hold_vlan {
112*f4b3ec61Sdh155122 	char		dhv_name[IFNAMSIZ];
113*f4b3ec61Sdh155122 	zoneid_t	dhv_zid;
114*f4b3ec61Sdh155122 	boolean_t	dhv_docheck;
115*f4b3ec61Sdh155122 } dld_hold_vlan_t;
116*f4b3ec61Sdh155122 
1170ba2cbe9Sxc151355 /*
1180ba2cbe9Sxc151355  * Secure objects ioctls
1190ba2cbe9Sxc151355  */
1200ba2cbe9Sxc151355 typedef enum {
1210ba2cbe9Sxc151355 	DLD_SECOBJ_CLASS_WEP = 1
1220ba2cbe9Sxc151355 } dld_secobj_class_t;
1230ba2cbe9Sxc151355 
1240ba2cbe9Sxc151355 #define	DLD_SECOBJ_OPT_CREATE	0x00000001
1250ba2cbe9Sxc151355 #define	DLD_SECOBJ_NAME_MAX	32
1260ba2cbe9Sxc151355 #define	DLD_SECOBJ_VAL_MAX	256
1270ba2cbe9Sxc151355 typedef struct dld_secobj {
1280ba2cbe9Sxc151355 	char			so_name[DLD_SECOBJ_NAME_MAX];
1290ba2cbe9Sxc151355 	dld_secobj_class_t	so_class;
1300ba2cbe9Sxc151355 	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
1310ba2cbe9Sxc151355 	uint_t			so_len;
1320ba2cbe9Sxc151355 } dld_secobj_t;
1330ba2cbe9Sxc151355 
1340ba2cbe9Sxc151355 #define	DLDIOCSECOBJSET		(DLDIOC | 0x05)
1350ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_set {
1360ba2cbe9Sxc151355 	dld_secobj_t		ss_obj;
1370ba2cbe9Sxc151355 	uint_t			ss_flags;
1380ba2cbe9Sxc151355 } dld_ioc_secobj_set_t;
1390ba2cbe9Sxc151355 
1400ba2cbe9Sxc151355 #define	DLDIOCSECOBJGET		(DLDIOC | 0x06)
1410ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_get {
1420ba2cbe9Sxc151355 	dld_secobj_t		sg_obj;
1430ba2cbe9Sxc151355 	uint_t			sg_count;
1440ba2cbe9Sxc151355 } dld_ioc_secobj_get_t;
1450ba2cbe9Sxc151355 
1460ba2cbe9Sxc151355 #define	DLDIOCSECOBJUNSET	(DLDIOC | 0x07)
1470ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_unset {
1480ba2cbe9Sxc151355 	char			su_name[DLD_SECOBJ_NAME_MAX];
1490ba2cbe9Sxc151355 } dld_ioc_secobj_unset_t;
1500ba2cbe9Sxc151355 
151*f4b3ec61Sdh155122 /*
152*f4b3ec61Sdh155122  * DLDIOCHOLDVLAN/DLDIOCRELEVLAN are added to support a "hold/release"
153*f4b3ec61Sdh155122  * operation on a VLAN. A hold will cause a VLAN to be created or the
154*f4b3ec61Sdh155122  * reference count will be increased, release will do the reverse.
155*f4b3ec61Sdh155122  */
156*f4b3ec61Sdh155122 #define	DLDIOCHOLDVLAN  (DLDIOC | 0x08)
157*f4b3ec61Sdh155122 
158*f4b3ec61Sdh155122 #define	DLDIOCRELEVLAN  (DLDIOC | 0x09)
159*f4b3ec61Sdh155122 
160*f4b3ec61Sdh155122 #define	DLDIOCZIDGET	(DLDIOC | 0x0a)
161*f4b3ec61Sdh155122 
162210db224Sericheng #ifdef _KERNEL
163210db224Sericheng int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
164210db224Sericheng int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
165210db224Sericheng int	dld_close(queue_t *);
166210db224Sericheng void	dld_wput(queue_t *, mblk_t *);
167210db224Sericheng void	dld_wsrv(queue_t *);
168210db224Sericheng void	dld_init_ops(struct dev_ops *, const char *);
169210db224Sericheng void	dld_fini_ops(struct dev_ops *);
170210db224Sericheng #endif
171210db224Sericheng 
1727c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1737c478bd9Sstevel@tonic-gate }
1747c478bd9Sstevel@tonic-gate #endif
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate #endif	/* _SYS_DLD_H */
177