netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] team: send port changed when added
@ 2012-09-21 11:51 Jiri Pirko
  2012-09-21 19:01 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2012-09-21 11:51 UTC (permalink / raw)
  To: netdev; +Cc: davem

On some hw, link is not up during adding iface to team. That causes event
not being sent to userspace and that may cause confusion.
Fix this bug by sending port changed event once it's added to team.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 drivers/net/team/team.c | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 266af7b..9ce0c51 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -966,7 +966,8 @@ static struct netpoll_info *team_netpoll_info(struct team *team)
 }
 #endif
 
-static void __team_port_change_check(struct team_port *port, bool linkup);
+static void __team_port_change_port_added(struct team_port *port, bool linkup);
+
 static int team_dev_type_check_change(struct net_device *dev,
 				      struct net_device *port_dev);
 
@@ -1079,7 +1080,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
 	team_port_enable(team, port);
 	list_add_tail_rcu(&port->list, &team->port_list);
 	__team_compute_features(team);
-	__team_port_change_check(port, !!netif_carrier_ok(port_dev));
+	__team_port_change_port_added(port, !!netif_carrier_ok(port_dev));
 	__team_options_change_check(team);
 
 	netdev_info(dev, "Port device %s added\n", portname);
@@ -1114,6 +1115,8 @@ err_set_mtu:
 	return err;
 }
 
+static void __team_port_change_port_removed(struct team_port *port);
+
 static int team_port_del(struct team *team, struct net_device *port_dev)
 {
 	struct net_device *dev = team->dev;
@@ -1130,8 +1133,7 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
 	__team_option_inst_mark_removed_port(team, port);
 	__team_options_change_check(team);
 	__team_option_inst_del_port(team, port);
-	port->removed = true;
-	__team_port_change_check(port, false);
+	__team_port_change_port_removed(port);
 	team_port_disable(team, port);
 	list_del_rcu(&port->list);
 	netdev_rx_handler_unregister(port_dev);
@@ -2499,13 +2501,11 @@ static void __team_options_change_check(struct team *team)
 }
 
 /* rtnl lock is held */
-static void __team_port_change_check(struct team_port *port, bool linkup)
+
+static void __team_port_change_send(struct team_port *port, bool linkup)
 {
 	int err;
 
-	if (!port->removed && port->state.linkup == linkup)
-		return;
-
 	port->changed = true;
 	port->state.linkup = linkup;
 	team_refresh_port_linkup(port);
@@ -2530,6 +2530,23 @@ send_event:
 
 }
 
+static void __team_port_change_check(struct team_port *port, bool linkup)
+{
+	if (port->state.linkup != linkup)
+		__team_port_change_send(port, linkup);
+}
+
+static void __team_port_change_port_added(struct team_port *port, bool linkup)
+{
+	__team_port_change_send(port, linkup);
+}
+
+static void __team_port_change_port_removed(struct team_port *port)
+{
+	port->removed = true;
+	__team_port_change_send(port, false);
+}
+
 static void team_port_change_check(struct team_port *port, bool linkup)
 {
 	struct team *team = port->team;
-- 
1.7.12

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

* Re: [patch net-next] team: send port changed when added
  2012-09-21 11:51 [patch net-next] team: send port changed when added Jiri Pirko
@ 2012-09-21 19:01 ` David Miller
  2012-09-22 17:04   ` Jiri Pirko
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2012-09-21 19:01 UTC (permalink / raw)
  To: jiri; +Cc: netdev

From: Jiri Pirko <jiri@resnulli.us>
Date: Fri, 21 Sep 2012 13:51:59 +0200

> On some hw, link is not up during adding iface to team. That causes event
> not being sent to userspace and that may cause confusion.
> Fix this bug by sending port changed event once it's added to team.
> 
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Applied, thanks a lot Jiri.

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

* Re: [patch net-next] team: send port changed when added
  2012-09-21 19:01 ` David Miller
@ 2012-09-22 17:04   ` Jiri Pirko
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2012-09-22 17:04 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Fri, Sep 21, 2012 at 09:01:42PM CEST, davem@davemloft.net wrote:
>From: Jiri Pirko <jiri@resnulli.us>
>Date: Fri, 21 Sep 2012 13:51:59 +0200
>
>> On some hw, link is not up during adding iface to team. That causes event
>> not being sent to userspace and that may cause confusion.
>> Fix this bug by sending port changed event once it's added to team.
>> 
>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>
>Applied, thanks a lot Jiri.

David, I just realized this would be good to have fixed in net tree as
well. Unfortunately this patch does not apply cleanly. I will send you
backported patch for net tree in a jiffy.

Thanks!

Jiri

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

end of thread, other threads:[~2012-09-22 17:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-21 11:51 [patch net-next] team: send port changed when added Jiri Pirko
2012-09-21 19:01 ` David Miller
2012-09-22 17:04   ` Jiri Pirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).