xref: /onnv-gate/usr/src/uts/common/sys/mac_provider.h (revision 8400:773afdd54b44)
18275SEric Cheng /*
28275SEric Cheng  * CDDL HEADER START
38275SEric Cheng  *
48275SEric Cheng  * The contents of this file are subject to the terms of the
58275SEric Cheng  * Common Development and Distribution License (the "License").
68275SEric Cheng  * You may not use this file except in compliance with the License.
78275SEric Cheng  *
88275SEric Cheng  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
98275SEric Cheng  * or http://www.opensolaris.org/os/licensing.
108275SEric Cheng  * See the License for the specific language governing permissions
118275SEric Cheng  * and limitations under the License.
128275SEric Cheng  *
138275SEric Cheng  * When distributing Covered Code, include this CDDL HEADER in each
148275SEric Cheng  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
158275SEric Cheng  * If applicable, add the following below this CDDL HEADER, with the
168275SEric Cheng  * fields enclosed by brackets "[]" replaced with your own identifying
178275SEric Cheng  * information: Portions Copyright [yyyy] [name of copyright owner]
188275SEric Cheng  *
198275SEric Cheng  * CDDL HEADER END
208275SEric Cheng  */
218275SEric Cheng 
228275SEric Cheng /*
238275SEric Cheng  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
248275SEric Cheng  * Use is subject to license terms.
258275SEric Cheng  */
268275SEric Cheng 
278275SEric Cheng #ifndef	_SYS_MAC_PROVIDER_H
288275SEric Cheng #define	_SYS_MAC_PROVIDER_H
298275SEric Cheng 
308275SEric Cheng #include <sys/types.h>
318275SEric Cheng #include <sys/ddi.h>
328275SEric Cheng #include <sys/sunddi.h>
338275SEric Cheng #include <sys/stream.h>
348275SEric Cheng #include <sys/mac_flow.h>
358275SEric Cheng #include <sys/mac.h>
368275SEric Cheng 
378275SEric Cheng /*
388275SEric Cheng  * MAC Provider Interface
398275SEric Cheng  */
408275SEric Cheng 
418275SEric Cheng #ifdef	__cplusplus
428275SEric Cheng extern "C" {
438275SEric Cheng #endif
448275SEric Cheng 
458275SEric Cheng /*
468275SEric Cheng  * MAC version identifier.  This is used by mac_alloc() mac_register() to
478275SEric Cheng  * verify that incompatible drivers don't register.
488275SEric Cheng  */
49*8400SNicolas.Droux@Sun.COM #define	MAC_VERSION	0x2
508275SEric Cheng 
518275SEric Cheng /*
528275SEric Cheng  * Opaque handle types
538275SEric Cheng  */
548275SEric Cheng typedef struct __mac_rule_handle	*mac_rule_handle_t;
558275SEric Cheng 
568275SEric Cheng /*
578275SEric Cheng  * Statistics
588275SEric Cheng  */
598275SEric Cheng 
608275SEric Cheng #define	XCVR_UNDEFINED		0
618275SEric Cheng #define	XCVR_NONE		1
628275SEric Cheng #define	XCVR_10			2
638275SEric Cheng #define	XCVR_100T4		3
648275SEric Cheng #define	XCVR_100X		4
658275SEric Cheng #define	XCVR_100T2		5
668275SEric Cheng #define	XCVR_1000X		6
678275SEric Cheng #define	XCVR_1000T		7
688275SEric Cheng 
698275SEric Cheng #ifdef	_KERNEL
708275SEric Cheng 
718275SEric Cheng /*
728275SEric Cheng  * Definitions for MAC Drivers Capabilities
738275SEric Cheng  */
748275SEric Cheng /*
758275SEric Cheng  * MAC layer capabilities.  These capabilities are handled by the drivers'
768275SEric Cheng  * mc_capab_get() callbacks.  Some capabilities require the driver to fill
778275SEric Cheng  * in a given data structure, and others are simply boolean capabilities.
788275SEric Cheng  * Note that capability values must be powers of 2 so that consumers and
798275SEric Cheng  * providers of this interface can keep track of which capabilities they
808275SEric Cheng  * care about by keeping a bitfield of these things around somewhere.
818275SEric Cheng  */
828275SEric Cheng typedef enum {
838275SEric Cheng 	/*
848275SEric Cheng 	 * Capabilities reserved for internal use only
858275SEric Cheng 	 */
868275SEric Cheng 	MAC_CAPAB_VNIC		= 0x0001, /* data is mac_capab_vnic_t */
878275SEric Cheng 	MAC_CAPAB_ANCHOR_VNIC	= 0x0002, /* boolean only, no data */
888275SEric Cheng 	MAC_CAPAB_AGGR		= 0x0004, /* data is mac_capab_aggr_t */
898275SEric Cheng 	MAC_CAPAB_NO_NATIVEVLAN	= 0x0008, /* boolean only, no data */
908275SEric Cheng 	MAC_CAPAB_NO_ZCOPY	= 0x0010, /* boolean only, no data */
918275SEric Cheng 	MAC_CAPAB_LEGACY	= 0x0020, /* data is mac_capab_legacy_t */
928275SEric Cheng 
938275SEric Cheng 	/*
948275SEric Cheng 	 * Public Capabilities
958275SEric Cheng 	 */
968275SEric Cheng 	MAC_CAPAB_HCKSUM	= 0x0100, /* data is a uint32_t */
978275SEric Cheng 	MAC_CAPAB_LSO		= 0x0200, /* data is mac_capab_lso_t */
988275SEric Cheng 	MAC_CAPAB_RINGS		= 0x0400, /* data is mac_capab_rings_t */
998275SEric Cheng 	MAC_CAPAB_MULTIFACTADDR = 0x0800, /* mac_data_multifactaddr_t */
1008275SEric Cheng 	MAC_CAPAB_SHARES	= 0x1000 /* data is mac_capab_share_t */
1018275SEric Cheng 
1028275SEric Cheng 	/* add new capabilities here */
1038275SEric Cheng } mac_capab_t;
1048275SEric Cheng 
1058275SEric Cheng 
1068275SEric Cheng /*
1078275SEric Cheng  * LSO capability
1088275SEric Cheng  */
1098275SEric Cheng typedef struct lso_basic_tcp_ipv4_s {
1108275SEric Cheng 	t_uscalar_t	lso_max;		/* maximum payload */
1118275SEric Cheng } lso_basic_tcp_ipv4_t;
1128275SEric Cheng 
1138275SEric Cheng /*
1148275SEric Cheng  * Currently supported flags for LSO.
1158275SEric Cheng  */
1168275SEric Cheng #define	LSO_TX_BASIC_TCP_IPV4	0x01		/* TCP LSO capability */
1178275SEric Cheng 
1188275SEric Cheng /*
1198275SEric Cheng  * Future LSO capabilities can be added at the end of the mac_capab_lso_t.
1208275SEric Cheng  * When such capability is added to the GLDv3 framework, the size of the
1218275SEric Cheng  * mac_capab_lso_t it allocates and passes to the drivers increases. Older
1228275SEric Cheng  * drivers wil access only the (upper) sections of that structure, that is the
1238275SEric Cheng  * sections carrying the capabilities they understand. This ensures the
1248275SEric Cheng  * interface can be safely extended in a binary compatible way.
1258275SEric Cheng  */
1268275SEric Cheng typedef	struct mac_capab_lso_s {
1278275SEric Cheng 	t_uscalar_t		lso_flags;
1288275SEric Cheng 	lso_basic_tcp_ipv4_t	lso_basic_tcp_ipv4;
1298275SEric Cheng 	/* Add future lso capabilities here */
1308275SEric Cheng } mac_capab_lso_t;
1318275SEric Cheng 
1328275SEric Cheng /*
1338275SEric Cheng  * Multiple Factory MAC Addresses Capability
1348275SEric Cheng  */
1358275SEric Cheng typedef struct mac_capab_multifactaddr_s {
1368275SEric Cheng 	/*
1378275SEric Cheng 	 * Number of factory addresses
1388275SEric Cheng 	 */
1398275SEric Cheng 	uint_t		mcm_naddr;
1408275SEric Cheng 
1418275SEric Cheng 	/*
1428275SEric Cheng 	 * Callbacks to query all the factory addresses.
1438275SEric Cheng 	 */
1448275SEric Cheng 	void		(*mcm_getaddr)(void *, uint_t, uint8_t *);
1458275SEric Cheng } mac_capab_multifactaddr_t;
1468275SEric Cheng 
1478275SEric Cheng /*
1488275SEric Cheng  * MAC driver entry point types.
1498275SEric Cheng  */
1508275SEric Cheng typedef int		(*mac_getstat_t)(void *, uint_t, uint64_t *);
1518275SEric Cheng typedef	int		(*mac_start_t)(void *);
1528275SEric Cheng typedef void		(*mac_stop_t)(void *);
1538275SEric Cheng typedef int		(*mac_setpromisc_t)(void *, boolean_t);
1548275SEric Cheng typedef int		(*mac_multicst_t)(void *, boolean_t, const uint8_t *);
1558275SEric Cheng typedef int		(*mac_unicst_t)(void *, const uint8_t *);
1568275SEric Cheng typedef void		(*mac_ioctl_t)(void *, queue_t *, mblk_t *);
1578275SEric Cheng typedef void		(*mac_resources_t)(void *);
1588275SEric Cheng typedef mblk_t		*(*mac_tx_t)(void *, mblk_t *);
1598275SEric Cheng typedef	boolean_t	(*mac_getcapab_t)(void *, mac_capab_t, void *);
1608275SEric Cheng typedef	int		(*mac_open_t)(void *);
1618275SEric Cheng typedef void		(*mac_close_t)(void *);
1628275SEric Cheng typedef	int		(*mac_set_prop_t)(void *, const char *, mac_prop_id_t,
1638275SEric Cheng 			    uint_t, const void *);
1648275SEric Cheng typedef	int		(*mac_get_prop_t)(void *, const char *, mac_prop_id_t,
1658275SEric Cheng 			    uint_t, uint_t, void *, uint_t *);
1668275SEric Cheng 
1678275SEric Cheng /*
1688275SEric Cheng  * Drivers must set all of these callbacks except for mc_resources,
1698275SEric Cheng  * mc_ioctl, and mc_getcapab, which are optional.  If any of these optional
1708275SEric Cheng  * callbacks are set, their appropriate flags must be set in mc_callbacks.
1718275SEric Cheng  * Any future additions to this list must also be accompanied by an
1728275SEric Cheng  * associated mc_callbacks flag so that the framework can grow without
1738275SEric Cheng  * affecting the binary compatibility of the interface.
1748275SEric Cheng  */
1758275SEric Cheng typedef struct mac_callbacks_s {
1768275SEric Cheng 	uint_t		mc_callbacks;	/* Denotes which callbacks are set */
1778275SEric Cheng 	mac_getstat_t	mc_getstat;	/* Get the value of a statistic */
1788275SEric Cheng 	mac_start_t	mc_start;	/* Start the device */
1798275SEric Cheng 	mac_stop_t	mc_stop;	/* Stop the device */
1808275SEric Cheng 	mac_setpromisc_t mc_setpromisc;	/* Enable or disable promiscuous mode */
1818275SEric Cheng 	mac_multicst_t	mc_multicst;	/* Enable or disable a multicast addr */
1828275SEric Cheng 	mac_unicst_t	mc_unicst;	/* Set the unicast MAC address */
1838275SEric Cheng 	mac_tx_t	mc_tx;		/* Transmit a packet */
1848275SEric Cheng 	mac_ioctl_t	mc_ioctl;	/* Process an unknown ioctl */
1858275SEric Cheng 	mac_getcapab_t	mc_getcapab;	/* Get capability information */
1868275SEric Cheng 	mac_open_t	mc_open;	/* Open the device */
1878275SEric Cheng 	mac_close_t	mc_close;	/* Close the device */
1888275SEric Cheng 	mac_set_prop_t	mc_setprop;
1898275SEric Cheng 	mac_get_prop_t	mc_getprop;
1908275SEric Cheng } mac_callbacks_t;
1918275SEric Cheng 
1928275SEric Cheng typedef struct mac_priv_prop_s {
1938275SEric Cheng 	char	mpp_name[MAXLINKPROPNAME];
1948275SEric Cheng 	uint_t	mpp_flags;
1958275SEric Cheng } mac_priv_prop_t;
1968275SEric Cheng 
1978275SEric Cheng /*
1988275SEric Cheng  * Virtualization Capabilities
1998275SEric Cheng  */
2008275SEric Cheng /*
2018275SEric Cheng  * The ordering of entries below is important. MAC_HW_CLASSIFIER
2028275SEric Cheng  * is the cutoff below which are entries which don't depend on
2038275SEric Cheng  * H/W. MAC_HW_CLASSIFIER and entries after that are cases where
2048275SEric Cheng  * H/W has been updated through add/modify/delete APIs.
2058275SEric Cheng  */
2068275SEric Cheng typedef enum {
2078275SEric Cheng 	MAC_NO_CLASSIFIER = 0,
2088275SEric Cheng 	MAC_SW_CLASSIFIER,
2098275SEric Cheng 	MAC_HW_CLASSIFIER
2108275SEric Cheng } mac_classify_type_t;
2118275SEric Cheng 
2128275SEric Cheng typedef	void	(*mac_rx_func_t)(void *, mac_resource_handle_t, mblk_t *,
2138275SEric Cheng     boolean_t);
2148275SEric Cheng 
2158275SEric Cheng /*
2168275SEric Cheng  * The virtualization level conveys the extent of the NIC hardware assistance
2178275SEric Cheng  * for traffic steering employed for virtualization:
2188275SEric Cheng  *
2198275SEric Cheng  * MAC_VIRT_NONE:	No assist for v12n.
2208275SEric Cheng  *
2218275SEric Cheng  * MAC_VIRT_LEVEL1:	Multiple Rx rings with MAC address level
2228275SEric Cheng  *			classification between groups of rings.
2238275SEric Cheng  *			Requires the support of the MAC_CAPAB_RINGS
2248275SEric Cheng  *			capability.
2258275SEric Cheng  *
2268275SEric Cheng  * MAC_VIRT_HIO:	Hybrid I/O capable MAC. Require the support
2278275SEric Cheng  *			of the MAC_CAPAB_SHARES capability.
2288275SEric Cheng  *
2298275SEric Cheng  * MAC_VIRT_SERIALIZE:	Temporary flag *ONLY* for nxge. Mac layer
2308275SEric Cheng  *			uses this to enable mac Tx serializer on
2318275SEric Cheng  *			outbound traffic and to always enqueue
2328275SEric Cheng  * 			incoming traffic on Rx soft rings in mac.
2338275SEric Cheng  */
2348275SEric Cheng #define	MAC_VIRT_NONE		0x0
2358275SEric Cheng #define	MAC_VIRT_LEVEL1		0x1
2368275SEric Cheng #define	MAC_VIRT_HIO		0x2
2378275SEric Cheng #define	MAC_VIRT_SERIALIZE	0x4
2388275SEric Cheng 
2398275SEric Cheng typedef enum {
2408275SEric Cheng 	MAC_RING_TYPE_RX = 1,	/* Receive ring */
2418275SEric Cheng 	MAC_RING_TYPE_TX	/* Transmit ring */
2428275SEric Cheng } mac_ring_type_t;
2438275SEric Cheng 
2448275SEric Cheng #define	MAX_RINGS_PER_GROUP	32
2458275SEric Cheng 
2468275SEric Cheng /*
2478275SEric Cheng  * Grouping type of a ring group
2488275SEric Cheng  *
2498275SEric Cheng  * MAC_GROUP_TYPE_STATIC: The ring group can not be re-grouped.
2508275SEric Cheng  * MAC_GROUP_TYPE_DYNAMIC: The ring group support dynamic re-grouping
2518275SEric Cheng  */
2528275SEric Cheng typedef enum {
2538275SEric Cheng 	MAC_GROUP_TYPE_STATIC = 1,	/* Static ring group */
2548275SEric Cheng 	MAC_GROUP_TYPE_DYNAMIC		/* Dynamic ring group */
2558275SEric Cheng } mac_group_type_t;
2568275SEric Cheng 
2578275SEric Cheng typedef	struct __mac_ring_driver	*mac_ring_driver_t;
2588275SEric Cheng typedef	struct __mac_group_driver	*mac_group_driver_t;
2598275SEric Cheng 
2608275SEric Cheng typedef	struct mac_ring_info_s mac_ring_info_t;
2618275SEric Cheng typedef	struct mac_group_info_s mac_group_info_t;
2628275SEric Cheng 
2638275SEric Cheng typedef void	(*mac_get_ring_t)(void *, mac_ring_type_t, const int, const int,
2648275SEric Cheng     mac_ring_info_t *, mac_ring_handle_t);
2658275SEric Cheng typedef void	(*mac_get_group_t)(void *, mac_ring_type_t, const int,
2668275SEric Cheng     mac_group_info_t *, mac_group_handle_t);
2678275SEric Cheng 
2688275SEric Cheng typedef void	(*mac_group_add_ring_t)(mac_group_driver_t,
2698275SEric Cheng     mac_ring_driver_t, mac_ring_type_t);
2708275SEric Cheng typedef void	(*mac_group_rem_ring_t)(mac_group_driver_t,
2718275SEric Cheng     mac_ring_driver_t, mac_ring_type_t);
2728275SEric Cheng 
2738275SEric Cheng /*
2748275SEric Cheng  * Multiple Rings Capability
2758275SEric Cheng  */
2768275SEric Cheng typedef struct	mac_capab_rings_s {
2778275SEric Cheng 	mac_ring_type_t		mr_type;	/* Ring type: Rx vs Tx */
2788275SEric Cheng 	mac_group_type_t	mr_group_type;	/* Dynamic vs static grouping */
2798275SEric Cheng 	uint_t			mr_rnum;	/* Number of rings */
2808275SEric Cheng 	uint_t			mr_gnum;	/* Number of ring groups */
2818275SEric Cheng 	mac_get_ring_t		mr_rget;	/* Get ring from driver */
2828275SEric Cheng 	mac_get_group_t		mr_gget;	/* Get ring group from driver */
2838275SEric Cheng 	mac_group_add_ring_t	mr_gaddring;	/* Add ring into a group */
2848275SEric Cheng 	mac_group_rem_ring_t	mr_gremring;	/* Remove ring from a group */
2858275SEric Cheng } mac_capab_rings_t;
2868275SEric Cheng 
2878275SEric Cheng /*
2888275SEric Cheng  * Common ring functions and driver interfaces
2898275SEric Cheng  */
2908275SEric Cheng typedef	int	(*mac_ring_start_t)(mac_ring_driver_t, uint64_t);
2918275SEric Cheng typedef	void	(*mac_ring_stop_t)(mac_ring_driver_t);
2928275SEric Cheng 
2938275SEric Cheng typedef	mblk_t	*(*mac_ring_send_t)(void *, mblk_t *);
2948275SEric Cheng typedef	mblk_t	*(*mac_ring_poll_t)(void *, int);
2958275SEric Cheng 
2968275SEric Cheng typedef struct mac_ring_info_s {
2978275SEric Cheng 	mac_ring_driver_t	mri_driver;
2988275SEric Cheng 	mac_ring_start_t	mri_start;
2998275SEric Cheng 	mac_ring_stop_t		mri_stop;
3008275SEric Cheng 	mac_intr_t		mri_intr;
3018275SEric Cheng 	union {
3028275SEric Cheng 		mac_ring_send_t	send;
3038275SEric Cheng 		mac_ring_poll_t	poll;
3048275SEric Cheng 	} mrfunion;
3058275SEric Cheng } mac_ring_info_s;
3068275SEric Cheng 
3078275SEric Cheng #define	mri_tx			mrfunion.send
3088275SEric Cheng #define	mri_poll		mrfunion.poll
3098275SEric Cheng 
3108275SEric Cheng typedef	int	(*mac_group_start_t)(mac_group_driver_t);
3118275SEric Cheng typedef	void	(*mac_group_stop_t)(mac_group_driver_t);
3128275SEric Cheng typedef	int	(*mac_add_mac_addr_t)(void *, const uint8_t *);
3138275SEric Cheng typedef	int	(*mac_rem_mac_addr_t)(void *, const uint8_t *);
3148275SEric Cheng 
3158275SEric Cheng struct mac_group_info_s {
3168275SEric Cheng 	mac_group_driver_t	mgi_driver;	/* Driver reference */
3178275SEric Cheng 	mac_group_start_t	mgi_start;	/* Start the group */
3188275SEric Cheng 	mac_group_stop_t	mgi_stop;	/* Stop the group */
3198275SEric Cheng 	uint_t			mgi_count;	/* Count of rings */
3208275SEric Cheng 	mac_intr_t		mgi_intr;	/* Optional per-group intr */
3218275SEric Cheng 
3228275SEric Cheng 	/* Only used for rx groups */
3238275SEric Cheng 	mac_add_mac_addr_t	mgi_addmac;	/* Add a MAC address */
3248275SEric Cheng 	mac_rem_mac_addr_t	mgi_remmac;	/* Remove a MAC address */
3258275SEric Cheng };
3268275SEric Cheng 
3278275SEric Cheng /*
3288275SEric Cheng  * Share management functions.
3298275SEric Cheng  */
3308275SEric Cheng typedef uint64_t mac_share_handle_t;
3318275SEric Cheng 
3328275SEric Cheng /*
3338275SEric Cheng  * Allocate and free a share. Returns ENOSPC if all shares have been
3348275SEric Cheng  * previously allocated.
3358275SEric Cheng  */
3368275SEric Cheng typedef int (*mac_alloc_share_t)(void *, mac_share_handle_t *);
3378275SEric Cheng typedef void (*mac_free_share_t)(mac_share_handle_t);
3388275SEric Cheng 
3398275SEric Cheng /*
3408275SEric Cheng  * Bind and unbind a share. Binding a share allows a domain
3418275SEric Cheng  * to have direct access to the groups and rings associated with
3428275SEric Cheng  * that share.
3438275SEric Cheng  */
3448275SEric Cheng typedef int (*mac_bind_share_t)(mac_share_handle_t, uint64_t, uint64_t *);
3458275SEric Cheng typedef void (*mac_unbind_share_t)(mac_share_handle_t);
3468275SEric Cheng 
3478275SEric Cheng /*
3488275SEric Cheng  * Return information on about a share.
3498275SEric Cheng  */
3508275SEric Cheng typedef void (*mac_share_query_t)(mac_share_handle_t, mac_ring_type_t,
3518275SEric Cheng     mac_ring_handle_t *, uint_t *);
3528275SEric Cheng 
3538275SEric Cheng /*
3548275SEric Cheng  * Basic idea, bind previously created ring groups to shares
3558275SEric Cheng  * for them to be exported (or shared) by another domain.
3568275SEric Cheng  * These interfaces bind/unbind the ring group to a share.
3578275SEric Cheng  * The groups and their rings will be shared with the guest
3588275SEric Cheng  * as soon as the share is bound.
3598275SEric Cheng  */
3608275SEric Cheng typedef int (*mac_share_add_group_t)(mac_share_handle_t,
3618275SEric Cheng     mac_group_driver_t);
3628275SEric Cheng typedef int (*mac_share_rem_group_t)(mac_share_handle_t,
3638275SEric Cheng     mac_group_driver_t);
3648275SEric Cheng 
3658275SEric Cheng typedef struct  mac_capab_share_s {
3668275SEric Cheng 	uint_t			ms_snum;	/* Number of shares (vr's) */
3678275SEric Cheng 	void			*ms_handle;	/* Handle to driver. */
3688275SEric Cheng 	mac_alloc_share_t	ms_salloc;	/* Get a share from driver. */
3698275SEric Cheng 	mac_free_share_t	ms_sfree;	/* Return a share to driver. */
3708275SEric Cheng 	mac_share_add_group_t	ms_sadd;	/* Add a group to the share. */
3718275SEric Cheng 	mac_share_rem_group_t	ms_sremove;	/* Remove group from share. */
3728275SEric Cheng 	mac_share_query_t	ms_squery;	/* Query share constraints */
3738275SEric Cheng 	mac_bind_share_t	ms_sbind;	/* Bind a share */
3748275SEric Cheng 	mac_unbind_share_t	ms_sunbind;	/* Unbind a share */
3758275SEric Cheng } mac_capab_share_t;
3768275SEric Cheng 
3778275SEric Cheng /*
3788275SEric Cheng  * MAC registration interface
3798275SEric Cheng  */
3808275SEric Cheng typedef struct mac_register_s {
3818275SEric Cheng 	uint_t			m_version;	/* set by mac_alloc() */
3828275SEric Cheng 	const char		*m_type_ident;
3838275SEric Cheng 	void			*m_driver;	/* Driver private data */
3848275SEric Cheng 	dev_info_t		*m_dip;
3858275SEric Cheng 	uint_t			m_instance;
3868275SEric Cheng 	uint8_t			*m_src_addr;
3878275SEric Cheng 	uint8_t			*m_dst_addr;
3888275SEric Cheng 	mac_callbacks_t		*m_callbacks;
3898275SEric Cheng 	uint_t			m_min_sdu;
3908275SEric Cheng 	uint_t			m_max_sdu;
3918275SEric Cheng 	void			*m_pdata;
3928275SEric Cheng 	size_t			m_pdata_size;
3938275SEric Cheng 	uint32_t		m_margin;
3948275SEric Cheng 	mac_priv_prop_t		*m_priv_props;
3958275SEric Cheng 	size_t			m_priv_prop_count;
3968275SEric Cheng 	uint32_t		m_v12n;		/* Virtualization level */
3978275SEric Cheng } mac_register_t;
3988275SEric Cheng 
3998275SEric Cheng /*
4008275SEric Cheng  * Flags for mc_callbacks.  Requiring drivers to set the flags associated
4018275SEric Cheng  * with optional callbacks initialized in the structure allows the mac
4028275SEric Cheng  * module to add optional callbacks in the future without requiring drivers
4038275SEric Cheng  * to recompile.
4048275SEric Cheng  */
4058275SEric Cheng #define	MC_IOCTL	0x001
4068275SEric Cheng #define	MC_GETCAPAB	0x002
4078275SEric Cheng #define	MC_OPEN		0x004
4088275SEric Cheng #define	MC_CLOSE	0x008
4098275SEric Cheng #define	MC_SETPROP	0x010
4108275SEric Cheng #define	MC_GETPROP	0x020
4118275SEric Cheng 
4128275SEric Cheng /*
4138275SEric Cheng  * Driver interface functions.
4148275SEric Cheng  */
4158275SEric Cheng extern void			mac_sdu_get(mac_handle_t, uint_t *, uint_t *);
4168275SEric Cheng extern int			mac_maxsdu_update(mac_handle_t, uint_t);
4178275SEric Cheng extern int			mac_set_prop(mac_handle_t, mac_prop_t *,
4188275SEric Cheng 				    void *, uint_t);
4198275SEric Cheng extern int			mac_get_prop(mac_handle_t, mac_prop_t *,
4208275SEric Cheng 				    void *, uint_t, uint_t *);
4218275SEric Cheng 
4228275SEric Cheng extern mac_register_t		*mac_alloc(uint_t);
4238275SEric Cheng extern void			mac_free(mac_register_t *);
4248275SEric Cheng extern int			mac_register(mac_register_t *, mac_handle_t *);
4258275SEric Cheng extern int			mac_disable_nowait(mac_handle_t);
4268275SEric Cheng extern int			mac_disable(mac_handle_t);
4278275SEric Cheng extern int  			mac_unregister(mac_handle_t);
4288275SEric Cheng extern void 			mac_rx(mac_handle_t, mac_resource_handle_t,
4298275SEric Cheng 				    mblk_t *);
4308275SEric Cheng extern void 			mac_rx_ring(mac_handle_t, mac_ring_handle_t,
4318275SEric Cheng 				    mblk_t *, uint64_t);
4328275SEric Cheng extern void 			mac_link_update(mac_handle_t, link_state_t);
4338275SEric Cheng extern void 			mac_unicst_update(mac_handle_t,
4348275SEric Cheng 				    const uint8_t *);
4358275SEric Cheng extern void			mac_tx_update(mac_handle_t);
4368275SEric Cheng extern void			mac_tx_ring_update(mac_handle_t,
4378275SEric Cheng 				    mac_ring_handle_t);
4388275SEric Cheng extern void			mac_resource_update(mac_handle_t);
4398275SEric Cheng extern void			mac_capab_update(mac_handle_t);
4408275SEric Cheng extern int			mac_pdata_update(mac_handle_t, void *,
4418275SEric Cheng 				    size_t);
4428275SEric Cheng extern void			mac_multicast_refresh(mac_handle_t,
4438275SEric Cheng 				    mac_multicst_t, void *, boolean_t);
4448275SEric Cheng extern void			mac_unicst_refresh(mac_handle_t, mac_unicst_t,
4458275SEric Cheng 				    void *);
4468275SEric Cheng extern void			mac_promisc_refresh(mac_handle_t,
4478275SEric Cheng 				    mac_setpromisc_t, void *);
4488275SEric Cheng extern boolean_t		mac_margin_update(mac_handle_t, uint32_t);
4498275SEric Cheng extern void			mac_margin_get(mac_handle_t, uint32_t *);
4508275SEric Cheng extern int			mac_margin_remove(mac_handle_t, uint32_t);
4518275SEric Cheng extern int			mac_margin_add(mac_handle_t, uint32_t *,
4528275SEric Cheng 				    boolean_t);
4538275SEric Cheng extern void			mac_init_ops(struct dev_ops *, const char *);
4548275SEric Cheng extern void			mac_fini_ops(struct dev_ops *);
4558275SEric Cheng extern uint32_t			mac_no_notification(mac_handle_t);
4568275SEric Cheng 
4578275SEric Cheng extern mactype_register_t	*mactype_alloc(uint_t);
4588275SEric Cheng extern void			mactype_free(mactype_register_t *);
4598275SEric Cheng extern int			mactype_register(mactype_register_t *);
4608275SEric Cheng extern int			mactype_unregister(const char *);
4618275SEric Cheng extern void			mac_set_ring(void *, void *);
4628275SEric Cheng 
4638275SEric Cheng extern boolean_t		mac_unicst_verify(mac_handle_t,
4648275SEric Cheng 				    const uint8_t *, uint_t);
4658275SEric Cheng 
4668275SEric Cheng extern boolean_t		mac_is_vnic(mac_handle_t);
4678275SEric Cheng 
4688275SEric Cheng extern int			mac_group_add_ring(mac_group_handle_t, int);
4698275SEric Cheng extern void			mac_group_rem_ring(mac_group_handle_t,
4708275SEric Cheng 				    mac_ring_handle_t);
4718275SEric Cheng 
4728275SEric Cheng #endif	/* _KERNEL */
4738275SEric Cheng 
4748275SEric Cheng #ifdef	__cplusplus
4758275SEric Cheng }
4768275SEric Cheng #endif
4778275SEric Cheng 
4788275SEric Cheng #endif /* _SYS_MAC_PROVIDER_H */
479