xref: /onnv-gate/usr/src/uts/common/sys/dld.h (revision 2311:2d86e52dcdf0)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*2311Sseb  * Common Development and Distribution License (the "License").
6*2311Sseb  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*2311Sseb  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_DLD_H
270Sstevel@tonic-gate #define	_SYS_DLD_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * Data-Link Driver (public header).
330Sstevel@tonic-gate  */
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #include <sys/types.h>
360Sstevel@tonic-gate #include <sys/stream.h>
370Sstevel@tonic-gate #include <sys/mac.h>
380Sstevel@tonic-gate #include <sys/dls.h>
390Sstevel@tonic-gate #include <net/if.h>
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #ifdef	__cplusplus
420Sstevel@tonic-gate extern "C" {
430Sstevel@tonic-gate #endif
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * Data-Link Driver Information (text emitted by modinfo(1m))
470Sstevel@tonic-gate  */
480Sstevel@tonic-gate #define	DLD_INFO	"Data-Link Driver v%I%"
490Sstevel@tonic-gate 
50269Sericheng #define	DLD_MAX_PPA	999
51269Sericheng #define	DLD_MAX_MINOR	(DLD_MAX_PPA + 1)
52269Sericheng 
530Sstevel@tonic-gate /*
540Sstevel@tonic-gate  * Options: To enable an option set the property name to a non-zero value
550Sstevel@tonic-gate  *	    in kernel/drv/dld.conf.
560Sstevel@tonic-gate  */
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /*
590Sstevel@tonic-gate  * Prevent use of the IP fast-path (direct M_DATA transmit).
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate #define	DLD_PROP_NO_FASTPATH	"no-fastpath"
620Sstevel@tonic-gate 
630Sstevel@tonic-gate /*
640Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_POLL capability.
650Sstevel@tonic-gate  */
660Sstevel@tonic-gate #define	DLD_PROP_NO_POLL	"no-poll"
670Sstevel@tonic-gate 
680Sstevel@tonic-gate /*
690Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
700Sstevel@tonic-gate  */
710Sstevel@tonic-gate #define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"
720Sstevel@tonic-gate 
730Sstevel@tonic-gate /*
740Sstevel@tonic-gate  * The name of the driver.
750Sstevel@tonic-gate  */
760Sstevel@tonic-gate #define	DLD_DRIVER_NAME		"dld"
770Sstevel@tonic-gate 
780Sstevel@tonic-gate /*
790Sstevel@tonic-gate  * The name of the control minor node of dld.
800Sstevel@tonic-gate  */
810Sstevel@tonic-gate #define	DLD_CONTROL_MINOR_NAME	"ctl"
820Sstevel@tonic-gate #define	DLD_CONTROL_MINOR	0
830Sstevel@tonic-gate #define	DLD_CONTROL_DEV		"/devices/pseudo/" DLD_DRIVER_NAME "@0:" \
840Sstevel@tonic-gate 				DLD_CONTROL_MINOR_NAME
850Sstevel@tonic-gate 
860Sstevel@tonic-gate /*
870Sstevel@tonic-gate  * IOCTL codes and data structures.
880Sstevel@tonic-gate  */
890Sstevel@tonic-gate #define	DLDIOC		('D' << 24 | 'L' << 16 | 'D' << 8)
900Sstevel@tonic-gate 
910Sstevel@tonic-gate #define	DLDIOCATTR	(DLDIOC | 0x03)
920Sstevel@tonic-gate 
930Sstevel@tonic-gate typedef struct dld_ioc_attr {
940Sstevel@tonic-gate 	char		dia_name[IFNAMSIZ];
950Sstevel@tonic-gate 	char		dia_dev[MAXNAMELEN];
96269Sericheng 	uint_t		dia_max_sdu;
970Sstevel@tonic-gate 	uint16_t	dia_vid;
980Sstevel@tonic-gate } dld_ioc_attr_t;
990Sstevel@tonic-gate 
100269Sericheng #define	DLDIOCVLAN	(DLDIOC | 0x04)
101269Sericheng 
102269Sericheng typedef struct dld_ioc_vlan {
103733Skrgopi 	char		div_name[IFNAMSIZ];
104269Sericheng 	uint_t		div_count;
105269Sericheng } dld_ioc_vlan_t;
106269Sericheng 
107269Sericheng typedef struct dld_vlan_info {
108269Sericheng 	char		dvi_name[IFNAMSIZ];
109269Sericheng } dld_vlan_info_t;
110269Sericheng 
111269Sericheng #ifdef _KERNEL
112269Sericheng int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
113269Sericheng int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
114269Sericheng int	dld_close(queue_t *);
115269Sericheng void	dld_wput(queue_t *, mblk_t *);
116269Sericheng void	dld_wsrv(queue_t *);
117269Sericheng void	dld_init_ops(struct dev_ops *, const char *);
118269Sericheng void	dld_fini_ops(struct dev_ops *);
119269Sericheng #endif
120269Sericheng 
1210Sstevel@tonic-gate #ifdef	__cplusplus
1220Sstevel@tonic-gate }
1230Sstevel@tonic-gate #endif
1240Sstevel@tonic-gate 
1250Sstevel@tonic-gate #endif	/* _SYS_DLD_H */
126