Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1333142 > unrolled thread

[PATCH RFC 1/3] net: bridge: log state when setting it

Started byVivien Didelot <vivien.didelot@savoirfairelinux.com>
First post2016-02-12 22:40 +0100
Last post2016-02-13 22:50 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH RFC 1/3] net: bridge: log state when setting it Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-02-12 22:40 +0100
    Re: [PATCH RFC 1/3] net: bridge: log state when setting it Ido Schimmel <idosch@mellanox.com> - 2016-02-13 21:10 +0100
      Re: [PATCH RFC 1/3] net: bridge: log state when setting it Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-02-13 22:50 +0100

#1333142 — [PATCH RFC 1/3] net: bridge: log state when setting it

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-02-12 22:40 +0100
Subject[PATCH RFC 1/3] net: bridge: log state when setting it
Message-ID<r1tBw-44h-9@gated-at.bofh.it>
Every call to br_set_state is followed by a call to br_log_state.
Directly call it within br_set_state instead.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 net/bridge/br_stp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index b3cca12..077afca 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -52,6 +52,8 @@ void br_set_state(struct net_bridge_port *p, unsigned int state)
 	if (err && err != -EOPNOTSUPP)
 		br_warn(p->br, "error setting offload STP state on port %u(%s)\n",
 				(unsigned int) p->port_no, p->dev->name);
+	else
+		br_log_state(p);
 }
 
 /* called under bridge lock */
@@ -126,7 +128,6 @@ static void br_root_port_block(const struct net_bridge *br,
 		  (unsigned int) p->port_no, p->dev->name);
 
 	br_set_state(p, BR_STATE_LISTENING);
-	br_log_state(p);
 	br_ifinfo_notify(RTM_NEWLINK, p);
 
 	if (br->forward_delay > 0)
@@ -407,7 +408,6 @@ static void br_make_blocking(struct net_bridge_port *p)
 			br_topology_change_detection(p->br);
 
 		br_set_state(p, BR_STATE_BLOCKING);
-		br_log_state(p);
 		br_ifinfo_notify(RTM_NEWLINK, p);
 
 		del_timer(&p->forward_delay_timer);
@@ -431,7 +431,6 @@ static void br_make_forwarding(struct net_bridge_port *p)
 	else
 		br_set_state(p, BR_STATE_LEARNING);
 
-	br_log_state(p);
 	br_ifinfo_notify(RTM_NEWLINK, p);
 
 	if (br->forward_delay != 0)
-- 
2.7.1

[toc] | [next] | [standalone]


#1333357

FromIdo Schimmel <idosch@mellanox.com>
Date2016-02-13 21:10 +0100
Message-ID<r1OFY-16I-13@gated-at.bofh.it>
In reply to#1333142
Fri, Feb 12, 2016 at 11:34:18PM IST, vivien.didelot@savoirfairelinux.com wrote:

Hi Vivien,

>Every call to br_set_state is followed by a call to br_log_state.
>Directly call it within br_set_state instead.
>
>Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>---

Maybe I'm missing something, but there are other instances of this
pattern throughout the code, so why not convert them as well? See
br_set_port_state() for example.

Thanks.

> net/bridge/br_stp.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
>index b3cca12..077afca 100644
>--- a/net/bridge/br_stp.c
>+++ b/net/bridge/br_stp.c
>@@ -52,6 +52,8 @@ void br_set_state(struct net_bridge_port *p, unsigned int state)
> 	if (err && err != -EOPNOTSUPP)
> 		br_warn(p->br, "error setting offload STP state on port %u(%s)\n",
> 				(unsigned int) p->port_no, p->dev->name);
>+	else
>+		br_log_state(p);
> }
> 
> /* called under bridge lock */
>@@ -126,7 +128,6 @@ static void br_root_port_block(const struct net_bridge *br,
> 		  (unsigned int) p->port_no, p->dev->name);
> 
> 	br_set_state(p, BR_STATE_LISTENING);
>-	br_log_state(p);
> 	br_ifinfo_notify(RTM_NEWLINK, p);
> 
> 	if (br->forward_delay > 0)
>@@ -407,7 +408,6 @@ static void br_make_blocking(struct net_bridge_port *p)
> 			br_topology_change_detection(p->br);
> 
> 		br_set_state(p, BR_STATE_BLOCKING);
>-		br_log_state(p);
> 		br_ifinfo_notify(RTM_NEWLINK, p);
> 
> 		del_timer(&p->forward_delay_timer);
>@@ -431,7 +431,6 @@ static void br_make_forwarding(struct net_bridge_port *p)
> 	else
> 		br_set_state(p, BR_STATE_LEARNING);
> 
>-	br_log_state(p);
> 	br_ifinfo_notify(RTM_NEWLINK, p);
> 
> 	if (br->forward_delay != 0)
>-- 
>2.7.1
>

[toc] | [prev] | [next] | [standalone]


#1333362

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-02-13 22:50 +0100
Message-ID<r1QeK-1UL-3@gated-at.bofh.it>
In reply to#1333357
Hi Ido,

Ido Schimmel <idosch@mellanox.com> writes:

> Fri, Feb 12, 2016 at 11:34:18PM IST, vivien.didelot@savoirfairelinux.com wrote:
>
> Hi Vivien,
>
>>Every call to br_set_state is followed by a call to br_log_state.
>>Directly call it within br_set_state instead.
>>
>>Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>>---
>
> Maybe I'm missing something, but there are other instances of this
> pattern throughout the code, so why not convert them as well? See
> br_set_port_state() for example.

Good catch, I'll factorize that and send this as a unique patch then.

Thanks,
-v

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web