]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/bonding/bond_main.c
bonding: use ethtool for link checking first
[net-next-2.6.git] / drivers / net / bonding / bond_main.c
index 63369b6b14d4f17ef7b756d81ebf89db3d73e896..e4166ee9091da369cd545f8950dbff07b1172200 100644 (file)
@@ -695,6 +695,18 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de
        if (bond->params.use_carrier)
                return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0;
 
+       /* Try to get link status using Ethtool first. */
+       if (slave_dev->ethtool_ops) {
+               if (slave_dev->ethtool_ops->get_link) {
+                       u32 link;
+
+                       link = slave_dev->ethtool_ops->get_link(slave_dev);
+
+                       return link ? BMSR_LSTATUS : 0;
+               }
+       }
+
+       /* Ethtool can't be used, fallback to MII ioclts. */
        ioctl = slave_ops->ndo_do_ioctl;
        if (ioctl) {
                /* TODO: set pointer to correct ioctl on a per team member */
@@ -720,20 +732,6 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de
                }
        }
 
-       /*
-        * Some drivers cache ETHTOOL_GLINK for a period of time so we only
-        * attempt to get link status from it if the above MII ioctls fail.
-        */
-       if (slave_dev->ethtool_ops) {
-               if (slave_dev->ethtool_ops->get_link) {
-                       u32 link;
-
-                       link = slave_dev->ethtool_ops->get_link(slave_dev);
-
-                       return link ? BMSR_LSTATUS : 0;
-               }
-       }
-
        /*
         * If reporting, report that either there's no dev->do_ioctl,
         * or both SIOCGMIIREG and get_link failed (meaning that we