xref: /titanic_54/usr/src/uts/common/sys/dld.h (revision 210db2243d3b5ca39c96a4c34c6d9453ddfbeaa9)
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
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_SYS_DLD_H
287c478bd9Sstevel@tonic-gate #define	_SYS_DLD_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * Data-Link Driver (public header).
347c478bd9Sstevel@tonic-gate  */
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
377c478bd9Sstevel@tonic-gate #include <sys/stream.h>
387c478bd9Sstevel@tonic-gate #include <sys/mac.h>
397c478bd9Sstevel@tonic-gate #include <sys/dls.h>
407c478bd9Sstevel@tonic-gate #include <net/if.h>
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
437c478bd9Sstevel@tonic-gate extern "C" {
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * Data-Link Driver Information (text emitted by modinfo(1m))
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate #define	DLD_INFO	"Data-Link Driver v%I%"
507c478bd9Sstevel@tonic-gate 
51*210db224Sericheng #define	DLD_MAX_PPA	999
52*210db224Sericheng #define	DLD_MAX_MINOR	(DLD_MAX_PPA + 1)
53*210db224Sericheng 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * Options: To enable an option set the property name to a non-zero value
567c478bd9Sstevel@tonic-gate  *	    in kernel/drv/dld.conf.
577c478bd9Sstevel@tonic-gate  */
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /*
607c478bd9Sstevel@tonic-gate  * Prevent use of the IP fast-path (direct M_DATA transmit).
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_FASTPATH	"no-fastpath"
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_POLL capability.
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_POLL	"no-poll"
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /*
707c478bd9Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * The name of the driver.
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate #define	DLD_DRIVER_NAME		"dld"
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * The name of the control minor node of dld.
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate #define	DLD_CONTROL_MINOR_NAME	"ctl"
837c478bd9Sstevel@tonic-gate #define	DLD_CONTROL_MINOR	0
847c478bd9Sstevel@tonic-gate #define	DLD_CONTROL_DEV		"/devices/pseudo/" DLD_DRIVER_NAME "@0:" \
857c478bd9Sstevel@tonic-gate 				DLD_CONTROL_MINOR_NAME
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate  * IOCTL codes and data structures.
897c478bd9Sstevel@tonic-gate  */
907c478bd9Sstevel@tonic-gate #define	DLDIOC		('D' << 24 | 'L' << 16 | 'D' << 8)
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #define	DLDIOCATTR	(DLDIOC | 0x03)
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate typedef struct dld_ioc_attr {
957c478bd9Sstevel@tonic-gate 	char		dia_name[IFNAMSIZ];
967c478bd9Sstevel@tonic-gate 	char		dia_dev[MAXNAMELEN];
97*210db224Sericheng 	uint_t		dia_max_sdu;
987c478bd9Sstevel@tonic-gate 	uint_t		dia_port;
997c478bd9Sstevel@tonic-gate 	uint16_t	dia_vid;
1007c478bd9Sstevel@tonic-gate } dld_ioc_attr_t;
1017c478bd9Sstevel@tonic-gate 
102*210db224Sericheng #define	DLDIOCVLAN	(DLDIOC | 0x04)
103*210db224Sericheng 
104*210db224Sericheng typedef struct dld_ioc_vlan {
105*210db224Sericheng 	uint_t		div_count;
106*210db224Sericheng } dld_ioc_vlan_t;
107*210db224Sericheng 
108*210db224Sericheng typedef struct dld_vlan_info {
109*210db224Sericheng 	char		dvi_name[IFNAMSIZ];
110*210db224Sericheng 	uint16_t	dvi_vid;
111*210db224Sericheng } dld_vlan_info_t;
112*210db224Sericheng 
113*210db224Sericheng #ifdef _KERNEL
114*210db224Sericheng int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
115*210db224Sericheng int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
116*210db224Sericheng int	dld_close(queue_t *);
117*210db224Sericheng void	dld_wput(queue_t *, mblk_t *);
118*210db224Sericheng void	dld_wsrv(queue_t *);
119*210db224Sericheng void	dld_init_ops(struct dev_ops *, const char *);
120*210db224Sericheng void	dld_fini_ops(struct dev_ops *);
121*210db224Sericheng #endif
122*210db224Sericheng 
1237c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1247c478bd9Sstevel@tonic-gate }
1257c478bd9Sstevel@tonic-gate #endif
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #endif	/* _SYS_DLD_H */
128