From: Stephen Hemminger <shemminger@vyatta.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: bridge: Eliminate unnecessary forward delay
Date: Mon, 4 Aug 2008 10:27:03 -0700 [thread overview]
Message-ID: <20080804102703.666baedd@extreme> (raw)
In-Reply-To: <20080804170439.GA13546@gondor.apana.org.au>
On Tue, 5 Aug 2008 01:04:39 +0800
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> Hi:
>
> bridge: Eliminate unnecessary forward delay
>
> When the forward delay is set to zero, we still delay the setting
> of the forwarding state by one or possibly two timers depending
> on whether STP is enabled. This could either turn out to be
> instantaneous, or horribly slow depending on the load of the
> machine.
>
> As there is nothing preventing us from enabling forwarding straight
> away, this patch eliminates this potential delay by executing the
> code directly if the forward delay is zero.
>
> The effect of this problem is that immediately after the carrier
> comes on a port, the bridge will drop all packets received from
> that port until it enters forwarding mode, thus causing unnecessary
> packet loss.
>
> Note that this patch doesn't fully remove the delay due to the
> link watcher. We should also check the carrier state when we
> are about to drop an incoming packet because the port is disabled.
> But that's for another patch.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
How about this, it is simpler just to do the state change.
--- a/net/bridge/br_stp.c 2008-08-04 10:20:21.000000000 -0700
+++ b/net/bridge/br_stp.c 2008-08-04 10:26:04.000000000 -0700
@@ -368,14 +368,26 @@ static void br_make_blocking(struct net_
/* called under bridge lock */
static void br_make_forwarding(struct net_bridge_port *p)
{
- if (p->state == BR_STATE_BLOCKING) {
- if (p->br->stp_enabled == BR_KERNEL_STP)
- p->state = BR_STATE_LISTENING;
- else
- p->state = BR_STATE_LEARNING;
+ struct net_bridge *br = p->br;
- br_log_state(p);
- mod_timer(&p->forward_delay_timer, jiffies + p->br->forward_delay); }
+ if (p->state != BR_STATE_BLOCKING)
+ return;
+
+ if (br->forward_delay == 0) {
+ p->state = BR_STATE_FORWARDING;
+ if (br_is_designated_for_some_port(br))
+ br_topology_change_detection(br);
+ del_timer(&p->forward_delay_timer);
+ }
+ else if (p->br->stp_enabled == BR_KERNEL_STP)
+ p->state = BR_STATE_LISTENING;
+ else
+ p->state = BR_STATE_LEARNING;
+
+ br_log_state(p);
+
+ if (br->forward_delay != 0)
+ mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay);
}
/* called under bridge lock */
next prev parent reply other threads:[~2008-08-04 17:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 17:04 bridge: Eliminate unnecessary forward delay Herbert Xu
2008-08-04 17:27 ` Stephen Hemminger [this message]
2008-08-04 17:32 ` Herbert Xu
2008-08-04 17:35 ` Stephen Hemminger
2008-08-05 2:12 ` Herbert Xu
2008-08-05 8:40 ` David Miller
2008-08-05 8:55 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080804102703.666baedd@extreme \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox