xref: /titanic_51/usr/src/uts/common/sys/aggr_impl.h (revision 09b7f21a0999a8ceb9f3e517fff7c39c52405ba2)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5f12af565Snd99603  * Common Development and Distribution License (the "License").
6f12af565Snd99603  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
220dc2366fSVenugopal Iyer  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_AGGR_IMPL_H
277c478bd9Sstevel@tonic-gate #define	_SYS_AGGR_IMPL_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/types.h>
302b24ab6bSSebastien Roy #include <sys/cred.h>
31ba2e4443Sseb #include <sys/mac_ether.h>
32da14cebeSEric Cheng #include <sys/mac_provider.h>
33da14cebeSEric Cheng #include <sys/mac_client.h>
34da14cebeSEric Cheng #include <sys/mac_client_priv.h>
357c478bd9Sstevel@tonic-gate #include <sys/aggr_lacp.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
387c478bd9Sstevel@tonic-gate extern "C" {
397c478bd9Sstevel@tonic-gate #endif
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef _KERNEL
427c478bd9Sstevel@tonic-gate 
43210db224Sericheng #define	AGGR_MINOR_CTL	1		/* control interface minor */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /* flags for aggr_grp_modify() */
467c478bd9Sstevel@tonic-gate #define	AGGR_MODIFY_POLICY		0x01
477c478bd9Sstevel@tonic-gate #define	AGGR_MODIFY_MAC			0x02
487c478bd9Sstevel@tonic-gate #define	AGGR_MODIFY_LACP_MODE		0x04
497c478bd9Sstevel@tonic-gate #define	AGGR_MODIFY_LACP_TIMER		0x08
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
52da14cebeSEric Cheng  * Possible value of aggr_rseudo_rx_ring_t.arr_flags. Set when the ring entry
53da14cebeSEric Cheng  * in the pseudo RX group is used.
54da14cebeSEric Cheng  */
55da14cebeSEric Cheng #define	MAC_PSEUDO_RING_INUSE	0x01
56da14cebeSEric Cheng 
57da14cebeSEric Cheng typedef struct aggr_unicst_addr_s {
58da14cebeSEric Cheng 	uint8_t				aua_addr[ETHERADDRL];
59da14cebeSEric Cheng 	struct aggr_unicst_addr_s	*aua_next;
60da14cebeSEric Cheng } aggr_unicst_addr_t;
61da14cebeSEric Cheng 
62da14cebeSEric Cheng typedef struct aggr_pseudo_rx_ring_s {
63da14cebeSEric Cheng 	mac_ring_handle_t	arr_rh;	/* filled in by aggr_fill_ring() */
64da14cebeSEric Cheng 	struct aggr_port_s	*arr_port;
65da14cebeSEric Cheng 	mac_ring_handle_t	arr_hw_rh;
66da14cebeSEric Cheng 	uint_t			arr_flags;
67da14cebeSEric Cheng 	uint64_t		arr_gen;
68da14cebeSEric Cheng } aggr_pseudo_rx_ring_t;
69da14cebeSEric Cheng 
70da14cebeSEric Cheng typedef struct aggr_pseudo_rx_group_s {
71da14cebeSEric Cheng 	struct aggr_grp_s	*arg_grp; /* filled in by aggr_fill_group() */
72da14cebeSEric Cheng 	mac_group_handle_t	arg_gh;   /* filled in by aggr_fill_group() */
73da14cebeSEric Cheng 	aggr_unicst_addr_t	*arg_macaddr;
74da14cebeSEric Cheng 	aggr_pseudo_rx_ring_t	arg_rings[MAX_RINGS_PER_GROUP];
75da14cebeSEric Cheng 	uint_t			arg_ring_cnt;
76da14cebeSEric Cheng } aggr_pseudo_rx_group_t;
77da14cebeSEric Cheng 
780dc2366fSVenugopal Iyer typedef struct aggr_pseudo_tx_ring_s {
790dc2366fSVenugopal Iyer 	mac_ring_handle_t	atr_rh;	/* filled in by aggr_fill_ring() */
800dc2366fSVenugopal Iyer 	struct aggr_port_s	*atr_port;
810dc2366fSVenugopal Iyer 	mac_ring_handle_t	atr_hw_rh;
820dc2366fSVenugopal Iyer 	uint_t			atr_flags;
830dc2366fSVenugopal Iyer } aggr_pseudo_tx_ring_t;
840dc2366fSVenugopal Iyer 
850dc2366fSVenugopal Iyer typedef struct aggr_pseudo_tx_group_s {
860dc2366fSVenugopal Iyer 	mac_group_handle_t	atg_gh;	/* filled in by aggr_fill_group() */
870dc2366fSVenugopal Iyer 	uint_t			atg_ring_cnt;
880dc2366fSVenugopal Iyer 	aggr_pseudo_tx_ring_t	atg_rings[MAX_RINGS_PER_GROUP];
890dc2366fSVenugopal Iyer } aggr_pseudo_tx_group_t;
900dc2366fSVenugopal Iyer 
91da14cebeSEric Cheng /*
927c478bd9Sstevel@tonic-gate  * A link aggregation MAC port.
937c478bd9Sstevel@tonic-gate  * Note that lp_next is protected by the lg_lock of the group the
947c478bd9Sstevel@tonic-gate  * port is part of.
957c478bd9Sstevel@tonic-gate  */
967c478bd9Sstevel@tonic-gate typedef struct aggr_port_s {
977c478bd9Sstevel@tonic-gate 	struct aggr_port_s *lp_next;
987c478bd9Sstevel@tonic-gate 	struct aggr_grp_s *lp_grp;		/* back ptr to group */
99d62bc4baSyz147064 	datalink_id_t	lp_linkid;
100392b1d6eSyz147064 	uint16_t	lp_portid;
1017c478bd9Sstevel@tonic-gate 	uint8_t		lp_addr[ETHERADDRL];	/* port MAC address */
1027c478bd9Sstevel@tonic-gate 	uint32_t	lp_refs;		/* refcount */
1037c478bd9Sstevel@tonic-gate 	aggr_port_state_t lp_state;
1047c478bd9Sstevel@tonic-gate 	uint32_t	lp_started : 1,
1057c478bd9Sstevel@tonic-gate 			lp_tx_enabled : 1,
1067c478bd9Sstevel@tonic-gate 			lp_collector_enabled : 1,
1077c478bd9Sstevel@tonic-gate 			lp_promisc_on : 1,
108d62bc4baSyz147064 			lp_no_link_update : 1,
1090dc2366fSVenugopal Iyer 			lp_rx_grp_added : 1,
1100dc2366fSVenugopal Iyer 			lp_tx_grp_added : 1,
111da14cebeSEric Cheng 			lp_closing : 1,
1120dc2366fSVenugopal Iyer 			lp_pad_bits : 24;
1137c478bd9Sstevel@tonic-gate 	mac_handle_t	lp_mh;
114da14cebeSEric Cheng 	mac_client_handle_t lp_mch;
1157c478bd9Sstevel@tonic-gate 	const mac_info_t *lp_mip;
1167c478bd9Sstevel@tonic-gate 	mac_notify_handle_t lp_mnh;
1177c478bd9Sstevel@tonic-gate 	uint_t		lp_tx_idx;		/* idx in group's tx array */
1187c478bd9Sstevel@tonic-gate 	uint64_t	lp_ifspeed;
1197c478bd9Sstevel@tonic-gate 	link_state_t	lp_link_state;
1207c478bd9Sstevel@tonic-gate 	link_duplex_t	lp_link_duplex;
1217c478bd9Sstevel@tonic-gate 	uint64_t	lp_stat[MAC_NSTAT];
122ba2e4443Sseb 	uint64_t	lp_ether_stat[ETHER_NSTAT];
1237c478bd9Sstevel@tonic-gate 	aggr_lacp_port_t lp_lacp;		/* LACP state */
1247c478bd9Sstevel@tonic-gate 	lacp_stats_t	lp_lacp_stats;
125d62bc4baSyz147064 	uint32_t	lp_margin;
126da14cebeSEric Cheng 	mac_promisc_handle_t lp_mphp;
127da14cebeSEric Cheng 	mac_unicast_handle_t lp_mah;
1287c478bd9Sstevel@tonic-gate 
129da14cebeSEric Cheng 	/* List of non-primary addresses that requires promiscous mode set */
130da14cebeSEric Cheng 	aggr_unicst_addr_t	*lp_prom_addr;
131da14cebeSEric Cheng 	/* handle of the underlying HW RX group */
132da14cebeSEric Cheng 	mac_group_handle_t	lp_hwgh;
1330dc2366fSVenugopal Iyer 	int			lp_tx_ring_cnt;
1340dc2366fSVenugopal Iyer 	/* handles of the underlying HW TX rings */
1350dc2366fSVenugopal Iyer 	mac_ring_handle_t	*lp_tx_rings;
1360dc2366fSVenugopal Iyer 	/*
1370dc2366fSVenugopal Iyer 	 * Handles of the pseudo TX rings. Each of them maps to
1380dc2366fSVenugopal Iyer 	 * corresponding hardware TX ring in lp_tx_rings[]. A
1390dc2366fSVenugopal Iyer 	 * pseudo TX ring is presented to aggr primary mac
1400dc2366fSVenugopal Iyer 	 * client even when underlying NIC has no TX ring.
1410dc2366fSVenugopal Iyer 	 */
1420dc2366fSVenugopal Iyer 	mac_ring_handle_t	*lp_pseudo_tx_rings;
1430dc2366fSVenugopal Iyer 	void			*lp_tx_notify_mh;
144da14cebeSEric Cheng } aggr_port_t;
14519599311Sudpa 
1467c478bd9Sstevel@tonic-gate /*
1477c478bd9Sstevel@tonic-gate  * A link aggregation group.
1487c478bd9Sstevel@tonic-gate  *
1497c478bd9Sstevel@tonic-gate  * The following per-group flags are defined:
1507c478bd9Sstevel@tonic-gate  *
1517c478bd9Sstevel@tonic-gate  * - lg_addr_fixed: set when the MAC address has been explicitely set
1527c478bd9Sstevel@tonic-gate  *   when the group was created, or by a m_unicst_set() request.
1537c478bd9Sstevel@tonic-gate  *   If this flag is not set, the MAC address of the group will be
1547c478bd9Sstevel@tonic-gate  *   set to the first port that is added to the group.
1557c478bd9Sstevel@tonic-gate  *
1567c478bd9Sstevel@tonic-gate  * - lg_add_set: used only when lg_addr_fixed is not set. Captures whether
1577c478bd9Sstevel@tonic-gate  *   the MAC address was initialized according to the members of the group.
1587c478bd9Sstevel@tonic-gate  *   When set, the lg_port field points to the port from which the
1597c478bd9Sstevel@tonic-gate  *   MAC address was initialized.
1607c478bd9Sstevel@tonic-gate  *
1617c478bd9Sstevel@tonic-gate  */
1627c478bd9Sstevel@tonic-gate typedef struct aggr_grp_s {
163d62bc4baSyz147064 	datalink_id_t	lg_linkid;
1647c478bd9Sstevel@tonic-gate 	uint16_t	lg_key;			/* key (group port number) */
1657c478bd9Sstevel@tonic-gate 	uint32_t	lg_refs;		/* refcount */
1667c478bd9Sstevel@tonic-gate 	uint16_t	lg_nports;		/* number of MAC ports */
1677c478bd9Sstevel@tonic-gate 	uint8_t		lg_addr[ETHERADDRL];	/* group MAC address */
1687c478bd9Sstevel@tonic-gate 	uint16_t
1694deae11aSyz147064 			lg_closing : 1,
1707c478bd9Sstevel@tonic-gate 			lg_addr_fixed : 1,	/* fixed MAC address? */
1717c478bd9Sstevel@tonic-gate 			lg_started : 1,		/* group started? */
1727c478bd9Sstevel@tonic-gate 			lg_promisc : 1,		/* in promiscuous mode? */
173d62bc4baSyz147064 			lg_zcopy : 1,
174d62bc4baSyz147064 			lg_vlan : 1,
175d62bc4baSyz147064 			lg_force : 1,
17619c868a0SRoamer 			lg_lso : 1,
17719c868a0SRoamer 			lg_pad_bits : 8;
1787c478bd9Sstevel@tonic-gate 	aggr_port_t	*lg_ports;		/* list of configured ports */
1797c478bd9Sstevel@tonic-gate 	aggr_port_t	*lg_mac_addr_port;
180ba2e4443Sseb 	mac_handle_t	lg_mh;
1812b24ab6bSSebastien Roy 	zoneid_t	lg_zoneid;
1827c478bd9Sstevel@tonic-gate 	uint_t		lg_nattached_ports;
183da14cebeSEric Cheng 	krwlock_t	lg_tx_lock;
1847c478bd9Sstevel@tonic-gate 	uint_t		lg_ntx_ports;
1857c478bd9Sstevel@tonic-gate 	aggr_port_t	**lg_tx_ports;		/* array of tx ports */
1867c478bd9Sstevel@tonic-gate 	uint_t		lg_tx_ports_size;	/* size of lg_tx_ports */
1877c478bd9Sstevel@tonic-gate 	uint32_t	lg_tx_policy;		/* outbound policy */
188ae6aa22aSVenugopal Iyer 	uint8_t		lg_mac_tx_policy;
1897c478bd9Sstevel@tonic-gate 	uint64_t	lg_ifspeed;
1907c478bd9Sstevel@tonic-gate 	link_state_t	lg_link_state;
1917c478bd9Sstevel@tonic-gate 	link_duplex_t	lg_link_duplex;
1927c478bd9Sstevel@tonic-gate 	uint64_t	lg_stat[MAC_NSTAT];
193ba2e4443Sseb 	uint64_t	lg_ether_stat[ETHER_NSTAT];
1947c478bd9Sstevel@tonic-gate 	aggr_lacp_mode_t lg_lacp_mode;		/* off, active, or passive */
1957c478bd9Sstevel@tonic-gate 	Agg_t		aggr;			/* 802.3ad data */
196ba2e4443Sseb 	uint32_t	lg_hcksum_txflags;
197f4420ae7Snd99603 	uint_t		lg_max_sdu;
198d62bc4baSyz147064 	uint32_t	lg_margin;
19919c868a0SRoamer 	mac_capab_lso_t lg_cap_lso;
2007c478bd9Sstevel@tonic-gate 
201da14cebeSEric Cheng 	/*
202da14cebeSEric Cheng 	 * The following fields are used by the LACP packets processing.
203da14cebeSEric Cheng 	 * Specifically, as the LACP packets processing is not performance
204da14cebeSEric Cheng 	 * critical, all LACP packets will be handled by a dedicated thread
205da14cebeSEric Cheng 	 * instead of in the mac_rx() call. This is to avoid the dead lock
206da14cebeSEric Cheng 	 * with mac_unicast_remove(), which holding the mac perimeter of the
207da14cebeSEric Cheng 	 * aggr, and wait for the mr_refcnt of the RX ring to drop to zero.
208da14cebeSEric Cheng 	 */
209da14cebeSEric Cheng 	kmutex_t	lg_lacp_lock;
210da14cebeSEric Cheng 	kcondvar_t	lg_lacp_cv;
211da14cebeSEric Cheng 	mblk_t		*lg_lacp_head;
212da14cebeSEric Cheng 	mblk_t		*lg_lacp_tail;
213da14cebeSEric Cheng 	kthread_t	*lg_lacp_rx_thread;
214da14cebeSEric Cheng 	boolean_t	lg_lacp_done;
2150dc2366fSVenugopal Iyer 
216da14cebeSEric Cheng 	aggr_pseudo_rx_group_t	lg_rx_group;
2170dc2366fSVenugopal Iyer 	aggr_pseudo_tx_group_t	lg_tx_group;
2180dc2366fSVenugopal Iyer 
2190dc2366fSVenugopal Iyer 	kmutex_t	lg_tx_flowctl_lock;
2200dc2366fSVenugopal Iyer 	kcondvar_t	lg_tx_flowctl_cv;
2210dc2366fSVenugopal Iyer 	uint_t		lg_tx_blocked_cnt;
2220dc2366fSVenugopal Iyer 	mac_ring_handle_t	*lg_tx_blocked_rings;
2230dc2366fSVenugopal Iyer 	kthread_t	*lg_tx_notify_thread;
2240dc2366fSVenugopal Iyer 	boolean_t	lg_tx_notify_done;
225da14cebeSEric Cheng 
226da14cebeSEric Cheng 	/*
227da14cebeSEric Cheng 	 * The following fields are used by aggr to wait for all the
228da14cebeSEric Cheng 	 * aggr_port_notify_cb() and aggr_port_timer_thread() to finish
229da14cebeSEric Cheng 	 * before it calls mac_unregister() when the aggr is deleted.
230da14cebeSEric Cheng 	 */
231da14cebeSEric Cheng 	kmutex_t	lg_port_lock;
232da14cebeSEric Cheng 	kcondvar_t	lg_port_cv;
233da14cebeSEric Cheng 	int		lg_port_ref;
234da14cebeSEric Cheng } aggr_grp_t;
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate #define	AGGR_GRP_REFHOLD(grp) {			\
2371a5e258fSJosef 'Jeff' Sipek 	atomic_inc_32(&(grp)->lg_refs);	\
2387c478bd9Sstevel@tonic-gate 	ASSERT((grp)->lg_refs != 0);		\
2397c478bd9Sstevel@tonic-gate }
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate #define	AGGR_GRP_REFRELE(grp) {					\
2427c478bd9Sstevel@tonic-gate 	ASSERT((grp)->lg_refs != 0);				\
2437c478bd9Sstevel@tonic-gate 	membar_exit();						\
2441a5e258fSJosef 'Jeff' Sipek 	if (atomic_dec_32_nv(&(grp)->lg_refs) == 0)		\
2457c478bd9Sstevel@tonic-gate 		aggr_grp_free(grp);				\
2467c478bd9Sstevel@tonic-gate }
2477c478bd9Sstevel@tonic-gate 
2487c478bd9Sstevel@tonic-gate #define	AGGR_PORT_REFHOLD(port) {		\
2491a5e258fSJosef 'Jeff' Sipek 	atomic_inc_32(&(port)->lp_refs);	\
2507c478bd9Sstevel@tonic-gate 	ASSERT((port)->lp_refs != 0);		\
2517c478bd9Sstevel@tonic-gate }
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate #define	AGGR_PORT_REFRELE(port) {				\
2547c478bd9Sstevel@tonic-gate 	ASSERT((port)->lp_refs != 0);				\
2557c478bd9Sstevel@tonic-gate 	membar_exit();						\
2561a5e258fSJosef 'Jeff' Sipek 	if (atomic_dec_32_nv(&(port)->lp_refs) == 0)	\
2577c478bd9Sstevel@tonic-gate 		aggr_port_free(port);				\
2587c478bd9Sstevel@tonic-gate }
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate extern dev_info_t *aggr_dip;
261eae72b5bSSebastien Roy extern int aggr_ioc_init(void);
262eae72b5bSSebastien Roy extern void aggr_ioc_fini(void);
2637c478bd9Sstevel@tonic-gate 
264d62bc4baSyz147064 typedef int (*aggr_grp_info_new_grp_fn_t)(void *, datalink_id_t, uint32_t,
265d62bc4baSyz147064     uchar_t *, boolean_t, boolean_t, uint32_t, uint32_t, aggr_lacp_mode_t,
266d62bc4baSyz147064     aggr_lacp_timer_t);
267d62bc4baSyz147064 typedef int (*aggr_grp_info_new_port_fn_t)(void *, datalink_id_t, uchar_t *,
268ba2e4443Sseb     aggr_port_state_t, aggr_lacp_state_t *);
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate extern void aggr_grp_init(void);
271c0192a57Sericheng extern void aggr_grp_fini(void);
272d62bc4baSyz147064 extern int aggr_grp_create(datalink_id_t, uint32_t, uint_t, laioc_port_t *,
273d62bc4baSyz147064     uint32_t, boolean_t, boolean_t, uchar_t *, aggr_lacp_mode_t,
2742b24ab6bSSebastien Roy     aggr_lacp_timer_t, cred_t *);
2752b24ab6bSSebastien Roy extern int aggr_grp_delete(datalink_id_t, cred_t *);
2767c478bd9Sstevel@tonic-gate extern void aggr_grp_free(aggr_grp_t *);
2777c478bd9Sstevel@tonic-gate 
278d62bc4baSyz147064 extern int aggr_grp_info(datalink_id_t, void *, aggr_grp_info_new_grp_fn_t,
2792b24ab6bSSebastien Roy     aggr_grp_info_new_port_fn_t, cred_t *);
2807c478bd9Sstevel@tonic-gate extern void aggr_grp_notify(aggr_grp_t *, uint32_t);
2817c478bd9Sstevel@tonic-gate extern boolean_t aggr_grp_attach_port(aggr_grp_t *, aggr_port_t *);
282da14cebeSEric Cheng extern boolean_t aggr_grp_detach_port(aggr_grp_t *, aggr_port_t *);
2834deae11aSyz147064 extern void aggr_grp_port_mac_changed(aggr_grp_t *, aggr_port_t *,
2844deae11aSyz147064     boolean_t *, boolean_t *);
285d62bc4baSyz147064 extern int aggr_grp_add_ports(datalink_id_t, uint_t, boolean_t,
286d62bc4baSyz147064     laioc_port_t *);
287d62bc4baSyz147064 extern int aggr_grp_rem_ports(datalink_id_t, uint_t, laioc_port_t *);
2884deae11aSyz147064 extern boolean_t aggr_grp_update_ports_mac(aggr_grp_t *);
289da14cebeSEric Cheng extern int aggr_grp_modify(datalink_id_t, uint8_t, uint32_t, boolean_t,
290da14cebeSEric Cheng     const uchar_t *, aggr_lacp_mode_t, aggr_lacp_timer_t);
2917c478bd9Sstevel@tonic-gate extern void aggr_grp_multicst_port(aggr_port_t *, boolean_t);
292210db224Sericheng extern uint_t aggr_grp_count(void);
293*09b7f21aSRobert Mustacchi extern void aggr_grp_update_default(aggr_grp_t *);
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate extern void aggr_port_init(void);
296c0192a57Sericheng extern void aggr_port_fini(void);
297da14cebeSEric Cheng extern int aggr_port_create(aggr_grp_t *, const datalink_id_t, boolean_t,
298da14cebeSEric Cheng     aggr_port_t **);
2997c478bd9Sstevel@tonic-gate extern void aggr_port_delete(aggr_port_t *);
3007c478bd9Sstevel@tonic-gate extern void aggr_port_free(aggr_port_t *);
3017c478bd9Sstevel@tonic-gate extern int aggr_port_start(aggr_port_t *);
3027c478bd9Sstevel@tonic-gate extern void aggr_port_stop(aggr_port_t *);
3037c478bd9Sstevel@tonic-gate extern int aggr_port_promisc(aggr_port_t *, boolean_t);
304da14cebeSEric Cheng extern int aggr_port_unicst(aggr_port_t *);
3057c478bd9Sstevel@tonic-gate extern int aggr_port_multicst(void *, boolean_t, const uint8_t *);
306ba2e4443Sseb extern uint64_t aggr_port_stat(aggr_port_t *, uint_t);
307da14cebeSEric Cheng extern boolean_t aggr_port_notify_link(aggr_grp_t *, aggr_port_t *);
308c615009fSyz147064 extern void aggr_port_init_callbacks(aggr_port_t *);
3097c478bd9Sstevel@tonic-gate 
310da14cebeSEric Cheng extern void aggr_recv_cb(void *, mac_resource_handle_t, mblk_t *, boolean_t);
3117c478bd9Sstevel@tonic-gate 
3120dc2366fSVenugopal Iyer extern void aggr_tx_ring_update(void *, uintptr_t);
3130dc2366fSVenugopal Iyer extern void aggr_tx_notify_thread(void *);
3147c478bd9Sstevel@tonic-gate extern void aggr_send_port_enable(aggr_port_t *);
3157c478bd9Sstevel@tonic-gate extern void aggr_send_port_disable(aggr_port_t *);
3167c478bd9Sstevel@tonic-gate extern void aggr_send_update_policy(aggr_grp_t *, uint32_t);
3177c478bd9Sstevel@tonic-gate 
318f12af565Snd99603 extern void aggr_lacp_init(void);
319f12af565Snd99603 extern void aggr_lacp_fini(void);
3207c478bd9Sstevel@tonic-gate extern void aggr_lacp_init_port(aggr_port_t *);
3217c478bd9Sstevel@tonic-gate extern void aggr_lacp_init_grp(aggr_grp_t *);
3227c478bd9Sstevel@tonic-gate extern void aggr_lacp_set_mode(aggr_grp_t *, aggr_lacp_mode_t,
3237c478bd9Sstevel@tonic-gate     aggr_lacp_timer_t);
3247c478bd9Sstevel@tonic-gate extern void aggr_lacp_update_mode(aggr_grp_t *, aggr_lacp_mode_t);
3257c478bd9Sstevel@tonic-gate extern void aggr_lacp_update_timer(aggr_grp_t *, aggr_lacp_timer_t);
326da14cebeSEric Cheng extern void aggr_lacp_rx_enqueue(aggr_port_t *, mblk_t *);
3277c478bd9Sstevel@tonic-gate extern void aggr_lacp_port_attached(aggr_port_t *);
3287c478bd9Sstevel@tonic-gate extern void aggr_lacp_port_detached(aggr_port_t *);
329da14cebeSEric Cheng extern void aggr_port_lacp_set_mode(aggr_grp_t *, aggr_port_t *);
330da14cebeSEric Cheng 
331da14cebeSEric Cheng extern void aggr_lacp_rx_thread(void *);
332da14cebeSEric Cheng extern void aggr_recv_lacp(aggr_port_t *, mac_resource_handle_t, mblk_t *);
333da14cebeSEric Cheng 
334da14cebeSEric Cheng extern void aggr_grp_port_hold(aggr_port_t *);
335da14cebeSEric Cheng extern void aggr_grp_port_rele(aggr_port_t *);
336da14cebeSEric Cheng extern void aggr_grp_port_wait(aggr_grp_t *);
337da14cebeSEric Cheng 
338da14cebeSEric Cheng extern int aggr_port_addmac(aggr_port_t *, const uint8_t *);
339da14cebeSEric Cheng extern void aggr_port_remmac(aggr_port_t *, const uint8_t *);
3407c478bd9Sstevel@tonic-gate 
3410dc2366fSVenugopal Iyer extern mblk_t *aggr_ring_tx(void *, mblk_t *);
3420dc2366fSVenugopal Iyer extern mblk_t *aggr_find_tx_ring(void *, mblk_t *,
3430dc2366fSVenugopal Iyer     uintptr_t, mac_ring_handle_t *);
3440dc2366fSVenugopal Iyer 
3457c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
3467c478bd9Sstevel@tonic-gate 
3477c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3487c478bd9Sstevel@tonic-gate }
3497c478bd9Sstevel@tonic-gate #endif
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate #endif	/* _SYS_AGGR_IMPL_H */
352