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