8446 uts: pci_check_bios() should check for BIOS
[unleashed.git] / include / sys / mac.h
blob101d6521386bc6f5dfbdde3781c98879457d9b36
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2016 Joyent, Inc.
25 * Copyright (c) 2015 Garrett D'Amore <garrett@damore.org>
28 #ifndef _SYS_MAC_H
29 #define _SYS_MAC_H
31 #include <sys/types.h>
32 #ifdef _KERNEL
33 #include <sys/sunddi.h>
34 #endif
37 * MAC Services Module
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
45 * MAC Information (text emitted by modinfo(1m))
47 #define MAC_INFO "MAC Services"
50 * MAC-Type version identifier. This is used by mactype_alloc() and
51 * mactype_register() to verify that incompatible MAC-Type plugins don't
52 * register.
54 #define MACTYPE_VERSION 0x1
57 * Opaque handle types
59 typedef struct __mac_handle *mac_handle_t;
60 typedef struct __mac_resource_handle *mac_resource_handle_t;
61 typedef struct __mac_notify_handle *mac_notify_handle_t;
62 typedef struct __mac_tx_notify_handle *mac_tx_notify_handle_t;
63 typedef struct __mac_intr_handle *mac_intr_handle_t;
64 typedef struct __mac_ring_handle *mac_ring_handle_t;
65 typedef struct __mac_group_handle *mac_group_handle_t;
67 #define DATALINK_INVALID_LINKID 0
68 #define DATALINK_ALL_LINKID 0
69 #define DATALINK_MAX_LINKID 0xffffffff
71 typedef enum {
72 LINK_STATE_UNKNOWN = -1,
73 LINK_STATE_DOWN,
74 LINK_STATE_UP
75 } link_state_t;
77 typedef enum {
78 LINK_DUPLEX_UNKNOWN = 0,
79 LINK_DUPLEX_HALF,
80 LINK_DUPLEX_FULL
81 } link_duplex_t;
83 typedef enum {
84 LINK_FLOWCTRL_NONE = 0,
85 LINK_FLOWCTRL_RX,
86 LINK_FLOWCTRL_TX,
87 LINK_FLOWCTRL_BI
88 } link_flowctrl_t;
90 typedef enum {
91 LINK_TAGMODE_VLANONLY = 0,
92 LINK_TAGMODE_NORMAL
93 } link_tagmode_t;
96 * Defines range of uint32_t values
98 typedef struct mac_propval_uint32_range_s {
99 uint32_t mpur_min;
100 uint32_t mpur_max;
101 } mac_propval_uint32_range_t;
104 * Data type of property values.
106 typedef enum {
107 MAC_PROPVAL_UINT8,
108 MAC_PROPVAL_UINT32,
109 MAC_PROPVAL_STR
110 } mac_propval_type_t;
113 * Captures possible values for a given property. A property can have
114 * range of values (int32, int64, uint32, uint64, et al) or collection/
115 * enumeration of values (strings).
116 * Can be used as a value-result parameter.
118 typedef struct mac_propval_range_s {
119 uint_t mpr_count; /* count of ranges */
120 mac_propval_type_t mpr_type; /* type of value */
121 union {
122 mac_propval_uint32_range_t mpr_uint32[1];
123 } u;
124 } mac_propval_range_t;
126 #define mpr_range_uint32 u.mpr_uint32
129 * Maximum MAC address length
131 #define MAXMACADDRLEN 20
133 #define MPT_MAXMACADDR 32
135 typedef struct mac_secondary_addr_s {
136 uint32_t ms_addrcnt;
137 uint8_t ms_addrs[MPT_MAXMACADDR][MAXMACADDRLEN];
138 } mac_secondary_addr_t;
140 typedef enum {
141 MAC_LOGTYPE_LINK = 1,
142 MAC_LOGTYPE_FLOW
143 } mac_logtype_t;
145 #define MAXLINKPROPNAME 256 /* max property name len */
148 * Public properties.
150 * Note that there are 2 sets of parameters: the *_EN_* values are
151 * those that the Administrator configures for autonegotiation. The
152 * _ADV_* values are those that are currently exposed over the wire.
154 * Please append properties to the end of this list. Do not reorder the list.
156 typedef enum {
157 MAC_PROP_DUPLEX = 0x00000001,
158 MAC_PROP_SPEED,
159 MAC_PROP_STATUS,
160 MAC_PROP_AUTONEG,
161 MAC_PROP_EN_AUTONEG,
162 MAC_PROP_MTU,
163 MAC_PROP_ZONE,
164 MAC_PROP_AUTOPUSH,
165 MAC_PROP_FLOWCTRL,
166 MAC_PROP_ADV_1000FDX_CAP,
167 MAC_PROP_EN_1000FDX_CAP,
168 MAC_PROP_ADV_1000HDX_CAP,
169 MAC_PROP_EN_1000HDX_CAP,
170 MAC_PROP_ADV_100FDX_CAP,
171 MAC_PROP_EN_100FDX_CAP,
172 MAC_PROP_ADV_100HDX_CAP,
173 MAC_PROP_EN_100HDX_CAP,
174 MAC_PROP_ADV_10FDX_CAP,
175 MAC_PROP_EN_10FDX_CAP,
176 MAC_PROP_ADV_10HDX_CAP,
177 MAC_PROP_EN_10HDX_CAP,
178 MAC_PROP_ADV_100T4_CAP,
179 MAC_PROP_EN_100T4_CAP,
180 MAC_PROP_IPTUN_HOPLIMIT,
181 MAC_PROP_IPTUN_ENCAPLIMIT,
182 MAC_PROP_WL_ESSID,
183 MAC_PROP_WL_BSSID,
184 MAC_PROP_WL_BSSTYPE,
185 MAC_PROP_WL_LINKSTATUS,
186 MAC_PROP_WL_DESIRED_RATES,
187 MAC_PROP_WL_SUPPORTED_RATES,
188 MAC_PROP_WL_AUTH_MODE,
189 MAC_PROP_WL_ENCRYPTION,
190 MAC_PROP_WL_RSSI,
191 MAC_PROP_WL_PHY_CONFIG,
192 MAC_PROP_WL_CAPABILITY,
193 MAC_PROP_WL_WPA,
194 MAC_PROP_WL_SCANRESULTS,
195 MAC_PROP_WL_POWER_MODE,
196 MAC_PROP_WL_RADIO,
197 MAC_PROP_WL_ESS_LIST,
198 MAC_PROP_WL_KEY_TAB,
199 MAC_PROP_WL_CREATE_IBSS,
200 MAC_PROP_WL_SETOPTIE,
201 MAC_PROP_WL_DELKEY,
202 MAC_PROP_WL_KEY,
203 MAC_PROP_WL_MLME,
204 MAC_PROP_TAGMODE,
205 MAC_PROP_ADV_10GFDX_CAP,
206 MAC_PROP_EN_10GFDX_CAP,
207 MAC_PROP_PVID,
208 MAC_PROP_LLIMIT,
209 MAC_PROP_LDECAY,
210 MAC_PROP_RESOURCE,
211 MAC_PROP_RESOURCE_EFF,
212 MAC_PROP_RXRINGSRANGE,
213 MAC_PROP_TXRINGSRANGE,
214 MAC_PROP_MAX_TX_RINGS_AVAIL,
215 MAC_PROP_MAX_RX_RINGS_AVAIL,
216 MAC_PROP_MAX_RXHWCLNT_AVAIL,
217 MAC_PROP_MAX_TXHWCLNT_AVAIL,
218 MAC_PROP_IB_LINKMODE,
219 MAC_PROP_VN_PROMISC_FILTERED,
220 MAC_PROP_SECONDARY_ADDRS,
221 MAC_PROP_ADV_40GFDX_CAP,
222 MAC_PROP_EN_40GFDX_CAP,
223 MAC_PROP_ADV_100GFDX_CAP,
224 MAC_PROP_EN_100GFDX_CAP,
225 MAC_PROP_ADV_2500FDX_CAP,
226 MAC_PROP_EN_2500FDX_CAP,
227 MAC_PROP_ADV_5000FDX_CAP,
228 MAC_PROP_EN_5000FDX_CAP,
229 MAC_PROP_ADV_25GFDX_CAP,
230 MAC_PROP_EN_25GFDX_CAP,
231 MAC_PROP_ADV_50GFDX_CAP,
232 MAC_PROP_EN_50GFDX_CAP,
233 MAC_PROP_PRIVATE = -1
234 } mac_prop_id_t;
237 * Flags to figure out r/w status of legacy ndd props.
239 #define MAC_PROP_PERM_READ 0x0001
240 #define MAC_PROP_PERM_WRITE 0x0010
241 #define MAC_PROP_MAP_KSTAT 0x0100
242 #define MAC_PROP_PERM_RW (MAC_PROP_PERM_READ|MAC_PROP_PERM_WRITE)
243 #define MAC_PROP_FLAGS_RK (MAC_PROP_PERM_READ|MAC_PROP_MAP_KSTAT)
245 #ifdef _KERNEL
248 * There are three ranges of statistics values. 0 to 1 - MAC_STAT_MIN are
249 * interface statistics maintained by the mac module. MAC_STAT_MIN to 1 -
250 * MACTYPE_STAT_MIN are common MAC statistics defined by the mac module and
251 * maintained by each driver. MACTYPE_STAT_MIN and above are statistics
252 * defined by MAC-Type plugins and maintained by each driver.
254 #define MAC_STAT_MIN 1000
255 #define MACTYPE_STAT_MIN 2000
257 #define IS_MAC_STAT(stat) \
258 (stat >= MAC_STAT_MIN && stat < MACTYPE_STAT_MIN)
259 #define IS_MACTYPE_STAT(stat) (stat >= MACTYPE_STAT_MIN)
262 * Statistics maintained by the mac module, and possibly populated as link
263 * statistics.
265 enum mac_mod_stat {
266 MAC_STAT_LINK_STATE,
267 MAC_STAT_LINK_UP,
268 MAC_STAT_PROMISC,
269 MAC_STAT_LOWLINK_STATE,
270 MAC_STAT_HDROPS
274 * Do not reorder, and add only to the end of this list.
276 enum mac_driver_stat {
277 /* MIB-II stats (RFC 1213 and RFC 1573) */
278 MAC_STAT_IFSPEED = MAC_STAT_MIN,
279 MAC_STAT_MULTIRCV,
280 MAC_STAT_BRDCSTRCV,
281 MAC_STAT_MULTIXMT,
282 MAC_STAT_BRDCSTXMT,
283 MAC_STAT_NORCVBUF,
284 MAC_STAT_IERRORS,
285 MAC_STAT_UNKNOWNS,
286 MAC_STAT_NOXMTBUF,
287 MAC_STAT_OERRORS,
288 MAC_STAT_COLLISIONS,
289 MAC_STAT_RBYTES,
290 MAC_STAT_IPACKETS,
291 MAC_STAT_OBYTES,
292 MAC_STAT_OPACKETS,
293 MAC_STAT_UNDERFLOWS,
294 MAC_STAT_OVERFLOWS
297 #define MAC_NSTAT (MAC_STAT_OVERFLOWS - MAC_STAT_IFSPEED + 1)
299 #define MAC_STAT_ISACOUNTER(_stat) ( \
300 (_stat) == MAC_STAT_MULTIRCV || \
301 (_stat) == MAC_STAT_BRDCSTRCV || \
302 (_stat) == MAC_STAT_MULTIXMT || \
303 (_stat) == MAC_STAT_BRDCSTXMT || \
304 (_stat) == MAC_STAT_NORCVBUF || \
305 (_stat) == MAC_STAT_IERRORS || \
306 (_stat) == MAC_STAT_UNKNOWNS || \
307 (_stat) == MAC_STAT_NOXMTBUF || \
308 (_stat) == MAC_STAT_OERRORS || \
309 (_stat) == MAC_STAT_COLLISIONS || \
310 (_stat) == MAC_STAT_RBYTES || \
311 (_stat) == MAC_STAT_IPACKETS || \
312 (_stat) == MAC_STAT_OBYTES || \
313 (_stat) == MAC_STAT_OPACKETS || \
314 (_stat) == MAC_STAT_UNDERFLOWS || \
315 (_stat) == MAC_STAT_OVERFLOWS)
318 * Immutable information. (This may not be modified after registration).
320 typedef struct mac_info_s {
321 uint_t mi_media;
322 uint_t mi_nativemedia;
323 uint_t mi_addr_length;
324 uint8_t *mi_unicst_addr;
325 uint8_t *mi_brdcst_addr;
326 } mac_info_t;
329 * When VNICs are created on top of the NIC, there are two levels
330 * of MAC layer, a lower MAC, which is the MAC layer at the level of the
331 * physical NIC, and an upper MAC, which is the MAC layer at the level
332 * of the VNIC. Each VNIC maps to a MAC client at the lower MAC, and
333 * the SRS and classification is done at the lower MAC level. The upper
334 * MAC is therefore for the most part pass-through, and therefore
335 * special processing needs to be done at the upper MAC layer when
336 * dealing with a VNIC.
338 * This capability allows the MAC layer to detect when a VNIC is being
339 * access, and implement the required shortcuts.
341 * In addition, this capability is used to keep the VNIC's secondary
342 * mac_clients in sync when the primary MAC is updated.
345 typedef void *(*mac_client_handle_fn_t)(void *);
346 typedef void (*mac_client_update_fn_t)(void *);
348 typedef struct mac_capab_vnic_s {
349 void *mcv_arg;
350 mac_client_handle_fn_t mcv_mac_client_handle;
351 mac_client_update_fn_t mcv_mac_secondary_update;
352 } mac_capab_vnic_t;
354 typedef void (*mac_rename_fn_t)(const char *, void *);
355 typedef mblk_t *(*mac_tx_ring_fn_t)(void *, mblk_t *, uintptr_t,
356 mac_ring_handle_t *);
357 typedef struct mac_capab_aggr_s {
358 mac_rename_fn_t mca_rename_fn;
359 int (*mca_unicst)(void *, const uint8_t *);
360 mac_tx_ring_fn_t mca_find_tx_ring_fn;
361 void *mca_arg;
362 } mac_capab_aggr_t;
364 /* Bridge transmit and receive function signatures */
365 typedef mblk_t *(*mac_bridge_tx_t)(mac_handle_t, mac_ring_handle_t, mblk_t *);
366 typedef void (*mac_bridge_rx_t)(mac_handle_t, mac_resource_handle_t, mblk_t *);
367 typedef void (*mac_bridge_ref_t)(mac_handle_t, boolean_t);
368 typedef link_state_t (*mac_bridge_ls_t)(mac_handle_t, link_state_t);
370 /* must change mac_notify_cb_list[] in mac_provider.c if this is changed */
371 typedef enum {
372 MAC_NOTE_LINK,
373 MAC_NOTE_UNICST,
374 MAC_NOTE_TX,
375 MAC_NOTE_DEVPROMISC,
376 MAC_NOTE_FASTPATH_FLUSH,
377 MAC_NOTE_SDU_SIZE,
378 MAC_NOTE_DEST,
379 MAC_NOTE_MARGIN,
380 MAC_NOTE_CAPAB_CHG,
381 MAC_NOTE_LOWLINK,
382 MAC_NOTE_ALLOWED_IPS,
383 MAC_NNOTE /* must be the last entry */
384 } mac_notify_type_t;
386 typedef void (*mac_notify_t)(void *, mac_notify_type_t);
387 typedef void (*mac_rx_t)(void *, mac_resource_handle_t, mblk_t *,
388 boolean_t);
389 typedef mblk_t *(*mac_receive_t)(void *, int);
392 * MAC resource types
394 typedef enum {
395 MAC_RX_FIFO = 1
396 } mac_resource_type_t;
398 typedef int (*mac_intr_enable_t)(mac_intr_handle_t);
399 typedef int (*mac_intr_disable_t)(mac_intr_handle_t);
401 typedef struct mac_intr_s {
402 mac_intr_handle_t mi_handle;
403 mac_intr_enable_t mi_enable;
404 mac_intr_disable_t mi_disable;
405 ddi_intr_handle_t mi_ddi_handle;
406 boolean_t mi_ddi_shared;
407 } mac_intr_t;
409 typedef struct mac_rx_fifo_s {
410 mac_resource_type_t mrf_type; /* MAC_RX_FIFO */
411 mac_intr_t mrf_intr;
412 mac_receive_t mrf_receive;
413 void *mrf_rx_arg;
414 uint32_t mrf_flow_priority;
416 * The CPU this flow is to be processed on. With intrd and future
417 * things, we should know which CPU the flow needs to be processed
418 * and get a squeue assigned on that CPU.
420 uint_t mrf_cpu_id;
421 } mac_rx_fifo_t;
423 #define mrf_intr_handle mrf_intr.mi_handle
424 #define mrf_intr_enable mrf_intr.mi_enable
425 #define mrf_intr_disable mrf_intr.mi_disable
427 typedef union mac_resource_u {
428 mac_resource_type_t mr_type;
429 mac_rx_fifo_t mr_fifo;
430 } mac_resource_t;
432 typedef enum {
433 MAC_ADDRTYPE_UNICAST,
434 MAC_ADDRTYPE_MULTICAST,
435 MAC_ADDRTYPE_BROADCAST
436 } mac_addrtype_t;
438 typedef struct mac_header_info_s {
439 size_t mhi_hdrsize;
440 size_t mhi_pktsize;
441 const uint8_t *mhi_daddr;
442 const uint8_t *mhi_saddr;
443 uint32_t mhi_origsap;
444 uint32_t mhi_bindsap;
445 mac_addrtype_t mhi_dsttype;
446 uint16_t mhi_tci;
447 boolean_t mhi_istagged;
448 boolean_t mhi_ispvid;
449 } mac_header_info_t;
452 * Function pointer to match dls client signature. Should be same as
453 * dls_rx_t to allow a soft ring to bypass DLS layer and call a DLS
454 * client directly.
456 typedef void (*mac_direct_rx_t)(void *, mac_resource_handle_t,
457 mblk_t *, mac_header_info_t *);
459 typedef mac_resource_handle_t (*mac_resource_add_t)(void *, mac_resource_t *);
460 typedef int (*mac_resource_bind_t)(void *,
461 mac_resource_handle_t, processorid_t);
462 typedef void (*mac_resource_remove_t)(void *, void *);
463 typedef void (*mac_resource_quiesce_t)(void *, void *);
464 typedef void (*mac_resource_restart_t)(void *, void *);
465 typedef int (*mac_resource_modify_t)(void *, void *,
466 mac_resource_t *);
467 typedef void (*mac_change_upcall_t)(void *, mac_direct_rx_t,
468 void *);
471 * MAC-Type plugin interfaces
474 typedef int (*mtops_addr_verify_t)(const void *, void *);
475 typedef boolean_t (*mtops_sap_verify_t)(uint32_t, uint32_t *, void *);
476 typedef mblk_t *(*mtops_header_t)(const void *, const void *,
477 uint32_t, void *, mblk_t *, size_t);
478 typedef int (*mtops_header_info_t)(mblk_t *, void *,
479 mac_header_info_t *);
480 typedef boolean_t (*mtops_pdata_verify_t)(void *, size_t);
481 typedef mblk_t *(*mtops_header_modify_t)(mblk_t *, void *);
482 typedef void (*mtops_link_details_t)(char *, size_t, mac_handle_t,
483 void *);
485 typedef struct mactype_ops_s {
486 uint_t mtops_ops;
488 * mtops_unicst_verify() returns 0 if the given address is a valid
489 * unicast address, or a non-zero errno otherwise.
491 mtops_addr_verify_t mtops_unicst_verify;
493 * mtops_multicst_verify() returns 0 if the given address is a
494 * valid multicast address, or a non-zero errno otherwise. If the
495 * media doesn't support multicast, ENOTSUP should be returned (for
496 * example).
498 mtops_addr_verify_t mtops_multicst_verify;
500 * mtops_sap_verify() returns B_TRUE if the given SAP is a valid
501 * SAP value, or B_FALSE otherwise.
503 mtops_sap_verify_t mtops_sap_verify;
505 * mtops_header() is used to allocate and construct a MAC header.
507 mtops_header_t mtops_header;
509 * mtops_header_info() is used to gather information on a given MAC
510 * header.
512 mtops_header_info_t mtops_header_info;
514 * mtops_pdata_verify() is used to verify the validity of MAC
515 * plugin data. It is called by mac_register() if the driver has
516 * supplied MAC plugin data, and also by mac_pdata_update() when
517 * drivers update the data.
519 mtops_pdata_verify_t mtops_pdata_verify;
521 * mtops_header_cook() is an optional callback that converts (or
522 * "cooks") the given raw header (as sent by a raw DLPI consumer)
523 * into one that is appropriate to send down to the MAC driver.
524 * Following the example above, an Ethernet header sent down by a
525 * DLPI consumer would be converted to whatever header the MAC
526 * driver expects.
528 mtops_header_modify_t mtops_header_cook;
530 * mtops_header_uncook() is an optional callback that does the
531 * opposite of mtops_header_cook(). It "uncooks" a given MAC
532 * header (as received from the driver) for consumption by raw DLPI
533 * consumers. For example, for a non-Ethernet plugin that wants
534 * raw DLPI consumers to be fooled into thinking that the device
535 * provides Ethernet access, this callback would modify the given
536 * mblk_t such that the MAC header is converted to an Ethernet
537 * header.
539 mtops_header_modify_t mtops_header_uncook;
541 * mtops_link_details() is an optional callback that provides
542 * extended information about the link state. Its primary purpose
543 * is to provide type-specific support for syslog contents on
544 * link up events. If no implementation is provided, then a default
545 * implementation will be used.
547 mtops_link_details_t mtops_link_details;
548 } mactype_ops_t;
551 * mtops_ops exists for the plugin to enumerate the optional callback
552 * entrypoints it has defined. This allows the mac module to define
553 * additional plugin entrypoints in mactype_ops_t without breaking backward
554 * compatibility with old plugins.
556 #define MTOPS_PDATA_VERIFY 0x001
557 #define MTOPS_HEADER_COOK 0x002
558 #define MTOPS_HEADER_UNCOOK 0x004
559 #define MTOPS_LINK_DETAILS 0x008
562 * Provide mapping for legacy ndd ioctls relevant to that mactype.
563 * Note that the ndd ioctls are obsolete, and may be removed in a future
564 * release of Solaris. The ndd ioctls are not typically used in legacy
565 * ethernet drivers. New datalink drivers of all link-types should use
566 * dladm(1m) interfaces for administering tunables and not have to provide
567 * a mapping.
569 typedef struct mac_ndd_mapping_s {
570 char *mp_name;
571 union {
572 mac_prop_id_t u_id;
573 uint_t u_kstat;
574 } u_mp_id;
575 long mp_minval;
576 long mp_maxval;
577 size_t mp_valsize;
578 int mp_flags;
579 } mac_ndd_mapping_t;
581 #define mp_prop_id u_mp_id.u_id
582 #define mp_kstat u_mp_id.u_kstat
584 typedef struct mac_stat_info_s {
585 uint_t msi_stat;
586 char *msi_name;
587 uint_t msi_type; /* as defined in kstat_named_init(9F) */
588 uint64_t msi_default;
589 } mac_stat_info_t;
591 typedef struct mactype_register_s {
592 uint_t mtr_version; /* set by mactype_alloc() */
593 const char *mtr_ident;
594 mactype_ops_t *mtr_ops;
595 uint_t mtr_mactype;
596 uint_t mtr_nativetype;
597 uint_t mtr_addrlen;
598 uint8_t *mtr_brdcst_addr;
599 mac_stat_info_t *mtr_stats;
600 size_t mtr_statcount;
601 mac_ndd_mapping_t *mtr_mapping;
602 size_t mtr_mappingcount;
603 } mactype_register_t;
606 * Driver interface functions.
608 extern int mac_open_by_linkid(datalink_id_t,
609 mac_handle_t *);
610 extern int mac_open_by_linkname(const char *,
611 mac_handle_t *);
612 extern const char *mac_name(mac_handle_t);
613 extern minor_t mac_minor(mac_handle_t);
614 extern minor_t mac_minor_hold(boolean_t);
615 extern void mac_minor_rele(minor_t);
616 extern void mac_sdu_get(mac_handle_t, uint_t *, uint_t *);
617 extern void mac_sdu_get2(mac_handle_t, uint_t *, uint_t *,
618 uint_t *);
619 extern int mac_maxsdu_update(mac_handle_t, uint_t);
620 extern int mac_maxsdu_update2(mac_handle_t, uint_t,
621 uint_t);
622 extern uint_t mac_addr_len(mac_handle_t);
623 extern int mac_type(mac_handle_t);
624 extern int mac_nativetype(mac_handle_t);
626 extern void mac_unicst_update(mac_handle_t,
627 const uint8_t *);
628 extern void mac_capab_update(mac_handle_t);
629 extern int mac_pdata_update(mac_handle_t, void *,
630 size_t);
631 extern boolean_t mac_margin_update(mac_handle_t, uint32_t);
632 extern void mac_margin_get(mac_handle_t, uint32_t *);
633 extern int mac_margin_remove(mac_handle_t, uint32_t);
634 extern int mac_margin_add(mac_handle_t, uint32_t *,
635 boolean_t);
636 extern int mac_mtu_add(mac_handle_t, uint32_t *,
637 boolean_t);
638 extern int mac_mtu_remove(mac_handle_t, uint32_t);
639 extern int mac_fastpath_disable(mac_handle_t);
640 extern void mac_fastpath_enable(mac_handle_t);
641 extern void mac_no_active(mac_handle_t);
643 extern mactype_register_t *mactype_alloc(uint_t);
644 extern void mactype_free(mactype_register_t *);
645 extern int mactype_register(mactype_register_t *);
646 extern int mactype_unregister(const char *);
648 extern int mac_start_logusage(mac_logtype_t, uint_t);
649 extern void mac_stop_logusage(mac_logtype_t);
651 extern mac_handle_t mac_get_lower_mac_handle(mac_handle_t);
652 extern boolean_t mac_is_vnic_primary(mac_handle_t);
655 * Packet hashing for distribution to multiple ports and rings.
658 #define MAC_PKT_HASH_L2 0x01
659 #define MAC_PKT_HASH_L3 0x02
660 #define MAC_PKT_HASH_L4 0x04
662 extern uint64_t mac_pkt_hash(uint_t, mblk_t *, uint8_t,
663 boolean_t);
666 * Bridging linkage
668 extern void mac_rx_common(mac_handle_t,
669 mac_resource_handle_t, mblk_t *);
670 extern int mac_bridge_set(mac_handle_t, mac_handle_t);
671 extern void mac_bridge_clear(mac_handle_t, mac_handle_t);
672 extern void mac_bridge_vectors(mac_bridge_tx_t,
673 mac_bridge_rx_t, mac_bridge_ref_t,
674 mac_bridge_ls_t);
676 /* special case function for TRILL observability */
677 extern void mac_trill_snoop(mac_handle_t, mblk_t *);
679 #endif /* _KERNEL */
681 #ifdef __cplusplus
683 #endif
685 #endif /* _SYS_MAC_H */