xref: /titanic_52/usr/src/uts/common/sys/dld.h (revision da14cebe459d3275048785f25bd869cb09b5307f)
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
5ba2e4443Sseb  * Common Development and Distribution License (the "License").
6ba2e4443Sseb  * 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 /*
22d62bc4baSyz147064  * Copyright 2008 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 /*
307c478bd9Sstevel@tonic-gate  * Data-Link Driver (public header).
31eae72b5bSSebastien Roy  *
32eae72b5bSSebastien Roy  * Note that the datastructures defined here define an ioctl interface
33eae72b5bSSebastien Roy  * that is shared betwen user and kernel space.  The dld driver thus
34eae72b5bSSebastien Roy  * assumes that the structures have identical layout and size when
35eae72b5bSSebastien Roy  * compiled in either IPL32 or LP64.
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #include <sys/types.h>
397c478bd9Sstevel@tonic-gate #include <sys/stream.h>
40eae72b5bSSebastien Roy #include <sys/dld_ioc.h>
41*da14cebeSEric Cheng #include <sys/mac_flow.h>
42d62bc4baSyz147064 #include <sys/conf.h>
43d62bc4baSyz147064 #include <sys/sad.h>
447c478bd9Sstevel@tonic-gate #include <net/if.h>
45e7801d59Ssowmini #include <sys/ddi.h>
46e7801d59Ssowmini #include <sys/sunddi.h>
473fd94f8cSam223141 #include <sys/mac.h>
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
507c478bd9Sstevel@tonic-gate extern "C" {
517c478bd9Sstevel@tonic-gate #endif
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Data-Link Driver Information (text emitted by modinfo(1m))
557c478bd9Sstevel@tonic-gate  */
564045d941Ssowmini #define	DLD_INFO	"Data-Link Driver"
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * Options: To enable an option set the property name to a non-zero value
607c478bd9Sstevel@tonic-gate  *	    in kernel/drv/dld.conf.
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * Prevent use of the IP fast-path (direct M_DATA transmit).
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_FASTPATH	"no-fastpath"
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_POLL capability.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_POLL	"no-poll"
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
757c478bd9Sstevel@tonic-gate  */
767c478bd9Sstevel@tonic-gate #define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /*
799c175129Sja97890  * Prevent advertising of the DL_CAPAB_SOFTRING capability.
809c175129Sja97890  */
819c175129Sja97890 #define	DLD_PROP_NO_SOFTRING	"no-softring"
829c175129Sja97890 
839c175129Sja97890 /*
847c478bd9Sstevel@tonic-gate  * The name of the driver.
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate #define	DLD_DRIVER_NAME		"dld"
877c478bd9Sstevel@tonic-gate 
88*da14cebeSEric Cheng #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
89*da14cebeSEric Cheng #pragma pack(4)
90*da14cebeSEric Cheng #endif
91*da14cebeSEric Cheng 
927c478bd9Sstevel@tonic-gate /*
937c478bd9Sstevel@tonic-gate  * IOCTL codes and data structures.
947c478bd9Sstevel@tonic-gate  */
95eae72b5bSSebastien Roy #define	DLDIOC_ATTR	DLDIOC(0x03)
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate typedef struct dld_ioc_attr {
98d62bc4baSyz147064 	datalink_id_t		dia_linkid;
99210db224Sericheng 	uint_t			dia_max_sdu;
1007c478bd9Sstevel@tonic-gate } dld_ioc_attr_t;
1017c478bd9Sstevel@tonic-gate 
102eae72b5bSSebastien Roy #define	DLDIOC_VLAN_ATTR	DLDIOC(0x04)
103d62bc4baSyz147064 typedef struct dld_ioc_vlan_attr {
104d62bc4baSyz147064 	datalink_id_t	div_vlanid;
105d62bc4baSyz147064 	uint16_t	div_vid;
106d62bc4baSyz147064 	datalink_id_t	div_linkid;
107d62bc4baSyz147064 	boolean_t	div_force;
108d62bc4baSyz147064 } dld_ioc_vlan_attr_t;
109210db224Sericheng 
110eae72b5bSSebastien Roy #define	DLDIOC_PHYS_ATTR	DLDIOC(0x05)
111e7801d59Ssowmini #define	DLPI_LINKNAME_MAX	32
112e7801d59Ssowmini 
113d62bc4baSyz147064 typedef struct dld_ioc_phys_attr {
114d62bc4baSyz147064 	datalink_id_t	dip_linkid;
115d62bc4baSyz147064 	/*
116d62bc4baSyz147064 	 * Whether this physical link supports vanity naming. Note that
117d62bc4baSyz147064 	 * physical links whose media type is not supported by GLDv3
118d62bc4baSyz147064 	 * can not support vanity naming.
119d62bc4baSyz147064 	 */
120d62bc4baSyz147064 	boolean_t	dip_novanity;
121d62bc4baSyz147064 	char		dip_dev[MAXLINKNAMELEN];
122d62bc4baSyz147064 } dld_ioc_phys_attr_t;
123f4b3ec61Sdh155122 
1240ba2cbe9Sxc151355 /*
1250ba2cbe9Sxc151355  * Secure objects ioctls
1260ba2cbe9Sxc151355  */
1270ba2cbe9Sxc151355 typedef enum {
128a399b765Szf162725 	DLD_SECOBJ_CLASS_WEP = 1,
129a399b765Szf162725 	DLD_SECOBJ_CLASS_WPA
1300ba2cbe9Sxc151355 } dld_secobj_class_t;
1310ba2cbe9Sxc151355 
1320ba2cbe9Sxc151355 #define	DLD_SECOBJ_OPT_CREATE	0x00000001
1330ba2cbe9Sxc151355 #define	DLD_SECOBJ_NAME_MAX	32
1340ba2cbe9Sxc151355 #define	DLD_SECOBJ_VAL_MAX	256
1350ba2cbe9Sxc151355 typedef struct dld_secobj {
1360ba2cbe9Sxc151355 	char			so_name[DLD_SECOBJ_NAME_MAX];
1370ba2cbe9Sxc151355 	dld_secobj_class_t	so_class;
1380ba2cbe9Sxc151355 	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
1390ba2cbe9Sxc151355 	uint_t			so_len;
1400ba2cbe9Sxc151355 } dld_secobj_t;
1410ba2cbe9Sxc151355 
142eae72b5bSSebastien Roy #define	DLDIOC_SECOBJ_SET	DLDIOC(0x06)
1430ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_set {
1440ba2cbe9Sxc151355 	dld_secobj_t		ss_obj;
1450ba2cbe9Sxc151355 	uint_t			ss_flags;
1460ba2cbe9Sxc151355 } dld_ioc_secobj_set_t;
1470ba2cbe9Sxc151355 
148eae72b5bSSebastien Roy #define	DLDIOC_SECOBJ_GET	DLDIOC(0x07)
1490ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_get {
1500ba2cbe9Sxc151355 	dld_secobj_t		sg_obj;
1510ba2cbe9Sxc151355 	uint_t			sg_count;
152eae72b5bSSebastien Roy 	uint_t			sg_size;
1530ba2cbe9Sxc151355 } dld_ioc_secobj_get_t;
1540ba2cbe9Sxc151355 
155d62bc4baSyz147064 /*
156d62bc4baSyz147064  * The following two slots were used outside of ON, so don't reuse them.
157d62bc4baSyz147064  *
158eae72b5bSSebastien Roy  * #define DLDIOCHOLDVLAN DLDIOC(0x08)
159eae72b5bSSebastien Roy  * #define DLDIOCRELEVLAN DLDIOC(0x09)
160d62bc4baSyz147064  */
161d62bc4baSyz147064 
162eae72b5bSSebastien Roy #define	DLDIOC_SECOBJ_UNSET	DLDIOC(0x0a)
1630ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_unset {
1640ba2cbe9Sxc151355 	char			su_name[DLD_SECOBJ_NAME_MAX];
1650ba2cbe9Sxc151355 } dld_ioc_secobj_unset_t;
1660ba2cbe9Sxc151355 
167eae72b5bSSebastien Roy #define	DLDIOC_CREATE_VLAN	DLDIOC(0x0b)
168d62bc4baSyz147064 typedef struct dld_ioc_create_vlan {
169d62bc4baSyz147064 	datalink_id_t	dic_vlanid;
170d62bc4baSyz147064 	datalink_id_t	dic_linkid;
171d62bc4baSyz147064 	uint16_t	dic_vid;
172d62bc4baSyz147064 	boolean_t	dic_force;
173d62bc4baSyz147064 } dld_ioc_create_vlan_t;
174d62bc4baSyz147064 
175eae72b5bSSebastien Roy #define	DLDIOC_DELETE_VLAN	DLDIOC(0x0c)
176d62bc4baSyz147064 typedef struct dld_ioc_delete_vlan {
177d62bc4baSyz147064 	datalink_id_t	did_linkid;
178d62bc4baSyz147064 } dld_ioc_delete_vlan_t;
179d62bc4baSyz147064 
1803bc21d0aSAruna Ramakrishna - Sun Microsystems /*
1813bc21d0aSAruna Ramakrishna - Sun Microsystems  * The following constants have been removed, and the slots are open:
1823bc21d0aSAruna Ramakrishna - Sun Microsystems  *
183eae72b5bSSebastien Roy  * #define DLDIOC_SETAUTOPUSH	DLDIOC(0x0d)
184eae72b5bSSebastien Roy  * #define DLDIOC_GETAUTOPUSH	DLDIOC(0x0e)
185eae72b5bSSebastien Roy  * #define DLDIOC_CLRAUTOPUSH	DLDIOC(0x0f)
1863bc21d0aSAruna Ramakrishna - Sun Microsystems  */
187d62bc4baSyz147064 
188eae72b5bSSebastien Roy #define	DLDIOC_DOORSERVER	DLDIOC(0x10)
189d62bc4baSyz147064 typedef struct dld_ioc_door {
190d62bc4baSyz147064 	boolean_t	did_start_door;
191d62bc4baSyz147064 } dld_ioc_door_t;
192d62bc4baSyz147064 
193eae72b5bSSebastien Roy #define	DLDIOC_RENAME		DLDIOC(0x11)
194d62bc4baSyz147064 typedef struct dld_ioc_rename {
195d62bc4baSyz147064 	datalink_id_t	dir_linkid1;
196d62bc4baSyz147064 	datalink_id_t	dir_linkid2;
197d62bc4baSyz147064 	char		dir_link[MAXLINKNAMELEN];
198d62bc4baSyz147064 } dld_ioc_rename_t;
199d62bc4baSyz147064 
200f4b3ec61Sdh155122 /*
2013bc21d0aSAruna Ramakrishna - Sun Microsystems  * The following constants have been removed, and the slots are open:
2023bc21d0aSAruna Ramakrishna - Sun Microsystems  *
203eae72b5bSSebastien Roy  * #define DLDIOC_SETZID	DLDIOC(0x12)
204eae72b5bSSebastien Roy  * #define DLDIOC_GETZID	DLDIOC(0x13)
205f4b3ec61Sdh155122  */
206f4b3ec61Sdh155122 
2073bc21d0aSAruna Ramakrishna - Sun Microsystems typedef struct dld_ioc_zid {
2083bc21d0aSAruna Ramakrishna - Sun Microsystems 	zoneid_t	diz_zid;
2093bc21d0aSAruna Ramakrishna - Sun Microsystems 	char		diz_link[MAXLINKNAMELEN];
2103bc21d0aSAruna Ramakrishna - Sun Microsystems } dld_ioc_zid_t;
211f4b3ec61Sdh155122 
212d62bc4baSyz147064 /*
213d62bc4baSyz147064  * data-link autopush configuration.
214d62bc4baSyz147064  */
215d62bc4baSyz147064 struct dlautopush {
216d62bc4baSyz147064 	uint_t	dap_anchor;
217d62bc4baSyz147064 	uint_t	dap_npush;
218d62bc4baSyz147064 	char	dap_aplist[MAXAPUSH][FMNAMESZ+1];
219d62bc4baSyz147064 };
220f4b3ec61Sdh155122 
221*da14cebeSEric Cheng #define	DLDIOC_MACADDRGET	DLDIOC(0x15)
222*da14cebeSEric Cheng typedef struct dld_ioc_macaddrget {
223*da14cebeSEric Cheng 	datalink_id_t	dig_linkid;
224*da14cebeSEric Cheng 	uint_t		dig_count;
225*da14cebeSEric Cheng 	uint_t		dig_size;
226*da14cebeSEric Cheng } dld_ioc_macaddrget_t;
227*da14cebeSEric Cheng 
228*da14cebeSEric Cheng /* possible flags for dmi_flags below */
229*da14cebeSEric Cheng #define	DLDIOCMACADDR_USED	0x1	/* address slot used */
230*da14cebeSEric Cheng 
231*da14cebeSEric Cheng typedef struct dld_macaddrinfo {
232*da14cebeSEric Cheng 	uint_t		dmi_slot;
233*da14cebeSEric Cheng 	uint_t		dmi_flags;
234*da14cebeSEric Cheng 	uint_t		dmi_addrlen;
235*da14cebeSEric Cheng 	uchar_t		dmi_addr[MAXMACADDRLEN];
236*da14cebeSEric Cheng 	char		dmi_client_name[MAXNAMELEN];
237*da14cebeSEric Cheng 	datalink_id_t	dma_client_linkid;
238*da14cebeSEric Cheng } dld_macaddrinfo_t;
239*da14cebeSEric Cheng 
240*da14cebeSEric Cheng /*
241*da14cebeSEric Cheng  * IOCTL codes and data structures for flowadm.
242*da14cebeSEric Cheng  */
243*da14cebeSEric Cheng #define	DLDIOC_ADDFLOW		DLDIOC(0x16)
244*da14cebeSEric Cheng typedef struct dld_ioc_addflow {
245*da14cebeSEric Cheng 	datalink_id_t		af_linkid;
246*da14cebeSEric Cheng 	flow_desc_t		af_flow_desc;
247*da14cebeSEric Cheng 	mac_resource_props_t	af_resource_props;
248*da14cebeSEric Cheng 	char			af_name[MAXNAMELEN];
249*da14cebeSEric Cheng } dld_ioc_addflow_t;
250*da14cebeSEric Cheng 
251*da14cebeSEric Cheng #define	DLDIOC_REMOVEFLOW	DLDIOC(0x17)
252*da14cebeSEric Cheng typedef struct dld_ioc_removeflow {
253*da14cebeSEric Cheng 	char			rf_name[MAXNAMELEN];
254*da14cebeSEric Cheng } dld_ioc_removeflow_t;
255*da14cebeSEric Cheng 
256*da14cebeSEric Cheng #define	DLDIOC_MODIFYFLOW	DLDIOC(0x18)
257*da14cebeSEric Cheng typedef struct dld_ioc_modifyflow {
258*da14cebeSEric Cheng 	char			mf_name[MAXNAMELEN];
259*da14cebeSEric Cheng 	mac_resource_props_t	mf_resource_props;
260*da14cebeSEric Cheng } dld_ioc_modifyflow_t;
261*da14cebeSEric Cheng 
262*da14cebeSEric Cheng #define	DLDIOC_WALKFLOW		DLDIOC(0x19)
263*da14cebeSEric Cheng typedef struct dld_ioc_walkflow {
264*da14cebeSEric Cheng 	datalink_id_t		wf_linkid;
265*da14cebeSEric Cheng 	char			wf_name[MAXNAMELEN];
266*da14cebeSEric Cheng 	uint32_t		wf_nflows;
267*da14cebeSEric Cheng 	uint_t			wf_len;
268*da14cebeSEric Cheng } dld_ioc_walkflow_t;
269*da14cebeSEric Cheng 
270*da14cebeSEric Cheng typedef struct dld_flowinfo {
271*da14cebeSEric Cheng 	datalink_id_t		fi_linkid;
272*da14cebeSEric Cheng 	flow_desc_t		fi_flow_desc;
273*da14cebeSEric Cheng 	mac_resource_props_t	fi_resource_props;
274*da14cebeSEric Cheng 	char			fi_flowname[MAXNAMELEN];
275*da14cebeSEric Cheng 	uint32_t		fi_pad;
276*da14cebeSEric Cheng } dld_flowinfo_t;
277*da14cebeSEric Cheng 
278*da14cebeSEric Cheng #define	DLDIOC_USAGELOG		DLDIOC(0x1a)
279*da14cebeSEric Cheng typedef struct dld_ioc_usagelog {
280*da14cebeSEric Cheng 	mac_logtype_t	ul_type;
281*da14cebeSEric Cheng 	boolean_t	ul_onoff;
282*da14cebeSEric Cheng 	uint_t		ul_interval;
283*da14cebeSEric Cheng } dld_ioc_usagelog_t;
284*da14cebeSEric Cheng 
285*da14cebeSEric Cheng #define	DLDIOC_SETMACPROP	DLDIOC(0x1b)
286*da14cebeSEric Cheng #define	DLDIOC_GETMACPROP	DLDIOC(0x1c)
2873fd94f8cSam223141 #define	MAC_PROP_VERSION	1
288e7801d59Ssowmini 
2893fd94f8cSam223141 typedef struct dld_ioc_macprop_s {
290e7801d59Ssowmini 	int		pr_version;
2914045d941Ssowmini 	uint_t		pr_flags;
2926b9e797cSsowmini 	datalink_id_t	pr_linkid;
2933fd94f8cSam223141 	mac_prop_id_t	pr_num;
294afdda45fSVasumathi Sundaram - Sun Microsystems 	uint_t		pr_perm_flags;
2954045d941Ssowmini 	char    	pr_name[MAXLINKPROPNAME];
296e7801d59Ssowmini 	uint_t		pr_valsize;		/* sizeof pr_val */
297e7801d59Ssowmini 	char		pr_val[1];
2983fd94f8cSam223141 } dld_ioc_macprop_t;
299e7801d59Ssowmini 
300*da14cebeSEric Cheng #define	DLDIOC_GETHWGRP		DLDIOC(0x1d)
301*da14cebeSEric Cheng 
302*da14cebeSEric Cheng typedef struct dld_ioc_hwgrpget {
303*da14cebeSEric Cheng 	datalink_id_t	dih_linkid;
304*da14cebeSEric Cheng 	uint_t		dih_n_groups;	/* number of groups included in ioc */
305*da14cebeSEric Cheng 	uint_t		dih_size;
306*da14cebeSEric Cheng } dld_ioc_hwgrpget_t;
307*da14cebeSEric Cheng 
308*da14cebeSEric Cheng #define	MAXCLIENTNAMELEN	1024
309*da14cebeSEric Cheng typedef struct dld_hwgrpinfo {
310*da14cebeSEric Cheng 	char	dhi_link_name[MAXLINKNAMELEN];
311*da14cebeSEric Cheng 	uint_t	dhi_grp_num;
312*da14cebeSEric Cheng 	uint_t	dhi_grp_type;
313*da14cebeSEric Cheng 	uint_t	dhi_n_rings;
314*da14cebeSEric Cheng 	uint_t	dhi_n_clnts;
315*da14cebeSEric Cheng 	/* XXXX later we should use dhi_n_clnts * MAXNAMELEN for dhi_clnts */
316*da14cebeSEric Cheng 	char	dhi_clnts[MAXCLIENTNAMELEN];
317*da14cebeSEric Cheng } dld_hwgrpinfo_t;
318*da14cebeSEric Cheng 
319*da14cebeSEric Cheng #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
320*da14cebeSEric Cheng #pragma pack()
321*da14cebeSEric Cheng #endif
322*da14cebeSEric Cheng 
323210db224Sericheng #ifdef _KERNEL
324*da14cebeSEric Cheng 
325*da14cebeSEric Cheng #define	DLD_CAPAB_DIRECT	0x00000001
326*da14cebeSEric Cheng #define	DLD_CAPAB_POLL		0x00000002
327*da14cebeSEric Cheng #define	DLD_CAPAB_PERIM		0x00000003
328*da14cebeSEric Cheng #define	DLD_CAPAB_LSO		0x00000004
329*da14cebeSEric Cheng 
330*da14cebeSEric Cheng #define	DLD_ENABLE		0x00000001
331*da14cebeSEric Cheng #define	DLD_DISABLE		0x00000002
332*da14cebeSEric Cheng #define	DLD_QUERY		0x00000003
333*da14cebeSEric Cheng 
334*da14cebeSEric Cheng /*
335*da14cebeSEric Cheng  * GLDv3 entry point for negotiating capabilities.
336*da14cebeSEric Cheng  * This is exposed to IP after negotiation of DL_CAPAB_DLD.
337*da14cebeSEric Cheng  *
338*da14cebeSEric Cheng  * This function takes the following arguments:
339*da14cebeSEric Cheng  * handle: used for identifying the interface to operate on (provided by dld).
340*da14cebeSEric Cheng  * type: capability type.
341*da14cebeSEric Cheng  * arg: points to a capability-specific structure.
342*da14cebeSEric Cheng  * flags: used for indicating whether to enable or disable a capability.
343*da14cebeSEric Cheng  *
344*da14cebeSEric Cheng  * With this function, capability negotiation is reduced from a multi-step
345*da14cebeSEric Cheng  * process to just one single function call.
346*da14cebeSEric Cheng  * e.g. the following code would pass 'x' from IP to dld and obtain
347*da14cebeSEric Cheng  * arg.output_arg from dld:
348*da14cebeSEric Cheng  *
349*da14cebeSEric Cheng  * arg.input_arg = x;
350*da14cebeSEric Cheng  * rc = (*dld_capab)(handle, DLD_CAPAB_XXX, &arg, DLD_ENABLE);
351*da14cebeSEric Cheng  * ill->info1 = arg.output_arg;
352*da14cebeSEric Cheng  */
353*da14cebeSEric Cheng typedef	int	(*dld_capab_func_t)(void *, uint_t, void *, uint_t);
354*da14cebeSEric Cheng 
355*da14cebeSEric Cheng /*
356*da14cebeSEric Cheng  * Direct Tx/Rx capability.
357*da14cebeSEric Cheng  */
358*da14cebeSEric Cheng typedef struct dld_capab_direct_s {
359*da14cebeSEric Cheng 	/*
360*da14cebeSEric Cheng 	 * Rx entry point and handle, owned by IP.
361*da14cebeSEric Cheng 	 */
362*da14cebeSEric Cheng 	uintptr_t	di_rx_cf;
363*da14cebeSEric Cheng 	void		*di_rx_ch;
364*da14cebeSEric Cheng 
365*da14cebeSEric Cheng 	/*
366*da14cebeSEric Cheng 	 * Tx entry points and handle, owned by DLD.
367*da14cebeSEric Cheng 	 */
368*da14cebeSEric Cheng 	/* Entry point for transmitting packets */
369*da14cebeSEric Cheng 	uintptr_t	di_tx_df;
370*da14cebeSEric Cheng 	void		*di_tx_dh;
371*da14cebeSEric Cheng 
372*da14cebeSEric Cheng 	/* flow control notification callback */
373*da14cebeSEric Cheng 	uintptr_t	di_tx_cb_df; /* callback registration/de-registration */
374*da14cebeSEric Cheng 	void		*di_tx_cb_dh;
375*da14cebeSEric Cheng } dld_capab_direct_t;
376*da14cebeSEric Cheng 
377*da14cebeSEric Cheng /*
378*da14cebeSEric Cheng  * Polling/softring capability.
379*da14cebeSEric Cheng  */
380*da14cebeSEric Cheng #define	POLL_SOFTRING		0x00000001
381*da14cebeSEric Cheng typedef struct dld_capab_poll_s {
382*da14cebeSEric Cheng 	uintptr_t	poll_ring_add_cf;
383*da14cebeSEric Cheng 	uintptr_t	poll_ring_remove_cf;
384*da14cebeSEric Cheng 	uintptr_t	poll_ring_quiesce_cf;
385*da14cebeSEric Cheng 	uintptr_t	poll_ring_restart_cf;
386*da14cebeSEric Cheng 	uintptr_t	poll_ring_bind_cf;
387*da14cebeSEric Cheng 	void		*poll_ring_ch;
388*da14cebeSEric Cheng 	uintptr_t	poll_mac_accept_df;
389*da14cebeSEric Cheng 	void		*poll_mac_dh;
390*da14cebeSEric Cheng } dld_capab_poll_t;
391*da14cebeSEric Cheng 
392*da14cebeSEric Cheng /*
393*da14cebeSEric Cheng  * LSO capability
394*da14cebeSEric Cheng  */
395*da14cebeSEric Cheng /*
396*da14cebeSEric Cheng  * Currently supported flags for LSO.
397*da14cebeSEric Cheng  */
398*da14cebeSEric Cheng #define	DLD_LSO_TX_BASIC_TCP_IPV4	0x01	/* TCP LSO capability */
399*da14cebeSEric Cheng 
400*da14cebeSEric Cheng typedef struct dld_capab_lso_s {
401*da14cebeSEric Cheng 	uint_t  lso_flags;	/* capability flags */
402*da14cebeSEric Cheng 	uint_t  lso_max;	/* maximum payload */
403*da14cebeSEric Cheng } dld_capab_lso_t;
404*da14cebeSEric Cheng 
405210db224Sericheng int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
406210db224Sericheng int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
407210db224Sericheng int	dld_close(queue_t *);
408210db224Sericheng void	dld_wput(queue_t *, mblk_t *);
409210db224Sericheng void	dld_wsrv(queue_t *);
410210db224Sericheng void	dld_init_ops(struct dev_ops *, const char *);
411210db224Sericheng void	dld_fini_ops(struct dev_ops *);
412d62bc4baSyz147064 int	dld_autopush(dev_t *, struct dlautopush *);
413*da14cebeSEric Cheng 
414*da14cebeSEric Cheng int	dld_add_flow(datalink_id_t, char *, flow_desc_t *,
415*da14cebeSEric Cheng     mac_resource_props_t *);
416*da14cebeSEric Cheng int	dld_remove_flow(char *);
417*da14cebeSEric Cheng int	dld_modify_flow(char *, mac_resource_props_t *);
418*da14cebeSEric Cheng int	dld_walk_flow(dld_ioc_walkflow_t *, intptr_t);
419*da14cebeSEric Cheng 
420210db224Sericheng #endif
421210db224Sericheng 
4227c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4237c478bd9Sstevel@tonic-gate }
4247c478bd9Sstevel@tonic-gate #endif
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate #endif	/* _SYS_DLD_H */
427