ixgbe: Fix unreachable retry logic in combined and byte I2C write functions
Subsystems (3)
PATCH 1/1 ixgbe: Fix unreachable retry logic in combined and byte I2C write functions
The current implementation of ixgbe_write_i2c_combined_generic_int and ixgbe_write_i2c_byte_generic_int sets max_retry to 1, which makes the condition retry < max_retry always evaluate to false. This renders the retry mechanism ineffective, as the debug message and retry logic are never executed.
This patch increases max_retry to 3 in both functions, aligning them with the retry logic in ixgbe_read_i2c_combined_generic_int. This ensures that the retry mechanism functions as intended, improving robustness in case of I2C write failures.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +2 -2
@@ -167,7 +167,7 @@ int ixgbe_write_i2c_combined_generic_int(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val, bool lock) { u32 swfw_mask = hw->phy.phy_semaphore_mask; -int max_retry =1 ; +int max_retry =3 ;int retry =0 ;u8 reg_high;u8 csum;
@@ -2285,7 +2285,7 @@ static int ixgbe_write_i2c_byte_generic_int(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr, u8 data, bool lock) { u32 swfw_mask = hw->phy.phy_semaphore_mask; -u32 max_retry =1 ; +u32 max_retry =3 ;u32 retry =0 ;int status;
Signature · 1 line
2.34.1
Quoted 9 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Rand Deeb
Sent: 06 March 2025 15:42
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; moderated list:INTEL ETHERNET DRIVERS <[email protected]>; open list:NETWORKING DRIVERS <[email protected]>; open list <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Rand Deeb <[email protected]>
Subject: [Intel-wired-lan] [PATCH] ixgbe: Fix unreachable retry logic in combined and byte I2C write functionsThe current implementation of
ixgbe_write_i2c_combined_generic_intandixgbe_write_i2c_byte_generic_intsetsmax_retryto1, which makes the conditionretry < max_retryalways evaluate tofalse. This renders the retry mechanism ineffective, as the debug message and retry logic are never executed.
Quoted 9 lines
This patch increases
max_retryto3in both functions, aligning them with the retry logic inixgbe_read_i2c_combined_generic_int. This ensures that the retry mechanism functions as intended, improving robustness in case of I2C write failures.Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by Rand Deeb <[email protected]>---
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)