aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/team
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2012-09-22 03:07:53 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-22 15:46:12 -0400
commit0b121fd28d071c766dddab743031ba6cfe9be68e (patch)
treef6ce9ce002942cdcbf9a4f0ded8374c5f4aefaee /drivers/net/team
parentab43ed8b7490cb387782423ecf74aeee7237e591 (diff)
team: send port changed when added
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/team')
-rw-r--r--drivers/net/team/team.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 341b65dbbcd3..3ffe8a6e3c8b 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -848,7 +848,7 @@ static struct netpoll_info *team_netpoll_info(struct team *team)
848} 848}
849#endif 849#endif
850 850
851static void __team_port_change_check(struct team_port *port, bool linkup); 851static void __team_port_change_port_added(struct team_port *port, bool linkup);
852 852
853static int team_port_add(struct team *team, struct net_device *port_dev) 853static int team_port_add(struct team *team, struct net_device *port_dev)
854{ 854{
@@ -948,7 +948,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
948 team_port_enable(team, port); 948 team_port_enable(team, port);
949 list_add_tail_rcu(&port->list, &team->port_list); 949 list_add_tail_rcu(&port->list, &team->port_list);
950 __team_compute_features(team); 950 __team_compute_features(team);
951 __team_port_change_check(port, !!netif_carrier_ok(port_dev)); 951 __team_port_change_port_added(port, !!netif_carrier_ok(port_dev));
952 __team_options_change_check(team); 952 __team_options_change_check(team);
953 953
954 netdev_info(dev, "Port device %s added\n", portname); 954 netdev_info(dev, "Port device %s added\n", portname);
@@ -983,6 +983,8 @@ err_set_mtu:
983 return err; 983 return err;
984} 984}
985 985
986static void __team_port_change_port_removed(struct team_port *port);
987
986static int team_port_del(struct team *team, struct net_device *port_dev) 988static int team_port_del(struct team *team, struct net_device *port_dev)
987{ 989{
988 struct net_device *dev = team->dev; 990 struct net_device *dev = team->dev;
@@ -999,8 +1001,7 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
999 __team_option_inst_mark_removed_port(team, port); 1001 __team_option_inst_mark_removed_port(team, port);
1000 __team_options_change_check(team); 1002 __team_options_change_check(team);
1001 __team_option_inst_del_port(team, port); 1003 __team_option_inst_del_port(team, port);
1002 port->removed = true; 1004 __team_port_change_port_removed(port);
1003 __team_port_change_check(port, false);
1004 team_port_disable(team, port); 1005 team_port_disable(team, port);
1005 list_del_rcu(&port->list); 1006 list_del_rcu(&port->list);
1006 netdev_rx_handler_unregister(port_dev); 1007 netdev_rx_handler_unregister(port_dev);
@@ -2251,13 +2252,11 @@ static void __team_options_change_check(struct team *team)
2251} 2252}
2252 2253
2253/* rtnl lock is held */ 2254/* rtnl lock is held */
2254static void __team_port_change_check(struct team_port *port, bool linkup) 2255
2256static void __team_port_change_send(struct team_port *port, bool linkup)
2255{ 2257{
2256 int err; 2258 int err;
2257 2259
2258 if (!port->removed && port->state.linkup == linkup)
2259 return;
2260
2261 port->changed = true; 2260 port->changed = true;
2262 port->state.linkup = linkup; 2261 port->state.linkup = linkup;
2263 team_refresh_port_linkup(port); 2262 team_refresh_port_linkup(port);
@@ -2282,6 +2281,23 @@ send_event:
2282 2281
2283} 2282}
2284 2283
2284static void __team_port_change_check(struct team_port *port, bool linkup)
2285{
2286 if (port->state.linkup != linkup)
2287 __team_port_change_send(port, linkup);
2288}
2289
2290static void __team_port_change_port_added(struct team_port *port, bool linkup)
2291{
2292 __team_port_change_send(port, linkup);
2293}
2294
2295static void __team_port_change_port_removed(struct team_port *port)
2296{
2297 port->removed = true;
2298 __team_port_change_send(port, false);
2299}
2300
2285static void team_port_change_check(struct team_port *port, bool linkup) 2301static void team_port_change_check(struct team_port *port, bool linkup)
2286{ 2302{
2287 struct team *team = port->team; 2303 struct team *team = port->team;