xref: /titanic_44/usr/src/uts/common/sys/mac.h (revision e7801d59e8ceda0cde8ebdfdddd7582ee2ea96ef)
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_MAC_H
277c478bd9Sstevel@tonic-gate #define	_SYS_MAC_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
31605445d5Sdg199075 #include <sys/types.h>
327c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
337c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
347c478bd9Sstevel@tonic-gate #include <sys/stream.h>
35*e7801d59Ssowmini #include <sys/dld.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * MAC Services Module
397c478bd9Sstevel@tonic-gate  */
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  * MAC Information (text emitted by modinfo(1m))
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate #define	MAC_INFO	"MAC Services v%I%"
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate /*
51ba2e4443Sseb  * MAC version identifier.  This is used by mac_alloc() mac_register() to
52ba2e4443Sseb  * verify that incompatible drivers don't register.
53ba2e4443Sseb  */
54ba2e4443Sseb #define	MAC_VERSION	0x1
55ba2e4443Sseb 
56ba2e4443Sseb /*
57ba2e4443Sseb  * MAC-Type version identifier.  This is used by mactype_alloc() and
58ba2e4443Sseb  * mactype_register() to verify that incompatible MAC-Type plugins don't
59ba2e4443Sseb  * register.
60ba2e4443Sseb  */
61ba2e4443Sseb #define	MACTYPE_VERSION	0x1
62ba2e4443Sseb 
63ba2e4443Sseb /*
647c478bd9Sstevel@tonic-gate  * Statistics
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #define	XCVR_UNDEFINED		0
687c478bd9Sstevel@tonic-gate #define	XCVR_NONE		1
697c478bd9Sstevel@tonic-gate #define	XCVR_10			2
707c478bd9Sstevel@tonic-gate #define	XCVR_100T4		3
717c478bd9Sstevel@tonic-gate #define	XCVR_100X		4
727c478bd9Sstevel@tonic-gate #define	XCVR_100T2		5
737c478bd9Sstevel@tonic-gate #define	XCVR_1000X		6
747c478bd9Sstevel@tonic-gate #define	XCVR_1000T		7
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate typedef enum {
777c478bd9Sstevel@tonic-gate 	LINK_STATE_UNKNOWN = -1,
787c478bd9Sstevel@tonic-gate 	LINK_STATE_DOWN,
797c478bd9Sstevel@tonic-gate 	LINK_STATE_UP
807c478bd9Sstevel@tonic-gate } link_state_t;
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate typedef enum {
837c478bd9Sstevel@tonic-gate 	LINK_DUPLEX_UNKNOWN = 0,
847c478bd9Sstevel@tonic-gate 	LINK_DUPLEX_HALF,
857c478bd9Sstevel@tonic-gate 	LINK_DUPLEX_FULL
867c478bd9Sstevel@tonic-gate } link_duplex_t;
877c478bd9Sstevel@tonic-gate 
88d62bc4baSyz147064 #define	DATALINK_INVALID_LINKID	0
89d62bc4baSyz147064 #define	DATALINK_ALL_LINKID	0
90d62bc4baSyz147064 #define	DATALINK_MAX_LINKID	0xffffffff
91d62bc4baSyz147064 
92*e7801d59Ssowmini typedef enum {
93*e7801d59Ssowmini 	LINK_FLOWCTRL_NONE = 0,
94*e7801d59Ssowmini 	LINK_FLOWCTRL_RX,
95*e7801d59Ssowmini 	LINK_FLOWCTRL_TX,
96*e7801d59Ssowmini 	LINK_FLOWCTRL_BI
97*e7801d59Ssowmini } link_flowctrl_t;
98*e7801d59Ssowmini 
99843e1988Sjohnlev /*
100843e1988Sjohnlev  * Maximum MAC address length
101843e1988Sjohnlev  */
102843e1988Sjohnlev #define	MAXMACADDRLEN	20
103843e1988Sjohnlev 
1047c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
1057c478bd9Sstevel@tonic-gate 
106ba2e4443Sseb typedef struct mac_stat_info_s {
107ba2e4443Sseb 	uint_t		msi_stat;
108ba2e4443Sseb 	char		*msi_name;
109ba2e4443Sseb 	uint_t		msi_type;	/* as defined in kstat_named_init(9F) */
110ba2e4443Sseb 	uint64_t	msi_default;
111ba2e4443Sseb } mac_stat_info_t;
112ba2e4443Sseb 
1137c478bd9Sstevel@tonic-gate /*
114ba2e4443Sseb  * There are three ranges of statistics values.  0 to 1 - MAC_STAT_MIN are
115ba2e4443Sseb  * interface statistics maintained by the mac module.  MAC_STAT_MIN to 1 -
116ba2e4443Sseb  * MACTYPE_STAT_MIN are common MAC statistics defined by the mac module and
117ba2e4443Sseb  * maintained by each driver.  MACTYPE_STAT_MIN and above are statistics
118ba2e4443Sseb  * defined by MAC-Type plugins and maintained by each driver.
1197c478bd9Sstevel@tonic-gate  */
120ba2e4443Sseb #define	MAC_STAT_MIN		1000
121ba2e4443Sseb #define	MACTYPE_STAT_MIN	2000
122ba2e4443Sseb 
123ba2e4443Sseb #define	IS_MAC_STAT(stat)	\
124ba2e4443Sseb 	(stat >= MAC_STAT_MIN && stat < MACTYPE_STAT_MIN)
125ba2e4443Sseb #define	IS_MACTYPE_STAT(stat)	(stat >= MACTYPE_STAT_MIN)
126ba2e4443Sseb 
1279b14cf1dSgd78059 /*
128d62bc4baSyz147064  * Statistics maintained by the mac module, and possibly populated as link
129d62bc4baSyz147064  * statistics.
130d62bc4baSyz147064  */
131d62bc4baSyz147064 enum mac_mod_stat {
132d62bc4baSyz147064 	MAC_STAT_LINK_STATE,
133d62bc4baSyz147064 	MAC_STAT_LINK_UP,
134d62bc4baSyz147064 	MAC_STAT_PROMISC
135d62bc4baSyz147064 };
136d62bc4baSyz147064 
137d62bc4baSyz147064 /*
1389b14cf1dSgd78059  * Do not reorder, and add only to the end of this list.
1399b14cf1dSgd78059  */
140ba2e4443Sseb enum mac_driver_stat {
141ba2e4443Sseb 	/* MIB-II stats (RFC 1213 and RFC 1573) */
142ba2e4443Sseb 	MAC_STAT_IFSPEED = MAC_STAT_MIN,
1437c478bd9Sstevel@tonic-gate 	MAC_STAT_MULTIRCV,
1447c478bd9Sstevel@tonic-gate 	MAC_STAT_BRDCSTRCV,
1457c478bd9Sstevel@tonic-gate 	MAC_STAT_MULTIXMT,
1467c478bd9Sstevel@tonic-gate 	MAC_STAT_BRDCSTXMT,
1477c478bd9Sstevel@tonic-gate 	MAC_STAT_NORCVBUF,
1487c478bd9Sstevel@tonic-gate 	MAC_STAT_IERRORS,
1497c478bd9Sstevel@tonic-gate 	MAC_STAT_UNKNOWNS,
1507c478bd9Sstevel@tonic-gate 	MAC_STAT_NOXMTBUF,
1517c478bd9Sstevel@tonic-gate 	MAC_STAT_OERRORS,
1527c478bd9Sstevel@tonic-gate 	MAC_STAT_COLLISIONS,
1537c478bd9Sstevel@tonic-gate 	MAC_STAT_RBYTES,
1547c478bd9Sstevel@tonic-gate 	MAC_STAT_IPACKETS,
1557c478bd9Sstevel@tonic-gate 	MAC_STAT_OBYTES,
1569b14cf1dSgd78059 	MAC_STAT_OPACKETS,
1579b14cf1dSgd78059 	MAC_STAT_UNDERFLOWS,
1589b14cf1dSgd78059 	MAC_STAT_OVERFLOWS
1597c478bd9Sstevel@tonic-gate };
1607c478bd9Sstevel@tonic-gate 
1619b14cf1dSgd78059 #define	MAC_NSTAT	(MAC_STAT_OVERFLOWS - MAC_STAT_IFSPEED + 1)
162ba2e4443Sseb 
163ba2e4443Sseb #define	MAC_STAT_ISACOUNTER(_stat) (		\
164ba2e4443Sseb 	    (_stat) == MAC_STAT_MULTIRCV ||	\
165ba2e4443Sseb 	    (_stat) == MAC_STAT_BRDCSTRCV ||	\
166ba2e4443Sseb 	    (_stat) == MAC_STAT_MULTIXMT ||	\
167ba2e4443Sseb 	    (_stat) == MAC_STAT_BRDCSTXMT ||	\
168ba2e4443Sseb 	    (_stat) == MAC_STAT_NORCVBUF ||	\
169ba2e4443Sseb 	    (_stat) == MAC_STAT_IERRORS ||	\
170ba2e4443Sseb 	    (_stat) == MAC_STAT_UNKNOWNS ||	\
171ba2e4443Sseb 	    (_stat) == MAC_STAT_NOXMTBUF ||	\
172ba2e4443Sseb 	    (_stat) == MAC_STAT_OERRORS ||	\
173ba2e4443Sseb 	    (_stat) == MAC_STAT_COLLISIONS ||	\
174ba2e4443Sseb 	    (_stat) == MAC_STAT_RBYTES ||	\
175ba2e4443Sseb 	    (_stat) == MAC_STAT_IPACKETS ||	\
176ba2e4443Sseb 	    (_stat) == MAC_STAT_OBYTES ||	\
1779b14cf1dSgd78059 	    (_stat) == MAC_STAT_OPACKETS ||	\
1789b14cf1dSgd78059 	    (_stat) == MAC_STAT_UNDERFLOWS ||	\
1799b14cf1dSgd78059 	    (_stat) == MAC_STAT_OVERFLOWS)
180ba2e4443Sseb 
1817c478bd9Sstevel@tonic-gate /*
1827c478bd9Sstevel@tonic-gate  * Immutable information. (This may not be modified after registration).
1837c478bd9Sstevel@tonic-gate  */
1847c478bd9Sstevel@tonic-gate typedef struct mac_info_s {
1857c478bd9Sstevel@tonic-gate 	uint_t		mi_media;
1860ba2cbe9Sxc151355 	uint_t		mi_nativemedia;
1877c478bd9Sstevel@tonic-gate 	uint_t		mi_addr_length;
188ba2e4443Sseb 	uint8_t		*mi_unicst_addr;
189ba2e4443Sseb 	uint8_t		*mi_brdcst_addr;
1907c478bd9Sstevel@tonic-gate } mac_info_t;
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate /*
1938347601bSyl150051  * LSO capability
1948347601bSyl150051  */
1958347601bSyl150051 typedef struct lso_basic_tcp_ipv4_s {
1968347601bSyl150051 	t_uscalar_t	lso_max;		/* maximum payload */
1978347601bSyl150051 } lso_basic_tcp_ipv4_t;
1988347601bSyl150051 
1998347601bSyl150051 /*
2008347601bSyl150051  * Future LSO capabilities can be added at the end of the mac_capab_lso_t.
2018347601bSyl150051  * When such capability is added to the GLDv3 framework, the size of the
2028347601bSyl150051  * mac_capab_lso_t it allocates and passes to the drivers increases. Older
2038347601bSyl150051  * drivers wil access only the (upper) sections of that structure, that is the
2048347601bSyl150051  * sections carrying the capabilities they understand. This ensures the
2058347601bSyl150051  * interface can be safely extended in a binary compatible way.
2068347601bSyl150051  */
2078347601bSyl150051 typedef	struct mac_capab_lso_s {
2088347601bSyl150051 	t_uscalar_t		lso_flags;
2098347601bSyl150051 	lso_basic_tcp_ipv4_t	lso_basic_tcp_ipv4;
2108347601bSyl150051 	/* Add future lso capabilities here */
2118347601bSyl150051 } mac_capab_lso_t;
2128347601bSyl150051 
2138347601bSyl150051 /*
214d62bc4baSyz147064  * Information for legacy devices.
215d62bc4baSyz147064  */
216d62bc4baSyz147064 typedef struct mac_capab_legacy_s {
217d62bc4baSyz147064 	/*
218d62bc4baSyz147064 	 * Notifications that the legacy device does not support.
219d62bc4baSyz147064 	 */
220d62bc4baSyz147064 	uint32_t	ml_unsup_note;
221d62bc4baSyz147064 	/*
222d62bc4baSyz147064 	 * dev_t of the legacy device; can be held to force attach.
223d62bc4baSyz147064 	 */
224d62bc4baSyz147064 	dev_t		ml_dev;
225d62bc4baSyz147064 } mac_capab_legacy_t;
226d62bc4baSyz147064 
227d62bc4baSyz147064 /*
228ba2e4443Sseb  * MAC layer capabilities.  These capabilities are handled by the drivers'
229ba2e4443Sseb  * mc_capab_get() callbacks.  Some capabilities require the driver to fill
230ba2e4443Sseb  * in a given data structure, and others are simply boolean capabilities.
231ba2e4443Sseb  * Note that capability values must be powers of 2 so that consumers and
232ba2e4443Sseb  * providers of this interface can keep track of which capabilities they
233ba2e4443Sseb  * care about by keeping a bitfield of these things around somewhere.
2347c478bd9Sstevel@tonic-gate  */
235ba2e4443Sseb typedef enum {
236ba2e4443Sseb 	MAC_CAPAB_HCKSUM	= 0x01, /* data is a uint32_t for the txflags */
237ed8845d8Skrgopi 	MAC_CAPAB_POLL		= 0x02,	/* boolean only, no data */
2388347601bSyl150051 	MAC_CAPAB_MULTIADDRESS	= 0x04, /* data is multiaddress_capab_t */
239d62bc4baSyz147064 	MAC_CAPAB_LSO		= 0x08, /* data is mac_capab_lso_t */
240d62bc4baSyz147064 	MAC_CAPAB_NO_NATIVEVLAN	= 0x10, /* boolean only, no data */
241d62bc4baSyz147064 	MAC_CAPAB_NO_ZCOPY	= 0x20, /* boolean only, no data */
242ba2e4443Sseb 	/* add new capabilities here */
243d62bc4baSyz147064 
244d62bc4baSyz147064 	/* The following capabilities are specific to softmac. */
245d62bc4baSyz147064 	MAC_CAPAB_LEGACY	= 0x8001, /* data is mac_capab_legacy_t */
246ba2e4443Sseb } mac_capab_t;
2477c478bd9Sstevel@tonic-gate 
248ed8845d8Skrgopi typedef int mac_addr_slot_t;
249ed8845d8Skrgopi 
250ed8845d8Skrgopi /* mma_flags values */
251ed8845d8Skrgopi #define	MMAC_SLOT_USED		0x1   /* address slot used */
252ed8845d8Skrgopi #define	MMAC_SLOT_UNUSED	0x2   /* free address slot */
253ed8845d8Skrgopi #define	MMAC_VENDOR_ADDR	0x4   /* address returned is vendor supplied */
254ed8845d8Skrgopi 
255ed8845d8Skrgopi typedef struct mac_multi_address_s {
256ed8845d8Skrgopi 	mac_addr_slot_t	mma_slot;	/* slot for add/remove/get/set */
257ed8845d8Skrgopi 	uint_t		mma_addrlen;
258ed8845d8Skrgopi 	uint8_t		mma_addr[MAXMACADDRLEN];
259ed8845d8Skrgopi 	uint_t		mma_flags;
260ed8845d8Skrgopi } mac_multi_addr_t;
261ed8845d8Skrgopi 
262ed8845d8Skrgopi typedef int	(*maddr_reserve_t)(void *, mac_multi_addr_t *);
263ed8845d8Skrgopi typedef int	(*maddr_add_t)(void *, mac_multi_addr_t *);
264ed8845d8Skrgopi typedef int	(*maddr_remove_t)(void *, mac_addr_slot_t);
265ed8845d8Skrgopi typedef int	(*maddr_modify_t)(void *, mac_multi_addr_t *);
266ed8845d8Skrgopi typedef int	(*maddr_get_t)(void *, mac_multi_addr_t *);
267ed8845d8Skrgopi 
268ed8845d8Skrgopi /* maddr_flag values */
269ed8845d8Skrgopi #define	MADDR_VENDOR_ADDR	0x01	/* addr returned is vendor supplied */
270ed8845d8Skrgopi 
271ed8845d8Skrgopi /* multiple mac address: add/remove/set/get mac address */
272ed8845d8Skrgopi typedef struct multiaddress_capab_s {
273ed8845d8Skrgopi 	int		maddr_naddr;	/* total addresses */
274ed8845d8Skrgopi 	int		maddr_naddrfree;	/* free address slots */
275ed8845d8Skrgopi 	uint_t		maddr_flag;	/* MADDR_VENDOR_ADDR bit can be set */
276ed8845d8Skrgopi 	/* driver entry points */
277ed8845d8Skrgopi 	void		*maddr_handle;	/* cookie to be used for the calls */
278ed8845d8Skrgopi 	maddr_reserve_t	maddr_reserve;	/* reserve a factory address */
279ed8845d8Skrgopi 	maddr_add_t	maddr_add;	/* add a new unicst address */
280ed8845d8Skrgopi 	maddr_remove_t	maddr_remove;	/* remove an added address */
281ed8845d8Skrgopi 	maddr_modify_t	maddr_modify;	/* modify an added address */
282ed8845d8Skrgopi 	maddr_get_t	maddr_get;	/* get address from specified slot */
283ed8845d8Skrgopi } multiaddress_capab_t;
284ed8845d8Skrgopi 
2857c478bd9Sstevel@tonic-gate /*
2867c478bd9Sstevel@tonic-gate  * MAC driver entry point types.
2877c478bd9Sstevel@tonic-gate  */
288ba2e4443Sseb typedef int		(*mac_getstat_t)(void *, uint_t, uint64_t *);
2897c478bd9Sstevel@tonic-gate typedef	int		(*mac_start_t)(void *);
2907c478bd9Sstevel@tonic-gate typedef void		(*mac_stop_t)(void *);
291ba2e4443Sseb typedef int		(*mac_setpromisc_t)(void *, boolean_t);
2927c478bd9Sstevel@tonic-gate typedef int		(*mac_multicst_t)(void *, boolean_t, const uint8_t *);
2937c478bd9Sstevel@tonic-gate typedef int		(*mac_unicst_t)(void *, const uint8_t *);
2947c478bd9Sstevel@tonic-gate typedef void		(*mac_ioctl_t)(void *, queue_t *, mblk_t *);
295ba2e4443Sseb typedef void		(*mac_resources_t)(void *);
2967c478bd9Sstevel@tonic-gate typedef mblk_t		*(*mac_tx_t)(void *, mblk_t *);
297ba2e4443Sseb typedef	boolean_t	(*mac_getcapab_t)(void *, mac_capab_t, void *);
298d62bc4baSyz147064 typedef	int		(*mac_open_t)(void *);
299d62bc4baSyz147064 typedef void		(*mac_close_t)(void *);
300*e7801d59Ssowmini typedef	int		(*mac_set_prop_t)(void *, const char *, mac_prop_id_t,
301*e7801d59Ssowmini     uint_t, const void *);
302*e7801d59Ssowmini typedef	int		(*mac_get_prop_t)(void *, const char *, mac_prop_id_t,
303*e7801d59Ssowmini     uint_t, void *);
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate /*
306ba2e4443Sseb  * Drivers must set all of these callbacks except for mc_resources,
307ba2e4443Sseb  * mc_ioctl, and mc_getcapab, which are optional.  If any of these optional
308ba2e4443Sseb  * callbacks are set, their appropriate flags must be set in mc_callbacks.
309ba2e4443Sseb  * Any future additions to this list must also be accompanied by an
310ba2e4443Sseb  * associated mc_callbacks flag so that the framework can grow without
311ba2e4443Sseb  * affecting the binary compatibility of the interface.
3127c478bd9Sstevel@tonic-gate  */
313ba2e4443Sseb typedef struct mac_callbacks_s {
314ba2e4443Sseb 	uint_t		mc_callbacks;	/* Denotes which callbacks are set */
315ba2e4443Sseb 	mac_getstat_t	mc_getstat;	/* Get the value of a statistic */
316ba2e4443Sseb 	mac_start_t	mc_start;	/* Start the device */
317ba2e4443Sseb 	mac_stop_t	mc_stop;	/* Stop the device */
318ba2e4443Sseb 	mac_setpromisc_t mc_setpromisc;	/* Enable or disable promiscuous mode */
319ba2e4443Sseb 	mac_multicst_t	mc_multicst;	/* Enable or disable a multicast addr */
320ba2e4443Sseb 	mac_unicst_t	mc_unicst;	/* Set the unicast MAC address */
321ba2e4443Sseb 	mac_tx_t	mc_tx;		/* Transmit a packet */
322ba2e4443Sseb 	mac_resources_t	mc_resources;	/* Get the device resources */
323ba2e4443Sseb 	mac_ioctl_t	mc_ioctl;	/* Process an unknown ioctl */
324ba2e4443Sseb 	mac_getcapab_t	mc_getcapab;	/* Get capability information */
325d62bc4baSyz147064 	mac_open_t	mc_open;	/* Open the device */
326d62bc4baSyz147064 	mac_close_t	mc_close;	/* Close the device */
327*e7801d59Ssowmini 	mac_set_prop_t	mc_setprop;
328*e7801d59Ssowmini 	mac_get_prop_t	mc_getprop;
329ba2e4443Sseb } mac_callbacks_t;
3307c478bd9Sstevel@tonic-gate 
3317c478bd9Sstevel@tonic-gate /*
332ba2e4443Sseb  * Flags for mc_callbacks.  Requiring drivers to set the flags associated
333ba2e4443Sseb  * with optional callbacks initialized in the structure allows the mac
334ba2e4443Sseb  * module to add optional callbacks in the future without requiring drivers
335ba2e4443Sseb  * to recompile.
3367c478bd9Sstevel@tonic-gate  */
337ba2e4443Sseb #define	MC_RESOURCES	0x001
338ba2e4443Sseb #define	MC_IOCTL	0x002
339ba2e4443Sseb #define	MC_GETCAPAB	0x004
340d62bc4baSyz147064 #define	MC_OPEN		0x008
341d62bc4baSyz147064 #define	MC_CLOSE	0x010
342*e7801d59Ssowmini #define	MC_SETPROP	0x020
343*e7801d59Ssowmini #define	MC_GETPROP	0x040
344d62bc4baSyz147064 
345d62bc4baSyz147064 #define	MAC_MAX_MINOR	1000
3467c478bd9Sstevel@tonic-gate 
347ba2e4443Sseb typedef struct mac_register_s {
348ba2e4443Sseb 	uint_t		m_version;	/* set by mac_alloc() */
349ba2e4443Sseb 	const char	*m_type_ident;
3507c478bd9Sstevel@tonic-gate 	void		*m_driver;	/* Driver private data */
3517c478bd9Sstevel@tonic-gate 	dev_info_t	*m_dip;
352ba2e4443Sseb 	uint_t		m_instance;
353ba2e4443Sseb 	uint8_t		*m_src_addr;
354ba2e4443Sseb 	uint8_t		*m_dst_addr;
355ba2e4443Sseb 	mac_callbacks_t	*m_callbacks;
356ba2e4443Sseb 	uint_t		m_min_sdu;
357ba2e4443Sseb 	uint_t		m_max_sdu;
358ba2e4443Sseb 	void		*m_pdata;
359ba2e4443Sseb 	size_t		m_pdata_size;
360d62bc4baSyz147064 	uint32_t	m_margin;
361ba2e4443Sseb } mac_register_t;
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate /*
3647c478bd9Sstevel@tonic-gate  * Opaque handle types.
3657c478bd9Sstevel@tonic-gate  */
366ba2e4443Sseb typedef	struct mac_t			*mac_handle_t;
3677c478bd9Sstevel@tonic-gate typedef struct __mac_notify_handle	*mac_notify_handle_t;
3687c478bd9Sstevel@tonic-gate typedef struct __mac_rx_handle		*mac_rx_handle_t;
3697c478bd9Sstevel@tonic-gate typedef struct __mac_txloop_handle	*mac_txloop_handle_t;
3707c478bd9Sstevel@tonic-gate typedef struct __mac_resource_handle	*mac_resource_handle_t;
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate /*
3737c478bd9Sstevel@tonic-gate  * MAC interface callback types.
3747c478bd9Sstevel@tonic-gate  */
3757c478bd9Sstevel@tonic-gate typedef enum {
3767c478bd9Sstevel@tonic-gate 	MAC_NOTE_LINK,
3777c478bd9Sstevel@tonic-gate 	MAC_NOTE_PROMISC,
3787c478bd9Sstevel@tonic-gate 	MAC_NOTE_UNICST,
3797c478bd9Sstevel@tonic-gate 	MAC_NOTE_TX,
3807c478bd9Sstevel@tonic-gate 	MAC_NOTE_RESOURCE,
3817c478bd9Sstevel@tonic-gate 	MAC_NOTE_DEVPROMISC,
382ba2e4443Sseb 	MAC_NOTE_FASTPATH_FLUSH,
383*e7801d59Ssowmini 	MAC_NOTE_SDU_SIZE,
384843e1988Sjohnlev 	MAC_NOTE_VNIC,
385d62bc4baSyz147064 	MAC_NOTE_MARGIN,
3867c478bd9Sstevel@tonic-gate 	MAC_NNOTE	/* must be the last entry */
3877c478bd9Sstevel@tonic-gate } mac_notify_type_t;
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate typedef void		(*mac_notify_t)(void *, mac_notify_type_t);
3907c478bd9Sstevel@tonic-gate typedef void		(*mac_rx_t)(void *, mac_resource_handle_t, mblk_t *);
3917c478bd9Sstevel@tonic-gate typedef void		(*mac_txloop_t)(void *, mblk_t *);
3927c478bd9Sstevel@tonic-gate typedef void		(*mac_blank_t)(void *, time_t, uint_t);
3937c478bd9Sstevel@tonic-gate 
3947c478bd9Sstevel@tonic-gate /*
3957c478bd9Sstevel@tonic-gate  * MAC promiscuous types
3967c478bd9Sstevel@tonic-gate  */
3977c478bd9Sstevel@tonic-gate typedef enum {
3987c478bd9Sstevel@tonic-gate 	MAC_PROMISC = 0x01,		/* MAC instance is promiscuous */
3997c478bd9Sstevel@tonic-gate 	MAC_DEVPROMISC = 0x02		/* Device is promiscuous */
4007c478bd9Sstevel@tonic-gate } mac_promisc_type_t;
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate /*
4037c478bd9Sstevel@tonic-gate  * MAC resource types
4047c478bd9Sstevel@tonic-gate  */
4057c478bd9Sstevel@tonic-gate typedef enum {
4067c478bd9Sstevel@tonic-gate 	MAC_RX_FIFO = 1
4077c478bd9Sstevel@tonic-gate } mac_resource_type_t;
4087c478bd9Sstevel@tonic-gate 
4097c478bd9Sstevel@tonic-gate typedef struct mac_rx_fifo_s {
4107c478bd9Sstevel@tonic-gate 	mac_resource_type_t	mrf_type;	/* MAC_RX_FIFO */
4117c478bd9Sstevel@tonic-gate 	mac_blank_t		mrf_blank;
4127c478bd9Sstevel@tonic-gate 	void			*mrf_arg;
4137c478bd9Sstevel@tonic-gate 	time_t			mrf_normal_blank_time;
4147c478bd9Sstevel@tonic-gate 	uint_t			mrf_normal_pkt_count;
4157c478bd9Sstevel@tonic-gate } mac_rx_fifo_t;
4167c478bd9Sstevel@tonic-gate 
41798b1442aSmeem typedef struct mac_txinfo_s {
41898b1442aSmeem 	mac_tx_t		mt_fn;
41998b1442aSmeem 	void			*mt_arg;
42098b1442aSmeem } mac_txinfo_t;
42198b1442aSmeem 
4227c478bd9Sstevel@tonic-gate typedef union mac_resource_u {
4237c478bd9Sstevel@tonic-gate 	mac_resource_type_t	mr_type;
4247c478bd9Sstevel@tonic-gate 	mac_rx_fifo_t		mr_fifo;
4257c478bd9Sstevel@tonic-gate } mac_resource_t;
4267c478bd9Sstevel@tonic-gate 
4277c478bd9Sstevel@tonic-gate typedef mac_resource_handle_t	(*mac_resource_add_t)(void *, mac_resource_t *);
4287c478bd9Sstevel@tonic-gate 
429ba2e4443Sseb typedef enum {
430ba2e4443Sseb 	MAC_ADDRTYPE_UNICAST,
431ba2e4443Sseb 	MAC_ADDRTYPE_MULTICAST,
432ba2e4443Sseb 	MAC_ADDRTYPE_BROADCAST
433ba2e4443Sseb } mac_addrtype_t;
434ba2e4443Sseb 
435ba2e4443Sseb typedef struct mac_header_info_s {
436ba2e4443Sseb 	size_t		mhi_hdrsize;
437ba2e4443Sseb 	size_t		mhi_pktsize;
438ba2e4443Sseb 	const uint8_t	*mhi_daddr;
439ba2e4443Sseb 	const uint8_t	*mhi_saddr;
440ba2e4443Sseb 	uint32_t	mhi_origsap;
441ba2e4443Sseb 	uint32_t	mhi_bindsap;
442ba2e4443Sseb 	mac_addrtype_t	mhi_dsttype;
443605445d5Sdg199075 	uint16_t	mhi_tci;
444d62bc4baSyz147064 	uint_t		mhi_istagged:1,
445d62bc4baSyz147064 			mhi_prom_looped:1;
446ba2e4443Sseb } mac_header_info_t;
447ba2e4443Sseb 
448ba2e4443Sseb /*
449ba2e4443Sseb  * MAC-Type plugin interfaces
450ba2e4443Sseb  */
451ba2e4443Sseb 
452ba2e4443Sseb typedef int		(*mtops_addr_verify_t)(const void *, void *);
453ba2e4443Sseb typedef boolean_t	(*mtops_sap_verify_t)(uint32_t, uint32_t *, void *);
454ba2e4443Sseb typedef mblk_t		*(*mtops_header_t)(const void *, const void *,
455ba2e4443Sseb     uint32_t, void *, mblk_t *, size_t);
456ba2e4443Sseb typedef int		(*mtops_header_info_t)(mblk_t *, void *,
457ba2e4443Sseb     mac_header_info_t *);
458ba2e4443Sseb typedef boolean_t	(*mtops_pdata_verify_t)(void *, size_t);
459ba2e4443Sseb typedef	mblk_t		*(*mtops_header_modify_t)(mblk_t *, void *);
4600d2a8e5eSgd78059 typedef void		(*mtops_link_details_t)(char *, size_t, mac_handle_t,
4610d2a8e5eSgd78059     void *);
462ba2e4443Sseb 
463ba2e4443Sseb typedef struct mactype_ops_s {
464ba2e4443Sseb 	uint_t			mtops_ops;
465ba2e4443Sseb 	/*
466ba2e4443Sseb 	 * mtops_unicst_verify() returns 0 if the given address is a valid
467ba2e4443Sseb 	 * unicast address, or a non-zero errno otherwise.
468ba2e4443Sseb 	 */
469ba2e4443Sseb 	mtops_addr_verify_t	mtops_unicst_verify;
470ba2e4443Sseb 	/*
471ba2e4443Sseb 	 * mtops_multicst_verify() returns 0 if the given address is a
472ba2e4443Sseb 	 * valid multicast address, or a non-zero errno otherwise.  If the
473ba2e4443Sseb 	 * media doesn't support multicast, ENOTSUP should be returned (for
474ba2e4443Sseb 	 * example).
475ba2e4443Sseb 	 */
476ba2e4443Sseb 	mtops_addr_verify_t	mtops_multicst_verify;
477ba2e4443Sseb 	/*
478ba2e4443Sseb 	 * mtops_sap_verify() returns B_TRUE if the given SAP is a valid
479ba2e4443Sseb 	 * SAP value, or B_FALSE otherwise.
480ba2e4443Sseb 	 */
481ba2e4443Sseb 	mtops_sap_verify_t	mtops_sap_verify;
482ba2e4443Sseb 	/*
483ba2e4443Sseb 	 * mtops_header() is used to allocate and construct a MAC header.
484ba2e4443Sseb 	 */
485ba2e4443Sseb 	mtops_header_t		mtops_header;
486ba2e4443Sseb 	/*
487ba2e4443Sseb 	 * mtops_header_info() is used to gather information on a given MAC
488ba2e4443Sseb 	 * header.
489ba2e4443Sseb 	 */
490ba2e4443Sseb 	mtops_header_info_t	mtops_header_info;
491ba2e4443Sseb 	/*
492ba2e4443Sseb 	 * mtops_pdata_verify() is used to verify the validity of MAC
493ba2e4443Sseb 	 * plugin data.  It is called by mac_register() if the driver has
494ba2e4443Sseb 	 * supplied MAC plugin data, and also by mac_pdata_update() when
495ba2e4443Sseb 	 * drivers update the data.
496ba2e4443Sseb 	 */
497ba2e4443Sseb 	mtops_pdata_verify_t	mtops_pdata_verify;
498ba2e4443Sseb 	/*
499ba2e4443Sseb 	 * mtops_header_cook() is an optional callback that converts (or
500ba2e4443Sseb 	 * "cooks") the given raw header (as sent by a raw DLPI consumer)
501ba2e4443Sseb 	 * into one that is appropriate to send down to the MAC driver.
502ba2e4443Sseb 	 * Following the example above, an Ethernet header sent down by a
503ba2e4443Sseb 	 * DLPI consumer would be converted to whatever header the MAC
504ba2e4443Sseb 	 * driver expects.
505ba2e4443Sseb 	 */
506ba2e4443Sseb 	mtops_header_modify_t	mtops_header_cook;
507ba2e4443Sseb 	/*
508ba2e4443Sseb 	 * mtops_header_uncook() is an optional callback that does the
509ba2e4443Sseb 	 * opposite of mtops_header_cook().  It "uncooks" a given MAC
510ba2e4443Sseb 	 * header (as received from the driver) for consumption by raw DLPI
511ba2e4443Sseb 	 * consumers.  For example, for a non-Ethernet plugin that wants
512ba2e4443Sseb 	 * raw DLPI consumers to be fooled into thinking that the device
513ba2e4443Sseb 	 * provides Ethernet access, this callback would modify the given
514ba2e4443Sseb 	 * mblk_t such that the MAC header is converted to an Ethernet
515ba2e4443Sseb 	 * header.
516ba2e4443Sseb 	 */
517ba2e4443Sseb 	mtops_header_modify_t	mtops_header_uncook;
5180d2a8e5eSgd78059 	/*
5190d2a8e5eSgd78059 	 * mtops_link_details() is an optional callback that provides
5200d2a8e5eSgd78059 	 * extended information about the link state.  Its primary purpose
5210d2a8e5eSgd78059 	 * is to provide type-specific support for syslog contents on
5220d2a8e5eSgd78059 	 * link up events.  If no implementation is provided, then a default
5230d2a8e5eSgd78059 	 * implementation will be used.
5240d2a8e5eSgd78059 	 */
5250d2a8e5eSgd78059 	mtops_link_details_t	mtops_link_details;
526ba2e4443Sseb } mactype_ops_t;
527ba2e4443Sseb 
528ba2e4443Sseb /*
529ba2e4443Sseb  * mtops_ops exists for the plugin to enumerate the optional callback
530ba2e4443Sseb  * entrypoints it has defined.  This allows the mac module to define
531ba2e4443Sseb  * additional plugin entrypoints in mactype_ops_t without breaking backward
532ba2e4443Sseb  * compatibility with old plugins.
533ba2e4443Sseb  */
534ba2e4443Sseb #define	MTOPS_PDATA_VERIFY	0x001
535ba2e4443Sseb #define	MTOPS_HEADER_COOK	0x002
536ba2e4443Sseb #define	MTOPS_HEADER_UNCOOK	0x004
5370d2a8e5eSgd78059 #define	MTOPS_LINK_DETAILS	0x008
538ba2e4443Sseb 
539ba2e4443Sseb typedef struct mactype_register_s {
540ba2e4443Sseb 	uint_t		mtr_version;	/* set by mactype_alloc() */
541ba2e4443Sseb 	const char	*mtr_ident;
542ba2e4443Sseb 	mactype_ops_t	*mtr_ops;
543ba2e4443Sseb 	uint_t		mtr_mactype;
5440ba2cbe9Sxc151355 	uint_t		mtr_nativetype;
545ba2e4443Sseb 	uint_t		mtr_addrlen;
546ba2e4443Sseb 	uint8_t		*mtr_brdcst_addr;
547ba2e4443Sseb 	mac_stat_info_t	*mtr_stats;
548ba2e4443Sseb 	size_t		mtr_statcount;
549ba2e4443Sseb } mactype_register_t;
550ba2e4443Sseb 
551*e7801d59Ssowmini typedef struct mac_prop_s {
552*e7801d59Ssowmini 	mac_prop_id_t	mp_id;
553*e7801d59Ssowmini 	char		*mp_name;
554*e7801d59Ssowmini } mac_prop_t;
555*e7801d59Ssowmini 
5567c478bd9Sstevel@tonic-gate /*
5577c478bd9Sstevel@tonic-gate  * Client interface functions.
5587c478bd9Sstevel@tonic-gate  */
559a08fa175Syz147064 extern int			mac_open(const char *, mac_handle_t *);
560d62bc4baSyz147064 extern int			mac_open_by_linkid(datalink_id_t,
561d62bc4baSyz147064 				    mac_handle_t *);
562d62bc4baSyz147064 extern int			mac_open_by_linkname(const char *,
563d62bc4baSyz147064 				    mac_handle_t *);
5647c478bd9Sstevel@tonic-gate extern void			mac_close(mac_handle_t);
5657c478bd9Sstevel@tonic-gate extern const mac_info_t		*mac_info(mac_handle_t);
566210db224Sericheng extern boolean_t		mac_info_get(const char *, mac_info_t *);
567ba2e4443Sseb extern uint64_t			mac_stat_get(mac_handle_t, uint_t);
5687c478bd9Sstevel@tonic-gate extern int			mac_start(mac_handle_t);
5697c478bd9Sstevel@tonic-gate extern void			mac_stop(mac_handle_t);
5707c478bd9Sstevel@tonic-gate extern int			mac_promisc_set(mac_handle_t, boolean_t,
5717c478bd9Sstevel@tonic-gate 				    mac_promisc_type_t);
5727c478bd9Sstevel@tonic-gate extern boolean_t		mac_promisc_get(mac_handle_t,
5737c478bd9Sstevel@tonic-gate 				    mac_promisc_type_t);
5747c478bd9Sstevel@tonic-gate extern int 			mac_multicst_add(mac_handle_t, const uint8_t *);
5757c478bd9Sstevel@tonic-gate extern int 			mac_multicst_remove(mac_handle_t,
5767c478bd9Sstevel@tonic-gate 				    const uint8_t *);
577ed8845d8Skrgopi extern boolean_t		mac_unicst_verify(mac_handle_t,
578ed8845d8Skrgopi 				    const uint8_t *, uint_t);
5797c478bd9Sstevel@tonic-gate extern int			mac_unicst_set(mac_handle_t, const uint8_t *);
5807c478bd9Sstevel@tonic-gate extern void			mac_unicst_get(mac_handle_t, uint8_t *);
581ba2e4443Sseb extern void			mac_dest_get(mac_handle_t, uint8_t *);
582*e7801d59Ssowmini extern void			mac_sdu_get(mac_handle_t, uint_t *, uint_t *);
5837c478bd9Sstevel@tonic-gate extern void			mac_resources(mac_handle_t);
5847c478bd9Sstevel@tonic-gate extern void			mac_ioctl(mac_handle_t, queue_t *, mblk_t *);
58598b1442aSmeem extern const mac_txinfo_t	*mac_tx_get(mac_handle_t);
586843e1988Sjohnlev extern const mac_txinfo_t	*mac_vnic_tx_get(mac_handle_t);
5877c478bd9Sstevel@tonic-gate extern link_state_t		mac_link_get(mac_handle_t);
5887c478bd9Sstevel@tonic-gate extern mac_notify_handle_t	mac_notify_add(mac_handle_t, mac_notify_t,
5897c478bd9Sstevel@tonic-gate 				    void *);
5907c478bd9Sstevel@tonic-gate extern void			mac_notify_remove(mac_handle_t,
5917c478bd9Sstevel@tonic-gate 				    mac_notify_handle_t);
5927c478bd9Sstevel@tonic-gate extern void			mac_notify(mac_handle_t);
5937c478bd9Sstevel@tonic-gate extern mac_rx_handle_t		mac_rx_add(mac_handle_t, mac_rx_t, void *);
594843e1988Sjohnlev extern mac_rx_handle_t		mac_active_rx_add(mac_handle_t, mac_rx_t,
595843e1988Sjohnlev 				    void *);
5961f8aaf0dSethindra extern void			mac_rx_remove(mac_handle_t, mac_rx_handle_t,
5971f8aaf0dSethindra 				    boolean_t);
5981f8aaf0dSethindra extern void			mac_rx_remove_wait(mac_handle_t);
5997c478bd9Sstevel@tonic-gate extern mblk_t			*mac_txloop(void *, mblk_t *);
6007c478bd9Sstevel@tonic-gate extern mac_txloop_handle_t	mac_txloop_add(mac_handle_t, mac_txloop_t,
6017c478bd9Sstevel@tonic-gate 				    void *);
6027c478bd9Sstevel@tonic-gate extern void			mac_txloop_remove(mac_handle_t,
6037c478bd9Sstevel@tonic-gate 				    mac_txloop_handle_t);
6047c478bd9Sstevel@tonic-gate extern boolean_t		mac_active_set(mac_handle_t);
605843e1988Sjohnlev extern boolean_t		mac_active_shareable_set(mac_handle_t);
6067c478bd9Sstevel@tonic-gate extern void			mac_active_clear(mac_handle_t);
607843e1988Sjohnlev extern void			mac_active_rx(void *, mac_resource_handle_t,
608843e1988Sjohnlev 				    mblk_t *);
609843e1988Sjohnlev extern boolean_t		mac_vnic_set(mac_handle_t, mac_txinfo_t *,
610843e1988Sjohnlev 				    mac_getcapab_t, void *);
611843e1988Sjohnlev extern void			mac_vnic_clear(mac_handle_t);
6127c478bd9Sstevel@tonic-gate extern void			mac_resource_set(mac_handle_t,
6137c478bd9Sstevel@tonic-gate 				    mac_resource_add_t, void *);
614210db224Sericheng extern dev_info_t		*mac_devinfo_get(mac_handle_t);
615d62bc4baSyz147064 extern const char		*mac_name(mac_handle_t);
616d62bc4baSyz147064 extern minor_t			mac_minor(mac_handle_t);
617ba2e4443Sseb extern boolean_t		mac_capab_get(mac_handle_t, mac_capab_t,
618ba2e4443Sseb 				    void *);
619843e1988Sjohnlev extern boolean_t		mac_vnic_capab_get(mac_handle_t, mac_capab_t,
620843e1988Sjohnlev 				    void *);
621ba2e4443Sseb extern boolean_t		mac_sap_verify(mac_handle_t, uint32_t,
622ba2e4443Sseb 				    uint32_t *);
623ba2e4443Sseb extern mblk_t			*mac_header(mac_handle_t, const uint8_t *,
624ba2e4443Sseb 				    uint32_t, mblk_t *, size_t);
625ba2e4443Sseb extern int			mac_header_info(mac_handle_t, mblk_t *,
626ba2e4443Sseb 				    mac_header_info_t *);
627ba2e4443Sseb extern mblk_t			*mac_header_cook(mac_handle_t, mblk_t *);
628ba2e4443Sseb extern mblk_t			*mac_header_uncook(mac_handle_t, mblk_t *);
629d62bc4baSyz147064 extern minor_t			mac_minor_hold(boolean_t);
630d62bc4baSyz147064 extern void			mac_minor_rele(minor_t);
6317c478bd9Sstevel@tonic-gate 
6327c478bd9Sstevel@tonic-gate /*
6337c478bd9Sstevel@tonic-gate  * Driver interface functions.
6347c478bd9Sstevel@tonic-gate  */
635ba2e4443Sseb extern mac_register_t		*mac_alloc(uint_t);
636ba2e4443Sseb extern void			mac_free(mac_register_t *);
637ba2e4443Sseb extern int			mac_register(mac_register_t *, mac_handle_t *);
638843e1988Sjohnlev extern int			mac_disable(mac_handle_t);
639ba2e4443Sseb extern int  			mac_unregister(mac_handle_t);
640ba2e4443Sseb extern void 			mac_rx(mac_handle_t, mac_resource_handle_t,
6417c478bd9Sstevel@tonic-gate 				    mblk_t *);
642ba2e4443Sseb extern void 			mac_link_update(mac_handle_t, link_state_t);
643ba2e4443Sseb extern void 			mac_unicst_update(mac_handle_t,
644ba2e4443Sseb 				    const uint8_t *);
645ba2e4443Sseb extern void			mac_tx_update(mac_handle_t);
646ba2e4443Sseb extern void			mac_resource_update(mac_handle_t);
647ba2e4443Sseb extern mac_resource_handle_t	mac_resource_add(mac_handle_t,
648ba2e4443Sseb 				    mac_resource_t *);
649*e7801d59Ssowmini extern int			mac_maxsdu_update(mac_handle_t, uint_t);
650ba2e4443Sseb extern int			mac_pdata_update(mac_handle_t, void *,
651ba2e4443Sseb 				    size_t);
652ba2e4443Sseb extern void			mac_multicst_refresh(mac_handle_t,
653ba2e4443Sseb 				    mac_multicst_t, void *, boolean_t);
654ba2e4443Sseb extern void			mac_unicst_refresh(mac_handle_t, mac_unicst_t,
6557c478bd9Sstevel@tonic-gate 				    void *);
656ba2e4443Sseb extern void			mac_promisc_refresh(mac_handle_t,
657ba2e4443Sseb 				    mac_setpromisc_t, void *);
658d62bc4baSyz147064 extern boolean_t		mac_margin_update(mac_handle_t, uint32_t);
659d62bc4baSyz147064 extern void			mac_margin_get(mac_handle_t, uint32_t *);
660d62bc4baSyz147064 extern int			mac_margin_remove(mac_handle_t, uint32_t);
661d62bc4baSyz147064 extern int			mac_margin_add(mac_handle_t, uint32_t *,
662d62bc4baSyz147064 				    boolean_t);
663210db224Sericheng extern void			mac_init_ops(struct dev_ops *, const char *);
664210db224Sericheng extern void			mac_fini_ops(struct dev_ops *);
665d62bc4baSyz147064 extern uint32_t			mac_no_notification(mac_handle_t);
666d62bc4baSyz147064 extern boolean_t		mac_is_legacy(mac_handle_t);
667d62bc4baSyz147064 extern int			mac_hold_exclusive(mac_handle_t);
668d62bc4baSyz147064 extern void			mac_rele_exclusive(mac_handle_t);
669d62bc4baSyz147064 
670ba2e4443Sseb extern mactype_register_t	*mactype_alloc(uint_t);
671ba2e4443Sseb extern void			mactype_free(mactype_register_t *);
672ba2e4443Sseb extern int			mactype_register(mactype_register_t *);
673ba2e4443Sseb extern int			mactype_unregister(const char *);
674*e7801d59Ssowmini extern int			mac_set_prop(mac_handle_t, mac_prop_t *,
675*e7801d59Ssowmini     void *, uint_t);
676*e7801d59Ssowmini extern int			mac_get_prop(mac_handle_t, mac_prop_t *,
677*e7801d59Ssowmini     void *, uint_t);
6787c478bd9Sstevel@tonic-gate 
6797c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
6807c478bd9Sstevel@tonic-gate 
6817c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
6827c478bd9Sstevel@tonic-gate }
6837c478bd9Sstevel@tonic-gate #endif
6847c478bd9Sstevel@tonic-gate 
6857c478bd9Sstevel@tonic-gate #endif /* _SYS_MAC_H */
686