10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*1852Syz147064  * Common Development and Distribution License (the "License").
6*1852Syz147064  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*1852Syz147064  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_MAC_IMPL_H
270Sstevel@tonic-gate #define	_SYS_MAC_IMPL_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/mac.h>
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate typedef struct mac_multicst_addr_s	mac_multicst_addr_t;
380Sstevel@tonic-gate 
390Sstevel@tonic-gate struct mac_multicst_addr_s {
400Sstevel@tonic-gate 	mac_multicst_addr_t	*mma_nextp;
410Sstevel@tonic-gate 	uint_t			mma_ref;
420Sstevel@tonic-gate 	uint8_t			mma_addr[MAXADDRLEN];
430Sstevel@tonic-gate };
440Sstevel@tonic-gate 
450Sstevel@tonic-gate typedef struct mac_notify_fn_s		mac_notify_fn_t;
460Sstevel@tonic-gate 
470Sstevel@tonic-gate struct mac_notify_fn_s {
480Sstevel@tonic-gate 	mac_notify_fn_t		*mnf_nextp;
490Sstevel@tonic-gate 	mac_notify_t		mnf_fn;
500Sstevel@tonic-gate 	void			*mnf_arg;
510Sstevel@tonic-gate };
520Sstevel@tonic-gate 
530Sstevel@tonic-gate typedef struct mac_rx_fn_s		mac_rx_fn_t;
540Sstevel@tonic-gate 
550Sstevel@tonic-gate struct mac_rx_fn_s {
560Sstevel@tonic-gate 	mac_rx_fn_t		*mrf_nextp;
570Sstevel@tonic-gate 	mac_rx_t		mrf_fn;
580Sstevel@tonic-gate 	void			*mrf_arg;
590Sstevel@tonic-gate };
600Sstevel@tonic-gate 
610Sstevel@tonic-gate typedef struct mac_txloop_fn_s		mac_txloop_fn_t;
620Sstevel@tonic-gate 
630Sstevel@tonic-gate struct mac_txloop_fn_s {
640Sstevel@tonic-gate 	mac_txloop_fn_t		*mtf_nextp;
650Sstevel@tonic-gate 	mac_txloop_t		mtf_fn;
660Sstevel@tonic-gate 	void			*mtf_arg;
670Sstevel@tonic-gate };
680Sstevel@tonic-gate 
690Sstevel@tonic-gate typedef boolean_t	(*mac_unicst_verify_t)(mac_impl_t *,
700Sstevel@tonic-gate     const uint8_t *);
710Sstevel@tonic-gate typedef boolean_t	(*mac_multicst_verify_t)(mac_impl_t *,
720Sstevel@tonic-gate     const uint8_t *);
730Sstevel@tonic-gate 
740Sstevel@tonic-gate struct mac_impl_s {
750Sstevel@tonic-gate 	mac_t			*mi_mp;
760Sstevel@tonic-gate 	char			mi_dev[MAXNAMELEN];
770Sstevel@tonic-gate 	uint_t			mi_port;
780Sstevel@tonic-gate 	char			mi_name[MAXNAMELEN];
790Sstevel@tonic-gate 
800Sstevel@tonic-gate 	uint32_t		mi_ref;
81*1852Syz147064 	boolean_t		mi_disabled;
820Sstevel@tonic-gate 
830Sstevel@tonic-gate 	krwlock_t		mi_state_lock;
840Sstevel@tonic-gate 	uint_t			mi_active;
850Sstevel@tonic-gate 
860Sstevel@tonic-gate 	krwlock_t		mi_data_lock;
870Sstevel@tonic-gate 	link_state_t		mi_link;
880Sstevel@tonic-gate 	uint_t			mi_promisc;
890Sstevel@tonic-gate 	uint_t			mi_devpromisc;
900Sstevel@tonic-gate 	uint8_t			mi_addr[MAXADDRLEN];
910Sstevel@tonic-gate 	mac_multicst_addr_t	*mi_mmap;
920Sstevel@tonic-gate 
930Sstevel@tonic-gate 	uint_t			mi_addr_length;
940Sstevel@tonic-gate 
950Sstevel@tonic-gate 	krwlock_t		mi_notify_lock;
960Sstevel@tonic-gate 	mac_notify_fn_t		*mi_mnfp;
970Sstevel@tonic-gate 
98*1852Syz147064 	kmutex_t		mi_notify_ref_lock;
99*1852Syz147064 	uint32_t		mi_notify_ref;
100*1852Syz147064 	kcondvar_t		mi_notify_cv;
101*1852Syz147064 
1020Sstevel@tonic-gate 	krwlock_t		mi_rx_lock;
1030Sstevel@tonic-gate 	mac_rx_fn_t		*mi_mrfp;
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate 	krwlock_t		mi_txloop_lock;
1060Sstevel@tonic-gate 	mac_txloop_fn_t		*mi_mtfp;
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate 	krwlock_t		mi_resource_lock;
1090Sstevel@tonic-gate 	mac_resource_add_t	mi_resource_add;
1100Sstevel@tonic-gate 	void			*mi_resource_add_arg;
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate 	kstat_t			*mi_ksp;
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate 	mac_unicst_verify_t	mi_unicst_verify;
1150Sstevel@tonic-gate 	mac_multicst_verify_t	mi_multicst_verify;
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate 	kmutex_t		mi_activelink_lock;
1180Sstevel@tonic-gate 	boolean_t		mi_activelink;
11956Smeem 
12056Smeem 	mac_txinfo_t		mi_txinfo;
12156Smeem 	mac_txinfo_t		mi_txloopinfo;
1220Sstevel@tonic-gate };
1230Sstevel@tonic-gate 
124*1852Syz147064 typedef struct mac_notify_task_arg {
125*1852Syz147064 	mac_impl_t		*mnt_mip;
126*1852Syz147064 	mac_notify_type_t	mnt_type;
127*1852Syz147064 } mac_notify_task_arg_t;
128*1852Syz147064 
1290Sstevel@tonic-gate extern void	mac_init(void);
1300Sstevel@tonic-gate extern int	mac_fini(void);
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate extern void	mac_stat_create(mac_impl_t *);
1330Sstevel@tonic-gate extern void	mac_stat_destroy(mac_impl_t *);
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate #ifdef	__cplusplus
1360Sstevel@tonic-gate }
1370Sstevel@tonic-gate #endif
1380Sstevel@tonic-gate 
1390Sstevel@tonic-gate #endif	/* _SYS_MAC_IMPL_H */
140