igb: Add counter to i21x doublecheck
Subsystems (2)
PATCH 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
--- drivers/net/ethernet/intel/igb/e1000_mac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/e1000_mac.c +8 -2
@@ -492,6 +492,8 @@ static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)**/ static void igb_i21x_hw_doublecheck (struct e1000_hw *hw) { +const unsigned int failed_cnt_max =3 ; +unsigned int failed_cnt =0 ;bool is_failed;int i;
@@ -502,10 +504,14 @@ 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 ; } } - }while (is_failed); +if (is_failed) + ++failed_cnt; + }while (is_failed && failed_cnt < failed_cnt_max); + +if (failed_cnt >= failed_cnt_max) +hw_dbg ("Failed to update MTA_REGISTER, too many retries" ); }/**
Signature · 1 line
1.8.3.1
Wang
PATCH 1/1 igb: Add counter to i21x doublecheck
Quoted 36 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Grzegorz Siwik
Sent: Thursday, April 29, 2021 21:29
To: intel-wired-lan at lists.osuosl.org
Cc: Siwik, Grzegorz <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v1] igb: Add counter to i21x doublecheckAdd
failed_countertoi21x_doublecheck(). There is possibility that loop will never end.
With this patch the loop will stop after maximum 3 retries to write toMTA_REGISTERSigned-off-by Grzegorz Siwik <[email protected]>--- drivers/net/ethernet/intel/igb/e1000_mac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/igb/e1000_mac.c +2
-1@@ -492,6 +492,8 @@ static u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)**/ static void igb_i21x_hw_doublecheck (struct e1000_hw *hw) { +const unsigned int failed_cnt_max =3 ; +unsigned int failed_cnt =0 ;bool is_failed;int i;@@ -502,10 +504,14 @@ 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 ; }
drivers/net/ethernet/intel/igb/e1000_mac.c static void igb_i21x_hw_doublecheck(struct e1000_hw *hw) · line 516
Quoted 10 lines
drivers/net/ethernet/intel/igb/e1000_mac.c +6
-1} - }while (is_failed); +if (is_failed) + ++failed_cnt; + }while (is_failed && failed_cnt < failed_cnt_max); + +if (failed_cnt >= failed_cnt_max) +hw_dbg ("Failed to update MTA_REGISTER, too many retries" ); }
May be simple as : - )
int count = 3;
if (is_failed && --count == 0) {
hw_dbg("Failed to update MTA_REGISTER, too many retries");
break;
}
} while (is_failed);Quoted 8 lines
drivers/net/ethernet/intel/igb/e1000_mac.c +0
-1/** -- 1.8.3.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan