]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.bak/.git/commitdiff
patch bonding-no-updelay-on-first-active-slave.patch
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 28 May 2009 10:54:19 +0000 (11:54 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 28 May 2009 10:54:19 +0000 (11:54 +0100)
drivers/net/bonding/bond_main.c

index 799aaa169c73216e30f2c4e93adedb7a4d0bf220..39841c3bef943b350cebaca25c30338a8ece1ccf 100644 (file)
@@ -625,6 +625,21 @@ down:
        return 0;
 }
 
+/*
+ * Count the number of slaves with link == BOND_LINK_*
+ */
+static int bond_count_slaves(struct bonding *bond, int link)
+{
+       struct slave *slave;
+       int i, count=0;
+
+       bond_for_each_slave(bond, slave, i) {
+               if (slave->link == link)
+                       count++;
+       }
+       return count;
+}
+
 /*
  * Get link speed and duplex from the slave's base driver
  * using ethtool. If for some reason the call fails or the
@@ -2299,13 +2314,20 @@ static int bond_miimon_inspect(struct bonding *bond)
                case BOND_LINK_DOWN:
                        if (!link_state)
                                continue;
+                               slave->link = BOND_LINK_BACK;
+                               slave->delay = 0;
 
-                       slave->link = BOND_LINK_BACK;
-                       slave->delay = bond->params.updelay;
-
-                       if (slave->delay) {
-                               printk(KERN_INFO DRV_NAME
-                                      ": %s: link status up for "
+                               if (bond_count_slaves(bond, BOND_LINK_UP) == 0) {
+                                       printk(KERN_INFO DRV_NAME
+                                              ": %s: link status up for "
+                                              "interface %s, enabling it "
+                                              "immediately as it is the only slave.\n",
+                                              bond->dev->name,
+                                              slave->dev->name);
+                               } else if (bond->params.updelay) {
+                                       slave->delay = bond->params.updelay;
+                                       printk(KERN_INFO DRV_NAME
+                                              ": %s: link status up for "
                                       "interface %s, enabling it in %d ms.\n",
                                       bond->dev->name, slave->dev->name,
                                       bond->params.updelay *