xref: /illumos-gate/usr/src/uts/common/sys/mac.h (revision 7b79d84636ec82b45f00c982cf6810db81852d17)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_MAC_H
28 #define	_SYS_MAC_H
29 
30 #include <sys/types.h>
31 #ifdef	_KERNEL
32 #include <sys/sunddi.h>
33 #endif
34 
35 /*
36  * MAC Services Module
37  */
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * MAC Information (text emitted by modinfo(1m))
45  */
46 #define	MAC_INFO	"MAC Services v1.20"
47 
48 /*
49  * MAC-Type version identifier.  This is used by mactype_alloc() and
50  * mactype_register() to verify that incompatible MAC-Type plugins don't
51  * register.
52  */
53 #define	MACTYPE_VERSION	0x1
54 
55 /*
56  * Opaque handle types
57  */
58 typedef struct __mac_handle		*mac_handle_t;
59 typedef struct __mac_resource_handle	*mac_resource_handle_t;
60 typedef struct __mac_notify_handle	*mac_notify_handle_t;
61 typedef struct __mac_tx_notify_handle	*mac_tx_notify_handle_t;
62 typedef	struct __mac_intr_handle	*mac_intr_handle_t;
63 typedef	struct __mac_ring_handle	*mac_ring_handle_t;
64 typedef	struct __mac_group_handle	*mac_group_handle_t;
65 
66 #define	DATALINK_INVALID_LINKID	0
67 #define	DATALINK_ALL_LINKID	0
68 #define	DATALINK_MAX_LINKID	0xffffffff
69 
70 #define	MAC_MAX_MINOR	1000
71 
72 typedef enum {
73 	LINK_STATE_UNKNOWN = -1,
74 	LINK_STATE_DOWN,
75 	LINK_STATE_UP
76 } link_state_t;
77 
78 typedef enum {
79 	LINK_DUPLEX_UNKNOWN = 0,
80 	LINK_DUPLEX_HALF,
81 	LINK_DUPLEX_FULL
82 } link_duplex_t;
83 
84 typedef enum {
85 	LINK_FLOWCTRL_NONE = 0,
86 	LINK_FLOWCTRL_RX,
87 	LINK_FLOWCTRL_TX,
88 	LINK_FLOWCTRL_BI
89 } link_flowctrl_t;
90 
91 typedef enum {
92 	LINK_TAGMODE_VLANONLY = 0,
93 	LINK_TAGMODE_NORMAL
94 } link_tagmode_t;
95 
96 /*
97  * Maximum MAC address length
98  */
99 #define	MAXMACADDRLEN		20
100 
101 typedef enum {
102 	MAC_LOGTYPE_LINK = 1,
103 	MAC_LOGTYPE_FLOW
104 } mac_logtype_t;
105 
106 /*
107  * Encodings for public properties.
108  * A most significant bit value of 1 indicates private property, intended
109  * to allow private property implementations to use internal encodings
110  * if desired.
111  *
112  * Note that there are 2 sets of parameters: the *_EN_*
113  * values are those that the Administrator configures for autonegotiation.
114  * The _ADV_* values are those that are currently exposed over the wire.
115  */
116 #define	MAXLINKPROPNAME		256
117 #define	MAC_PROP_DEFAULT	0x0001
118 typedef enum {
119 	MAC_PROP_DUPLEX = 0x00000001,
120 	MAC_PROP_SPEED,
121 	MAC_PROP_STATUS,
122 	MAC_PROP_AUTONEG,
123 	MAC_PROP_EN_AUTONEG,
124 	MAC_PROP_MTU,
125 	MAC_PROP_ZONE,
126 	MAC_PROP_AUTOPUSH,
127 	MAC_PROP_FLOWCTRL,
128 	MAC_PROP_ADV_1000FDX_CAP,
129 	MAC_PROP_EN_1000FDX_CAP,
130 	MAC_PROP_ADV_1000HDX_CAP,
131 	MAC_PROP_EN_1000HDX_CAP,
132 	MAC_PROP_ADV_100FDX_CAP,
133 	MAC_PROP_EN_100FDX_CAP,
134 	MAC_PROP_ADV_100HDX_CAP,
135 	MAC_PROP_EN_100HDX_CAP,
136 	MAC_PROP_ADV_10FDX_CAP,
137 	MAC_PROP_EN_10FDX_CAP,
138 	MAC_PROP_ADV_10HDX_CAP,
139 	MAC_PROP_EN_10HDX_CAP,
140 	MAC_PROP_ADV_100T4_CAP,
141 	MAC_PROP_EN_100T4_CAP,
142 	MAC_PROP_WL_ESSID,
143 	MAC_PROP_WL_BSSID,
144 	MAC_PROP_WL_BSSTYPE,
145 	MAC_PROP_WL_LINKSTATUS,
146 	MAC_PROP_WL_DESIRED_RATES,
147 	MAC_PROP_WL_SUPPORTED_RATES,
148 	MAC_PROP_WL_AUTH_MODE,
149 	MAC_PROP_WL_ENCRYPTION,
150 	MAC_PROP_WL_RSSI,
151 	MAC_PROP_WL_PHY_CONFIG,
152 	MAC_PROP_WL_CAPABILITY,
153 	MAC_PROP_WL_WPA,
154 	MAC_PROP_WL_SCANRESULTS,
155 	MAC_PROP_WL_POWER_MODE,
156 	MAC_PROP_WL_RADIO,
157 	MAC_PROP_WL_ESS_LIST,
158 	MAC_PROP_WL_KEY_TAB,
159 	MAC_PROP_WL_CREATE_IBSS,
160 	MAC_PROP_WL_SETOPTIE,
161 	MAC_PROP_WL_DELKEY,
162 	MAC_PROP_WL_KEY,
163 	MAC_PROP_WL_MLME,
164 	MAC_PROP_MAXBW,
165 	MAC_PROP_PRIO,
166 	MAC_PROP_BIND_CPU,
167 	MAC_PROP_TAGMODE,
168 	MAC_PROP_PRIVATE = -1
169 } mac_prop_id_t;
170 
171 /*
172  * Flags to figure out r/w status of legacy ndd props.
173  */
174 #define	MAC_PROP_PERM_READ		0x0001
175 #define	MAC_PROP_PERM_WRITE		0x0010
176 #define	MAC_PROP_MAP_KSTAT		0x0100
177 #define	MAC_PROP_PERM_RW		(MAC_PROP_PERM_READ|MAC_PROP_PERM_WRITE)
178 #define	MAC_PROP_FLAGS_RK		(MAC_PROP_PERM_READ|MAC_PROP_MAP_KSTAT)
179 
180 #ifdef	_KERNEL
181 
182 /*
183  * There are three ranges of statistics values.  0 to 1 - MAC_STAT_MIN are
184  * interface statistics maintained by the mac module.  MAC_STAT_MIN to 1 -
185  * MACTYPE_STAT_MIN are common MAC statistics defined by the mac module and
186  * maintained by each driver.  MACTYPE_STAT_MIN and above are statistics
187  * defined by MAC-Type plugins and maintained by each driver.
188  */
189 #define	MAC_STAT_MIN		1000
190 #define	MACTYPE_STAT_MIN	2000
191 
192 #define	IS_MAC_STAT(stat)	\
193 	(stat >= MAC_STAT_MIN && stat < MACTYPE_STAT_MIN)
194 #define	IS_MACTYPE_STAT(stat)	(stat >= MACTYPE_STAT_MIN)
195 
196 /*
197  * Statistics maintained by the mac module, and possibly populated as link
198  * statistics.
199  */
200 enum mac_mod_stat {
201 	MAC_STAT_LINK_STATE,
202 	MAC_STAT_LINK_UP,
203 	MAC_STAT_PROMISC
204 };
205 
206 /*
207  * Do not reorder, and add only to the end of this list.
208  */
209 enum mac_driver_stat {
210 	/* MIB-II stats (RFC 1213 and RFC 1573) */
211 	MAC_STAT_IFSPEED = MAC_STAT_MIN,
212 	MAC_STAT_MULTIRCV,
213 	MAC_STAT_BRDCSTRCV,
214 	MAC_STAT_MULTIXMT,
215 	MAC_STAT_BRDCSTXMT,
216 	MAC_STAT_NORCVBUF,
217 	MAC_STAT_IERRORS,
218 	MAC_STAT_UNKNOWNS,
219 	MAC_STAT_NOXMTBUF,
220 	MAC_STAT_OERRORS,
221 	MAC_STAT_COLLISIONS,
222 	MAC_STAT_RBYTES,
223 	MAC_STAT_IPACKETS,
224 	MAC_STAT_OBYTES,
225 	MAC_STAT_OPACKETS,
226 	MAC_STAT_UNDERFLOWS,
227 	MAC_STAT_OVERFLOWS
228 };
229 
230 #define	MAC_NSTAT	(MAC_STAT_OVERFLOWS - MAC_STAT_IFSPEED + 1)
231 
232 #define	MAC_STAT_ISACOUNTER(_stat) (		\
233 	    (_stat) == MAC_STAT_MULTIRCV ||	\
234 	    (_stat) == MAC_STAT_BRDCSTRCV ||	\
235 	    (_stat) == MAC_STAT_MULTIXMT ||	\
236 	    (_stat) == MAC_STAT_BRDCSTXMT ||	\
237 	    (_stat) == MAC_STAT_NORCVBUF ||	\
238 	    (_stat) == MAC_STAT_IERRORS ||	\
239 	    (_stat) == MAC_STAT_UNKNOWNS ||	\
240 	    (_stat) == MAC_STAT_NOXMTBUF ||	\
241 	    (_stat) == MAC_STAT_OERRORS ||	\
242 	    (_stat) == MAC_STAT_COLLISIONS ||	\
243 	    (_stat) == MAC_STAT_RBYTES ||	\
244 	    (_stat) == MAC_STAT_IPACKETS ||	\
245 	    (_stat) == MAC_STAT_OBYTES ||	\
246 	    (_stat) == MAC_STAT_OPACKETS ||	\
247 	    (_stat) == MAC_STAT_UNDERFLOWS ||	\
248 	    (_stat) == MAC_STAT_OVERFLOWS)
249 
250 /*
251  * Immutable information. (This may not be modified after registration).
252  */
253 typedef struct mac_info_s {
254 	uint_t		mi_media;
255 	uint_t		mi_nativemedia;
256 	uint_t		mi_addr_length;
257 	uint8_t		*mi_unicst_addr;
258 	uint8_t		*mi_brdcst_addr;
259 } mac_info_t;
260 
261 /*
262  * When VNICs are created on top of the NIC, there are two levels
263  * of MAC layer, a lower MAC, which is the MAC layer at the level of the
264  * physical NIC, and an upper MAC, which is the MAC layer at the level
265  * of the VNIC. Each VNIC maps to a MAC client at the lower MAC, and
266  * the SRS and classification is done at the lower MAC level. The upper
267  * MAC is therefore for the most part pass-through, and therefore
268  * special processing needs to be done at the upper MAC layer when
269  * dealing with a VNIC.
270  *
271  * This capability allows the MAC layer to detect when a VNIC is being
272  * access, and implement the required shortcuts.
273  */
274 
275 typedef void *(*mac_client_handle_fn_t)(void *);
276 
277 typedef struct mac_capab_vnic_s {
278 	void			*mcv_arg;
279 	mac_client_handle_fn_t	mcv_mac_client_handle;
280 } mac_capab_vnic_t;
281 
282 typedef void (*mac_rename_fn_t)(const char *, void *);
283 typedef struct mac_capab_aggr_s {
284 	mac_rename_fn_t mca_rename_fn;
285 	int (*mca_unicst)(void *, const uint8_t *);
286 } mac_capab_aggr_t;
287 
288 typedef enum {
289 	MAC_NOTE_LINK,
290 	MAC_NOTE_PROMISC,
291 	MAC_NOTE_UNICST,
292 	MAC_NOTE_TX,
293 	MAC_NOTE_RESOURCE,
294 	MAC_NOTE_DEVPROMISC,
295 	MAC_NOTE_FASTPATH_FLUSH,
296 	MAC_NOTE_SDU_SIZE,
297 	MAC_NOTE_MARGIN,
298 	MAC_NOTE_CAPAB_CHG,
299 	MAC_NNOTE	/* must be the last entry */
300 } mac_notify_type_t;
301 
302 typedef void		(*mac_notify_t)(void *, mac_notify_type_t);
303 typedef void		(*mac_rx_t)(void *, mac_resource_handle_t, mblk_t *,
304 			    boolean_t);
305 typedef	mblk_t		*(*mac_receive_t)(void *, int);
306 
307 /*
308  * MAC promiscuous types
309  */
310 typedef enum {
311 	MAC_PROMISC = 0x01,		/* MAC instance is promiscuous */
312 	MAC_DEVPROMISC = 0x02		/* Device is promiscuous */
313 } mac_promisc_type_t;
314 
315 /*
316  * MAC resource types
317  */
318 typedef enum {
319 	MAC_RX_FIFO = 1
320 } mac_resource_type_t;
321 
322 typedef	int	(*mac_intr_enable_t)(mac_intr_handle_t);
323 typedef	int	(*mac_intr_disable_t)(mac_intr_handle_t);
324 
325 typedef	struct mac_intr_s {
326 	mac_intr_handle_t	mi_handle;
327 	mac_intr_enable_t	mi_enable;
328 	mac_intr_disable_t	mi_disable;
329 } mac_intr_t;
330 
331 typedef struct mac_rx_fifo_s {
332 	mac_resource_type_t	mrf_type;	/* MAC_RX_FIFO */
333 	mac_intr_t		mrf_intr;
334 	mac_receive_t		mrf_receive;
335 	void			*mrf_rx_arg;
336 	uint32_t		mrf_flow_priority;
337 	/*
338 	 * The CPU this flow is to be processed on. With intrd and future
339 	 * things, we should know which CPU the flow needs to be processed
340 	 * and get a squeue assigned on that CPU.
341 	 */
342 	uint_t			mrf_cpu_id;
343 } mac_rx_fifo_t;
344 
345 #define	mrf_intr_handle		mrf_intr.mi_handle
346 #define	mrf_intr_enable		mrf_intr.mi_enable
347 #define	mrf_intr_disable	mrf_intr.mi_disable
348 
349 typedef union mac_resource_u {
350 	mac_resource_type_t	mr_type;
351 	mac_rx_fifo_t		mr_fifo;
352 } mac_resource_t;
353 
354 typedef enum {
355 	MAC_ADDRTYPE_UNICAST,
356 	MAC_ADDRTYPE_MULTICAST,
357 	MAC_ADDRTYPE_BROADCAST
358 } mac_addrtype_t;
359 
360 typedef struct mac_header_info_s {
361 	size_t		mhi_hdrsize;
362 	size_t		mhi_pktsize;
363 	const uint8_t	*mhi_daddr;
364 	const uint8_t	*mhi_saddr;
365 	uint32_t	mhi_origsap;
366 	uint32_t	mhi_bindsap;
367 	mac_addrtype_t	mhi_dsttype;
368 	uint16_t	mhi_tci;
369 	boolean_t	mhi_istagged;
370 } mac_header_info_t;
371 
372 /*
373  * Function pointer to match dls client signature. Should be same as
374  * dls_rx_t to allow a soft ring to bypass DLS layer and call a DLS
375  * client directly.
376  */
377 typedef	void		(*mac_direct_rx_t)(void *, mac_resource_handle_t,
378 				mblk_t *, mac_header_info_t *);
379 
380 typedef mac_resource_handle_t	(*mac_resource_add_t)(void *, mac_resource_t *);
381 typedef int			(*mac_resource_bind_t)(void *,
382     mac_resource_handle_t, processorid_t);
383 typedef void			(*mac_resource_remove_t)(void *, void *);
384 typedef void			(*mac_resource_quiesce_t)(void *, void *);
385 typedef void			(*mac_resource_restart_t)(void *, void *);
386 typedef int			(*mac_resource_modify_t)(void *, void *,
387 				    mac_resource_t *);
388 typedef	void			(*mac_change_upcall_t)(void *, mac_direct_rx_t,
389     void *);
390 
391 /*
392  * MAC-Type plugin interfaces
393  */
394 
395 typedef int		(*mtops_addr_verify_t)(const void *, void *);
396 typedef boolean_t	(*mtops_sap_verify_t)(uint32_t, uint32_t *, void *);
397 typedef mblk_t		*(*mtops_header_t)(const void *, const void *,
398     uint32_t, void *, mblk_t *, size_t);
399 typedef int		(*mtops_header_info_t)(mblk_t *, void *,
400     mac_header_info_t *);
401 typedef boolean_t	(*mtops_pdata_verify_t)(void *, size_t);
402 typedef	mblk_t		*(*mtops_header_modify_t)(mblk_t *, void *);
403 typedef void		(*mtops_link_details_t)(char *, size_t, mac_handle_t,
404     void *);
405 
406 typedef struct mactype_ops_s {
407 	uint_t			mtops_ops;
408 	/*
409 	 * mtops_unicst_verify() returns 0 if the given address is a valid
410 	 * unicast address, or a non-zero errno otherwise.
411 	 */
412 	mtops_addr_verify_t	mtops_unicst_verify;
413 	/*
414 	 * mtops_multicst_verify() returns 0 if the given address is a
415 	 * valid multicast address, or a non-zero errno otherwise.  If the
416 	 * media doesn't support multicast, ENOTSUP should be returned (for
417 	 * example).
418 	 */
419 	mtops_addr_verify_t	mtops_multicst_verify;
420 	/*
421 	 * mtops_sap_verify() returns B_TRUE if the given SAP is a valid
422 	 * SAP value, or B_FALSE otherwise.
423 	 */
424 	mtops_sap_verify_t	mtops_sap_verify;
425 	/*
426 	 * mtops_header() is used to allocate and construct a MAC header.
427 	 */
428 	mtops_header_t		mtops_header;
429 	/*
430 	 * mtops_header_info() is used to gather information on a given MAC
431 	 * header.
432 	 */
433 	mtops_header_info_t	mtops_header_info;
434 	/*
435 	 * mtops_pdata_verify() is used to verify the validity of MAC
436 	 * plugin data.  It is called by mac_register() if the driver has
437 	 * supplied MAC plugin data, and also by mac_pdata_update() when
438 	 * drivers update the data.
439 	 */
440 	mtops_pdata_verify_t	mtops_pdata_verify;
441 	/*
442 	 * mtops_header_cook() is an optional callback that converts (or
443 	 * "cooks") the given raw header (as sent by a raw DLPI consumer)
444 	 * into one that is appropriate to send down to the MAC driver.
445 	 * Following the example above, an Ethernet header sent down by a
446 	 * DLPI consumer would be converted to whatever header the MAC
447 	 * driver expects.
448 	 */
449 	mtops_header_modify_t	mtops_header_cook;
450 	/*
451 	 * mtops_header_uncook() is an optional callback that does the
452 	 * opposite of mtops_header_cook().  It "uncooks" a given MAC
453 	 * header (as received from the driver) for consumption by raw DLPI
454 	 * consumers.  For example, for a non-Ethernet plugin that wants
455 	 * raw DLPI consumers to be fooled into thinking that the device
456 	 * provides Ethernet access, this callback would modify the given
457 	 * mblk_t such that the MAC header is converted to an Ethernet
458 	 * header.
459 	 */
460 	mtops_header_modify_t	mtops_header_uncook;
461 	/*
462 	 * mtops_link_details() is an optional callback that provides
463 	 * extended information about the link state.  Its primary purpose
464 	 * is to provide type-specific support for syslog contents on
465 	 * link up events.  If no implementation is provided, then a default
466 	 * implementation will be used.
467 	 */
468 	mtops_link_details_t	mtops_link_details;
469 } mactype_ops_t;
470 
471 /*
472  * mtops_ops exists for the plugin to enumerate the optional callback
473  * entrypoints it has defined.  This allows the mac module to define
474  * additional plugin entrypoints in mactype_ops_t without breaking backward
475  * compatibility with old plugins.
476  */
477 #define	MTOPS_PDATA_VERIFY	0x001
478 #define	MTOPS_HEADER_COOK	0x002
479 #define	MTOPS_HEADER_UNCOOK	0x004
480 #define	MTOPS_LINK_DETAILS	0x008
481 
482 /*
483  * Provide mapping for legacy ndd ioctls relevant to that mactype.
484  * Note that the ndd ioctls are obsolete, and may be removed in a future
485  * release of Solaris. The ndd ioctls are not typically used in legacy
486  * ethernet drivers. New datalink drivers of all link-types should use
487  * dladm(1m) interfaces for administering tunables and not have to provide
488  * a mapping.
489  */
490 typedef struct mac_ndd_mapping_s {
491 	char		*mp_name;
492 	union {
493 		mac_prop_id_t   u_id;
494 		uint_t		u_kstat;
495 	} u_mp_id;
496 	long		mp_minval;
497 	long		mp_maxval;
498 	size_t		mp_valsize;
499 	int		mp_flags;
500 } mac_ndd_mapping_t;
501 
502 #define	mp_prop_id	u_mp_id.u_id
503 #define	mp_kstat	u_mp_id.u_kstat
504 
505 typedef struct mac_stat_info_s {
506 	uint_t		msi_stat;
507 	char		*msi_name;
508 	uint_t		msi_type;	/* as defined in kstat_named_init(9F) */
509 	uint64_t	msi_default;
510 } mac_stat_info_t;
511 
512 typedef struct mactype_register_s {
513 	uint_t		mtr_version;	/* set by mactype_alloc() */
514 	const char	*mtr_ident;
515 	mactype_ops_t	*mtr_ops;
516 	uint_t		mtr_mactype;
517 	uint_t		mtr_nativetype;
518 	uint_t		mtr_addrlen;
519 	uint8_t		*mtr_brdcst_addr;
520 	mac_stat_info_t	*mtr_stats;
521 	size_t		mtr_statcount;
522 	mac_ndd_mapping_t *mtr_mapping;
523 	size_t		mtr_mappingcount;
524 } mactype_register_t;
525 
526 typedef struct mac_prop_s {
527 	mac_prop_id_t	mp_id;
528 	char		*mp_name;
529 	uint_t		mp_flags;
530 } mac_prop_t;
531 
532 /*
533  * Driver interface functions.
534  */
535 extern int			mac_open_by_linkid(datalink_id_t,
536 				    mac_handle_t *);
537 extern int			mac_open_by_linkname(const char *,
538 				    mac_handle_t *);
539 extern const char		*mac_name(mac_handle_t);
540 extern minor_t			mac_minor(mac_handle_t);
541 extern minor_t			mac_minor_hold(boolean_t);
542 extern void			mac_minor_rele(minor_t);
543 extern void			mac_sdu_get(mac_handle_t, uint_t *, uint_t *);
544 extern int			mac_maxsdu_update(mac_handle_t, uint_t);
545 
546 extern void 			mac_unicst_update(mac_handle_t,
547 				    const uint8_t *);
548 extern void			mac_resource_update(mac_handle_t);
549 extern void			mac_capab_update(mac_handle_t);
550 extern int			mac_pdata_update(mac_handle_t, void *,
551 				    size_t);
552 extern boolean_t		mac_margin_update(mac_handle_t, uint32_t);
553 extern void			mac_margin_get(mac_handle_t, uint32_t *);
554 extern int			mac_margin_remove(mac_handle_t, uint32_t);
555 extern int			mac_margin_add(mac_handle_t, uint32_t *,
556 				    boolean_t);
557 extern int			mac_fastpath_disable(mac_handle_t);
558 extern void			mac_fastpath_enable(mac_handle_t);
559 
560 extern mactype_register_t	*mactype_alloc(uint_t);
561 extern void			mactype_free(mactype_register_t *);
562 extern int			mactype_register(mactype_register_t *);
563 extern int			mactype_unregister(const char *);
564 
565 extern int			mac_start_logusage(mac_logtype_t, uint_t);
566 extern void			mac_stop_logusage(mac_logtype_t);
567 
568 extern mac_handle_t		mac_get_lower_mac_handle(mac_handle_t);
569 
570 /*
571  * Packet hashing for distribution to multiple ports and rings.
572  */
573 
574 #define	MAC_PKT_HASH_L2		0x01
575 #define	MAC_PKT_HASH_L3		0x02
576 #define	MAC_PKT_HASH_L4		0x04
577 
578 extern uint64_t			mac_pkt_hash(uint_t, mblk_t *, uint8_t,
579 				    boolean_t);
580 
581 #endif	/* _KERNEL */
582 
583 #ifdef	__cplusplus
584 }
585 #endif
586 
587 #endif /* _SYS_MAC_H */
588