All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: bridge: log port STP state on change
@ 2016-02-16 15:09 Vivien Didelot
  2016-02-17  4:27 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vivien Didelot @ 2016-02-16 15:09 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Ido Schimmel,
	Stephen Hemminger, Florian Fainelli, Andrew Lunn, Vivien Didelot

Remove the shared br_log_state function and print the info directly in
br_set_state, where the net_bridge_port state is actually changed.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 net/bridge/br_netlink.c   |  1 -
 net/bridge/br_private.h   |  1 -
 net/bridge/br_stp.c       | 14 ++++----------
 net/bridge/br_stp_if.c    |  2 --
 net/bridge/br_stp_timer.c |  1 -
 5 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 40197ff..e9c635e 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -598,7 +598,6 @@ static int br_set_port_state(struct net_bridge_port *p, u8 state)
 		return -ENETDOWN;
 
 	br_set_state(p, state);
-	br_log_state(p);
 	br_port_state_selection(p->br);
 	return 0;
 }
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 302ab0a..1b5d145 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -900,7 +900,6 @@ static inline void br_nf_core_fini(void) {}
 #endif
 
 /* br_stp.c */
-void br_log_state(const struct net_bridge_port *p);
 void br_set_state(struct net_bridge_port *p, unsigned int state);
 struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no);
 void br_init_port(struct net_bridge_port *p);
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index b3cca12..c22816a 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -30,13 +30,6 @@ static const char *const br_port_state_names[] = {
 	[BR_STATE_BLOCKING] = "blocking",
 };
 
-void br_log_state(const struct net_bridge_port *p)
-{
-	br_info(p->br, "port %u(%s) entered %s state\n",
-		(unsigned int) p->port_no, p->dev->name,
-		br_port_state_names[p->state]);
-}
-
 void br_set_state(struct net_bridge_port *p, unsigned int state)
 {
 	struct switchdev_attr attr = {
@@ -52,6 +45,10 @@ 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_info(p->br, "port %u(%s) entered %s state\n",
+				(unsigned int) p->port_no, p->dev->name,
+				br_port_state_names[p->state]);
 }
 
 /* called under bridge lock */
@@ -126,7 +123,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 +403,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 +426,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)
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index a31ac6a..984d462 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -102,7 +102,6 @@ void br_stp_enable_port(struct net_bridge_port *p)
 {
 	br_init_port(p);
 	br_port_state_selection(p->br);
-	br_log_state(p);
 	br_ifinfo_notify(RTM_NEWLINK, p);
 }
 
@@ -118,7 +117,6 @@ void br_stp_disable_port(struct net_bridge_port *p)
 	p->topology_change_ack = 0;
 	p->config_pending = 0;
 
-	br_log_state(p);
 	br_ifinfo_notify(RTM_NEWLINK, p);
 
 	del_timer(&p->message_age_timer);
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
index 5f0f5af..da058b8 100644
--- a/net/bridge/br_stp_timer.c
+++ b/net/bridge/br_stp_timer.c
@@ -98,7 +98,6 @@ static void br_forward_delay_timer_expired(unsigned long arg)
 			br_topology_change_detection(br);
 		netif_carrier_on(br->dev);
 	}
-	br_log_state(p);
 	rcu_read_lock();
 	br_ifinfo_notify(RTM_NEWLINK, p);
 	rcu_read_unlock();
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: bridge: log port STP state on change
  2016-02-16 15:09 [PATCH net-next] net: bridge: log port STP state on change Vivien Didelot
@ 2016-02-17  4:27 ` Stephen Hemminger
  2016-02-17 10:14 ` Ido Schimmel
  2016-02-18 19:21 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2016-02-17  4:27 UTC (permalink / raw)
  To: Vivien Didelot
  Cc: netdev, linux-kernel, kernel, David S. Miller, Ido Schimmel,
	Florian Fainelli, Andrew Lunn

On Tue, 16 Feb 2016 10:09:51 -0500
Vivien Didelot <vivien.didelot@savoirfairelinux.com> wrote:

> Remove the shared br_log_state function and print the info directly in
> br_set_state, where the net_bridge_port state is actually changed.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---

Looks good and fixes the weird case where set_state fails then a log
message would still be printed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: bridge: log port STP state on change
  2016-02-16 15:09 [PATCH net-next] net: bridge: log port STP state on change Vivien Didelot
  2016-02-17  4:27 ` Stephen Hemminger
@ 2016-02-17 10:14 ` Ido Schimmel
  2016-02-18 19:21 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2016-02-17 10:14 UTC (permalink / raw)
  To: Vivien Didelot
  Cc: netdev, linux-kernel, kernel, David S. Miller, Stephen Hemminger,
	Florian Fainelli, Andrew Lunn

Tue, Feb 16, 2016 at 05:09:51PM IST, vivien.didelot@savoirfairelinux.com wrote:
>Remove the shared br_log_state function and print the info directly in
>br_set_state, where the net_bridge_port state is actually changed.
>
>Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>---

Acked-by: Ido Schimmel <idosch@mellanox.com>

Thanks Vivien.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: bridge: log port STP state on change
  2016-02-16 15:09 [PATCH net-next] net: bridge: log port STP state on change Vivien Didelot
  2016-02-17  4:27 ` Stephen Hemminger
  2016-02-17 10:14 ` Ido Schimmel
@ 2016-02-18 19:21 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-02-18 19:21 UTC (permalink / raw)
  To: vivien.didelot
  Cc: netdev, linux-kernel, kernel, idosch, stephen, f.fainelli, andrew

From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Tue, 16 Feb 2016 10:09:51 -0500

> Remove the shared br_log_state function and print the info directly in
> br_set_state, where the net_bridge_port state is actually changed.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Applied, thanks Vivien.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-18 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16 15:09 [PATCH net-next] net: bridge: log port STP state on change Vivien Didelot
2016-02-17  4:27 ` Stephen Hemminger
2016-02-17 10:14 ` Ido Schimmel
2016-02-18 19:21 ` David Miller

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.