diff options
author | Flavio Leitner <fbl@redhat.com> | 2012-12-30 03:27:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-03 05:15:14 -0500 |
commit | 06a7fc429f00a90c03d677d8c5ae09f0db6bf87d (patch) | |
tree | 98dc7408e642b9569aab4b23a774899f9b96eac3 /drivers/net/team | |
parent | f8ca2b6f03499379926a3a4f20f3c193325949b3 (diff) |
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) | |||
1400 | 1400 | ||
1401 | static int team_open(struct net_device *dev) | 1401 | static int team_open(struct net_device *dev) |
1402 | { | 1402 | { |
1403 | netif_carrier_on(dev); | ||
1404 | return 0; | 1403 | return 0; |
1405 | } | 1404 | } |
1406 | 1405 | ||
1407 | static int team_close(struct net_device *dev) | 1406 | static int team_close(struct net_device *dev) |
1408 | { | 1407 | { |
1409 | netif_carrier_off(dev); | ||
1410 | return 0; | 1408 | return 0; |
1411 | } | 1409 | } |
1412 | 1410 | ||
@@ -2560,21 +2558,43 @@ send_event: | |||
2560 | 2558 | ||
2561 | } | 2559 | } |
2562 | 2560 | ||
2561 | static void __team_carrier_check(struct team *team) | ||
2562 | { | ||
2563 | struct team_port *port; | ||
2564 | bool team_linkup; | ||
2565 | |||
2566 | team_linkup = false; | ||
2567 | list_for_each_entry(port, &team->port_list, list) { | ||
2568 | if (port->linkup) { | ||
2569 | team_linkup = true; | ||
2570 | break; | ||
2571 | } | ||
2572 | } | ||
2573 | |||
2574 | if (team_linkup) | ||
2575 | netif_carrier_on(team->dev); | ||
2576 | else | ||
2577 | netif_carrier_off(team->dev); | ||
2578 | } | ||
2579 | |||
2563 | static void __team_port_change_check(struct team_port *port, bool linkup) | 2580 | static void __team_port_change_check(struct team_port *port, bool linkup) |
2564 | { | 2581 | { |
2565 | if (port->state.linkup != linkup) | 2582 | if (port->state.linkup != linkup) |
2566 | __team_port_change_send(port, linkup); | 2583 | __team_port_change_send(port, linkup); |
2584 | __team_carrier_check(port->team); | ||
2567 | } | 2585 | } |
2568 | 2586 | ||
2569 | static void __team_port_change_port_added(struct team_port *port, bool linkup) | 2587 | static void __team_port_change_port_added(struct team_port *port, bool linkup) |
2570 | { | 2588 | { |
2571 | __team_port_change_send(port, linkup); | 2589 | __team_port_change_send(port, linkup); |
2590 | __team_carrier_check(port->team); | ||
2572 | } | 2591 | } |
2573 | 2592 | ||
2574 | static void __team_port_change_port_removed(struct team_port *port) | 2593 | static void __team_port_change_port_removed(struct team_port *port) |
2575 | { | 2594 | { |
2576 | port->removed = true; | 2595 | port->removed = true; |
2577 | __team_port_change_send(port, false); | 2596 | __team_port_change_send(port, false); |
2597 | __team_carrier_check(port->team); | ||
2578 | } | 2598 | } |
2579 | 2599 | ||
2580 | static void team_port_change_check(struct team_port *port, bool linkup) | 2600 | static void team_port_change_check(struct team_port *port, bool linkup) |