xref: /titanic_54/usr/src/uts/common/sys/dld.h (revision ba2e4443695ee6a6f420a35cd4fc3d3346d22932)
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
5*ba2e4443Sseb  * Common Development and Distribution License (the "License").
6*ba2e4443Sseb  * 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*ba2e4443Sseb  * 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 
111210db224Sericheng #ifdef _KERNEL
112210db224Sericheng int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
113210db224Sericheng int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
114210db224Sericheng int	dld_close(queue_t *);
115210db224Sericheng void	dld_wput(queue_t *, mblk_t *);
116210db224Sericheng void	dld_wsrv(queue_t *);
117210db224Sericheng void	dld_init_ops(struct dev_ops *, const char *);
118210db224Sericheng void	dld_fini_ops(struct dev_ops *);
119210db224Sericheng #endif
120210db224Sericheng 
1217c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1227c478bd9Sstevel@tonic-gate }
1237c478bd9Sstevel@tonic-gate #endif
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #endif	/* _SYS_DLD_H */
126