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 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_MAC_IMPL_H 27 #define _SYS_MAC_IMPL_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include <sys/mac.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 typedef struct mac_multicst_addr_s mac_multicst_addr_t; 38 39 struct mac_multicst_addr_s { 40 mac_multicst_addr_t *mma_nextp; 41 uint_t mma_ref; 42 uint8_t mma_addr[MAXADDRLEN]; 43 }; 44 45 typedef struct mac_notify_fn_s mac_notify_fn_t; 46 47 struct mac_notify_fn_s { 48 mac_notify_fn_t *mnf_nextp; 49 mac_notify_t mnf_fn; 50 void *mnf_arg; 51 }; 52 53 typedef struct mac_rx_fn_s mac_rx_fn_t; 54 55 struct mac_rx_fn_s { 56 mac_rx_fn_t *mrf_nextp; 57 mac_rx_t mrf_fn; 58 void *mrf_arg; 59 }; 60 61 typedef struct mac_txloop_fn_s mac_txloop_fn_t; 62 63 struct mac_txloop_fn_s { 64 mac_txloop_fn_t *mtf_nextp; 65 mac_txloop_t mtf_fn; 66 void *mtf_arg; 67 }; 68 69 typedef boolean_t (*mac_unicst_verify_t)(mac_impl_t *, 70 const uint8_t *); 71 typedef boolean_t (*mac_multicst_verify_t)(mac_impl_t *, 72 const uint8_t *); 73 74 struct mac_impl_s { 75 mac_t *mi_mp; 76 char mi_dev[MAXNAMELEN]; 77 uint_t mi_port; 78 char mi_name[MAXNAMELEN]; 79 80 uint32_t mi_ref; 81 boolean_t mi_disabled; 82 83 krwlock_t mi_state_lock; 84 uint_t mi_active; 85 86 krwlock_t mi_data_lock; 87 link_state_t mi_link; 88 uint_t mi_promisc; 89 uint_t mi_devpromisc; 90 uint8_t mi_addr[MAXADDRLEN]; 91 mac_multicst_addr_t *mi_mmap; 92 93 uint_t mi_addr_length; 94 95 krwlock_t mi_notify_lock; 96 mac_notify_fn_t *mi_mnfp; 97 98 kmutex_t mi_notify_ref_lock; 99 uint32_t mi_notify_ref; 100 kcondvar_t mi_notify_cv; 101 102 krwlock_t mi_rx_lock; 103 mac_rx_fn_t *mi_mrfp; 104 105 krwlock_t mi_txloop_lock; 106 mac_txloop_fn_t *mi_mtfp; 107 108 krwlock_t mi_resource_lock; 109 mac_resource_add_t mi_resource_add; 110 void *mi_resource_add_arg; 111 112 kstat_t *mi_ksp; 113 114 mac_unicst_verify_t mi_unicst_verify; 115 mac_multicst_verify_t mi_multicst_verify; 116 117 kmutex_t mi_activelink_lock; 118 boolean_t mi_activelink; 119 120 mac_txinfo_t mi_txinfo; 121 mac_txinfo_t mi_txloopinfo; 122 }; 123 124 typedef struct mac_notify_task_arg { 125 mac_impl_t *mnt_mip; 126 mac_notify_type_t mnt_type; 127 } mac_notify_task_arg_t; 128 129 extern void mac_init(void); 130 extern int mac_fini(void); 131 132 extern void mac_stat_create(mac_impl_t *); 133 extern void mac_stat_destroy(mac_impl_t *); 134 135 #ifdef __cplusplus 136 } 137 #endif 138 139 #endif /* _SYS_MAC_IMPL_H */ 140