aggr_impl.h revision da14cebe459d3275048785f25bd869cb09b5307f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_AGGR_IMPL_H
#define _SYS_AGGR_IMPL_H
#include <sys/mac_ether.h>
#include <sys/mac_provider.h>
#include <sys/mac_client.h>
#include <sys/mac_client_priv.h>
#include <sys/aggr_lacp.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/* flags for aggr_grp_modify() */
#define AGGR_MODIFY_POLICY 0x01
#define AGGR_MODIFY_MAC 0x02
#define AGGR_MODIFY_LACP_MODE 0x04
#define AGGR_MODIFY_LACP_TIMER 0x08
/*
* Possible value of aggr_rseudo_rx_ring_t.arr_flags. Set when the ring entry
* in the pseudo RX group is used.
*/
#define MAC_PSEUDO_RING_INUSE 0x01
typedef struct aggr_unicst_addr_s {
struct aggr_unicst_addr_s *aua_next;
typedef struct aggr_pseudo_rx_ring_s {
struct aggr_port_s *arr_port;
typedef struct aggr_pseudo_rx_group_s {
/*
* A link aggregation MAC port.
* Note that lp_next is protected by the lg_lock of the group the
* port is part of.
*/
typedef struct aggr_port_s {
struct aggr_port_s *lp_next;
lp_tx_enabled : 1,
lp_collector_enabled : 1,
lp_promisc_on : 1,
lp_no_link_update : 1,
lp_grp_added : 1,
lp_closing : 1,
lp_pad_bits : 25;
const mac_info_t *lp_mip;
/* List of non-primary addresses that requires promiscous mode set */
/* handle of the underlying HW RX group */
} aggr_port_t;
/*
* A link aggregation group.
*
* The following per-group flags are defined:
*
* - lg_addr_fixed: set when the MAC address has been explicitely set
* when the group was created, or by a m_unicst_set() request.
* If this flag is not set, the MAC address of the group will be
* set to the first port that is added to the group.
*
* - lg_add_set: used only when lg_addr_fixed is not set. Captures whether
* the MAC address was initialized according to the members of the group.
* When set, the lg_port field points to the port from which the
* MAC address was initialized.
*
*/
typedef struct aggr_grp_s {
lg_closing : 1,
lg_zcopy : 1,
lg_vlan : 1,
lg_force : 1,
lg_pad_bits : 9;
/*
* The following fields are used by the LACP packets processing.
* Specifically, as the LACP packets processing is not performance
* critical, all LACP packets will be handled by a dedicated thread
* instead of in the mac_rx() call. This is to avoid the dead lock
* with mac_unicast_remove(), which holding the mac perimeter of the
* aggr, and wait for the mr_refcnt of the RX ring to drop to zero.
*/
/*
* The following fields are used by aggr to wait for all the
* aggr_port_notify_cb() and aggr_port_timer_thread() to finish
* before it calls mac_unregister() when the aggr is deleted.
*/
int lg_port_ref;
} aggr_grp_t;
#define AGGR_GRP_REFHOLD(grp) { \
}
#define AGGR_GRP_REFRELE(grp) { \
membar_exit(); \
aggr_grp_free(grp); \
}
#define AGGR_PORT_REFHOLD(port) { \
}
#define AGGR_PORT_REFRELE(port) { \
membar_exit(); \
aggr_port_free(port); \
}
extern dev_info_t *aggr_dip;
extern int aggr_ioc_init(void);
extern void aggr_ioc_fini(void);
extern void aggr_grp_init(void);
extern void aggr_grp_fini(void);
extern int aggr_grp_delete(datalink_id_t);
extern void aggr_grp_free(aggr_grp_t *);
laioc_port_t *);
extern uint_t aggr_grp_count(void);
extern void aggr_port_init(void);
extern void aggr_port_fini(void);
aggr_port_t **);
extern void aggr_port_delete(aggr_port_t *);
extern void aggr_port_free(aggr_port_t *);
extern int aggr_port_start(aggr_port_t *);
extern void aggr_port_stop(aggr_port_t *);
extern int aggr_port_unicst(aggr_port_t *);
extern void aggr_port_init_callbacks(aggr_port_t *);
extern void aggr_send_port_enable(aggr_port_t *);
extern void aggr_send_port_disable(aggr_port_t *);
extern void aggr_lacp_init(void);
extern void aggr_lacp_fini(void);
extern void aggr_lacp_init_port(aggr_port_t *);
extern void aggr_lacp_init_grp(aggr_grp_t *);
extern void aggr_lacp_port_attached(aggr_port_t *);
extern void aggr_lacp_port_detached(aggr_port_t *);
extern void aggr_lacp_rx_thread(void *);
extern void aggr_grp_port_hold(aggr_port_t *);
extern void aggr_grp_port_rele(aggr_port_t *);
extern void aggr_grp_port_wait(aggr_grp_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_AGGR_IMPL_H */