]> www.infradead.org Git - nvme.git/commitdiff
igb: Add counter to i21x doublecheck
authorGrzegorz Siwik <grzegorz.siwik@intel.com>
Fri, 30 Apr 2021 12:41:30 +0000 (14:41 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 23 Jul 2021 16:08:11 +0000 (09:08 -0700)
Add failed_counter to i21x_doublecheck(). There is possibility that
loop will never end.
With this patch the loop will stop after maximum 3 retries
to write to MTA_REGISTER

Signed-off-by: Grzegorz Siwik <grzegorz.siwik@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/igb/e1000_mac.c

index e63ee3cca5ea3aa0c038b7821d4116670f3f761f..1277c5c7d0996a22df812c8d2f519cfbe3f76ec3 100644 (file)
@@ -492,6 +492,7 @@ static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
  **/
 static void igb_i21x_hw_doublecheck(struct e1000_hw *hw)
 {
+       int failed_cnt = 3;
        bool is_failed;
        int i;
 
@@ -502,9 +503,12 @@ static void igb_i21x_hw_doublecheck(struct e1000_hw *hw)
                                is_failed = true;
                                array_wr32(E1000_MTA, i, hw->mac.mta_shadow[i]);
                                wrfl();
-                               break;
                        }
                }
+               if (is_failed && --failed_cnt <= 0) {
+                       hw_dbg("Failed to update MTA_REGISTER, too many retries");
+                       break;
+               }
        } while (is_failed);
 }