Skip to contentSkip to conversation

igb: Add counter to i21x doublecheck

PATCH New Grzegorz Siwik 2 participants 2 messages Apr 30, 2021 – Jun 25, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 igb: Add counter to i21x doublecheck

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

---
v2: Changed retries counting method
Moved hw_dbg info

---
 drivers/net/ethernet/intel/igb/e1000_mac.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/e1000_mac.c +5 -1
index e63ee3c..1277c5c 100644
@@ -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);
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/1 igb: Add counter to i21x doublecheck

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Siwik
Sent: Friday, April 30, 2021 5:42 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Siwik, Grzegorz <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2] igb: Add counter to i21x doublecheck

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

Quoted 7 lines

---
v2: Changed retries counting method Moved hw_dbg info

---
 drivers/net/ethernet/intel/igb/e1000_mac.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)