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