Commit 0b121fd2 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

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: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ab43ed8b
...@@ -848,7 +848,7 @@ static struct netpoll_info *team_netpoll_info(struct team *team) ...@@ -848,7 +848,7 @@ static struct netpoll_info *team_netpoll_info(struct team *team)
} }
#endif #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_port_add(struct team *team, struct net_device *port_dev) static int team_port_add(struct team *team, struct net_device *port_dev)
{ {
...@@ -948,7 +948,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev) ...@@ -948,7 +948,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
team_port_enable(team, port); team_port_enable(team, port);
list_add_tail_rcu(&port->list, &team->port_list); list_add_tail_rcu(&port->list, &team->port_list);
__team_compute_features(team); __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); __team_options_change_check(team);
netdev_info(dev, "Port device %s added\n", portname); netdev_info(dev, "Port device %s added\n", portname);
...@@ -983,6 +983,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev) ...@@ -983,6 +983,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
return err; 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) static int team_port_del(struct team *team, struct net_device *port_dev)
{ {
struct net_device *dev = team->dev; struct net_device *dev = team->dev;
...@@ -999,8 +1001,7 @@ static int team_port_del(struct team *team, struct net_device *port_dev) ...@@ -999,8 +1001,7 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
__team_option_inst_mark_removed_port(team, port); __team_option_inst_mark_removed_port(team, port);
__team_options_change_check(team); __team_options_change_check(team);
__team_option_inst_del_port(team, port); __team_option_inst_del_port(team, port);
port->removed = true; __team_port_change_port_removed(port);
__team_port_change_check(port, false);
team_port_disable(team, port); team_port_disable(team, port);
list_del_rcu(&port->list); list_del_rcu(&port->list);
netdev_rx_handler_unregister(port_dev); netdev_rx_handler_unregister(port_dev);
...@@ -2251,13 +2252,11 @@ static void __team_options_change_check(struct team *team) ...@@ -2251,13 +2252,11 @@ static void __team_options_change_check(struct team *team)
} }
/* rtnl lock is held */ /* 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; int err;
if (!port->removed && port->state.linkup == linkup)
return;
port->changed = true; port->changed = true;
port->state.linkup = linkup; port->state.linkup = linkup;
team_refresh_port_linkup(port); team_refresh_port_linkup(port);
...@@ -2282,6 +2281,23 @@ static void __team_port_change_check(struct team_port *port, bool linkup) ...@@ -2282,6 +2281,23 @@ static void __team_port_change_check(struct team_port *port, bool linkup)
} }
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) static void team_port_change_check(struct team_port *port, bool linkup)
{ {
struct team *team = port->team; struct team *team = port->team;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment