Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Jay Vosburgh <fubar@us.ibm.com>
Cc: bonding-devel@lists.sf.net, netdev@vger.kernel.org
Subject: [PATCH] bonding: fix link down handling in 802.3ad mode
Date: Fri, 15 May 2009 11:44:32 -0700	[thread overview]
Message-ID: <20090515114432.4025a2d6@nehalam> (raw)

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>

---	       
This patch is a bug fix and should go into 2.6.30

--- a/drivers/net/bonding/bond_3ad.c	2009-05-14 15:38:15.090363836 -0700
+++ b/drivers/net/bonding/bond_3ad.c	2009-05-15 11:41:44.313559146 -0700
@@ -1465,6 +1465,12 @@ static struct aggregator *ad_agg_selecti
 	return best;
 }
 
+static int agg_device_up(const struct aggregator *agg)
+{
+	return (netif_running(agg->slave->dev) &&
+		netif_carrier_ok(agg->slave->dev));
+}
+
 /**
  * ad_agg_selection_logic - select an aggregation group for a team
  * @aggregator: the aggregator we're looking at
@@ -1496,14 +1502,13 @@ static void ad_agg_selection_logic(struc
 	struct port *port;
 
 	origin = agg;
-
 	active = __get_active_agg(agg);
-	best = active;
+	best = (active && agg_device_up(active)) ? active : NULL;
 
 	do {
 		agg->is_active = 0;
 
-		if (agg->num_of_ports)
+		if (agg->num_of_ports && agg_device_up(agg))
 			best = ad_agg_selection_test(best, agg);
 
 	} while ((agg = __get_next_agg(agg)));

             reply	other threads:[~2009-05-15 18:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-15 18:44 Stephen Hemminger [this message]
2009-05-15 19:35 ` [PATCH] bonding: fix link down handling in 802.3ad mode Jay Vosburgh
2009-05-18  4:16   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090515114432.4025a2d6@nehalam \
    --to=shemminger@vyatta.com \
    --cc=bonding-devel@lists.sf.net \
    --cc=fubar@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox