Commit 06a7fc42 authored by Flavio Leitner's avatar Flavio Leitner Committed by David S. Miller

team: update master carrier state

Update master's carrier state when there is any
change with its ports.
Signed-off-by: default avatarFlavio Leitner <fbl@redhat.com>
Acked-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f8ca2b6f
...@@ -1400,13 +1400,11 @@ static void team_destructor(struct net_device *dev) ...@@ -1400,13 +1400,11 @@ static void team_destructor(struct net_device *dev)
static int team_open(struct net_device *dev) static int team_open(struct net_device *dev)
{ {
netif_carrier_on(dev);
return 0; return 0;
} }
static int team_close(struct net_device *dev) static int team_close(struct net_device *dev)
{ {
netif_carrier_off(dev);
return 0; return 0;
} }
...@@ -2560,21 +2558,43 @@ static void __team_port_change_send(struct team_port *port, bool linkup) ...@@ -2560,21 +2558,43 @@ static void __team_port_change_send(struct team_port *port, bool linkup)
} }
static void __team_carrier_check(struct team *team)
{
struct team_port *port;
bool team_linkup;
team_linkup = false;
list_for_each_entry(port, &team->port_list, list) {
if (port->linkup) {
team_linkup = true;
break;
}
}
if (team_linkup)
netif_carrier_on(team->dev);
else
netif_carrier_off(team->dev);
}
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) if (port->state.linkup != linkup)
__team_port_change_send(port, linkup); __team_port_change_send(port, linkup);
__team_carrier_check(port->team);
} }
static void __team_port_change_port_added(struct team_port *port, bool linkup) static void __team_port_change_port_added(struct team_port *port, bool linkup)
{ {
__team_port_change_send(port, linkup); __team_port_change_send(port, linkup);
__team_carrier_check(port->team);
} }
static void __team_port_change_port_removed(struct team_port *port) static void __team_port_change_port_removed(struct team_port *port)
{ {
port->removed = true; port->removed = true;
__team_port_change_send(port, false); __team_port_change_send(port, false);
__team_carrier_check(port->team);
} }
static void team_port_change_check(struct team_port *port, bool linkup) static void team_port_change_check(struct team_port *port, bool linkup)
......
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