Remove the dependency of bridgestp.h on if_bridgevar.h by moving a couple of

private structures to if_bridge.c.
This commit is contained in:
Andrew Thompson 2006-07-27 21:01:48 +00:00
parent 04c1ba9b05
commit 9674cf0e27
5 changed files with 50 additions and 53 deletions

View File

@ -169,6 +169,51 @@ __FBSDID("$FreeBSD$");
*/
#define BRIDGE_IFCAPS_MASK IFCAP_TXCSUM
/*
* Bridge interface list entry.
*/
struct bridge_iflist {
LIST_ENTRY(bridge_iflist) bif_next;
struct ifnet *bif_ifp; /* member if */
struct bstp_port bif_stp; /* STP state */
uint32_t bif_flags; /* member if flags */
int bif_mutecap; /* member muted caps */
};
/*
* Bridge route node.
*/
struct bridge_rtnode {
LIST_ENTRY(bridge_rtnode) brt_hash; /* hash table linkage */
LIST_ENTRY(bridge_rtnode) brt_list; /* list linkage */
struct ifnet *brt_ifp; /* destination if */
unsigned long brt_expire; /* expiration time */
uint8_t brt_flags; /* address flags */
uint8_t brt_addr[ETHER_ADDR_LEN];
};
/*
* Software state for each bridge.
*/
struct bridge_softc {
struct ifnet *sc_ifp; /* make this an interface */
LIST_ENTRY(bridge_softc) sc_list;
struct mtx sc_mtx;
struct cv sc_cv;
uint32_t sc_brtmax; /* max # of addresses */
uint32_t sc_brtcnt; /* cur. # of addresses */
uint32_t sc_brttimeout; /* rt timeout in seconds */
struct callout sc_brcallout; /* bridge callout */
uint32_t sc_iflist_ref; /* refcount for sc_iflist */
uint32_t sc_iflist_xcnt; /* refcount for sc_iflist */
LIST_HEAD(, bridge_iflist) sc_iflist; /* member interface list */
LIST_HEAD(, bridge_rtnode) *sc_rthash; /* our forwarding table */
LIST_HEAD(, bridge_rtnode) sc_rtlist; /* list version of above */
uint32_t sc_rthash_key; /* key for hash */
LIST_HEAD(, bridge_iflist) sc_spanlist; /* span ports list */
struct bstp_state sc_stp; /* STP state */
};
static struct mtx bridge_list_mtx;
eventhandler_tag bridge_detach_cookie = NULL;
@ -189,6 +234,9 @@ static void bridge_start(struct ifnet *);
static struct mbuf *bridge_input(struct ifnet *, struct mbuf *);
static int bridge_output(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *);
static void bridge_enqueue(struct bridge_softc *, struct ifnet *,
struct mbuf *);
static void bridge_rtdelete(struct bridge_softc *, struct ifnet *ifp, int);
static void bridge_forward(struct bridge_softc *, struct mbuf *m);
@ -1469,7 +1517,7 @@ bridge_stop(struct ifnet *ifp, int disable)
* Enqueue a packet on a bridge member interface.
*
*/
__inline void
static void
bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m)
{
int len, err = 0;
@ -2366,7 +2414,7 @@ bridge_rtdaddr(struct bridge_softc *sc, const uint8_t *addr)
*
* Delete routes to a speicifc member interface.
*/
void
static void
bridge_rtdelete(struct bridge_softc *sc, struct ifnet *ifp, int full)
{
struct bridge_rtnode *brt, *nbrt;

View File

@ -194,51 +194,6 @@ struct ifbrparam {
#ifdef _KERNEL
/*
* Bridge interface list entry.
*/
struct bridge_iflist {
LIST_ENTRY(bridge_iflist) bif_next;
struct ifnet *bif_ifp; /* member if */
struct bstp_port bif_stp; /* STP state */
uint32_t bif_flags; /* member if flags */
int bif_mutecap; /* member muted caps */
};
/*
* Bridge route node.
*/
struct bridge_rtnode {
LIST_ENTRY(bridge_rtnode) brt_hash; /* hash table linkage */
LIST_ENTRY(bridge_rtnode) brt_list; /* list linkage */
struct ifnet *brt_ifp; /* destination if */
unsigned long brt_expire; /* expiration time */
uint8_t brt_flags; /* address flags */
uint8_t brt_addr[ETHER_ADDR_LEN];
};
/*
* Software state for each bridge.
*/
struct bridge_softc {
struct ifnet *sc_ifp; /* make this an interface */
LIST_ENTRY(bridge_softc) sc_list;
struct mtx sc_mtx;
struct cv sc_cv;
uint32_t sc_brtmax; /* max # of addresses */
uint32_t sc_brtcnt; /* cur. # of addresses */
uint32_t sc_brttimeout; /* rt timeout in seconds */
struct callout sc_brcallout; /* bridge callout */
uint32_t sc_iflist_ref; /* refcount for sc_iflist */
uint32_t sc_iflist_xcnt; /* refcount for sc_iflist */
LIST_HEAD(, bridge_iflist) sc_iflist; /* member interface list */
LIST_HEAD(, bridge_rtnode) *sc_rthash; /* our forwarding table */
LIST_HEAD(, bridge_rtnode) sc_rtlist; /* list version of above */
uint32_t sc_rthash_key; /* key for hash */
LIST_HEAD(, bridge_iflist) sc_spanlist; /* span ports list */
struct bstp_state sc_stp; /* STP state */
};
#define BRIDGE_LOCK_INIT(_sc) do { \
mtx_init(&(_sc)->sc_mtx, "if_bridge", NULL, MTX_DEF); \
cv_init(&(_sc)->sc_cv, "if_bridge_cv"); \
@ -291,9 +246,6 @@ struct bridge_softc {
_err = (*bridge_output_p)(_ifp, _m, NULL, NULL); \
} while (0)
void bridge_enqueue(struct bridge_softc *, struct ifnet *, struct mbuf *);
void bridge_rtdelete(struct bridge_softc *, struct ifnet *ifp, int);
extern struct mbuf *(*bridge_input_p)(struct ifnet *, struct mbuf *);
extern int (*bridge_output_p)(struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *);

View File

@ -59,7 +59,6 @@
#include <net/if_types.h>
#include <net/bpf.h>
#include <net/ethernet.h>
#include <net/bridgestp.h>
#include <net/if_bridgevar.h>
#include <net/if_vlan_var.h>

View File

@ -81,7 +81,6 @@
#include <netinet/ip_encap.h>
#include <net/ethernet.h>
#include <net/bridgestp.h>
#include <net/if_bridgevar.h>
#include <net/if_gif.h>

View File

@ -61,7 +61,6 @@
#include <net/if_arp.h>
#include <net/if_var.h>
#include <net/ethernet.h>
#include <net/bridgestp.h>
#include <net/if_bridgevar.h>
#include <netgraph/ng_message.h>