From: "Nicolas de Pesloüan" <nicolas.2p.debian@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>,
"Pekka Savola (ipv6)" <pekkas@netcore.fi>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
James Morris <jmorris@namei.org>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
"David S. Miller" <davem@davemloft.net>,
Adam Majer <adamm@zombino.com>
Subject: Re: [Bridge] [PATCH] bridge: control carrier based on ports online
Date: Mon, 07 Mar 2011 21:48:16 +0100 [thread overview]
Message-ID: <4D754490.4000105@gmail.com> (raw)
In-Reply-To: <20110307103406.27330529@nehalam>
Le 07/03/2011 19:34, Stephen Hemminger a écrit :
> This makes the bridge device behave like a physical device.
> In earlier releases the bridge always asserted carrier. This
> changes the behavior so that bridge device carrier is on only
> if one or more ports are in the forwarding state. This
> should help IPv6 autoconfiguration, DHCP, and routing daemons.
>
> I did brief testing with Network and Virt manager and they
> seem fine, but since this changes behavior of bridge, it should
> wait until net-next (2.6.39).
>
> Signed-off-by: Stephen Hemminger<shemminger@vyatta.com>
>
> ---
> net/bridge/br_device.c | 4 ++++
> net/bridge/br_stp.c | 35 ++++++++++++++++++++++-------------
> net/bridge/br_stp_timer.c | 1 +
> 3 files changed, 27 insertions(+), 13 deletions(-)
>
> --- a/net/bridge/br_device.c 2011-03-07 08:40:08.913599513 -0800
> +++ b/net/bridge/br_device.c 2011-03-07 08:40:48.382377389 -0800
> @@ -78,6 +78,8 @@ static int br_dev_open(struct net_device
> {
> struct net_bridge *br = netdev_priv(dev);
>
> + netif_carrier_off(dev);
> +
> br_features_recompute(br);
> netif_start_queue(dev);
> br_stp_enable_bridge(br);
> @@ -94,6 +96,8 @@ static int br_dev_stop(struct net_device
> {
> struct net_bridge *br = netdev_priv(dev);
>
> + netif_carrier_off(dev);
> +
> br_stp_disable_bridge(br);
> br_multicast_stop(br);
>
> --- a/net/bridge/br_stp.c 2011-03-07 08:41:58.619783678 -0800
> +++ b/net/bridge/br_stp.c 2011-03-07 08:53:58.953558810 -0800
> @@ -397,28 +397,37 @@ static void br_make_forwarding(struct ne
> void br_port_state_selection(struct net_bridge *br)
> {
> struct net_bridge_port *p;
> + unsigned int liveports = 0;
>
> /* Don't change port states if userspace is handling STP */
> if (br->stp_enabled == BR_USER_STP)
> return;
>
> list_for_each_entry(p,&br->port_list, list) {
> - if (p->state != BR_STATE_DISABLED) {
> - if (p->port_no == br->root_port) {
> - p->config_pending = 0;
> - p->topology_change_ack = 0;
> - br_make_forwarding(p);
> - } else if (br_is_designated_port(p)) {
> - del_timer(&p->message_age_timer);
> - br_make_forwarding(p);
> - } else {
> - p->config_pending = 0;
> - p->topology_change_ack = 0;
> - br_make_blocking(p);
> - }
> + if (p->state == BR_STATE_DISABLED)
> + continue;
> +
> + if (p->port_no == br->root_port) {
> + p->config_pending = 0;
> + p->topology_change_ack = 0;
> + br_make_forwarding(p);
> + } else if (br_is_designated_port(p)) {
> + del_timer(&p->message_age_timer);
> + br_make_forwarding(p);
> + } else {
> + p->config_pending = 0;
> + p->topology_change_ack = 0;
> + br_make_blocking(p);
Is the above part really related to the purpose of this patch? It looks like (good) cleanup, but
should be in a different patch.
Except from this comment,
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
> }
>
> + if (p->state == BR_STATE_FORWARDING)
> + ++liveports;
> }
> +
> + if (liveports == 0)
> + netif_carrier_off(br->dev);
> + else
> + netif_carrier_on(br->dev);
> }
>
> /* called under bridge lock */
> --- a/net/bridge/br_stp_timer.c 2011-03-07 08:53:25.728770710 -0800
> +++ b/net/bridge/br_stp_timer.c 2011-03-07 08:53:40.273116636 -0800
> @@ -94,6 +94,7 @@ static void br_forward_delay_timer_expir
> p->state = BR_STATE_FORWARDING;
> if (br_is_designated_for_some_port(br))
> br_topology_change_detection(br);
> + netif_carrier_on(br->dev);
> }
> br_log_state(p);
> spin_unlock(&br->lock);
>
WARNING: multiple messages have this Message-ID (diff)
From: "Nicolas de Pesloüan" <nicolas.2p.debian@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Adam Majer <adamm@zombino.com>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
"Pekka Savola (ipv6)" <pekkas@netcore.fi>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>,
bridge@lists.linux-foundation.org, netdev@vger.kernel.org,
Andy Gospodarek <andy@greyhouse.net>,
Jay Vosburgh <fubar@us.ibm.com>
Subject: Re: [PATCH] bridge: control carrier based on ports online
Date: Mon, 07 Mar 2011 21:48:16 +0100 [thread overview]
Message-ID: <4D754490.4000105@gmail.com> (raw)
In-Reply-To: <20110307103406.27330529@nehalam>
Le 07/03/2011 19:34, Stephen Hemminger a écrit :
> This makes the bridge device behave like a physical device.
> In earlier releases the bridge always asserted carrier. This
> changes the behavior so that bridge device carrier is on only
> if one or more ports are in the forwarding state. This
> should help IPv6 autoconfiguration, DHCP, and routing daemons.
>
> I did brief testing with Network and Virt manager and they
> seem fine, but since this changes behavior of bridge, it should
> wait until net-next (2.6.39).
>
> Signed-off-by: Stephen Hemminger<shemminger@vyatta.com>
>
> ---
> net/bridge/br_device.c | 4 ++++
> net/bridge/br_stp.c | 35 ++++++++++++++++++++++-------------
> net/bridge/br_stp_timer.c | 1 +
> 3 files changed, 27 insertions(+), 13 deletions(-)
>
> --- a/net/bridge/br_device.c 2011-03-07 08:40:08.913599513 -0800
> +++ b/net/bridge/br_device.c 2011-03-07 08:40:48.382377389 -0800
> @@ -78,6 +78,8 @@ static int br_dev_open(struct net_device
> {
> struct net_bridge *br = netdev_priv(dev);
>
> + netif_carrier_off(dev);
> +
> br_features_recompute(br);
> netif_start_queue(dev);
> br_stp_enable_bridge(br);
> @@ -94,6 +96,8 @@ static int br_dev_stop(struct net_device
> {
> struct net_bridge *br = netdev_priv(dev);
>
> + netif_carrier_off(dev);
> +
> br_stp_disable_bridge(br);
> br_multicast_stop(br);
>
> --- a/net/bridge/br_stp.c 2011-03-07 08:41:58.619783678 -0800
> +++ b/net/bridge/br_stp.c 2011-03-07 08:53:58.953558810 -0800
> @@ -397,28 +397,37 @@ static void br_make_forwarding(struct ne
> void br_port_state_selection(struct net_bridge *br)
> {
> struct net_bridge_port *p;
> + unsigned int liveports = 0;
>
> /* Don't change port states if userspace is handling STP */
> if (br->stp_enabled == BR_USER_STP)
> return;
>
> list_for_each_entry(p,&br->port_list, list) {
> - if (p->state != BR_STATE_DISABLED) {
> - if (p->port_no == br->root_port) {
> - p->config_pending = 0;
> - p->topology_change_ack = 0;
> - br_make_forwarding(p);
> - } else if (br_is_designated_port(p)) {
> - del_timer(&p->message_age_timer);
> - br_make_forwarding(p);
> - } else {
> - p->config_pending = 0;
> - p->topology_change_ack = 0;
> - br_make_blocking(p);
> - }
> + if (p->state == BR_STATE_DISABLED)
> + continue;
> +
> + if (p->port_no == br->root_port) {
> + p->config_pending = 0;
> + p->topology_change_ack = 0;
> + br_make_forwarding(p);
> + } else if (br_is_designated_port(p)) {
> + del_timer(&p->message_age_timer);
> + br_make_forwarding(p);
> + } else {
> + p->config_pending = 0;
> + p->topology_change_ack = 0;
> + br_make_blocking(p);
Is the above part really related to the purpose of this patch? It looks like (good) cleanup, but
should be in a different patch.
Except from this comment,
Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>
> }
>
> + if (p->state == BR_STATE_FORWARDING)
> + ++liveports;
> }
> +
> + if (liveports == 0)
> + netif_carrier_off(br->dev);
> + else
> + netif_carrier_on(br->dev);
> }
>
> /* called under bridge lock */
> --- a/net/bridge/br_stp_timer.c 2011-03-07 08:53:25.728770710 -0800
> +++ b/net/bridge/br_stp_timer.c 2011-03-07 08:53:40.273116636 -0800
> @@ -94,6 +94,7 @@ static void br_forward_delay_timer_expir
> p->state = BR_STATE_FORWARDING;
> if (br_is_designated_for_some_port(br))
> br_topology_change_detection(br);
> + netif_carrier_on(br->dev);
> }
> br_log_state(p);
> spin_unlock(&br->lock);
>
next prev parent reply other threads:[~2011-03-07 20:48 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-06 5:18 [Bridge] [PATCH 1/2] Issue NETDEV_CHANGE notification when bridge changes state Adam Majer
2011-03-06 5:18 ` Adam Majer
2011-03-06 5:20 ` [Bridge] [PATCH 2/2] Retry autoconfiguration on interface after NETDEV_CHANGE notification Adam Majer
2011-03-06 5:20 ` Adam Majer
2011-03-06 5:31 ` [Bridge] [PATCH 1/2] Issue NETDEV_CHANGE notification when bridge changes state Adam Majer
2011-03-06 5:31 ` Adam Majer
2011-03-06 6:43 ` [Bridge] " Stephen Hemminger
2011-03-06 6:43 ` Stephen Hemminger
2011-03-06 8:03 ` [Bridge] " Adam Majer
2011-03-06 8:03 ` Adam Majer
2011-03-06 17:45 ` [Bridge] " Stephen Hemminger
2011-03-06 17:45 ` Stephen Hemminger
2011-03-07 0:25 ` [Bridge] " Adam Majer
2011-03-07 0:25 ` Adam Majer
2011-03-07 6:41 ` [Bridge] " Stephen Hemminger
2011-03-07 6:41 ` Stephen Hemminger
2011-03-07 7:44 ` [Bridge] " Nicolas de Pesloüan
2011-03-07 7:44 ` Nicolas de Pesloüan
2011-03-07 18:34 ` [Bridge] [PATCH] bridge: control carrier based on ports online Stephen Hemminger
2011-03-07 18:34 ` Stephen Hemminger
2011-03-07 20:48 ` Nicolas de Pesloüan [this message]
2011-03-07 20:48 ` Nicolas de Pesloüan
2011-03-07 21:44 ` [Bridge] " Stephen Hemminger
2011-03-07 21:44 ` Stephen Hemminger
2011-03-07 21:51 ` [Bridge] " Nicolas de Pesloüan
2011-03-07 21:51 ` Nicolas de Pesloüan
2011-03-08 1:08 ` [Bridge] " Adam Majer
2011-03-08 1:08 ` Adam Majer
2011-03-14 21:29 ` [Bridge] " David Miller
2011-03-14 21:29 ` David Miller
2011-03-06 18:01 ` [Bridge] [PATCH 1/2] Issue NETDEV_CHANGE notification when bridge changes state Jan Ceuleers
2011-03-06 18:01 ` Jan Ceuleers
2011-03-09 15:09 ` [Bridge] " Américo Wang
2011-03-09 15:09 ` Américo Wang
2011-03-09 16:44 ` [Bridge] " Adam Majer
2011-03-09 16:44 ` Adam Majer
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=4D754490.4000105@gmail.com \
--to=nicolas.2p.debian@gmail.com \
--cc=adamm@zombino.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=jmorris@namei.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=pekkas@netcore.fi \
--cc=shemminger@vyatta.com \
--cc=yoshfuji@linux-ipv6.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.