bridge_impl.h revision f2905fb789fa42069fdb0ba5bd1b61400e23f348
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _BRIDGE_IMPL_H
#define _BRIDGE_IMPL_H
/*
* These are the internal data structures used by the layer-two (Ethernet)
* bridging module.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/sysmacros.h>
#include <sys/ethernet.h>
#include <sys/mac_client.h>
#define BRIDGE_DEV_NAME "bridge"
"forward_direct", "forward_unknown", "forward_mbcast", \
"learn_source", "learn_moved", "learn_expire", "learn_size"
typedef struct bridge_ksinst_s {
typedef struct bridge_kslink_s {
/*
* There's one instance structure and one observability mac node for each
* bridge. Each open non-DLPI stream gets a 'stream' structure; these are used
* for bridge instance allocation and control. Each link on the bridge has a
* link structure. Finally, the bridge has a table of learned forwarding
* entries, each with a list of outputs, which are either links or TRILL
* nicknames.
*
* The mac structure lives as long as the dls and mac layers are busy. It can
* outlive the bridge instance and be picked up again (by name) if the instance
* is restarted.
*/
struct bridge_mac_s;
struct bridge_stream_s;
typedef struct bridge_inst_s {
struct bridge_stream_s *bi_control;
struct bridge_mac_s *bi_mac;
void *bi_trilldata;
char bi_name[MAXLINKNAMELEN];
/*
* The bridge MAC structure has the same lifetime as an observability node.
* It's created when a bridge instance is allocated, but is not freed when the
* instance is removed because there's no way for a MAC client to guarantee
* that all users have disappeared.
*/
typedef struct bridge_mac_s {
char bm_name[MAXLINKNAMELEN];
} bridge_mac_t;
/*
* Bridge streams are used only for instance allocation and control.
*/
typedef struct bridge_stream_s {
/*
* These macros are used to set and test link membership in particular VLANs.
* This membership is used to determine how to forward packets between
* interfaces.
*/
#define BRIDGE_VLAN_ARR_SIZE \
(1 << ((v) % NBBY)))
(1 << ((v) % NBBY)))
~(1 << ((v) % NBBY)))
(1 << ((v) % NBBY)))
/*
* This structure represents a link attached to a bridge. VLAN membership
* information is kept here; when forwarding, we must look at the membership of
* the input link and the output to determine when to update the packet
* contents and when to discard.
*/
typedef struct bridge_link_s {
void *bl_trilldata;
/*
* This represents a learned forwarding entry. These are generally created and
* refreshed on demand as we learn about nodes through source MAC addresses we
* see. They're destroyed when they age away. For forwarding, we look up the
* destination address in an AVL tree, and the entry found tells us where the
* that source must live.
*/
typedef struct bridge_fwd_s {
} bridge_fwd_t;
#define BFF_INTREE 0x0001
/* TRILL linkage */
mblk_t *, mac_header_info_t *);
typedef void (*trill_br_dstr_t)(void *, bridge_inst_t *);
typedef void (*trill_ln_dstr_t)(void *, bridge_link_t *);
extern bridge_inst_t *bridge_trill_brref(const char *, void *);
extern void bridge_trill_brunref(bridge_inst_t *);
void *);
extern void bridge_trill_lnunref(bridge_link_t *);
/* Ethernet multicast address; constant stored in bridge module */
extern const uint8_t all_isis_rbridges[];
extern const uint8_t bridge_group_address[];
#ifdef __cplusplus
}
#endif
#endif /* _BRIDGE_IMPL_H */