1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_SYS_MAC_IMPL_H
28*0Sstevel@tonic-gate #define	_SYS_MAC_IMPL_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/mac.h>
33*0Sstevel@tonic-gate #include <sys/ght.h>
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate #ifdef	__cplusplus
36*0Sstevel@tonic-gate extern "C" {
37*0Sstevel@tonic-gate #endif
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate typedef struct mac_multicst_addr_s	mac_multicst_addr_t;
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate struct mac_multicst_addr_s {
42*0Sstevel@tonic-gate 	mac_multicst_addr_t	*mma_nextp;
43*0Sstevel@tonic-gate 	uint_t			mma_ref;
44*0Sstevel@tonic-gate 	uint8_t			mma_addr[MAXADDRLEN];
45*0Sstevel@tonic-gate };
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate typedef struct mac_notify_fn_s		mac_notify_fn_t;
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate struct mac_notify_fn_s {
50*0Sstevel@tonic-gate 	mac_notify_fn_t		*mnf_nextp;
51*0Sstevel@tonic-gate 	mac_notify_t		mnf_fn;
52*0Sstevel@tonic-gate 	void			*mnf_arg;
53*0Sstevel@tonic-gate };
54*0Sstevel@tonic-gate 
55*0Sstevel@tonic-gate typedef struct mac_rx_fn_s		mac_rx_fn_t;
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate struct mac_rx_fn_s {
58*0Sstevel@tonic-gate 	mac_rx_fn_t		*mrf_nextp;
59*0Sstevel@tonic-gate 	mac_rx_t		mrf_fn;
60*0Sstevel@tonic-gate 	void			*mrf_arg;
61*0Sstevel@tonic-gate };
62*0Sstevel@tonic-gate 
63*0Sstevel@tonic-gate typedef struct mac_txloop_fn_s		mac_txloop_fn_t;
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate struct mac_txloop_fn_s {
66*0Sstevel@tonic-gate 	mac_txloop_fn_t		*mtf_nextp;
67*0Sstevel@tonic-gate 	mac_txloop_t		mtf_fn;
68*0Sstevel@tonic-gate 	void			*mtf_arg;
69*0Sstevel@tonic-gate };
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate typedef boolean_t	(*mac_unicst_verify_t)(mac_impl_t *,
72*0Sstevel@tonic-gate     const uint8_t *);
73*0Sstevel@tonic-gate typedef boolean_t	(*mac_multicst_verify_t)(mac_impl_t *,
74*0Sstevel@tonic-gate     const uint8_t *);
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate struct mac_impl_s {
77*0Sstevel@tonic-gate 	mac_t			*mi_mp;
78*0Sstevel@tonic-gate 	char			mi_dev[MAXNAMELEN];
79*0Sstevel@tonic-gate 	uint_t			mi_port;
80*0Sstevel@tonic-gate 	char			mi_name[MAXNAMELEN];
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate 	ghte_t			mi_hte;
83*0Sstevel@tonic-gate 	uint32_t		mi_ref;
84*0Sstevel@tonic-gate 	boolean_t		mi_destroying;
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate 	krwlock_t		mi_state_lock;
87*0Sstevel@tonic-gate 	uint_t			mi_active;
88*0Sstevel@tonic-gate 
89*0Sstevel@tonic-gate 	krwlock_t		mi_data_lock;
90*0Sstevel@tonic-gate 	link_state_t		mi_link;
91*0Sstevel@tonic-gate 	uint_t			mi_promisc;
92*0Sstevel@tonic-gate 	uint_t			mi_devpromisc;
93*0Sstevel@tonic-gate 	uint8_t			mi_addr[MAXADDRLEN];
94*0Sstevel@tonic-gate 	mac_multicst_addr_t	*mi_mmap;
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate 	uint_t			mi_addr_length;
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate 	krwlock_t		mi_notify_lock;
99*0Sstevel@tonic-gate 	mac_notify_fn_t		*mi_mnfp;
100*0Sstevel@tonic-gate 
101*0Sstevel@tonic-gate 	krwlock_t		mi_rx_lock;
102*0Sstevel@tonic-gate 	mac_rx_fn_t		*mi_mrfp;
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate 	krwlock_t		mi_txloop_lock;
105*0Sstevel@tonic-gate 	mac_txloop_fn_t		*mi_mtfp;
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate 	krwlock_t		mi_resource_lock;
108*0Sstevel@tonic-gate 	mac_resource_add_t	mi_resource_add;
109*0Sstevel@tonic-gate 	void			*mi_resource_add_arg;
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate 	kstat_t			*mi_ksp;
112*0Sstevel@tonic-gate 
113*0Sstevel@tonic-gate 	mac_unicst_verify_t	mi_unicst_verify;
114*0Sstevel@tonic-gate 	mac_multicst_verify_t	mi_multicst_verify;
115*0Sstevel@tonic-gate 
116*0Sstevel@tonic-gate 	kmutex_t		mi_activelink_lock;
117*0Sstevel@tonic-gate 	boolean_t		mi_activelink;
118*0Sstevel@tonic-gate };
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate extern void	mac_init(void);
121*0Sstevel@tonic-gate extern int	mac_fini(void);
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate extern void	mac_stat_create(mac_impl_t *);
124*0Sstevel@tonic-gate extern void	mac_stat_destroy(mac_impl_t *);
125*0Sstevel@tonic-gate 
126*0Sstevel@tonic-gate #ifdef	__cplusplus
127*0Sstevel@tonic-gate }
128*0Sstevel@tonic-gate #endif
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate #endif	/* _SYS_MAC_IMPL_H */
131