xref: /onnv-gate/usr/src/uts/common/sys/dld.h (revision 7408:eff7960d93cd)
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
52311Sseb  * Common Development and Distribution License (the "License").
62311Sseb  * 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 /*
225895Syz147064  * Copyright 2008 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 /*
300Sstevel@tonic-gate  * Data-Link Driver (public header).
31*7408SSebastien.Roy@Sun.COM  *
32*7408SSebastien.Roy@Sun.COM  * Note that the datastructures defined here define an ioctl interface
33*7408SSebastien.Roy@Sun.COM  * that is shared betwen user and kernel space.  The dld driver thus
34*7408SSebastien.Roy@Sun.COM  * assumes that the structures have identical layout and size when
35*7408SSebastien.Roy@Sun.COM  * compiled in either IPL32 or LP64.
360Sstevel@tonic-gate  */
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #include <sys/types.h>
390Sstevel@tonic-gate #include <sys/stream.h>
40*7408SSebastien.Roy@Sun.COM #include <sys/dld_ioc.h>
415895Syz147064 #include <sys/conf.h>
425895Syz147064 #include <sys/sad.h>
430Sstevel@tonic-gate #include <net/if.h>
445903Ssowmini #include <sys/ddi.h>
455903Ssowmini #include <sys/sunddi.h>
466789Sam223141 #include <sys/mac.h>
470Sstevel@tonic-gate 
480Sstevel@tonic-gate #ifdef	__cplusplus
490Sstevel@tonic-gate extern "C" {
500Sstevel@tonic-gate #endif
510Sstevel@tonic-gate 
520Sstevel@tonic-gate /*
530Sstevel@tonic-gate  * Data-Link Driver Information (text emitted by modinfo(1m))
540Sstevel@tonic-gate  */
556512Ssowmini #define	DLD_INFO	"Data-Link Driver"
560Sstevel@tonic-gate 
570Sstevel@tonic-gate /*
580Sstevel@tonic-gate  * Options: To enable an option set the property name to a non-zero value
590Sstevel@tonic-gate  *	    in kernel/drv/dld.conf.
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate 
620Sstevel@tonic-gate /*
630Sstevel@tonic-gate  * Prevent use of the IP fast-path (direct M_DATA transmit).
640Sstevel@tonic-gate  */
650Sstevel@tonic-gate #define	DLD_PROP_NO_FASTPATH	"no-fastpath"
660Sstevel@tonic-gate 
670Sstevel@tonic-gate /*
680Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_POLL capability.
690Sstevel@tonic-gate  */
700Sstevel@tonic-gate #define	DLD_PROP_NO_POLL	"no-poll"
710Sstevel@tonic-gate 
720Sstevel@tonic-gate /*
730Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
740Sstevel@tonic-gate  */
750Sstevel@tonic-gate #define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"
760Sstevel@tonic-gate 
770Sstevel@tonic-gate /*
784114Sja97890  * Prevent advertising of the DL_CAPAB_SOFTRING capability.
794114Sja97890  */
804114Sja97890 #define	DLD_PROP_NO_SOFTRING	"no-softring"
814114Sja97890 
824114Sja97890 /*
830Sstevel@tonic-gate  * The name of the driver.
840Sstevel@tonic-gate  */
850Sstevel@tonic-gate #define	DLD_DRIVER_NAME		"dld"
860Sstevel@tonic-gate 
870Sstevel@tonic-gate /*
880Sstevel@tonic-gate  * IOCTL codes and data structures.
890Sstevel@tonic-gate  */
90*7408SSebastien.Roy@Sun.COM #define	DLDIOC_ATTR	DLDIOC(0x03)
910Sstevel@tonic-gate 
920Sstevel@tonic-gate typedef struct dld_ioc_attr {
935895Syz147064 	datalink_id_t	dia_linkid;
94269Sericheng 	uint_t		dia_max_sdu;
950Sstevel@tonic-gate } dld_ioc_attr_t;
960Sstevel@tonic-gate 
97*7408SSebastien.Roy@Sun.COM #define	DLDIOC_VLAN_ATTR	DLDIOC(0x04)
985895Syz147064 typedef struct dld_ioc_vlan_attr {
995895Syz147064 	datalink_id_t	div_vlanid;
1005895Syz147064 	uint16_t	div_vid;
1015895Syz147064 	datalink_id_t	div_linkid;
1025895Syz147064 	boolean_t	div_force;
1035895Syz147064 	boolean_t	div_implicit;
1045895Syz147064 } dld_ioc_vlan_attr_t;
105269Sericheng 
106*7408SSebastien.Roy@Sun.COM #define	DLDIOC_PHYS_ATTR	DLDIOC(0x05)
1075903Ssowmini #define	DLPI_LINKNAME_MAX	32
1085903Ssowmini 
1095895Syz147064 typedef struct dld_ioc_phys_attr {
1105895Syz147064 	datalink_id_t	dip_linkid;
1115895Syz147064 	/*
1125895Syz147064 	 * Whether this physical link supports vanity naming. Note that
1135895Syz147064 	 * physical links whose media type is not supported by GLDv3
1145895Syz147064 	 * can not support vanity naming.
1155895Syz147064 	 */
1165895Syz147064 	boolean_t	dip_novanity;
1175895Syz147064 	char		dip_dev[MAXLINKNAMELEN];
1185895Syz147064 } dld_ioc_phys_attr_t;
1193448Sdh155122 
1203147Sxc151355 /*
1213147Sxc151355  * Secure objects ioctls
1223147Sxc151355  */
1233147Sxc151355 typedef enum {
1244126Szf162725 	DLD_SECOBJ_CLASS_WEP = 1,
1254126Szf162725 	DLD_SECOBJ_CLASS_WPA
1263147Sxc151355 } dld_secobj_class_t;
1273147Sxc151355 
1283147Sxc151355 #define	DLD_SECOBJ_OPT_CREATE	0x00000001
1293147Sxc151355 #define	DLD_SECOBJ_NAME_MAX	32
1303147Sxc151355 #define	DLD_SECOBJ_VAL_MAX	256
1313147Sxc151355 typedef struct dld_secobj {
1323147Sxc151355 	char			so_name[DLD_SECOBJ_NAME_MAX];
1333147Sxc151355 	dld_secobj_class_t	so_class;
1343147Sxc151355 	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
1353147Sxc151355 	uint_t			so_len;
1363147Sxc151355 } dld_secobj_t;
1373147Sxc151355 
138*7408SSebastien.Roy@Sun.COM #define	DLDIOC_SECOBJ_SET	DLDIOC(0x06)
1393147Sxc151355 typedef struct dld_ioc_secobj_set {
1403147Sxc151355 	dld_secobj_t		ss_obj;
1413147Sxc151355 	uint_t			ss_flags;
1423147Sxc151355 } dld_ioc_secobj_set_t;
1433147Sxc151355 
144*7408SSebastien.Roy@Sun.COM #define	DLDIOC_SECOBJ_GET	DLDIOC(0x07)
1453147Sxc151355 typedef struct dld_ioc_secobj_get {
1463147Sxc151355 	dld_secobj_t		sg_obj;
1473147Sxc151355 	uint_t			sg_count;
148*7408SSebastien.Roy@Sun.COM 	uint_t			sg_size;
1493147Sxc151355 } dld_ioc_secobj_get_t;
1503147Sxc151355 
1515895Syz147064 /*
1525895Syz147064  * The following two slots were used outside of ON, so don't reuse them.
1535895Syz147064  *
154*7408SSebastien.Roy@Sun.COM  * #define DLDIOCHOLDVLAN DLDIOC(0x08)
155*7408SSebastien.Roy@Sun.COM  * #define DLDIOCRELEVLAN DLDIOC(0x09)
1565895Syz147064  */
1575895Syz147064 
158*7408SSebastien.Roy@Sun.COM #define	DLDIOC_SECOBJ_UNSET	DLDIOC(0x0a)
1593147Sxc151355 typedef struct dld_ioc_secobj_unset {
1603147Sxc151355 	char			su_name[DLD_SECOBJ_NAME_MAX];
1613147Sxc151355 } dld_ioc_secobj_unset_t;
1623147Sxc151355 
163*7408SSebastien.Roy@Sun.COM #define	DLDIOC_CREATE_VLAN	DLDIOC(0x0b)
1645895Syz147064 typedef struct dld_ioc_create_vlan {
1655895Syz147064 	datalink_id_t	dic_vlanid;
1665895Syz147064 	datalink_id_t	dic_linkid;
1675895Syz147064 	uint16_t	dic_vid;
1685895Syz147064 	boolean_t	dic_force;
1695895Syz147064 } dld_ioc_create_vlan_t;
1705895Syz147064 
171*7408SSebastien.Roy@Sun.COM #define	DLDIOC_DELETE_VLAN	DLDIOC(0x0c)
1725895Syz147064 typedef struct dld_ioc_delete_vlan {
1735895Syz147064 	datalink_id_t	did_linkid;
1745895Syz147064 } dld_ioc_delete_vlan_t;
1755895Syz147064 
1767342SAruna.Ramakrishna@Sun.COM /*
1777342SAruna.Ramakrishna@Sun.COM  * The following constants have been removed, and the slots are open:
1787342SAruna.Ramakrishna@Sun.COM  *
179*7408SSebastien.Roy@Sun.COM  * #define DLDIOC_SETAUTOPUSH	DLDIOC(0x0d)
180*7408SSebastien.Roy@Sun.COM  * #define DLDIOC_GETAUTOPUSH	DLDIOC(0x0e)
181*7408SSebastien.Roy@Sun.COM  * #define DLDIOC_CLRAUTOPUSH	DLDIOC(0x0f)
1827342SAruna.Ramakrishna@Sun.COM  */
1835895Syz147064 
184*7408SSebastien.Roy@Sun.COM #define	DLDIOC_DOORSERVER	DLDIOC(0x10)
1855895Syz147064 typedef struct dld_ioc_door {
1865895Syz147064 	boolean_t	did_start_door;
1875895Syz147064 } dld_ioc_door_t;
1885895Syz147064 
189*7408SSebastien.Roy@Sun.COM #define	DLDIOC_RENAME		DLDIOC(0x11)
1905895Syz147064 typedef struct dld_ioc_rename {
1915895Syz147064 	datalink_id_t	dir_linkid1;
1925895Syz147064 	datalink_id_t	dir_linkid2;
1935895Syz147064 	char		dir_link[MAXLINKNAMELEN];
1945895Syz147064 } dld_ioc_rename_t;
1955895Syz147064 
1963448Sdh155122 /*
1977342SAruna.Ramakrishna@Sun.COM  * The following constants have been removed, and the slots are open:
1987342SAruna.Ramakrishna@Sun.COM  *
199*7408SSebastien.Roy@Sun.COM  * #define DLDIOC_SETZID	DLDIOC(0x12)
200*7408SSebastien.Roy@Sun.COM  * #define DLDIOC_GETZID	DLDIOC(0x13)
2013448Sdh155122  */
2023448Sdh155122 
2037342SAruna.Ramakrishna@Sun.COM typedef struct dld_ioc_zid {
2047342SAruna.Ramakrishna@Sun.COM 	zoneid_t	diz_zid;
2057342SAruna.Ramakrishna@Sun.COM 	char		diz_link[MAXLINKNAMELEN];
2067342SAruna.Ramakrishna@Sun.COM 	boolean_t	diz_is_ppa_hack;
2077342SAruna.Ramakrishna@Sun.COM } dld_ioc_zid_t;
2083448Sdh155122 
209*7408SSebastien.Roy@Sun.COM #define	DLDIOC_GETZID  		DLDIOC(0x13)
210*7408SSebastien.Roy@Sun.COM typedef struct dld_ioc_getzid {
211*7408SSebastien.Roy@Sun.COM 	datalink_id_t	dig_linkid;
212*7408SSebastien.Roy@Sun.COM 	zoneid_t	dig_zid;
213*7408SSebastien.Roy@Sun.COM } dld_ioc_getzid_t;
214*7408SSebastien.Roy@Sun.COM 
2155895Syz147064 /*
2165895Syz147064  * data-link autopush configuration.
2175895Syz147064  */
2185895Syz147064 struct dlautopush {
2195895Syz147064 	uint_t	dap_anchor;
2205895Syz147064 	uint_t	dap_npush;
2215895Syz147064 	char	dap_aplist[MAXAPUSH][FMNAMESZ+1];
2225895Syz147064 };
2233448Sdh155122 
224*7408SSebastien.Roy@Sun.COM #define	DLDIOC_SETMACPROP	DLDIOC(0x14)
225*7408SSebastien.Roy@Sun.COM #define	DLDIOC_GETMACPROP	DLDIOC(0x15)
2266789Sam223141 #define	MAC_PROP_VERSION	1
2275903Ssowmini 
2286789Sam223141 typedef struct dld_ioc_macprop_s {
2295903Ssowmini 	int		pr_version;
2306512Ssowmini 	uint_t		pr_flags;
2315960Ssowmini 	datalink_id_t	pr_linkid;
2326789Sam223141 	mac_prop_id_t	pr_num;
2336512Ssowmini 	char    	pr_name[MAXLINKPROPNAME];
2345903Ssowmini 	uint_t		pr_valsize;		/* sizeof pr_val */
2355903Ssowmini 	char		pr_val[1];
2366789Sam223141 } dld_ioc_macprop_t;
2375903Ssowmini 
238269Sericheng #ifdef _KERNEL
239269Sericheng int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
240269Sericheng int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
241269Sericheng int	dld_close(queue_t *);
242269Sericheng void	dld_wput(queue_t *, mblk_t *);
243269Sericheng void	dld_wsrv(queue_t *);
244269Sericheng void	dld_init_ops(struct dev_ops *, const char *);
245269Sericheng void	dld_fini_ops(struct dev_ops *);
2465895Syz147064 int	dld_autopush(dev_t *, struct dlautopush *);
247269Sericheng #endif
248269Sericheng 
2490Sstevel@tonic-gate #ifdef	__cplusplus
2500Sstevel@tonic-gate }
2510Sstevel@tonic-gate #endif
2520Sstevel@tonic-gate 
2530Sstevel@tonic-gate #endif	/* _SYS_DLD_H */
254