xref: /titanic_52/usr/src/uts/common/sys/mac.h (revision b142f83db07eef31395422eb0514e14b61cb678b)
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  */
21da14cebeSEric Cheng 
227c478bd9Sstevel@tonic-gate /*
231cfa752fSRamaswamy Tummala  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24*b142f83dSRobert Mustacchi  * Copyright (c) 2017, Joyent, Inc.
253bc4925dSGarrett D'Amore  * Copyright (c) 2015 Garrett D'Amore <garrett@damore.org>
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef	_SYS_MAC_H
297c478bd9Sstevel@tonic-gate #define	_SYS_MAC_H
307c478bd9Sstevel@tonic-gate 
31605445d5Sdg199075 #include <sys/types.h>
3282a2fc47SJames Carlson #ifdef	_KERNEL
337c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
3482a2fc47SJames Carlson #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  * MAC Services Module
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
417c478bd9Sstevel@tonic-gate extern "C" {
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * MAC Information (text emitted by modinfo(1m))
467c478bd9Sstevel@tonic-gate  */
4761af1958SGarrett D'Amore #define	MAC_INFO	"MAC Services"
48ba2e4443Sseb 
49ba2e4443Sseb /*
50ba2e4443Sseb  * MAC-Type version identifier.  This is used by mactype_alloc() and
51ba2e4443Sseb  * mactype_register() to verify that incompatible MAC-Type plugins don't
52ba2e4443Sseb  * register.
53ba2e4443Sseb  */
54ba2e4443Sseb #define	MACTYPE_VERSION	0x1
55ba2e4443Sseb 
56ba2e4443Sseb /*
57da14cebeSEric Cheng  * Opaque handle types
587c478bd9Sstevel@tonic-gate  */
59da14cebeSEric Cheng typedef struct __mac_handle		*mac_handle_t;
60da14cebeSEric Cheng typedef struct __mac_resource_handle	*mac_resource_handle_t;
61da14cebeSEric Cheng typedef struct __mac_notify_handle	*mac_notify_handle_t;
62da14cebeSEric Cheng typedef struct __mac_tx_notify_handle	*mac_tx_notify_handle_t;
63da14cebeSEric Cheng typedef	struct __mac_intr_handle	*mac_intr_handle_t;
64da14cebeSEric Cheng typedef	struct __mac_ring_handle	*mac_ring_handle_t;
65da14cebeSEric Cheng typedef	struct __mac_group_handle	*mac_group_handle_t;
667c478bd9Sstevel@tonic-gate 
67da14cebeSEric Cheng #define	DATALINK_INVALID_LINKID	0
68da14cebeSEric Cheng #define	DATALINK_ALL_LINKID	0
69da14cebeSEric Cheng #define	DATALINK_MAX_LINKID	0xffffffff
70da14cebeSEric Cheng 
717c478bd9Sstevel@tonic-gate typedef enum {
727c478bd9Sstevel@tonic-gate 	LINK_STATE_UNKNOWN = -1,
737c478bd9Sstevel@tonic-gate 	LINK_STATE_DOWN,
747c478bd9Sstevel@tonic-gate 	LINK_STATE_UP
757c478bd9Sstevel@tonic-gate } link_state_t;
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate typedef enum {
787c478bd9Sstevel@tonic-gate 	LINK_DUPLEX_UNKNOWN = 0,
797c478bd9Sstevel@tonic-gate 	LINK_DUPLEX_HALF,
807c478bd9Sstevel@tonic-gate 	LINK_DUPLEX_FULL
817c478bd9Sstevel@tonic-gate } link_duplex_t;
827c478bd9Sstevel@tonic-gate 
83e7801d59Ssowmini typedef enum {
84e7801d59Ssowmini 	LINK_FLOWCTRL_NONE = 0,
85e7801d59Ssowmini 	LINK_FLOWCTRL_RX,
86e7801d59Ssowmini 	LINK_FLOWCTRL_TX,
87e7801d59Ssowmini 	LINK_FLOWCTRL_BI
88e7801d59Ssowmini } link_flowctrl_t;
89e7801d59Ssowmini 
90e75f0919SSebastien Roy typedef enum {
91e75f0919SSebastien Roy 	LINK_TAGMODE_VLANONLY = 0,
92e75f0919SSebastien Roy 	LINK_TAGMODE_NORMAL
93e75f0919SSebastien Roy } link_tagmode_t;
94e75f0919SSebastien Roy 
95da14cebeSEric Cheng /*
960dc2366fSVenugopal Iyer  * Defines range of uint32_t values
97f0f2c3a5SGirish Moodalbail  */
98f0f2c3a5SGirish Moodalbail typedef struct mac_propval_uint32_range_s {
99f0f2c3a5SGirish Moodalbail 	uint32_t mpur_min;
100f0f2c3a5SGirish Moodalbail 	uint32_t mpur_max;
101f0f2c3a5SGirish Moodalbail } mac_propval_uint32_range_t;
102f0f2c3a5SGirish Moodalbail 
103f0f2c3a5SGirish Moodalbail /*
1040dc2366fSVenugopal Iyer  * Data type of property values.
105f0f2c3a5SGirish Moodalbail  */
106f0f2c3a5SGirish Moodalbail typedef enum {
1070dc2366fSVenugopal Iyer 	MAC_PROPVAL_UINT8,
1080dc2366fSVenugopal Iyer 	MAC_PROPVAL_UINT32,
1090dc2366fSVenugopal Iyer 	MAC_PROPVAL_STR
110f0f2c3a5SGirish Moodalbail } mac_propval_type_t;
111f0f2c3a5SGirish Moodalbail 
112f0f2c3a5SGirish Moodalbail /*
113f0f2c3a5SGirish Moodalbail  * Captures possible values for a given property. A property can have
114f0f2c3a5SGirish Moodalbail  * range of values (int32, int64, uint32, uint64, et al) or collection/
115f0f2c3a5SGirish Moodalbail  * enumeration of values (strings).
116f0f2c3a5SGirish Moodalbail  * Can be used as a value-result parameter.
117f0f2c3a5SGirish Moodalbail  */
118f0f2c3a5SGirish Moodalbail typedef struct mac_propval_range_s {
119f0f2c3a5SGirish Moodalbail 	uint_t mpr_count;			/* count of ranges */
120f0f2c3a5SGirish Moodalbail 	mac_propval_type_t mpr_type;		/* type of value */
121f0f2c3a5SGirish Moodalbail 	union {
122f0f2c3a5SGirish Moodalbail 		mac_propval_uint32_range_t mpr_uint32[1];
123f0f2c3a5SGirish Moodalbail 	} u;
124f0f2c3a5SGirish Moodalbail } mac_propval_range_t;
125f0f2c3a5SGirish Moodalbail 
1260dc2366fSVenugopal Iyer #define	mpr_range_uint32	u.mpr_uint32
127f0f2c3a5SGirish Moodalbail 
128f0f2c3a5SGirish Moodalbail /*
129da14cebeSEric Cheng  * Maximum MAC address length
130da14cebeSEric Cheng  */
131da14cebeSEric Cheng #define	MAXMACADDRLEN		20
132da14cebeSEric Cheng 
1331a41ca23SJerry Jelinek #define	MPT_MAXMACADDR		32
1341a41ca23SJerry Jelinek 
1351a41ca23SJerry Jelinek typedef struct mac_secondary_addr_s {
1361a41ca23SJerry Jelinek 	uint32_t	ms_addrcnt;
1371a41ca23SJerry Jelinek 	uint8_t		ms_addrs[MPT_MAXMACADDR][MAXMACADDRLEN];
1381a41ca23SJerry Jelinek } mac_secondary_addr_t;
1391a41ca23SJerry Jelinek 
140da14cebeSEric Cheng typedef enum {
141da14cebeSEric Cheng 	MAC_LOGTYPE_LINK = 1,
142da14cebeSEric Cheng 	MAC_LOGTYPE_FLOW
143da14cebeSEric Cheng } mac_logtype_t;
1443fd94f8cSam223141 
1450dc2366fSVenugopal Iyer #define	MAXLINKPROPNAME		256		/* max property name len */
1460dc2366fSVenugopal Iyer 
1473fd94f8cSam223141 /*
1480dc2366fSVenugopal Iyer  * Public properties.
1493fd94f8cSam223141  *
1500dc2366fSVenugopal Iyer  * Note that there are 2 sets of parameters: the *_EN_* values are
1510dc2366fSVenugopal Iyer  * those that the Administrator configures for autonegotiation. The
1520dc2366fSVenugopal Iyer  * _ADV_* values are those that are currently exposed over the wire.
153422542c1SRobert Mustacchi  *
154422542c1SRobert Mustacchi  * Please append properties to the end of this list. Do not reorder the list.
1553fd94f8cSam223141  */
1563fd94f8cSam223141 typedef enum {
1573fd94f8cSam223141 	MAC_PROP_DUPLEX = 0x00000001,
1583fd94f8cSam223141 	MAC_PROP_SPEED,
1593fd94f8cSam223141 	MAC_PROP_STATUS,
1603fd94f8cSam223141 	MAC_PROP_AUTONEG,
1613fd94f8cSam223141 	MAC_PROP_EN_AUTONEG,
1623fd94f8cSam223141 	MAC_PROP_MTU,
1633bc21d0aSAruna Ramakrishna - Sun Microsystems 	MAC_PROP_ZONE,
1643bc21d0aSAruna Ramakrishna - Sun Microsystems 	MAC_PROP_AUTOPUSH,
1653fd94f8cSam223141 	MAC_PROP_FLOWCTRL,
1663fd94f8cSam223141 	MAC_PROP_ADV_1000FDX_CAP,
1673fd94f8cSam223141 	MAC_PROP_EN_1000FDX_CAP,
1683fd94f8cSam223141 	MAC_PROP_ADV_1000HDX_CAP,
1693fd94f8cSam223141 	MAC_PROP_EN_1000HDX_CAP,
1703fd94f8cSam223141 	MAC_PROP_ADV_100FDX_CAP,
1713fd94f8cSam223141 	MAC_PROP_EN_100FDX_CAP,
1723fd94f8cSam223141 	MAC_PROP_ADV_100HDX_CAP,
1733fd94f8cSam223141 	MAC_PROP_EN_100HDX_CAP,
1743fd94f8cSam223141 	MAC_PROP_ADV_10FDX_CAP,
1753fd94f8cSam223141 	MAC_PROP_EN_10FDX_CAP,
1763fd94f8cSam223141 	MAC_PROP_ADV_10HDX_CAP,
1773fd94f8cSam223141 	MAC_PROP_EN_10HDX_CAP,
1783fd94f8cSam223141 	MAC_PROP_ADV_100T4_CAP,
1793fd94f8cSam223141 	MAC_PROP_EN_100T4_CAP,
1802b24ab6bSSebastien Roy 	MAC_PROP_IPTUN_HOPLIMIT,
1812b24ab6bSSebastien Roy 	MAC_PROP_IPTUN_ENCAPLIMIT,
182bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_ESSID,
183bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_BSSID,
184bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_BSSTYPE,
185bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_LINKSTATUS,
186bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_DESIRED_RATES,
187bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_SUPPORTED_RATES,
188bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_AUTH_MODE,
189bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_ENCRYPTION,
190bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_RSSI,
191bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_PHY_CONFIG,
192bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_CAPABILITY,
193bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_WPA,
194bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_SCANRESULTS,
195bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_POWER_MODE,
196bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_RADIO,
197bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_ESS_LIST,
198bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_KEY_TAB,
199bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_CREATE_IBSS,
200bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_SETOPTIE,
201bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_DELKEY,
202bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_KEY,
203bcb5c89dSSowmini Varadhan 	MAC_PROP_WL_MLME,
204e75f0919SSebastien Roy 	MAC_PROP_TAGMODE,
205aca118b7Slucy wang - Sun Microsystems - Beijing China 	MAC_PROP_ADV_10GFDX_CAP,
206aca118b7Slucy wang - Sun Microsystems - Beijing China 	MAC_PROP_EN_10GFDX_CAP,
2074eaa4710SRishi Srivatsavai 	MAC_PROP_PVID,
2084eaa4710SRishi Srivatsavai 	MAC_PROP_LLIMIT,
2094eaa4710SRishi Srivatsavai 	MAC_PROP_LDECAY,
2100dc2366fSVenugopal Iyer 	MAC_PROP_RESOURCE,
2110dc2366fSVenugopal Iyer 	MAC_PROP_RESOURCE_EFF,
2120dc2366fSVenugopal Iyer 	MAC_PROP_RXRINGSRANGE,
2130dc2366fSVenugopal Iyer 	MAC_PROP_TXRINGSRANGE,
2140dc2366fSVenugopal Iyer 	MAC_PROP_MAX_TX_RINGS_AVAIL,
2150dc2366fSVenugopal Iyer 	MAC_PROP_MAX_RX_RINGS_AVAIL,
2160dc2366fSVenugopal Iyer 	MAC_PROP_MAX_RXHWCLNT_AVAIL,
2170dc2366fSVenugopal Iyer 	MAC_PROP_MAX_TXHWCLNT_AVAIL,
2181cfa752fSRamaswamy Tummala 	MAC_PROP_IB_LINKMODE,
219098d2c75SRobert Mustacchi 	MAC_PROP_VN_PROMISC_FILTERED,
2201a41ca23SJerry Jelinek 	MAC_PROP_SECONDARY_ADDRS,
2213bc4925dSGarrett D'Amore 	MAC_PROP_ADV_40GFDX_CAP,
2223bc4925dSGarrett D'Amore 	MAC_PROP_EN_40GFDX_CAP,
2233bc4925dSGarrett D'Amore 	MAC_PROP_ADV_100GFDX_CAP,
2243bc4925dSGarrett D'Amore 	MAC_PROP_EN_100GFDX_CAP,
2253bc4925dSGarrett D'Amore 	MAC_PROP_ADV_2500FDX_CAP,
2263bc4925dSGarrett D'Amore 	MAC_PROP_EN_2500FDX_CAP,
2273bc4925dSGarrett D'Amore 	MAC_PROP_ADV_5000FDX_CAP,
2283bc4925dSGarrett D'Amore 	MAC_PROP_EN_5000FDX_CAP,
229422542c1SRobert Mustacchi 	MAC_PROP_ADV_25GFDX_CAP,
230422542c1SRobert Mustacchi 	MAC_PROP_EN_25GFDX_CAP,
231422542c1SRobert Mustacchi 	MAC_PROP_ADV_50GFDX_CAP,
232422542c1SRobert Mustacchi 	MAC_PROP_EN_50GFDX_CAP,
2333fd94f8cSam223141 	MAC_PROP_PRIVATE = -1
2343fd94f8cSam223141 } mac_prop_id_t;
2353fd94f8cSam223141 
236843e1988Sjohnlev /*
237afdda45fSVasumathi Sundaram - Sun Microsystems  * Flags to figure out r/w status of legacy ndd props.
238afdda45fSVasumathi Sundaram - Sun Microsystems  */
239afdda45fSVasumathi Sundaram - Sun Microsystems #define	MAC_PROP_PERM_READ		0x0001
240afdda45fSVasumathi Sundaram - Sun Microsystems #define	MAC_PROP_PERM_WRITE		0x0010
241afdda45fSVasumathi Sundaram - Sun Microsystems #define	MAC_PROP_MAP_KSTAT		0x0100
242afdda45fSVasumathi Sundaram - Sun Microsystems #define	MAC_PROP_PERM_RW		(MAC_PROP_PERM_READ|MAC_PROP_PERM_WRITE)
243afdda45fSVasumathi Sundaram - Sun Microsystems #define	MAC_PROP_FLAGS_RK		(MAC_PROP_PERM_READ|MAC_PROP_MAP_KSTAT)
244afdda45fSVasumathi Sundaram - Sun Microsystems 
245*b142f83dSRobert Mustacchi /*
246*b142f83dSRobert Mustacchi  * Valid LED mode bits
247*b142f83dSRobert Mustacchi  */
248*b142f83dSRobert Mustacchi typedef enum mac_led_mode {
249*b142f83dSRobert Mustacchi 	MAC_LED_DEFAULT	= (1 << 0),
250*b142f83dSRobert Mustacchi 	MAC_LED_OFF	= (1 << 1),
251*b142f83dSRobert Mustacchi 	MAC_LED_IDENT	= (1 << 2),
252*b142f83dSRobert Mustacchi 	MAC_LED_ON	= (1 << 3)
253*b142f83dSRobert Mustacchi } mac_led_mode_t;
254*b142f83dSRobert Mustacchi 
255*b142f83dSRobert Mustacchi 
2567c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate /*
259ba2e4443Sseb  * There are three ranges of statistics values.  0 to 1 - MAC_STAT_MIN are
260ba2e4443Sseb  * interface statistics maintained by the mac module.  MAC_STAT_MIN to 1 -
261ba2e4443Sseb  * MACTYPE_STAT_MIN are common MAC statistics defined by the mac module and
262ba2e4443Sseb  * maintained by each driver.  MACTYPE_STAT_MIN and above are statistics
263ba2e4443Sseb  * defined by MAC-Type plugins and maintained by each driver.
2647c478bd9Sstevel@tonic-gate  */
265ba2e4443Sseb #define	MAC_STAT_MIN		1000
266ba2e4443Sseb #define	MACTYPE_STAT_MIN	2000
267ba2e4443Sseb 
268ba2e4443Sseb #define	IS_MAC_STAT(stat)	\
269ba2e4443Sseb 	(stat >= MAC_STAT_MIN && stat < MACTYPE_STAT_MIN)
270ba2e4443Sseb #define	IS_MACTYPE_STAT(stat)	(stat >= MACTYPE_STAT_MIN)
271ba2e4443Sseb 
2729b14cf1dSgd78059 /*
273d62bc4baSyz147064  * Statistics maintained by the mac module, and possibly populated as link
274d62bc4baSyz147064  * statistics.
275d62bc4baSyz147064  */
276d62bc4baSyz147064 enum mac_mod_stat {
277d62bc4baSyz147064 	MAC_STAT_LINK_STATE,
278d62bc4baSyz147064 	MAC_STAT_LINK_UP,
2794eaa4710SRishi Srivatsavai 	MAC_STAT_PROMISC,
2800dc2366fSVenugopal Iyer 	MAC_STAT_LOWLINK_STATE,
2810dc2366fSVenugopal Iyer 	MAC_STAT_HDROPS
282d62bc4baSyz147064 };
283d62bc4baSyz147064 
284d62bc4baSyz147064 /*
2859b14cf1dSgd78059  * Do not reorder, and add only to the end of this list.
2869b14cf1dSgd78059  */
287ba2e4443Sseb enum mac_driver_stat {
288ba2e4443Sseb 	/* MIB-II stats (RFC 1213 and RFC 1573) */
289ba2e4443Sseb 	MAC_STAT_IFSPEED = MAC_STAT_MIN,
2907c478bd9Sstevel@tonic-gate 	MAC_STAT_MULTIRCV,
2917c478bd9Sstevel@tonic-gate 	MAC_STAT_BRDCSTRCV,
2927c478bd9Sstevel@tonic-gate 	MAC_STAT_MULTIXMT,
2937c478bd9Sstevel@tonic-gate 	MAC_STAT_BRDCSTXMT,
2947c478bd9Sstevel@tonic-gate 	MAC_STAT_NORCVBUF,
2957c478bd9Sstevel@tonic-gate 	MAC_STAT_IERRORS,
2967c478bd9Sstevel@tonic-gate 	MAC_STAT_UNKNOWNS,
2977c478bd9Sstevel@tonic-gate 	MAC_STAT_NOXMTBUF,
2987c478bd9Sstevel@tonic-gate 	MAC_STAT_OERRORS,
2997c478bd9Sstevel@tonic-gate 	MAC_STAT_COLLISIONS,
3007c478bd9Sstevel@tonic-gate 	MAC_STAT_RBYTES,
3017c478bd9Sstevel@tonic-gate 	MAC_STAT_IPACKETS,
3027c478bd9Sstevel@tonic-gate 	MAC_STAT_OBYTES,
3039b14cf1dSgd78059 	MAC_STAT_OPACKETS,
3049b14cf1dSgd78059 	MAC_STAT_UNDERFLOWS,
3059b14cf1dSgd78059 	MAC_STAT_OVERFLOWS
3067c478bd9Sstevel@tonic-gate };
3077c478bd9Sstevel@tonic-gate 
3089b14cf1dSgd78059 #define	MAC_NSTAT	(MAC_STAT_OVERFLOWS - MAC_STAT_IFSPEED + 1)
309ba2e4443Sseb 
310ba2e4443Sseb #define	MAC_STAT_ISACOUNTER(_stat) (		\
311ba2e4443Sseb 	    (_stat) == MAC_STAT_MULTIRCV ||	\
312ba2e4443Sseb 	    (_stat) == MAC_STAT_BRDCSTRCV ||	\
313ba2e4443Sseb 	    (_stat) == MAC_STAT_MULTIXMT ||	\
314ba2e4443Sseb 	    (_stat) == MAC_STAT_BRDCSTXMT ||	\
315ba2e4443Sseb 	    (_stat) == MAC_STAT_NORCVBUF ||	\
316ba2e4443Sseb 	    (_stat) == MAC_STAT_IERRORS ||	\
317ba2e4443Sseb 	    (_stat) == MAC_STAT_UNKNOWNS ||	\
318ba2e4443Sseb 	    (_stat) == MAC_STAT_NOXMTBUF ||	\
319ba2e4443Sseb 	    (_stat) == MAC_STAT_OERRORS ||	\
320ba2e4443Sseb 	    (_stat) == MAC_STAT_COLLISIONS ||	\
321ba2e4443Sseb 	    (_stat) == MAC_STAT_RBYTES ||	\
322ba2e4443Sseb 	    (_stat) == MAC_STAT_IPACKETS ||	\
323ba2e4443Sseb 	    (_stat) == MAC_STAT_OBYTES ||	\
3249b14cf1dSgd78059 	    (_stat) == MAC_STAT_OPACKETS ||	\
3259b14cf1dSgd78059 	    (_stat) == MAC_STAT_UNDERFLOWS ||	\
3269b14cf1dSgd78059 	    (_stat) == MAC_STAT_OVERFLOWS)
327ba2e4443Sseb 
3287c478bd9Sstevel@tonic-gate /*
3297c478bd9Sstevel@tonic-gate  * Immutable information. (This may not be modified after registration).
3307c478bd9Sstevel@tonic-gate  */
3317c478bd9Sstevel@tonic-gate typedef struct mac_info_s {
3327c478bd9Sstevel@tonic-gate 	uint_t		mi_media;
3330ba2cbe9Sxc151355 	uint_t		mi_nativemedia;
3347c478bd9Sstevel@tonic-gate 	uint_t		mi_addr_length;
335ba2e4443Sseb 	uint8_t		*mi_unicst_addr;
336ba2e4443Sseb 	uint8_t		*mi_brdcst_addr;
3377c478bd9Sstevel@tonic-gate } mac_info_t;
3387c478bd9Sstevel@tonic-gate 
3397c478bd9Sstevel@tonic-gate /*
340da14cebeSEric Cheng  * When VNICs are created on top of the NIC, there are two levels
341da14cebeSEric Cheng  * of MAC layer, a lower MAC, which is the MAC layer at the level of the
342da14cebeSEric Cheng  * physical NIC, and an upper MAC, which is the MAC layer at the level
343da14cebeSEric Cheng  * of the VNIC. Each VNIC maps to a MAC client at the lower MAC, and
344da14cebeSEric Cheng  * the SRS and classification is done at the lower MAC level. The upper
345da14cebeSEric Cheng  * MAC is therefore for the most part pass-through, and therefore
346da14cebeSEric Cheng  * special processing needs to be done at the upper MAC layer when
347da14cebeSEric Cheng  * dealing with a VNIC.
348678453a8Sspeer  *
349da14cebeSEric Cheng  * This capability allows the MAC layer to detect when a VNIC is being
350da14cebeSEric Cheng  * access, and implement the required shortcuts.
3511a41ca23SJerry Jelinek  *
3521a41ca23SJerry Jelinek  * In addition, this capability is used to keep the VNIC's secondary
3531a41ca23SJerry Jelinek  * mac_clients in sync when the primary MAC is updated.
354678453a8Sspeer  */
355678453a8Sspeer 
356da14cebeSEric Cheng typedef void *(*mac_client_handle_fn_t)(void *);
3571a41ca23SJerry Jelinek typedef void (*mac_client_update_fn_t)(void *);
358678453a8Sspeer 
359da14cebeSEric Cheng typedef struct mac_capab_vnic_s {
360da14cebeSEric Cheng 	void			*mcv_arg;
361da14cebeSEric Cheng 	mac_client_handle_fn_t	mcv_mac_client_handle;
3621a41ca23SJerry Jelinek 	mac_client_update_fn_t	mcv_mac_secondary_update;
363da14cebeSEric Cheng } mac_capab_vnic_t;
364678453a8Sspeer 
365da14cebeSEric Cheng typedef void (*mac_rename_fn_t)(const char *, void *);
3660dc2366fSVenugopal Iyer typedef mblk_t *(*mac_tx_ring_fn_t)(void *, mblk_t *, uintptr_t,
3670dc2366fSVenugopal Iyer     mac_ring_handle_t *);
368da14cebeSEric Cheng typedef struct mac_capab_aggr_s {
369da14cebeSEric Cheng 	mac_rename_fn_t mca_rename_fn;
370da14cebeSEric Cheng 	int (*mca_unicst)(void *, const uint8_t *);
3710dc2366fSVenugopal Iyer 	mac_tx_ring_fn_t mca_find_tx_ring_fn;
3720dc2366fSVenugopal Iyer 	void *mca_arg;
373da14cebeSEric Cheng } mac_capab_aggr_t;
374678453a8Sspeer 
3754eaa4710SRishi Srivatsavai /* Bridge transmit and receive function signatures */
3764eaa4710SRishi Srivatsavai typedef mblk_t *(*mac_bridge_tx_t)(mac_handle_t, mac_ring_handle_t, mblk_t *);
3774eaa4710SRishi Srivatsavai typedef void (*mac_bridge_rx_t)(mac_handle_t, mac_resource_handle_t, mblk_t *);
3784eaa4710SRishi Srivatsavai typedef void (*mac_bridge_ref_t)(mac_handle_t, boolean_t);
3794eaa4710SRishi Srivatsavai typedef link_state_t (*mac_bridge_ls_t)(mac_handle_t, link_state_t);
3804eaa4710SRishi Srivatsavai 
3814eaa4710SRishi Srivatsavai /* must change mac_notify_cb_list[] in mac_provider.c if this is changed */
3827c478bd9Sstevel@tonic-gate typedef enum {
3837c478bd9Sstevel@tonic-gate 	MAC_NOTE_LINK,
3847c478bd9Sstevel@tonic-gate 	MAC_NOTE_UNICST,
3857c478bd9Sstevel@tonic-gate 	MAC_NOTE_TX,
3867c478bd9Sstevel@tonic-gate 	MAC_NOTE_DEVPROMISC,
387ba2e4443Sseb 	MAC_NOTE_FASTPATH_FLUSH,
388e7801d59Ssowmini 	MAC_NOTE_SDU_SIZE,
3892b24ab6bSSebastien Roy 	MAC_NOTE_DEST,
390d62bc4baSyz147064 	MAC_NOTE_MARGIN,
391da14cebeSEric Cheng 	MAC_NOTE_CAPAB_CHG,
3924eaa4710SRishi Srivatsavai 	MAC_NOTE_LOWLINK,
393550b6e40SSowmini Varadhan 	MAC_NOTE_ALLOWED_IPS,
3947c478bd9Sstevel@tonic-gate 	MAC_NNOTE	/* must be the last entry */
3957c478bd9Sstevel@tonic-gate } mac_notify_type_t;
3967c478bd9Sstevel@tonic-gate 
3977c478bd9Sstevel@tonic-gate typedef void		(*mac_notify_t)(void *, mac_notify_type_t);
398da14cebeSEric Cheng typedef void		(*mac_rx_t)(void *, mac_resource_handle_t, mblk_t *,
399da14cebeSEric Cheng 			    boolean_t);
400da14cebeSEric Cheng typedef	mblk_t		*(*mac_receive_t)(void *, int);
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 
409da14cebeSEric Cheng typedef	int	(*mac_intr_enable_t)(mac_intr_handle_t);
410da14cebeSEric Cheng typedef	int	(*mac_intr_disable_t)(mac_intr_handle_t);
411da14cebeSEric Cheng 
412da14cebeSEric Cheng typedef	struct mac_intr_s {
413da14cebeSEric Cheng 	mac_intr_handle_t	mi_handle;
414da14cebeSEric Cheng 	mac_intr_enable_t	mi_enable;
415da14cebeSEric Cheng 	mac_intr_disable_t	mi_disable;
4160dc2366fSVenugopal Iyer 	ddi_intr_handle_t	mi_ddi_handle;
4170dc2366fSVenugopal Iyer 	boolean_t		mi_ddi_shared;
418da14cebeSEric Cheng } mac_intr_t;
419da14cebeSEric Cheng 
4207c478bd9Sstevel@tonic-gate typedef struct mac_rx_fifo_s {
4217c478bd9Sstevel@tonic-gate 	mac_resource_type_t	mrf_type;	/* MAC_RX_FIFO */
422da14cebeSEric Cheng 	mac_intr_t		mrf_intr;
423da14cebeSEric Cheng 	mac_receive_t		mrf_receive;
424da14cebeSEric Cheng 	void			*mrf_rx_arg;
425da14cebeSEric Cheng 	uint32_t		mrf_flow_priority;
426da14cebeSEric Cheng 	/*
427da14cebeSEric Cheng 	 * The CPU this flow is to be processed on. With intrd and future
428da14cebeSEric Cheng 	 * things, we should know which CPU the flow needs to be processed
429da14cebeSEric Cheng 	 * and get a squeue assigned on that CPU.
430da14cebeSEric Cheng 	 */
431da14cebeSEric Cheng 	uint_t			mrf_cpu_id;
4327c478bd9Sstevel@tonic-gate } mac_rx_fifo_t;
4337c478bd9Sstevel@tonic-gate 
434da14cebeSEric Cheng #define	mrf_intr_handle		mrf_intr.mi_handle
435da14cebeSEric Cheng #define	mrf_intr_enable		mrf_intr.mi_enable
436da14cebeSEric Cheng #define	mrf_intr_disable	mrf_intr.mi_disable
43798b1442aSmeem 
4387c478bd9Sstevel@tonic-gate typedef union mac_resource_u {
4397c478bd9Sstevel@tonic-gate 	mac_resource_type_t	mr_type;
4407c478bd9Sstevel@tonic-gate 	mac_rx_fifo_t		mr_fifo;
4417c478bd9Sstevel@tonic-gate } mac_resource_t;
4427c478bd9Sstevel@tonic-gate 
443ba2e4443Sseb typedef enum {
444ba2e4443Sseb 	MAC_ADDRTYPE_UNICAST,
445ba2e4443Sseb 	MAC_ADDRTYPE_MULTICAST,
446ba2e4443Sseb 	MAC_ADDRTYPE_BROADCAST
447ba2e4443Sseb } mac_addrtype_t;
448ba2e4443Sseb 
449ba2e4443Sseb typedef struct mac_header_info_s {
450ba2e4443Sseb 	size_t		mhi_hdrsize;
451ba2e4443Sseb 	size_t		mhi_pktsize;
452ba2e4443Sseb 	const uint8_t	*mhi_daddr;
453ba2e4443Sseb 	const uint8_t	*mhi_saddr;
454ba2e4443Sseb 	uint32_t	mhi_origsap;
455ba2e4443Sseb 	uint32_t	mhi_bindsap;
456ba2e4443Sseb 	mac_addrtype_t	mhi_dsttype;
457605445d5Sdg199075 	uint16_t	mhi_tci;
458da14cebeSEric Cheng 	boolean_t	mhi_istagged;
4594eaa4710SRishi Srivatsavai 	boolean_t	mhi_ispvid;
460ba2e4443Sseb } mac_header_info_t;
461ba2e4443Sseb 
462ba2e4443Sseb /*
463da14cebeSEric Cheng  * Function pointer to match dls client signature. Should be same as
464da14cebeSEric Cheng  * dls_rx_t to allow a soft ring to bypass DLS layer and call a DLS
465da14cebeSEric Cheng  * client directly.
466da14cebeSEric Cheng  */
467da14cebeSEric Cheng typedef	void		(*mac_direct_rx_t)(void *, mac_resource_handle_t,
468da14cebeSEric Cheng 				mblk_t *, mac_header_info_t *);
469da14cebeSEric Cheng 
470da14cebeSEric Cheng typedef mac_resource_handle_t	(*mac_resource_add_t)(void *, mac_resource_t *);
471da14cebeSEric Cheng typedef int			(*mac_resource_bind_t)(void *,
472da14cebeSEric Cheng     mac_resource_handle_t, processorid_t);
473da14cebeSEric Cheng typedef void			(*mac_resource_remove_t)(void *, void *);
474da14cebeSEric Cheng typedef void			(*mac_resource_quiesce_t)(void *, void *);
475da14cebeSEric Cheng typedef void			(*mac_resource_restart_t)(void *, void *);
476da14cebeSEric Cheng typedef int			(*mac_resource_modify_t)(void *, void *,
477da14cebeSEric Cheng 				    mac_resource_t *);
478da14cebeSEric Cheng typedef	void			(*mac_change_upcall_t)(void *, mac_direct_rx_t,
479da14cebeSEric Cheng     void *);
480da14cebeSEric Cheng 
481da14cebeSEric Cheng /*
482ba2e4443Sseb  * MAC-Type plugin interfaces
483ba2e4443Sseb  */
484ba2e4443Sseb 
485ba2e4443Sseb typedef int		(*mtops_addr_verify_t)(const void *, void *);
486ba2e4443Sseb typedef boolean_t	(*mtops_sap_verify_t)(uint32_t, uint32_t *, void *);
487ba2e4443Sseb typedef mblk_t		*(*mtops_header_t)(const void *, const void *,
488ba2e4443Sseb     uint32_t, void *, mblk_t *, size_t);
489ba2e4443Sseb typedef int		(*mtops_header_info_t)(mblk_t *, void *,
490ba2e4443Sseb     mac_header_info_t *);
491ba2e4443Sseb typedef boolean_t	(*mtops_pdata_verify_t)(void *, size_t);
492ba2e4443Sseb typedef	mblk_t		*(*mtops_header_modify_t)(mblk_t *, void *);
4930d2a8e5eSgd78059 typedef void		(*mtops_link_details_t)(char *, size_t, mac_handle_t,
4940d2a8e5eSgd78059     void *);
495ba2e4443Sseb 
496ba2e4443Sseb typedef struct mactype_ops_s {
497ba2e4443Sseb 	uint_t			mtops_ops;
498ba2e4443Sseb 	/*
499ba2e4443Sseb 	 * mtops_unicst_verify() returns 0 if the given address is a valid
500ba2e4443Sseb 	 * unicast address, or a non-zero errno otherwise.
501ba2e4443Sseb 	 */
502ba2e4443Sseb 	mtops_addr_verify_t	mtops_unicst_verify;
503ba2e4443Sseb 	/*
504ba2e4443Sseb 	 * mtops_multicst_verify() returns 0 if the given address is a
505ba2e4443Sseb 	 * valid multicast address, or a non-zero errno otherwise.  If the
506ba2e4443Sseb 	 * media doesn't support multicast, ENOTSUP should be returned (for
507ba2e4443Sseb 	 * example).
508ba2e4443Sseb 	 */
509ba2e4443Sseb 	mtops_addr_verify_t	mtops_multicst_verify;
510ba2e4443Sseb 	/*
511ba2e4443Sseb 	 * mtops_sap_verify() returns B_TRUE if the given SAP is a valid
512ba2e4443Sseb 	 * SAP value, or B_FALSE otherwise.
513ba2e4443Sseb 	 */
514ba2e4443Sseb 	mtops_sap_verify_t	mtops_sap_verify;
515ba2e4443Sseb 	/*
516ba2e4443Sseb 	 * mtops_header() is used to allocate and construct a MAC header.
517ba2e4443Sseb 	 */
518ba2e4443Sseb 	mtops_header_t		mtops_header;
519ba2e4443Sseb 	/*
520ba2e4443Sseb 	 * mtops_header_info() is used to gather information on a given MAC
521ba2e4443Sseb 	 * header.
522ba2e4443Sseb 	 */
523ba2e4443Sseb 	mtops_header_info_t	mtops_header_info;
524ba2e4443Sseb 	/*
525ba2e4443Sseb 	 * mtops_pdata_verify() is used to verify the validity of MAC
526ba2e4443Sseb 	 * plugin data.  It is called by mac_register() if the driver has
527ba2e4443Sseb 	 * supplied MAC plugin data, and also by mac_pdata_update() when
528ba2e4443Sseb 	 * drivers update the data.
529ba2e4443Sseb 	 */
530ba2e4443Sseb 	mtops_pdata_verify_t	mtops_pdata_verify;
531ba2e4443Sseb 	/*
532ba2e4443Sseb 	 * mtops_header_cook() is an optional callback that converts (or
533ba2e4443Sseb 	 * "cooks") the given raw header (as sent by a raw DLPI consumer)
534ba2e4443Sseb 	 * into one that is appropriate to send down to the MAC driver.
535ba2e4443Sseb 	 * Following the example above, an Ethernet header sent down by a
536ba2e4443Sseb 	 * DLPI consumer would be converted to whatever header the MAC
537ba2e4443Sseb 	 * driver expects.
538ba2e4443Sseb 	 */
539ba2e4443Sseb 	mtops_header_modify_t	mtops_header_cook;
540ba2e4443Sseb 	/*
541ba2e4443Sseb 	 * mtops_header_uncook() is an optional callback that does the
542ba2e4443Sseb 	 * opposite of mtops_header_cook().  It "uncooks" a given MAC
543ba2e4443Sseb 	 * header (as received from the driver) for consumption by raw DLPI
544ba2e4443Sseb 	 * consumers.  For example, for a non-Ethernet plugin that wants
545ba2e4443Sseb 	 * raw DLPI consumers to be fooled into thinking that the device
546ba2e4443Sseb 	 * provides Ethernet access, this callback would modify the given
547ba2e4443Sseb 	 * mblk_t such that the MAC header is converted to an Ethernet
548ba2e4443Sseb 	 * header.
549ba2e4443Sseb 	 */
550ba2e4443Sseb 	mtops_header_modify_t	mtops_header_uncook;
5510d2a8e5eSgd78059 	/*
5520d2a8e5eSgd78059 	 * mtops_link_details() is an optional callback that provides
5530d2a8e5eSgd78059 	 * extended information about the link state.  Its primary purpose
5540d2a8e5eSgd78059 	 * is to provide type-specific support for syslog contents on
5550d2a8e5eSgd78059 	 * link up events.  If no implementation is provided, then a default
5560d2a8e5eSgd78059 	 * implementation will be used.
5570d2a8e5eSgd78059 	 */
5580d2a8e5eSgd78059 	mtops_link_details_t	mtops_link_details;
559ba2e4443Sseb } mactype_ops_t;
560ba2e4443Sseb 
561ba2e4443Sseb /*
562ba2e4443Sseb  * mtops_ops exists for the plugin to enumerate the optional callback
563ba2e4443Sseb  * entrypoints it has defined.  This allows the mac module to define
564ba2e4443Sseb  * additional plugin entrypoints in mactype_ops_t without breaking backward
565ba2e4443Sseb  * compatibility with old plugins.
566ba2e4443Sseb  */
567ba2e4443Sseb #define	MTOPS_PDATA_VERIFY	0x001
568ba2e4443Sseb #define	MTOPS_HEADER_COOK	0x002
569ba2e4443Sseb #define	MTOPS_HEADER_UNCOOK	0x004
5700d2a8e5eSgd78059 #define	MTOPS_LINK_DETAILS	0x008
571ba2e4443Sseb 
5724045d941Ssowmini /*
5734045d941Ssowmini  * Provide mapping for legacy ndd ioctls relevant to that mactype.
5744045d941Ssowmini  * Note that the ndd ioctls are obsolete, and may be removed in a future
5754045d941Ssowmini  * release of Solaris. The ndd ioctls are not typically used in legacy
5764045d941Ssowmini  * ethernet drivers. New datalink drivers of all link-types should use
5774045d941Ssowmini  * dladm(1m) interfaces for administering tunables and not have to provide
5784045d941Ssowmini  * a mapping.
5794045d941Ssowmini  */
5804045d941Ssowmini typedef struct mac_ndd_mapping_s {
5814045d941Ssowmini 	char		*mp_name;
5824045d941Ssowmini 	union {
5834045d941Ssowmini 		mac_prop_id_t   u_id;
5844045d941Ssowmini 		uint_t		u_kstat;
5854045d941Ssowmini 	} u_mp_id;
5864045d941Ssowmini 	long		mp_minval;
5874045d941Ssowmini 	long		mp_maxval;
5884045d941Ssowmini 	size_t		mp_valsize;
5894045d941Ssowmini 	int		mp_flags;
5904045d941Ssowmini } mac_ndd_mapping_t;
5914045d941Ssowmini 
5924045d941Ssowmini #define	mp_prop_id	u_mp_id.u_id
5934045d941Ssowmini #define	mp_kstat	u_mp_id.u_kstat
5944045d941Ssowmini 
595da14cebeSEric Cheng typedef struct mac_stat_info_s {
596da14cebeSEric Cheng 	uint_t		msi_stat;
597da14cebeSEric Cheng 	char		*msi_name;
598da14cebeSEric Cheng 	uint_t		msi_type;	/* as defined in kstat_named_init(9F) */
599da14cebeSEric Cheng 	uint64_t	msi_default;
600da14cebeSEric Cheng } mac_stat_info_t;
601da14cebeSEric Cheng 
602ba2e4443Sseb typedef struct mactype_register_s {
603ba2e4443Sseb 	uint_t		mtr_version;	/* set by mactype_alloc() */
604ba2e4443Sseb 	const char	*mtr_ident;
605ba2e4443Sseb 	mactype_ops_t	*mtr_ops;
606ba2e4443Sseb 	uint_t		mtr_mactype;
6070ba2cbe9Sxc151355 	uint_t		mtr_nativetype;
608ba2e4443Sseb 	uint_t		mtr_addrlen;
609ba2e4443Sseb 	uint8_t		*mtr_brdcst_addr;
610ba2e4443Sseb 	mac_stat_info_t	*mtr_stats;
611ba2e4443Sseb 	size_t		mtr_statcount;
6124045d941Ssowmini 	mac_ndd_mapping_t *mtr_mapping;
6134045d941Ssowmini 	size_t		mtr_mappingcount;
614ba2e4443Sseb } mactype_register_t;
615ba2e4443Sseb 
6167c478bd9Sstevel@tonic-gate /*
617da14cebeSEric Cheng  * Driver interface functions.
6187c478bd9Sstevel@tonic-gate  */
619d62bc4baSyz147064 extern int			mac_open_by_linkid(datalink_id_t,
620d62bc4baSyz147064 				    mac_handle_t *);
621d62bc4baSyz147064 extern int			mac_open_by_linkname(const char *,
622d62bc4baSyz147064 				    mac_handle_t *);
623d62bc4baSyz147064 extern const char		*mac_name(mac_handle_t);
624d62bc4baSyz147064 extern minor_t			mac_minor(mac_handle_t);
625d62bc4baSyz147064 extern minor_t			mac_minor_hold(boolean_t);
626d62bc4baSyz147064 extern void			mac_minor_rele(minor_t);
627da14cebeSEric Cheng extern void			mac_sdu_get(mac_handle_t, uint_t *, uint_t *);
6281eee170aSErik Nordmark extern void			mac_sdu_get2(mac_handle_t, uint_t *, uint_t *,
6291eee170aSErik Nordmark 				    uint_t *);
630da14cebeSEric Cheng extern int			mac_maxsdu_update(mac_handle_t, uint_t);
6311eee170aSErik Nordmark extern int			mac_maxsdu_update2(mac_handle_t, uint_t,
6321eee170aSErik Nordmark 				    uint_t);
6330a0e9771SDarren Reed extern uint_t			mac_addr_len(mac_handle_t);
6340a0e9771SDarren Reed extern int			mac_type(mac_handle_t);
635f195a053SDarren Reed extern int			mac_nativetype(mac_handle_t);
6367c478bd9Sstevel@tonic-gate 
637ba2e4443Sseb extern void 			mac_unicst_update(mac_handle_t,
638ba2e4443Sseb 				    const uint8_t *);
639da14cebeSEric Cheng extern void			mac_capab_update(mac_handle_t);
640ba2e4443Sseb extern int			mac_pdata_update(mac_handle_t, void *,
641ba2e4443Sseb 				    size_t);
642d62bc4baSyz147064 extern boolean_t		mac_margin_update(mac_handle_t, uint32_t);
643d62bc4baSyz147064 extern void			mac_margin_get(mac_handle_t, uint32_t *);
644d62bc4baSyz147064 extern int			mac_margin_remove(mac_handle_t, uint32_t);
645d62bc4baSyz147064 extern int			mac_margin_add(mac_handle_t, uint32_t *,
646d62bc4baSyz147064 				    boolean_t);
647a776d98eSRobert Mustacchi extern int			mac_mtu_add(mac_handle_t, uint32_t *,
648a776d98eSRobert Mustacchi 				    boolean_t);
649a776d98eSRobert Mustacchi extern int			mac_mtu_remove(mac_handle_t, uint32_t);
6505d460eafSCathy Zhou extern int			mac_fastpath_disable(mac_handle_t);
6515d460eafSCathy Zhou extern void			mac_fastpath_enable(mac_handle_t);
6524eaa4710SRishi Srivatsavai extern void			mac_no_active(mac_handle_t);
653d62bc4baSyz147064 
654ba2e4443Sseb extern mactype_register_t	*mactype_alloc(uint_t);
655ba2e4443Sseb extern void			mactype_free(mactype_register_t *);
656ba2e4443Sseb extern int			mactype_register(mactype_register_t *);
657ba2e4443Sseb extern int			mactype_unregister(const char *);
658da14cebeSEric Cheng 
6595d460eafSCathy Zhou extern int			mac_start_logusage(mac_logtype_t, uint_t);
660da14cebeSEric Cheng extern void			mac_stop_logusage(mac_logtype_t);
661da14cebeSEric Cheng 
662da14cebeSEric Cheng extern mac_handle_t		mac_get_lower_mac_handle(mac_handle_t);
6630dc2366fSVenugopal Iyer extern boolean_t		mac_is_vnic_primary(mac_handle_t);
6647c478bd9Sstevel@tonic-gate 
665ae6aa22aSVenugopal Iyer /*
666ae6aa22aSVenugopal Iyer  * Packet hashing for distribution to multiple ports and rings.
667ae6aa22aSVenugopal Iyer  */
668ae6aa22aSVenugopal Iyer 
669ae6aa22aSVenugopal Iyer #define	MAC_PKT_HASH_L2		0x01
670ae6aa22aSVenugopal Iyer #define	MAC_PKT_HASH_L3		0x02
671ae6aa22aSVenugopal Iyer #define	MAC_PKT_HASH_L4		0x04
672ae6aa22aSVenugopal Iyer 
673ae6aa22aSVenugopal Iyer extern uint64_t			mac_pkt_hash(uint_t, mblk_t *, uint8_t,
674ae6aa22aSVenugopal Iyer 				    boolean_t);
675ae6aa22aSVenugopal Iyer 
6764eaa4710SRishi Srivatsavai /*
6774eaa4710SRishi Srivatsavai  * Bridging linkage
6784eaa4710SRishi Srivatsavai  */
6794eaa4710SRishi Srivatsavai extern void			mac_rx_common(mac_handle_t,
6804eaa4710SRishi Srivatsavai 				    mac_resource_handle_t, mblk_t *);
6814eaa4710SRishi Srivatsavai extern int			mac_bridge_set(mac_handle_t, mac_handle_t);
6824eaa4710SRishi Srivatsavai extern void			mac_bridge_clear(mac_handle_t, mac_handle_t);
6834eaa4710SRishi Srivatsavai extern void			mac_bridge_vectors(mac_bridge_tx_t,
6844eaa4710SRishi Srivatsavai 				    mac_bridge_rx_t, mac_bridge_ref_t,
6854eaa4710SRishi Srivatsavai 				    mac_bridge_ls_t);
6864eaa4710SRishi Srivatsavai 
6874eaa4710SRishi Srivatsavai /* special case function for TRILL observability */
6884eaa4710SRishi Srivatsavai extern void			mac_trill_snoop(mac_handle_t, mblk_t *);
6894eaa4710SRishi Srivatsavai 
6907c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
6917c478bd9Sstevel@tonic-gate 
6927c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
6937c478bd9Sstevel@tonic-gate }
6947c478bd9Sstevel@tonic-gate #endif
6957c478bd9Sstevel@tonic-gate 
6967c478bd9Sstevel@tonic-gate #endif /* _SYS_MAC_H */
697