xref: /titanic_44/usr/src/uts/common/sys/mac_impl.h (revision 683007910b81ed9ff942db7c464d1b6df524048a)
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 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 typedef struct mac_multicst_addr_s	mac_multicst_addr_t;
39 
40 struct mac_multicst_addr_s {
41 	mac_multicst_addr_t	*mma_nextp;
42 	uint_t			mma_ref;
43 	uint8_t			mma_addr[MAXADDRLEN];
44 };
45 
46 typedef struct mac_notify_fn_s		mac_notify_fn_t;
47 
48 struct mac_notify_fn_s {
49 	mac_notify_fn_t		*mnf_nextp;
50 	mac_notify_t		mnf_fn;
51 	void			*mnf_arg;
52 };
53 
54 typedef struct mac_rx_fn_s		mac_rx_fn_t;
55 
56 struct mac_rx_fn_s {
57 	mac_rx_fn_t		*mrf_nextp;
58 	mac_rx_t		mrf_fn;
59 	void			*mrf_arg;
60 };
61 
62 typedef struct mac_txloop_fn_s		mac_txloop_fn_t;
63 
64 struct mac_txloop_fn_s {
65 	mac_txloop_fn_t		*mtf_nextp;
66 	mac_txloop_t		mtf_fn;
67 	void			*mtf_arg;
68 };
69 
70 typedef boolean_t	(*mac_unicst_verify_t)(mac_impl_t *,
71     const uint8_t *);
72 typedef boolean_t	(*mac_multicst_verify_t)(mac_impl_t *,
73     const uint8_t *);
74 
75 struct mac_impl_s {
76 	mac_t			*mi_mp;
77 	char			mi_dev[MAXNAMELEN];
78 	uint_t			mi_port;
79 	char			mi_name[MAXNAMELEN];
80 
81 	uint32_t		mi_ref;
82 	boolean_t		mi_destroying;
83 
84 	krwlock_t		mi_state_lock;
85 	uint_t			mi_active;
86 
87 	krwlock_t		mi_data_lock;
88 	link_state_t		mi_link;
89 	uint_t			mi_promisc;
90 	uint_t			mi_devpromisc;
91 	uint8_t			mi_addr[MAXADDRLEN];
92 	mac_multicst_addr_t	*mi_mmap;
93 
94 	uint_t			mi_addr_length;
95 
96 	krwlock_t		mi_notify_lock;
97 	mac_notify_fn_t		*mi_mnfp;
98 
99 	krwlock_t		mi_rx_lock;
100 	mac_rx_fn_t		*mi_mrfp;
101 
102 	krwlock_t		mi_txloop_lock;
103 	mac_txloop_fn_t		*mi_mtfp;
104 
105 	krwlock_t		mi_resource_lock;
106 	mac_resource_add_t	mi_resource_add;
107 	void			*mi_resource_add_arg;
108 
109 	kstat_t			*mi_ksp;
110 
111 	mac_unicst_verify_t	mi_unicst_verify;
112 	mac_multicst_verify_t	mi_multicst_verify;
113 
114 	kmutex_t		mi_activelink_lock;
115 	boolean_t		mi_activelink;
116 
117 	mac_txinfo_t		mi_txinfo;
118 	mac_txinfo_t		mi_txloopinfo;
119 };
120 
121 extern void	mac_init(void);
122 extern int	mac_fini(void);
123 
124 extern void	mac_stat_create(mac_impl_t *);
125 extern void	mac_stat_destroy(mac_impl_t *);
126 
127 #ifdef	__cplusplus
128 }
129 #endif
130 
131 #endif	/* _SYS_MAC_IMPL_H */
132