Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Mar 2006 13:23:41 +1300
From:      Andrew Thompson <thompsa@freebsd.org>
To:        Nik Lam <freebsdnik@j2d.lam.net.au>
Cc:        freebsd-net@freebsd.org
Subject:   Re: configuring if_bridge with stp at boot in /etc/rc.conf
Message-ID:  <20060306002341.GB44857@heff.fud.org.nz>
In-Reply-To: <440B6644.3050800@j2d.lam.net.au>
References:  <440683E2.8000009@j2d.lam.net.au> <440B4759.6010106@j2d.lam.net.au> <20060305204051.GA44857@heff.fud.org.nz> <440B6644.3050800@j2d.lam.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help

--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Mar 06, 2006 at 09:29:24AM +1100, Nik Lam wrote:
> Andrew Thompson wrote:
> >On Mon, Mar 06, 2006 at 07:17:29AM +1100, Nik Lam wrote:
> >>To re-iterate, when I try to activate the bridge with STP parameters
> >>in rc.conf, one of the bridge interfaces goes into forwarding mode,
> >>but the other interfaces remains in disabled mode.
> >
> >Can you post the full output from ifconfig and tell us what version of
> >the OS you are running.
> >
> 
> Here's what I see about a minute after booting up.  If I run it earlier 
> I get to see the em1 member of bridge0 go through the listening and 
> learning modes, but em2 remains disabled throughout.
> 

It may be possible that the link-up notification is not happening for
em2 or we are somehow missing the first one.

Can you try this patch and see if stp on em2 kicks into life. Can you
also test unplugging/plugging the network cable for em2 and see if you
get link change messages in your dmesg.


Andrew

--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bstp_linktick.diff"

Index: bridgestp.c
===================================================================
RCS file: /home/ncvs/src/sys/net/bridgestp.c,v
retrieving revision 1.11
diff -u -p -r1.11 bridgestp.c
--- bridgestp.c	28 Feb 2006 00:13:24 -0000	1.11
+++ bridgestp.c	6 Mar 2006 00:19:06 -0000
@@ -75,6 +75,7 @@ __FBSDID("$FreeBSD: src/sys/net/bridgest
 
 #define	BSTP_MESSAGE_AGE_INCR	(1 * 256)	/* in 256ths of a second */
 #define	BSTP_TICK_VAL		(1 * 256)	/* in 256ths of a second */
+#define	BSTP_LINK_TIMER		(BSTP_TICK_VAL * 15)
 
 /*
  * Because BPDU's do not make nicely aligned structures, two different
@@ -916,6 +917,7 @@ bstp_initialization(struct bridge_softc 
 	bstp_port_state_selection(sc);
 	bstp_config_bpdu_generation(sc);
 	bstp_timer_start(&sc->sc_hello_timer, 0);
+	bstp_timer_start(&sc->sc_link_timer, 0);
 }
 
 void
@@ -1121,20 +1123,15 @@ bstp_tick(void *arg)
 
 	BRIDGE_LOCK_ASSERT(sc);
 
-#if 0
-	LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
-		if ((bif->bif_flags & IFBIF_STP) == 0)
-			continue;
-		/*
-		 * XXX This can cause a lag in "link does away"
-		 * XXX and "spanning tree gets updated".  We need
-		 * XXX come sort of callback from the link state
-		 * XXX update code to kick spanning tree.
-		 * XXX --thorpej@NetBSD.org
-		 */
-		bstp_ifupdstatus(sc, bif);
+	/* slow timer to catch missed link events */
+	if (bstp_timer_expired(&sc->sc_link_timer, BSTP_LINK_TIMER)) {
+		LIST_FOREACH(bif, &sc->sc_iflist, bif_next) {
+			if ((bif->bif_flags & IFBIF_STP) == 0)
+				continue;
+			bstp_ifupdstatus(sc, bif);
+		}
+		bstp_timer_start(&sc->sc_link_timer, 0);
 	}
-#endif
 
 	if (bstp_timer_expired(&sc->sc_hello_timer, sc->sc_hello_time))
 		bstp_hello_timer_expiry(sc);
Index: if_bridgevar.h
===================================================================
RCS file: /home/ncvs/src/sys/net/if_bridgevar.h,v
retrieving revision 1.10
diff -u -p -r1.10 if_bridgevar.h
--- if_bridgevar.h	14 Jan 2006 03:51:30 -0000	1.10
+++ if_bridgevar.h	5 Mar 2006 22:50:50 -0000
@@ -301,6 +301,7 @@ struct bridge_softc {
 	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 bridge_timer	sc_link_timer;
 };
 
 #define BRIDGE_LOCK_INIT(_sc)		do {			\

--1yeeQ81UyVL57Vl7--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060306002341.GB44857>