aggr_impl.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_AGGR_IMPL_H
#define _SYS_AGGR_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/aggr_lacp.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#define AGGR_MINOR_CTL 0 /* control interface minor */
/* 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
/*
* 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_closing : 1,
/*
* Indicates whether it is in the process of setting
* MAC address to the aggregation group MAC
*/
lp_set_grpmac : 1,
lp_pad_bits : 26;
const mac_info_t *lp_mip;
void *lp_tx_arg;
} 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_pad_bits : 12;
} 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;
typedef int (*aggr_grp_info_new_port_fn_t)(void *, char *, uint32_t,
typedef void (*aggr_grp_walker_fn_t)(aggr_grp_t *, void *);
extern void aggr_grp_init(void);
extern int aggr_grp_fini(void);
extern int aggr_grp_delete(uint32_t);
extern void aggr_grp_free(aggr_grp_t *);
extern void aggr_grp_update_ports_mac(aggr_grp_t *);
extern void aggr_grp_walk(aggr_grp_walker_fn_t, void *);
extern void aggr_port_init(void);
extern int aggr_port_fini(void);
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 void aggr_send_port_enable(aggr_port_t *);
extern void aggr_send_port_disable(aggr_port_t *);
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_policy_changed(aggr_grp_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_AGGR_IMPL_H */