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 5f12af565Snd * Common Development and Distribution License (the "License"). 6f12af565Snd * 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. 2484de666eSRyan Zezeski * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved. 2584de666eSRyan Zezeski * Copyright 2018 Joyent, Inc. 26*13810335SPaul Winder * Copyright 2020 RackTop Systems, Inc. 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifndef _SYS_AGGR_IMPL_H 307c478bd9Sstevel@tonic-gate #define _SYS_AGGR_IMPL_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #include <sys/types.h> 332b24ab6bSSebastien Roy #include <sys/cred.h> 34ba2e4443Sseb #include <sys/mac_ether.h> 35da14cebeSEric Cheng #include <sys/mac_provider.h> 36da14cebeSEric Cheng #include <sys/mac_client.h> 37da14cebeSEric Cheng #include <sys/mac_client_priv.h> 387c478bd9Sstevel@tonic-gate #include <sys/aggr_lacp.h> 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #ifdef __cplusplus 417c478bd9Sstevel@tonic-gate extern "C" { 427c478bd9Sstevel@tonic-gate #endif 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #ifdef _KERNEL 457c478bd9Sstevel@tonic-gate 46210db224Sericheng #define AGGR_MINOR_CTL 1 /* control interface minor */ 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* flags for aggr_grp_modify() */ 497c478bd9Sstevel@tonic-gate #define AGGR_MODIFY_POLICY 0x01 507c478bd9Sstevel@tonic-gate #define AGGR_MODIFY_MAC 0x02 517c478bd9Sstevel@tonic-gate #define AGGR_MODIFY_LACP_MODE 0x04 527c478bd9Sstevel@tonic-gate #define AGGR_MODIFY_LACP_TIMER 0x08 537c478bd9Sstevel@tonic-gate 54da14cebeSEric Cheng /* 55da14cebeSEric Cheng * Possible value of aggr_rseudo_rx_ring_t.arr_flags. Set when the ring entry 56da14cebeSEric Cheng * in the pseudo RX group is used. 57da14cebeSEric Cheng */ 58da14cebeSEric Cheng #define MAC_PSEUDO_RING_INUSE 0x01 59da14cebeSEric Cheng 6045948e49SRyan Zezeski #define MAX_GROUPS_PER_PORT 128 6145948e49SRyan Zezeski 6284de666eSRyan Zezeski /* 6384de666eSRyan Zezeski * VLAN filters placed on the Rx pseudo group. 6484de666eSRyan Zezeski */ 6584de666eSRyan Zezeski typedef struct aggr_vlan { 6684de666eSRyan Zezeski list_node_t av_link; 6784de666eSRyan Zezeski uint16_t av_vid; /* VLAN ID */ 6884de666eSRyan Zezeski uint_t av_refs; /* num aggr clients using this VID */ 6984de666eSRyan Zezeski } aggr_vlan_t; 7084de666eSRyan Zezeski 71da14cebeSEric Cheng typedef struct aggr_unicst_addr_s { 72da14cebeSEric Cheng uint8_t aua_addr[ETHERADDRL]; 73da14cebeSEric Cheng struct aggr_unicst_addr_s *aua_next; 74da14cebeSEric Cheng } aggr_unicst_addr_t; 75da14cebeSEric Cheng 76da14cebeSEric Cheng typedef struct aggr_pseudo_rx_ring_s { 7745948e49SRyan Zezeski mac_ring_handle_t arr_rh; /* set by aggr_fill_ring() */ 7845948e49SRyan Zezeski struct aggr_port_s *arr_port; 7945948e49SRyan Zezeski struct aggr_pseudo_rx_group_s *arr_grp; 8045948e49SRyan Zezeski mac_ring_handle_t arr_hw_rh; 8145948e49SRyan Zezeski uint_t arr_flags; 8245948e49SRyan Zezeski uint64_t arr_gen; 83da14cebeSEric Cheng } aggr_pseudo_rx_ring_t; 84da14cebeSEric Cheng 8545948e49SRyan Zezeski /* 8645948e49SRyan Zezeski * An aggr pseudo group abstracts the underlying ports' HW groups. For 8745948e49SRyan Zezeski * example, if each port has 8 groups (mac_group_t), then the aggr 8845948e49SRyan Zezeski * will create 8 pseudo groups. Each pseudo group represents a 8945948e49SRyan Zezeski * collection of HW groups: one group from each port. If you have 9045948e49SRyan Zezeski * three ports then the pseudo group stands in for three HW groups. 9145948e49SRyan Zezeski */ 92da14cebeSEric Cheng typedef struct aggr_pseudo_rx_group_s { 9345948e49SRyan Zezeski uint_t arg_index; 94da14cebeSEric Cheng struct aggr_grp_s *arg_grp; /* filled in by aggr_fill_group() */ 95da14cebeSEric Cheng mac_group_handle_t arg_gh; /* filled in by aggr_fill_group() */ 96da14cebeSEric Cheng aggr_unicst_addr_t *arg_macaddr; 97da14cebeSEric Cheng aggr_pseudo_rx_ring_t arg_rings[MAX_RINGS_PER_GROUP]; 98da14cebeSEric Cheng uint_t arg_ring_cnt; 9984de666eSRyan Zezeski uint_t arg_untagged; /* num clients untagged */ 10084de666eSRyan Zezeski list_t arg_vlans; /* VLANs on this group */ 101da14cebeSEric Cheng } aggr_pseudo_rx_group_t; 102da14cebeSEric Cheng 1030dc2366fSVenugopal Iyer typedef struct aggr_pseudo_tx_ring_s { 1040dc2366fSVenugopal Iyer mac_ring_handle_t atr_rh; /* filled in by aggr_fill_ring() */ 1050dc2366fSVenugopal Iyer struct aggr_port_s *atr_port; 1060dc2366fSVenugopal Iyer mac_ring_handle_t atr_hw_rh; 1070dc2366fSVenugopal Iyer uint_t atr_flags; 1080dc2366fSVenugopal Iyer } aggr_pseudo_tx_ring_t; 1090dc2366fSVenugopal Iyer 1100dc2366fSVenugopal Iyer typedef struct aggr_pseudo_tx_group_s { 1110dc2366fSVenugopal Iyer mac_group_handle_t atg_gh; /* filled in by aggr_fill_group() */ 1120dc2366fSVenugopal Iyer uint_t atg_ring_cnt; 1130dc2366fSVenugopal Iyer aggr_pseudo_tx_ring_t atg_rings[MAX_RINGS_PER_GROUP]; 1140dc2366fSVenugopal Iyer } aggr_pseudo_tx_group_t; 1150dc2366fSVenugopal Iyer 1167c478bd9Sstevel@tonic-gate /* 1177c478bd9Sstevel@tonic-gate * A link aggregation MAC port. 1187c478bd9Sstevel@tonic-gate * Note that lp_next is protected by the lg_lock of the group the 1197c478bd9Sstevel@tonic-gate * port is part of. 1207c478bd9Sstevel@tonic-gate */ 1217c478bd9Sstevel@tonic-gate typedef struct aggr_port_s { 1227c478bd9Sstevel@tonic-gate struct aggr_port_s *lp_next; 1237c478bd9Sstevel@tonic-gate struct aggr_grp_s *lp_grp; /* back ptr to group */ 124d62bc4baSyz datalink_id_t lp_linkid; 125392b1d6eSyz uint16_t lp_portid; 1267c478bd9Sstevel@tonic-gate uint8_t lp_addr[ETHERADDRL]; /* port MAC address */ 1277c478bd9Sstevel@tonic-gate uint32_t lp_refs; /* refcount */ 1287c478bd9Sstevel@tonic-gate aggr_port_state_t lp_state; 1297c478bd9Sstevel@tonic-gate uint32_t lp_started : 1, 1307c478bd9Sstevel@tonic-gate lp_tx_enabled : 1, 1317c478bd9Sstevel@tonic-gate lp_collector_enabled : 1, 1327c478bd9Sstevel@tonic-gate lp_promisc_on : 1, 133d62bc4baSyz lp_no_link_update : 1, 1340dc2366fSVenugopal Iyer lp_tx_grp_added : 1, 135da14cebeSEric Cheng lp_closing : 1, 13645948e49SRyan Zezeski lp_pad_bits : 25; 1377c478bd9Sstevel@tonic-gate mac_handle_t lp_mh; 13845948e49SRyan Zezeski 13945948e49SRyan Zezeski mac_client_handle_t lp_mch; 14045948e49SRyan Zezeski 1417c478bd9Sstevel@tonic-gate const mac_info_t *lp_mip; 1427c478bd9Sstevel@tonic-gate mac_notify_handle_t lp_mnh; 1437c478bd9Sstevel@tonic-gate uint_t lp_tx_idx; /* idx in group's tx array */ 1447c478bd9Sstevel@tonic-gate uint64_t lp_ifspeed; 1457c478bd9Sstevel@tonic-gate link_state_t lp_link_state; 1467c478bd9Sstevel@tonic-gate link_duplex_t lp_link_duplex; 1477c478bd9Sstevel@tonic-gate uint64_t lp_stat[MAC_NSTAT]; 148ba2e4443Sseb uint64_t lp_ether_stat[ETHER_NSTAT]; 1497c478bd9Sstevel@tonic-gate aggr_lacp_port_t lp_lacp; /* LACP state */ 1507c478bd9Sstevel@tonic-gate lacp_stats_t lp_lacp_stats; 151d62bc4baSyz uint32_t lp_margin; 15245948e49SRyan Zezeski 153da14cebeSEric Cheng mac_unicast_handle_t lp_mah; 1547c478bd9Sstevel@tonic-gate 155da14cebeSEric Cheng /* List of non-primary addresses that requires promiscous mode set */ 156da14cebeSEric Cheng aggr_unicst_addr_t *lp_prom_addr; 15745948e49SRyan Zezeski 15845948e49SRyan Zezeski /* 15945948e49SRyan Zezeski * References to the underlying HW Rx groups of this port. 16045948e49SRyan Zezeski * Used by aggr to program HW classification for the pseudo 16145948e49SRyan Zezeski * groups. 16245948e49SRyan Zezeski */ 16345948e49SRyan Zezeski mac_group_handle_t lp_hwghs[MAX_GROUPS_PER_PORT]; 16445948e49SRyan Zezeski 165*13810335SPaul Winder uint_t lp_tx_ring_alloc; 166*13810335SPaul Winder uint_t lp_tx_ring_cnt; 1670dc2366fSVenugopal Iyer /* handles of the underlying HW TX rings */ 1680dc2366fSVenugopal Iyer mac_ring_handle_t *lp_tx_rings; 1690dc2366fSVenugopal Iyer /* 1700dc2366fSVenugopal Iyer * Handles of the pseudo TX rings. Each of them maps to 1710dc2366fSVenugopal Iyer * corresponding hardware TX ring in lp_tx_rings[]. A 1720dc2366fSVenugopal Iyer * pseudo TX ring is presented to aggr primary mac 1730dc2366fSVenugopal Iyer * client even when underlying NIC has no TX ring. 1740dc2366fSVenugopal Iyer */ 1750dc2366fSVenugopal Iyer mac_ring_handle_t *lp_pseudo_tx_rings; 1760dc2366fSVenugopal Iyer void *lp_tx_notify_mh; 177da14cebeSEric Cheng } aggr_port_t; 17819599311Sudpa 1797c478bd9Sstevel@tonic-gate /* 1807c478bd9Sstevel@tonic-gate * A link aggregation group. 1817c478bd9Sstevel@tonic-gate * 1827c478bd9Sstevel@tonic-gate * The following per-group flags are defined: 1837c478bd9Sstevel@tonic-gate * 1847c478bd9Sstevel@tonic-gate * - lg_addr_fixed: set when the MAC address has been explicitely set 1857c478bd9Sstevel@tonic-gate * when the group was created, or by a m_unicst_set() request. 1867c478bd9Sstevel@tonic-gate * If this flag is not set, the MAC address of the group will be 1877c478bd9Sstevel@tonic-gate * set to the first port that is added to the group. 1887c478bd9Sstevel@tonic-gate * 1897c478bd9Sstevel@tonic-gate * - lg_add_set: used only when lg_addr_fixed is not set. Captures whether 1907c478bd9Sstevel@tonic-gate * the MAC address was initialized according to the members of the group. 1917c478bd9Sstevel@tonic-gate * When set, the lg_port field points to the port from which the 1927c478bd9Sstevel@tonic-gate * MAC address was initialized. 1937c478bd9Sstevel@tonic-gate * 1947c478bd9Sstevel@tonic-gate */ 1957c478bd9Sstevel@tonic-gate typedef struct aggr_grp_s { 196d62bc4baSyz datalink_id_t lg_linkid; 1977c478bd9Sstevel@tonic-gate uint16_t lg_key; /* key (group port number) */ 1987c478bd9Sstevel@tonic-gate uint32_t lg_refs; /* refcount */ 1997c478bd9Sstevel@tonic-gate uint16_t lg_nports; /* number of MAC ports */ 200*13810335SPaul Winder uint16_t lg_nports_high; /* highest no. of MAC ports */ 2017c478bd9Sstevel@tonic-gate uint8_t lg_addr[ETHERADDRL]; /* group MAC address */ 2027c478bd9Sstevel@tonic-gate uint16_t 2034deae11aSyz lg_closing : 1, 2047c478bd9Sstevel@tonic-gate lg_addr_fixed : 1, /* fixed MAC address? */ 2057c478bd9Sstevel@tonic-gate lg_started : 1, /* group started? */ 2067c478bd9Sstevel@tonic-gate lg_promisc : 1, /* in promiscuous mode? */ 207d62bc4baSyz lg_zcopy : 1, 208d62bc4baSyz lg_vlan : 1, 209d62bc4baSyz lg_force : 1, 21019c868a0SRoamer lg_lso : 1, 21119c868a0SRoamer lg_pad_bits : 8; 2127c478bd9Sstevel@tonic-gate aggr_port_t *lg_ports; /* list of configured ports */ 21345948e49SRyan Zezeski aggr_port_t *lg_mac_addr_port; /* using address of this port */ 214ba2e4443Sseb mac_handle_t lg_mh; 2152b24ab6bSSebastien Roy zoneid_t lg_zoneid; 2167c478bd9Sstevel@tonic-gate uint_t lg_nattached_ports; 217da14cebeSEric Cheng krwlock_t lg_tx_lock; 2187c478bd9Sstevel@tonic-gate uint_t lg_ntx_ports; 2197c478bd9Sstevel@tonic-gate aggr_port_t **lg_tx_ports; /* array of tx ports */ 2207c478bd9Sstevel@tonic-gate uint_t lg_tx_ports_size; /* size of lg_tx_ports */ 2217c478bd9Sstevel@tonic-gate uint32_t lg_tx_policy; /* outbound policy */ 222ae6aa22aSVenugopal Iyer uint8_t lg_mac_tx_policy; 2237c478bd9Sstevel@tonic-gate link_state_t lg_link_state; 22484de666eSRyan Zezeski 22584de666eSRyan Zezeski 22684de666eSRyan Zezeski /* 22784de666eSRyan Zezeski * The lg_stat_lock must be held when accessing these fields. 22884de666eSRyan Zezeski */ 22984de666eSRyan Zezeski kmutex_t lg_stat_lock; 23084de666eSRyan Zezeski uint64_t lg_ifspeed; 2317c478bd9Sstevel@tonic-gate link_duplex_t lg_link_duplex; 2327c478bd9Sstevel@tonic-gate uint64_t lg_stat[MAC_NSTAT]; 233ba2e4443Sseb uint64_t lg_ether_stat[ETHER_NSTAT]; 23484de666eSRyan Zezeski 2357c478bd9Sstevel@tonic-gate aggr_lacp_mode_t lg_lacp_mode; /* off, active, or passive */ 2367c478bd9Sstevel@tonic-gate Agg_t aggr; /* 802.3ad data */ 237ba2e4443Sseb uint32_t lg_hcksum_txflags; 238f4420ae7Snd uint_t lg_max_sdu; 239d62bc4baSyz uint32_t lg_margin; 24019c868a0SRoamer mac_capab_lso_t lg_cap_lso; 2417c478bd9Sstevel@tonic-gate 242da14cebeSEric Cheng /* 243da14cebeSEric Cheng * The following fields are used by the LACP packets processing. 244da14cebeSEric Cheng * Specifically, as the LACP packets processing is not performance 245da14cebeSEric Cheng * critical, all LACP packets will be handled by a dedicated thread 246da14cebeSEric Cheng * instead of in the mac_rx() call. This is to avoid the dead lock 247da14cebeSEric Cheng * with mac_unicast_remove(), which holding the mac perimeter of the 248da14cebeSEric Cheng * aggr, and wait for the mr_refcnt of the RX ring to drop to zero. 249da14cebeSEric Cheng */ 250da14cebeSEric Cheng kmutex_t lg_lacp_lock; 251da14cebeSEric Cheng kcondvar_t lg_lacp_cv; 252da14cebeSEric Cheng mblk_t *lg_lacp_head; 253da14cebeSEric Cheng mblk_t *lg_lacp_tail; 254da14cebeSEric Cheng kthread_t *lg_lacp_rx_thread; 255da14cebeSEric Cheng boolean_t lg_lacp_done; 2560dc2366fSVenugopal Iyer 25745948e49SRyan Zezeski uint_t lg_rx_group_count; 25845948e49SRyan Zezeski aggr_pseudo_rx_group_t lg_rx_groups[MAX_GROUPS_PER_PORT]; 25945948e49SRyan Zezeski 2600dc2366fSVenugopal Iyer aggr_pseudo_tx_group_t lg_tx_group; 2610dc2366fSVenugopal Iyer 2620dc2366fSVenugopal Iyer kmutex_t lg_tx_flowctl_lock; 2630dc2366fSVenugopal Iyer kcondvar_t lg_tx_flowctl_cv; 2640dc2366fSVenugopal Iyer uint_t lg_tx_blocked_cnt; 2650dc2366fSVenugopal Iyer mac_ring_handle_t *lg_tx_blocked_rings; 2660dc2366fSVenugopal Iyer kthread_t *lg_tx_notify_thread; 2670dc2366fSVenugopal Iyer boolean_t lg_tx_notify_done; 268da14cebeSEric Cheng 269da14cebeSEric Cheng /* 270da14cebeSEric Cheng * The following fields are used by aggr to wait for all the 271da14cebeSEric Cheng * aggr_port_notify_cb() and aggr_port_timer_thread() to finish 272da14cebeSEric Cheng * before it calls mac_unregister() when the aggr is deleted. 273da14cebeSEric Cheng */ 274da14cebeSEric Cheng kmutex_t lg_port_lock; 275da14cebeSEric Cheng kcondvar_t lg_port_cv; 276da14cebeSEric Cheng int lg_port_ref; 277da14cebeSEric Cheng } aggr_grp_t; 2787c478bd9Sstevel@tonic-gate 2797c478bd9Sstevel@tonic-gate #define AGGR_GRP_REFHOLD(grp) { \ 2801a5e258fSJosef 'Jeff' Sipek atomic_inc_32(&(grp)->lg_refs); \ 2817c478bd9Sstevel@tonic-gate ASSERT((grp)->lg_refs != 0); \ 2827c478bd9Sstevel@tonic-gate } 2837c478bd9Sstevel@tonic-gate 2847c478bd9Sstevel@tonic-gate #define AGGR_GRP_REFRELE(grp) { \ 2857c478bd9Sstevel@tonic-gate ASSERT((grp)->lg_refs != 0); \ 2867c478bd9Sstevel@tonic-gate membar_exit(); \ 2871a5e258fSJosef 'Jeff' Sipek if (atomic_dec_32_nv(&(grp)->lg_refs) == 0) \ 2887c478bd9Sstevel@tonic-gate aggr_grp_free(grp); \ 2897c478bd9Sstevel@tonic-gate } 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gate #define AGGR_PORT_REFHOLD(port) { \ 2921a5e258fSJosef 'Jeff' Sipek atomic_inc_32(&(port)->lp_refs); \ 2937c478bd9Sstevel@tonic-gate ASSERT((port)->lp_refs != 0); \ 2947c478bd9Sstevel@tonic-gate } 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate #define AGGR_PORT_REFRELE(port) { \ 2977c478bd9Sstevel@tonic-gate ASSERT((port)->lp_refs != 0); \ 2987c478bd9Sstevel@tonic-gate membar_exit(); \ 2991a5e258fSJosef 'Jeff' Sipek if (atomic_dec_32_nv(&(port)->lp_refs) == 0) \ 3007c478bd9Sstevel@tonic-gate aggr_port_free(port); \ 3017c478bd9Sstevel@tonic-gate } 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate extern dev_info_t *aggr_dip; 304eae72b5bSSebastien Roy extern int aggr_ioc_init(void); 305eae72b5bSSebastien Roy extern void aggr_ioc_fini(void); 3067c478bd9Sstevel@tonic-gate 307d62bc4baSyz typedef int (*aggr_grp_info_new_grp_fn_t)(void *, datalink_id_t, uint32_t, 308d62bc4baSyz uchar_t *, boolean_t, boolean_t, uint32_t, uint32_t, aggr_lacp_mode_t, 309d62bc4baSyz aggr_lacp_timer_t); 310d62bc4baSyz typedef int (*aggr_grp_info_new_port_fn_t)(void *, datalink_id_t, uchar_t *, 311ba2e4443Sseb aggr_port_state_t, aggr_lacp_state_t *); 3127c478bd9Sstevel@tonic-gate 3137c478bd9Sstevel@tonic-gate extern void aggr_grp_init(void); 314c0192a57Sericheng extern void aggr_grp_fini(void); 315d62bc4baSyz extern int aggr_grp_create(datalink_id_t, uint32_t, uint_t, laioc_port_t *, 316d62bc4baSyz uint32_t, boolean_t, boolean_t, uchar_t *, aggr_lacp_mode_t, 3172b24ab6bSSebastien Roy aggr_lacp_timer_t, cred_t *); 3182b24ab6bSSebastien Roy extern int aggr_grp_delete(datalink_id_t, cred_t *); 3197c478bd9Sstevel@tonic-gate extern void aggr_grp_free(aggr_grp_t *); 3207c478bd9Sstevel@tonic-gate 321d62bc4baSyz extern int aggr_grp_info(datalink_id_t, void *, aggr_grp_info_new_grp_fn_t, 3222b24ab6bSSebastien Roy aggr_grp_info_new_port_fn_t, cred_t *); 3237c478bd9Sstevel@tonic-gate extern void aggr_grp_notify(aggr_grp_t *, uint32_t); 3247c478bd9Sstevel@tonic-gate extern boolean_t aggr_grp_attach_port(aggr_grp_t *, aggr_port_t *); 325da14cebeSEric Cheng extern boolean_t aggr_grp_detach_port(aggr_grp_t *, aggr_port_t *); 3264deae11aSyz extern void aggr_grp_port_mac_changed(aggr_grp_t *, aggr_port_t *, 3274deae11aSyz boolean_t *, boolean_t *); 328d62bc4baSyz extern int aggr_grp_add_ports(datalink_id_t, uint_t, boolean_t, 329d62bc4baSyz laioc_port_t *); 330d62bc4baSyz extern int aggr_grp_rem_ports(datalink_id_t, uint_t, laioc_port_t *); 3314deae11aSyz extern boolean_t aggr_grp_update_ports_mac(aggr_grp_t *); 332da14cebeSEric Cheng extern int aggr_grp_modify(datalink_id_t, uint8_t, uint32_t, boolean_t, 333da14cebeSEric Cheng const uchar_t *, aggr_lacp_mode_t, aggr_lacp_timer_t); 3347c478bd9Sstevel@tonic-gate extern void aggr_grp_multicst_port(aggr_port_t *, boolean_t); 335210db224Sericheng extern uint_t aggr_grp_count(void); 33609b7f21aSRobert Mustacchi extern void aggr_grp_update_default(aggr_grp_t *); 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate extern void aggr_port_init(void); 339c0192a57Sericheng extern void aggr_port_fini(void); 340da14cebeSEric Cheng extern int aggr_port_create(aggr_grp_t *, const datalink_id_t, boolean_t, 341da14cebeSEric Cheng aggr_port_t **); 3427c478bd9Sstevel@tonic-gate extern void aggr_port_delete(aggr_port_t *); 3437c478bd9Sstevel@tonic-gate extern void aggr_port_free(aggr_port_t *); 3447c478bd9Sstevel@tonic-gate extern int aggr_port_start(aggr_port_t *); 3457c478bd9Sstevel@tonic-gate extern void aggr_port_stop(aggr_port_t *); 3467c478bd9Sstevel@tonic-gate extern int aggr_port_promisc(aggr_port_t *, boolean_t); 347da14cebeSEric Cheng extern int aggr_port_unicst(aggr_port_t *); 3487c478bd9Sstevel@tonic-gate extern int aggr_port_multicst(void *, boolean_t, const uint8_t *); 349ba2e4443Sseb extern uint64_t aggr_port_stat(aggr_port_t *, uint_t); 350da14cebeSEric Cheng extern boolean_t aggr_port_notify_link(aggr_grp_t *, aggr_port_t *); 351c615009fSyz extern void aggr_port_init_callbacks(aggr_port_t *); 3527c478bd9Sstevel@tonic-gate 353da14cebeSEric Cheng extern void aggr_recv_cb(void *, mac_resource_handle_t, mblk_t *, boolean_t); 3547c478bd9Sstevel@tonic-gate 3550dc2366fSVenugopal Iyer extern void aggr_tx_ring_update(void *, uintptr_t); 3560dc2366fSVenugopal Iyer extern void aggr_tx_notify_thread(void *); 3577c478bd9Sstevel@tonic-gate extern void aggr_send_port_enable(aggr_port_t *); 3587c478bd9Sstevel@tonic-gate extern void aggr_send_port_disable(aggr_port_t *); 3597c478bd9Sstevel@tonic-gate extern void aggr_send_update_policy(aggr_grp_t *, uint32_t); 3607c478bd9Sstevel@tonic-gate 361f12af565Snd extern void aggr_lacp_init(void); 362f12af565Snd extern void aggr_lacp_fini(void); 3637c478bd9Sstevel@tonic-gate extern void aggr_lacp_init_port(aggr_port_t *); 3647c478bd9Sstevel@tonic-gate extern void aggr_lacp_init_grp(aggr_grp_t *); 3657c478bd9Sstevel@tonic-gate extern void aggr_lacp_set_mode(aggr_grp_t *, aggr_lacp_mode_t, 3667c478bd9Sstevel@tonic-gate aggr_lacp_timer_t); 3677c478bd9Sstevel@tonic-gate extern void aggr_lacp_update_mode(aggr_grp_t *, aggr_lacp_mode_t); 3687c478bd9Sstevel@tonic-gate extern void aggr_lacp_update_timer(aggr_grp_t *, aggr_lacp_timer_t); 369da14cebeSEric Cheng extern void aggr_lacp_rx_enqueue(aggr_port_t *, mblk_t *); 3707c478bd9Sstevel@tonic-gate extern void aggr_lacp_port_attached(aggr_port_t *); 3717c478bd9Sstevel@tonic-gate extern void aggr_lacp_port_detached(aggr_port_t *); 372da14cebeSEric Cheng extern void aggr_port_lacp_set_mode(aggr_grp_t *, aggr_port_t *); 373da14cebeSEric Cheng 374da14cebeSEric Cheng extern void aggr_lacp_rx_thread(void *); 375da14cebeSEric Cheng extern void aggr_recv_lacp(aggr_port_t *, mac_resource_handle_t, mblk_t *); 376da14cebeSEric Cheng 377da14cebeSEric Cheng extern void aggr_grp_port_hold(aggr_port_t *); 378da14cebeSEric Cheng extern void aggr_grp_port_rele(aggr_port_t *); 379da14cebeSEric Cheng extern void aggr_grp_port_wait(aggr_grp_t *); 380da14cebeSEric Cheng 38145948e49SRyan Zezeski extern int aggr_port_addmac(aggr_port_t *, uint_t, const uint8_t *); 38245948e49SRyan Zezeski extern void aggr_port_remmac(aggr_port_t *, uint_t, const uint8_t *); 3837c478bd9Sstevel@tonic-gate 38445948e49SRyan Zezeski extern int aggr_port_addvlan(aggr_port_t *, uint_t, uint16_t); 38545948e49SRyan Zezeski extern int aggr_port_remvlan(aggr_port_t *, uint_t, uint16_t); 38684de666eSRyan Zezeski 3870dc2366fSVenugopal Iyer extern mblk_t *aggr_ring_tx(void *, mblk_t *); 3880dc2366fSVenugopal Iyer extern mblk_t *aggr_find_tx_ring(void *, mblk_t *, 3890dc2366fSVenugopal Iyer uintptr_t, mac_ring_handle_t *); 3900dc2366fSVenugopal Iyer 3917c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 3927c478bd9Sstevel@tonic-gate 3937c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3947c478bd9Sstevel@tonic-gate } 3957c478bd9Sstevel@tonic-gate #endif 3967c478bd9Sstevel@tonic-gate 3977c478bd9Sstevel@tonic-gate #endif /* _SYS_AGGR_IMPL_H */ 398