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 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_MAC_H 27 #define _SYS_MAC_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include <sys/types.h> 32 #include <sys/ddi.h> 33 #include <sys/sunddi.h> 34 #include <sys/stream.h> 35 36 /* 37 * MAC Services Module 38 */ 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /* 45 * MAC Information (text emitted by modinfo(1m)) 46 */ 47 #define MAC_INFO "MAC Services v%I%" 48 49 /* 50 * MAC version identifier. This is used by mac_alloc() mac_register() to 51 * verify that incompatible drivers don't register. 52 */ 53 #define MAC_VERSION 0x1 54 55 /* 56 * MAC-Type version identifier. This is used by mactype_alloc() and 57 * mactype_register() to verify that incompatible MAC-Type plugins don't 58 * register. 59 */ 60 #define MACTYPE_VERSION 0x1 61 62 /* 63 * Statistics 64 */ 65 66 #define XCVR_UNDEFINED 0 67 #define XCVR_NONE 1 68 #define XCVR_10 2 69 #define XCVR_100T4 3 70 #define XCVR_100X 4 71 #define XCVR_100T2 5 72 #define XCVR_1000X 6 73 #define XCVR_1000T 7 74 75 typedef enum { 76 LINK_STATE_UNKNOWN = -1, 77 LINK_STATE_DOWN, 78 LINK_STATE_UP 79 } link_state_t; 80 81 typedef enum { 82 LINK_DUPLEX_UNKNOWN = 0, 83 LINK_DUPLEX_HALF, 84 LINK_DUPLEX_FULL 85 } link_duplex_t; 86 87 typedef uint32_t datalink_id_t; 88 #define DATALINK_INVALID_LINKID 0 89 #define DATALINK_ALL_LINKID 0 90 #define DATALINK_MAX_LINKID 0xffffffff 91 92 /* 93 * Maximum MAC address length 94 */ 95 #define MAXMACADDRLEN 20 96 97 #ifdef _KERNEL 98 99 typedef struct mac_stat_info_s { 100 uint_t msi_stat; 101 char *msi_name; 102 uint_t msi_type; /* as defined in kstat_named_init(9F) */ 103 uint64_t msi_default; 104 } mac_stat_info_t; 105 106 /* 107 * There are three ranges of statistics values. 0 to 1 - MAC_STAT_MIN are 108 * interface statistics maintained by the mac module. MAC_STAT_MIN to 1 - 109 * MACTYPE_STAT_MIN are common MAC statistics defined by the mac module and 110 * maintained by each driver. MACTYPE_STAT_MIN and above are statistics 111 * defined by MAC-Type plugins and maintained by each driver. 112 */ 113 #define MAC_STAT_MIN 1000 114 #define MACTYPE_STAT_MIN 2000 115 116 #define IS_MAC_STAT(stat) \ 117 (stat >= MAC_STAT_MIN && stat < MACTYPE_STAT_MIN) 118 #define IS_MACTYPE_STAT(stat) (stat >= MACTYPE_STAT_MIN) 119 120 /* 121 * Statistics maintained by the mac module, and possibly populated as link 122 * statistics. 123 */ 124 enum mac_mod_stat { 125 MAC_STAT_LINK_STATE, 126 MAC_STAT_LINK_UP, 127 MAC_STAT_PROMISC 128 }; 129 130 /* 131 * Do not reorder, and add only to the end of this list. 132 */ 133 enum mac_driver_stat { 134 /* MIB-II stats (RFC 1213 and RFC 1573) */ 135 MAC_STAT_IFSPEED = MAC_STAT_MIN, 136 MAC_STAT_MULTIRCV, 137 MAC_STAT_BRDCSTRCV, 138 MAC_STAT_MULTIXMT, 139 MAC_STAT_BRDCSTXMT, 140 MAC_STAT_NORCVBUF, 141 MAC_STAT_IERRORS, 142 MAC_STAT_UNKNOWNS, 143 MAC_STAT_NOXMTBUF, 144 MAC_STAT_OERRORS, 145 MAC_STAT_COLLISIONS, 146 MAC_STAT_RBYTES, 147 MAC_STAT_IPACKETS, 148 MAC_STAT_OBYTES, 149 MAC_STAT_OPACKETS, 150 MAC_STAT_UNDERFLOWS, 151 MAC_STAT_OVERFLOWS 152 }; 153 154 #define MAC_NSTAT (MAC_STAT_OVERFLOWS - MAC_STAT_IFSPEED + 1) 155 156 #define MAC_STAT_ISACOUNTER(_stat) ( \ 157 (_stat) == MAC_STAT_MULTIRCV || \ 158 (_stat) == MAC_STAT_BRDCSTRCV || \ 159 (_stat) == MAC_STAT_MULTIXMT || \ 160 (_stat) == MAC_STAT_BRDCSTXMT || \ 161 (_stat) == MAC_STAT_NORCVBUF || \ 162 (_stat) == MAC_STAT_IERRORS || \ 163 (_stat) == MAC_STAT_UNKNOWNS || \ 164 (_stat) == MAC_STAT_NOXMTBUF || \ 165 (_stat) == MAC_STAT_OERRORS || \ 166 (_stat) == MAC_STAT_COLLISIONS || \ 167 (_stat) == MAC_STAT_RBYTES || \ 168 (_stat) == MAC_STAT_IPACKETS || \ 169 (_stat) == MAC_STAT_OBYTES || \ 170 (_stat) == MAC_STAT_OPACKETS || \ 171 (_stat) == MAC_STAT_UNDERFLOWS || \ 172 (_stat) == MAC_STAT_OVERFLOWS) 173 174 /* 175 * Immutable information. (This may not be modified after registration). 176 */ 177 typedef struct mac_info_s { 178 uint_t mi_media; 179 uint_t mi_nativemedia; 180 uint_t mi_sdu_min; 181 uint_t mi_sdu_max; 182 uint_t mi_addr_length; 183 uint8_t *mi_unicst_addr; 184 uint8_t *mi_brdcst_addr; 185 } mac_info_t; 186 187 /* 188 * LSO capability 189 */ 190 typedef struct lso_basic_tcp_ipv4_s { 191 t_uscalar_t lso_max; /* maximum payload */ 192 } lso_basic_tcp_ipv4_t; 193 194 /* 195 * Future LSO capabilities can be added at the end of the mac_capab_lso_t. 196 * When such capability is added to the GLDv3 framework, the size of the 197 * mac_capab_lso_t it allocates and passes to the drivers increases. Older 198 * drivers wil access only the (upper) sections of that structure, that is the 199 * sections carrying the capabilities they understand. This ensures the 200 * interface can be safely extended in a binary compatible way. 201 */ 202 typedef struct mac_capab_lso_s { 203 t_uscalar_t lso_flags; 204 lso_basic_tcp_ipv4_t lso_basic_tcp_ipv4; 205 /* Add future lso capabilities here */ 206 } mac_capab_lso_t; 207 208 /* 209 * Information for legacy devices. 210 */ 211 typedef struct mac_capab_legacy_s { 212 /* 213 * Notifications that the legacy device does not support. 214 */ 215 uint32_t ml_unsup_note; 216 /* 217 * dev_t of the legacy device; can be held to force attach. 218 */ 219 dev_t ml_dev; 220 } mac_capab_legacy_t; 221 222 /* 223 * MAC layer capabilities. These capabilities are handled by the drivers' 224 * mc_capab_get() callbacks. Some capabilities require the driver to fill 225 * in a given data structure, and others are simply boolean capabilities. 226 * Note that capability values must be powers of 2 so that consumers and 227 * providers of this interface can keep track of which capabilities they 228 * care about by keeping a bitfield of these things around somewhere. 229 */ 230 typedef enum { 231 MAC_CAPAB_HCKSUM = 0x01, /* data is a uint32_t for the txflags */ 232 MAC_CAPAB_POLL = 0x02, /* boolean only, no data */ 233 MAC_CAPAB_MULTIADDRESS = 0x04, /* data is multiaddress_capab_t */ 234 MAC_CAPAB_LSO = 0x08, /* data is mac_capab_lso_t */ 235 MAC_CAPAB_NO_NATIVEVLAN = 0x10, /* boolean only, no data */ 236 MAC_CAPAB_NO_ZCOPY = 0x20, /* boolean only, no data */ 237 /* add new capabilities here */ 238 239 /* The following capabilities are specific to softmac. */ 240 MAC_CAPAB_LEGACY = 0x8001, /* data is mac_capab_legacy_t */ 241 } mac_capab_t; 242 243 typedef int mac_addr_slot_t; 244 245 /* mma_flags values */ 246 #define MMAC_SLOT_USED 0x1 /* address slot used */ 247 #define MMAC_SLOT_UNUSED 0x2 /* free address slot */ 248 #define MMAC_VENDOR_ADDR 0x4 /* address returned is vendor supplied */ 249 250 typedef struct mac_multi_address_s { 251 mac_addr_slot_t mma_slot; /* slot for add/remove/get/set */ 252 uint_t mma_addrlen; 253 uint8_t mma_addr[MAXMACADDRLEN]; 254 uint_t mma_flags; 255 } mac_multi_addr_t; 256 257 typedef int (*maddr_reserve_t)(void *, mac_multi_addr_t *); 258 typedef int (*maddr_add_t)(void *, mac_multi_addr_t *); 259 typedef int (*maddr_remove_t)(void *, mac_addr_slot_t); 260 typedef int (*maddr_modify_t)(void *, mac_multi_addr_t *); 261 typedef int (*maddr_get_t)(void *, mac_multi_addr_t *); 262 263 /* maddr_flag values */ 264 #define MADDR_VENDOR_ADDR 0x01 /* addr returned is vendor supplied */ 265 266 /* multiple mac address: add/remove/set/get mac address */ 267 typedef struct multiaddress_capab_s { 268 int maddr_naddr; /* total addresses */ 269 int maddr_naddrfree; /* free address slots */ 270 uint_t maddr_flag; /* MADDR_VENDOR_ADDR bit can be set */ 271 /* driver entry points */ 272 void *maddr_handle; /* cookie to be used for the calls */ 273 maddr_reserve_t maddr_reserve; /* reserve a factory address */ 274 maddr_add_t maddr_add; /* add a new unicst address */ 275 maddr_remove_t maddr_remove; /* remove an added address */ 276 maddr_modify_t maddr_modify; /* modify an added address */ 277 maddr_get_t maddr_get; /* get address from specified slot */ 278 } multiaddress_capab_t; 279 280 /* 281 * MAC driver entry point types. 282 */ 283 typedef int (*mac_getstat_t)(void *, uint_t, uint64_t *); 284 typedef int (*mac_start_t)(void *); 285 typedef void (*mac_stop_t)(void *); 286 typedef int (*mac_setpromisc_t)(void *, boolean_t); 287 typedef int (*mac_multicst_t)(void *, boolean_t, const uint8_t *); 288 typedef int (*mac_unicst_t)(void *, const uint8_t *); 289 typedef void (*mac_ioctl_t)(void *, queue_t *, mblk_t *); 290 typedef void (*mac_resources_t)(void *); 291 typedef mblk_t *(*mac_tx_t)(void *, mblk_t *); 292 typedef boolean_t (*mac_getcapab_t)(void *, mac_capab_t, void *); 293 typedef int (*mac_open_t)(void *); 294 typedef void (*mac_close_t)(void *); 295 296 /* 297 * Drivers must set all of these callbacks except for mc_resources, 298 * mc_ioctl, and mc_getcapab, which are optional. If any of these optional 299 * callbacks are set, their appropriate flags must be set in mc_callbacks. 300 * Any future additions to this list must also be accompanied by an 301 * associated mc_callbacks flag so that the framework can grow without 302 * affecting the binary compatibility of the interface. 303 */ 304 typedef struct mac_callbacks_s { 305 uint_t mc_callbacks; /* Denotes which callbacks are set */ 306 mac_getstat_t mc_getstat; /* Get the value of a statistic */ 307 mac_start_t mc_start; /* Start the device */ 308 mac_stop_t mc_stop; /* Stop the device */ 309 mac_setpromisc_t mc_setpromisc; /* Enable or disable promiscuous mode */ 310 mac_multicst_t mc_multicst; /* Enable or disable a multicast addr */ 311 mac_unicst_t mc_unicst; /* Set the unicast MAC address */ 312 mac_tx_t mc_tx; /* Transmit a packet */ 313 mac_resources_t mc_resources; /* Get the device resources */ 314 mac_ioctl_t mc_ioctl; /* Process an unknown ioctl */ 315 mac_getcapab_t mc_getcapab; /* Get capability information */ 316 mac_open_t mc_open; /* Open the device */ 317 mac_close_t mc_close; /* Close the device */ 318 } mac_callbacks_t; 319 320 /* 321 * Flags for mc_callbacks. Requiring drivers to set the flags associated 322 * with optional callbacks initialized in the structure allows the mac 323 * module to add optional callbacks in the future without requiring drivers 324 * to recompile. 325 */ 326 #define MC_RESOURCES 0x001 327 #define MC_IOCTL 0x002 328 #define MC_GETCAPAB 0x004 329 #define MC_OPEN 0x008 330 #define MC_CLOSE 0x010 331 332 #define MAC_MAX_MINOR 1000 333 334 typedef struct mac_register_s { 335 uint_t m_version; /* set by mac_alloc() */ 336 const char *m_type_ident; 337 void *m_driver; /* Driver private data */ 338 dev_info_t *m_dip; 339 uint_t m_instance; 340 uint8_t *m_src_addr; 341 uint8_t *m_dst_addr; 342 mac_callbacks_t *m_callbacks; 343 uint_t m_min_sdu; 344 uint_t m_max_sdu; 345 void *m_pdata; 346 size_t m_pdata_size; 347 uint32_t m_margin; 348 } mac_register_t; 349 350 /* 351 * Opaque handle types. 352 */ 353 typedef struct mac_t *mac_handle_t; 354 typedef struct __mac_notify_handle *mac_notify_handle_t; 355 typedef struct __mac_rx_handle *mac_rx_handle_t; 356 typedef struct __mac_txloop_handle *mac_txloop_handle_t; 357 typedef struct __mac_resource_handle *mac_resource_handle_t; 358 359 /* 360 * MAC interface callback types. 361 */ 362 typedef enum { 363 MAC_NOTE_LINK, 364 MAC_NOTE_PROMISC, 365 MAC_NOTE_UNICST, 366 MAC_NOTE_TX, 367 MAC_NOTE_RESOURCE, 368 MAC_NOTE_DEVPROMISC, 369 MAC_NOTE_FASTPATH_FLUSH, 370 MAC_NOTE_VNIC, 371 MAC_NOTE_MARGIN, 372 MAC_NNOTE /* must be the last entry */ 373 } mac_notify_type_t; 374 375 typedef void (*mac_notify_t)(void *, mac_notify_type_t); 376 typedef void (*mac_rx_t)(void *, mac_resource_handle_t, mblk_t *); 377 typedef void (*mac_txloop_t)(void *, mblk_t *); 378 typedef void (*mac_blank_t)(void *, time_t, uint_t); 379 380 /* 381 * MAC promiscuous types 382 */ 383 typedef enum { 384 MAC_PROMISC = 0x01, /* MAC instance is promiscuous */ 385 MAC_DEVPROMISC = 0x02 /* Device is promiscuous */ 386 } mac_promisc_type_t; 387 388 /* 389 * MAC resource types 390 */ 391 typedef enum { 392 MAC_RX_FIFO = 1 393 } mac_resource_type_t; 394 395 typedef struct mac_rx_fifo_s { 396 mac_resource_type_t mrf_type; /* MAC_RX_FIFO */ 397 mac_blank_t mrf_blank; 398 void *mrf_arg; 399 time_t mrf_normal_blank_time; 400 uint_t mrf_normal_pkt_count; 401 } mac_rx_fifo_t; 402 403 typedef struct mac_txinfo_s { 404 mac_tx_t mt_fn; 405 void *mt_arg; 406 } mac_txinfo_t; 407 408 typedef union mac_resource_u { 409 mac_resource_type_t mr_type; 410 mac_rx_fifo_t mr_fifo; 411 } mac_resource_t; 412 413 typedef mac_resource_handle_t (*mac_resource_add_t)(void *, mac_resource_t *); 414 415 typedef enum { 416 MAC_ADDRTYPE_UNICAST, 417 MAC_ADDRTYPE_MULTICAST, 418 MAC_ADDRTYPE_BROADCAST 419 } mac_addrtype_t; 420 421 typedef struct mac_header_info_s { 422 size_t mhi_hdrsize; 423 size_t mhi_pktsize; 424 const uint8_t *mhi_daddr; 425 const uint8_t *mhi_saddr; 426 uint32_t mhi_origsap; 427 uint32_t mhi_bindsap; 428 mac_addrtype_t mhi_dsttype; 429 uint16_t mhi_tci; 430 uint_t mhi_istagged:1, 431 mhi_prom_looped:1; 432 } mac_header_info_t; 433 434 /* 435 * MAC-Type plugin interfaces 436 */ 437 438 typedef int (*mtops_addr_verify_t)(const void *, void *); 439 typedef boolean_t (*mtops_sap_verify_t)(uint32_t, uint32_t *, void *); 440 typedef mblk_t *(*mtops_header_t)(const void *, const void *, 441 uint32_t, void *, mblk_t *, size_t); 442 typedef int (*mtops_header_info_t)(mblk_t *, void *, 443 mac_header_info_t *); 444 typedef boolean_t (*mtops_pdata_verify_t)(void *, size_t); 445 typedef mblk_t *(*mtops_header_modify_t)(mblk_t *, void *); 446 typedef void (*mtops_link_details_t)(char *, size_t, mac_handle_t, 447 void *); 448 449 typedef struct mactype_ops_s { 450 uint_t mtops_ops; 451 /* 452 * mtops_unicst_verify() returns 0 if the given address is a valid 453 * unicast address, or a non-zero errno otherwise. 454 */ 455 mtops_addr_verify_t mtops_unicst_verify; 456 /* 457 * mtops_multicst_verify() returns 0 if the given address is a 458 * valid multicast address, or a non-zero errno otherwise. If the 459 * media doesn't support multicast, ENOTSUP should be returned (for 460 * example). 461 */ 462 mtops_addr_verify_t mtops_multicst_verify; 463 /* 464 * mtops_sap_verify() returns B_TRUE if the given SAP is a valid 465 * SAP value, or B_FALSE otherwise. 466 */ 467 mtops_sap_verify_t mtops_sap_verify; 468 /* 469 * mtops_header() is used to allocate and construct a MAC header. 470 */ 471 mtops_header_t mtops_header; 472 /* 473 * mtops_header_info() is used to gather information on a given MAC 474 * header. 475 */ 476 mtops_header_info_t mtops_header_info; 477 /* 478 * mtops_pdata_verify() is used to verify the validity of MAC 479 * plugin data. It is called by mac_register() if the driver has 480 * supplied MAC plugin data, and also by mac_pdata_update() when 481 * drivers update the data. 482 */ 483 mtops_pdata_verify_t mtops_pdata_verify; 484 /* 485 * mtops_header_cook() is an optional callback that converts (or 486 * "cooks") the given raw header (as sent by a raw DLPI consumer) 487 * into one that is appropriate to send down to the MAC driver. 488 * Following the example above, an Ethernet header sent down by a 489 * DLPI consumer would be converted to whatever header the MAC 490 * driver expects. 491 */ 492 mtops_header_modify_t mtops_header_cook; 493 /* 494 * mtops_header_uncook() is an optional callback that does the 495 * opposite of mtops_header_cook(). It "uncooks" a given MAC 496 * header (as received from the driver) for consumption by raw DLPI 497 * consumers. For example, for a non-Ethernet plugin that wants 498 * raw DLPI consumers to be fooled into thinking that the device 499 * provides Ethernet access, this callback would modify the given 500 * mblk_t such that the MAC header is converted to an Ethernet 501 * header. 502 */ 503 mtops_header_modify_t mtops_header_uncook; 504 /* 505 * mtops_link_details() is an optional callback that provides 506 * extended information about the link state. Its primary purpose 507 * is to provide type-specific support for syslog contents on 508 * link up events. If no implementation is provided, then a default 509 * implementation will be used. 510 */ 511 mtops_link_details_t mtops_link_details; 512 } mactype_ops_t; 513 514 /* 515 * mtops_ops exists for the plugin to enumerate the optional callback 516 * entrypoints it has defined. This allows the mac module to define 517 * additional plugin entrypoints in mactype_ops_t without breaking backward 518 * compatibility with old plugins. 519 */ 520 #define MTOPS_PDATA_VERIFY 0x001 521 #define MTOPS_HEADER_COOK 0x002 522 #define MTOPS_HEADER_UNCOOK 0x004 523 #define MTOPS_LINK_DETAILS 0x008 524 525 typedef struct mactype_register_s { 526 uint_t mtr_version; /* set by mactype_alloc() */ 527 const char *mtr_ident; 528 mactype_ops_t *mtr_ops; 529 uint_t mtr_mactype; 530 uint_t mtr_nativetype; 531 uint_t mtr_addrlen; 532 uint8_t *mtr_brdcst_addr; 533 mac_stat_info_t *mtr_stats; 534 size_t mtr_statcount; 535 } mactype_register_t; 536 537 /* 538 * Client interface functions. 539 */ 540 extern int mac_open(const char *, mac_handle_t *); 541 extern int mac_open_by_linkid(datalink_id_t, 542 mac_handle_t *); 543 extern int mac_open_by_linkname(const char *, 544 mac_handle_t *); 545 extern void mac_close(mac_handle_t); 546 extern const mac_info_t *mac_info(mac_handle_t); 547 extern boolean_t mac_info_get(const char *, mac_info_t *); 548 extern uint64_t mac_stat_get(mac_handle_t, uint_t); 549 extern int mac_start(mac_handle_t); 550 extern void mac_stop(mac_handle_t); 551 extern int mac_promisc_set(mac_handle_t, boolean_t, 552 mac_promisc_type_t); 553 extern boolean_t mac_promisc_get(mac_handle_t, 554 mac_promisc_type_t); 555 extern int mac_multicst_add(mac_handle_t, const uint8_t *); 556 extern int mac_multicst_remove(mac_handle_t, 557 const uint8_t *); 558 extern boolean_t mac_unicst_verify(mac_handle_t, 559 const uint8_t *, uint_t); 560 extern int mac_unicst_set(mac_handle_t, const uint8_t *); 561 extern void mac_unicst_get(mac_handle_t, uint8_t *); 562 extern void mac_dest_get(mac_handle_t, uint8_t *); 563 extern void mac_resources(mac_handle_t); 564 extern void mac_ioctl(mac_handle_t, queue_t *, mblk_t *); 565 extern const mac_txinfo_t *mac_tx_get(mac_handle_t); 566 extern const mac_txinfo_t *mac_vnic_tx_get(mac_handle_t); 567 extern link_state_t mac_link_get(mac_handle_t); 568 extern mac_notify_handle_t mac_notify_add(mac_handle_t, mac_notify_t, 569 void *); 570 extern void mac_notify_remove(mac_handle_t, 571 mac_notify_handle_t); 572 extern void mac_notify(mac_handle_t); 573 extern mac_rx_handle_t mac_rx_add(mac_handle_t, mac_rx_t, void *); 574 extern mac_rx_handle_t mac_active_rx_add(mac_handle_t, mac_rx_t, 575 void *); 576 extern void mac_rx_remove(mac_handle_t, mac_rx_handle_t, 577 boolean_t); 578 extern void mac_rx_remove_wait(mac_handle_t); 579 extern mblk_t *mac_txloop(void *, mblk_t *); 580 extern mac_txloop_handle_t mac_txloop_add(mac_handle_t, mac_txloop_t, 581 void *); 582 extern void mac_txloop_remove(mac_handle_t, 583 mac_txloop_handle_t); 584 extern boolean_t mac_active_set(mac_handle_t); 585 extern boolean_t mac_active_shareable_set(mac_handle_t); 586 extern void mac_active_clear(mac_handle_t); 587 extern void mac_active_rx(void *, mac_resource_handle_t, 588 mblk_t *); 589 extern boolean_t mac_vnic_set(mac_handle_t, mac_txinfo_t *, 590 mac_getcapab_t, void *); 591 extern void mac_vnic_clear(mac_handle_t); 592 extern void mac_resource_set(mac_handle_t, 593 mac_resource_add_t, void *); 594 extern dev_info_t *mac_devinfo_get(mac_handle_t); 595 extern const char *mac_name(mac_handle_t); 596 extern minor_t mac_minor(mac_handle_t); 597 extern boolean_t mac_capab_get(mac_handle_t, mac_capab_t, 598 void *); 599 extern boolean_t mac_vnic_capab_get(mac_handle_t, mac_capab_t, 600 void *); 601 extern boolean_t mac_sap_verify(mac_handle_t, uint32_t, 602 uint32_t *); 603 extern mblk_t *mac_header(mac_handle_t, const uint8_t *, 604 uint32_t, mblk_t *, size_t); 605 extern int mac_header_info(mac_handle_t, mblk_t *, 606 mac_header_info_t *); 607 extern mblk_t *mac_header_cook(mac_handle_t, mblk_t *); 608 extern mblk_t *mac_header_uncook(mac_handle_t, mblk_t *); 609 extern minor_t mac_minor_hold(boolean_t); 610 extern void mac_minor_rele(minor_t); 611 612 /* 613 * Driver interface functions. 614 */ 615 extern mac_register_t *mac_alloc(uint_t); 616 extern void mac_free(mac_register_t *); 617 extern int mac_register(mac_register_t *, mac_handle_t *); 618 extern int mac_disable(mac_handle_t); 619 extern int mac_unregister(mac_handle_t); 620 extern void mac_rx(mac_handle_t, mac_resource_handle_t, 621 mblk_t *); 622 extern void mac_link_update(mac_handle_t, link_state_t); 623 extern void mac_unicst_update(mac_handle_t, 624 const uint8_t *); 625 extern void mac_tx_update(mac_handle_t); 626 extern void mac_resource_update(mac_handle_t); 627 extern mac_resource_handle_t mac_resource_add(mac_handle_t, 628 mac_resource_t *); 629 extern int mac_pdata_update(mac_handle_t, void *, 630 size_t); 631 extern void mac_multicst_refresh(mac_handle_t, 632 mac_multicst_t, void *, boolean_t); 633 extern void mac_unicst_refresh(mac_handle_t, mac_unicst_t, 634 void *); 635 extern void mac_promisc_refresh(mac_handle_t, 636 mac_setpromisc_t, void *); 637 extern boolean_t mac_margin_update(mac_handle_t, uint32_t); 638 extern void mac_margin_get(mac_handle_t, uint32_t *); 639 extern int mac_margin_remove(mac_handle_t, uint32_t); 640 extern int mac_margin_add(mac_handle_t, uint32_t *, 641 boolean_t); 642 extern void mac_init_ops(struct dev_ops *, const char *); 643 extern void mac_fini_ops(struct dev_ops *); 644 extern uint32_t mac_no_notification(mac_handle_t); 645 extern boolean_t mac_is_legacy(mac_handle_t); 646 extern int mac_hold_exclusive(mac_handle_t); 647 extern void mac_rele_exclusive(mac_handle_t); 648 649 extern mactype_register_t *mactype_alloc(uint_t); 650 extern void mactype_free(mactype_register_t *); 651 extern int mactype_register(mactype_register_t *); 652 extern int mactype_unregister(const char *); 653 654 #endif /* _KERNEL */ 655 656 #ifdef __cplusplus 657 } 658 #endif 659 660 #endif /* _SYS_MAC_H */ 661