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