]> xenbits.xen.org Git - xenclient/kernel.git/commitdiff
imported patch bonding-no-updelay-on-first-active-slave.patch bonding-balance-slb-fixes3.patch
authort_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:06:05 +0000 (12:06 +0000)
committert_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:06:05 +0000 (12:06 +0000)
drivers/net/bonding/bond_main.c

index 7f0bde1a8c8a4de782b5c6e5fe3d1b2211dad4f5..aa329c0e373e03b1fdfa9c4380a3939ecc86c6b9 100644 (file)
@@ -609,6 +609,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
@@ -2182,11 +2197,17 @@ void bond_mii_monitor(struct net_device *bond_dev)
                                break;
                        } else {        /* link going up */
                                slave->link  = BOND_LINK_BACK;
-                               slave->delay = bond->params.updelay;
+                               slave->delay = 0;
 
-                               if (bond->params.updelay) {
-                                       /* if updelay == 0, no need to
-                                          advertise about a 0 ms delay */
+                               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 "