diff options
author | Flavio Leitner <fbl@redhat.com> | 2012-12-30 08:27:29 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-03 02:15:14 -0800 |
commit | 06a7fc429f00a90c03d677d8c5ae09f0db6bf87d (patch) | |
tree | 98dc7408e642b9569aab4b23a774899f9b96eac3 /drivers/net/team | |
parent | f8ca2b6f03499379926a3a4f20f3c193325949b3 (diff) | |
download | linux-06a7fc429f00a90c03d677d8c5ae09f0db6bf87d.tar.gz linux-06a7fc429f00a90c03d677d8c5ae09f0db6bf87d.tar.bz2 linux-06a7fc429f00a90c03d677d8c5ae09f0db6bf87d.zip |
team: update master carrier state
Update master's carrier state when there is any
change with its ports.
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-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.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 918a901754b6..78c7d8724614 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -1400,13 +1400,11 @@ static void team_destructor(struct net_device *dev) static int team_open(struct net_device *dev) { - netif_carrier_on(dev); return 0; } static int team_close(struct net_device *dev) { - netif_carrier_off(dev); return 0; } @@ -2560,21 +2558,43 @@ send_event: } +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) { if (port->state.linkup != 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) { __team_port_change_send(port, linkup); + __team_carrier_check(port->team); } static void __team_port_change_port_removed(struct team_port *port) { port->removed = true; __team_port_change_send(port, false); + __team_carrier_check(port->team); } static void team_port_change_check(struct team_port *port, bool linkup) |