All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: Re: bridge interface initial carrier state
Date: Mon, 11 Feb 2013 16:46:41 -0600	[thread overview]
Message-ID: <1360622801.8633.34.camel@dcbw.foobar.com> (raw)
In-Reply-To: <20130211135930.4cdad83c@nehalam.linuxnetplumber.net>

On Mon, 2013-02-11 at 13:59 -0800, Stephen Hemminger wrote:
> On Mon, 11 Feb 2013 14:01:55 -0600
> Dan Williams <dcbw@redhat.com> wrote:
> 
> > Hi,
> > 
> > I'm wondering if the initial carrier state of 'on' is intentional for a
> > bridge without ports; immediately after adding ports, the carrier is
> > recalculated and depends on the combined state of each port's carrier
> > and STP forwarding state.  So a userspace program attempting to decide
> > whether the bridge was usable or not has to look at both (a) how many
> > ports are available and (b) bridge carrier state, instead of just
> > looking at the bridge carrier state.
> > 
> > Dan
> 
> Perhaps a future enhancement of bridge would be to use operstate flags
> to indicate lower layer down if there are no ports.

While we're at it, it appears that if a bridge port is added when it has
no carrier, nothing directly triggers br_port_state_selection() to
ensure that the bridge's carrier state is correct:

	if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) &&
	    (br->dev->flags & IFF_UP))
		br_stp_enable_port(p);

Any reason why we can't run br_port_state_selection() unconditionally
when adding a new port?  When removing a port that gets run by
br_stp_disable_port(), which is somewhat asymmetrical.

When adding, we don't necessarily want to enable STP operation on the
port until it's ready, so that hunk above for br_stp_enable_port() is
probably just fine, but we should still probably be recalculating the
bridge's carrier when it gets its first port even if that port isn't yet
usable?  Or not?

Dan

      reply	other threads:[~2013-02-11 22:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 20:01 bridge interface initial carrier state Dan Williams
2013-02-11 21:58 ` Stephen Hemminger
2013-02-12 21:06   ` Jiri Pirko
2013-02-12 21:10     ` David Miller
2013-02-11 21:59 ` Stephen Hemminger
2013-02-11 22:46   ` Dan Williams [this message]

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=1360622801.8633.34.camel@dcbw.foobar.com \
    --to=dcbw@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.