igb: add code to retry a phy read in the event of failure on link check
authorAlexander Duyck <alexander.h.duyck@intel.com>
Mon, 5 Oct 2009 06:35:23 +0000 (06:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 6 Oct 2009 21:59:23 +0000 (14:59 -0700)
This patch adds a retry to phy reads in the event of failure.  The original
code broke out of the loop on failure and this is a mistake as we should be
trying to do the read twice.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/igb/e1000_phy.c

index b27275d7ff6d787b8a37bfea344a6cff0dd12bdc..5fe03e114b83a6240d0e0c11ae985365f7004c7f 100644 (file)
@@ -1444,8 +1444,14 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations,
                 * it across the board.
                 */
                ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
-               if (ret_val)
-                       break;
+               if (ret_val) {
+                       /*
+                        * If the first read fails, another entity may have
+                        * ownership of the resources, wait and try again to
+                        * see if they have relinquished the resources yet.
+                        */
+                       udelay(usec_interval);
+               }
                ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
                if (ret_val)
                        break;