aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_3ad.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-05-15 04:44:32 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-18 00:15:54 -0400
commit4cd6fe1c6483cde93e2ec91f58b7af9c9eea51ad (patch)
treec50f35af42e89e72a3c37847dffe3b25d3fdc60c /drivers/net/bonding/bond_3ad.c
parentffc7a8649426f666818b63915b0f43fdf1757242 (diff)
bonding: fix link down handling in 802.3ad mode
One of the purposes of bonding is to allow for redundant links, and failover correctly if the cable is pulled. If all the members of a bonded device have no carrier present, the bonded device itself needs to report no carrier present to user space so management tools (like routing daemons) can respond. Bonding in 802.3ad mode does not work correctly for this because it incorrectly chooses a link that is down as a possible aggregator. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_3ad.c')
-rw-r--r--drivers/net/bonding/bond_3ad.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 8c2e5ab51f08..faf094abef7f 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1465,6 +1465,12 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,
1465 return best; 1465 return best;
1466} 1466}
1467 1467
1468static int agg_device_up(const struct aggregator *agg)
1469{
1470 return (netif_running(agg->slave->dev) &&
1471 netif_carrier_ok(agg->slave->dev));
1472}
1473
1468/** 1474/**
1469 * ad_agg_selection_logic - select an aggregation group for a team 1475 * ad_agg_selection_logic - select an aggregation group for a team
1470 * @aggregator: the aggregator we're looking at 1476 * @aggregator: the aggregator we're looking at
@@ -1496,14 +1502,13 @@ static void ad_agg_selection_logic(struct aggregator *agg)
1496 struct port *port; 1502 struct port *port;
1497 1503
1498 origin = agg; 1504 origin = agg;
1499
1500 active = __get_active_agg(agg); 1505 active = __get_active_agg(agg);
1501 best = active; 1506 best = (active && agg_device_up(active)) ? active : NULL;
1502 1507
1503 do { 1508 do {
1504 agg->is_active = 0; 1509 agg->is_active = 0;
1505 1510
1506 if (agg->num_of_ports) 1511 if (agg->num_of_ports && agg_device_up(agg))
1507 best = ad_agg_selection_test(best, agg); 1512 best = ad_agg_selection_test(best, agg);
1508 1513
1509 } while ((agg = __get_next_agg(agg))); 1514 } while ((agg = __get_next_agg(agg)));