* [PATCH] ixgbe: Fix unreachable retry logic in combined and byte I2C write functions
@ 2025-03-06 10:12 Rand Deeb
2025-03-21 4:46 ` [Intel-wired-lan] " Rinitha, SX
0 siblings, 1 reply; 2+ messages in thread
From: Rand Deeb @ 2025-03-06 10:12 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:INTEL ETHERNET DRIVERS,
open list:NETWORKING DRIVERS, open list
Cc: deeb.rand, lvc-project, voskresenski.stanislav, Rand Deeb
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.
Signed-off-by: Rand Deeb <rand.sec96@gmail.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index 0a03a8bb5f88..2d54828bdfbb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -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;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [Intel-wired-lan] [PATCH] ixgbe: Fix unreachable retry logic in combined and byte I2C write functions
2025-03-06 10:12 [PATCH] ixgbe: Fix unreachable retry logic in combined and byte I2C write functions Rand Deeb
@ 2025-03-21 4:46 ` Rinitha, SX
0 siblings, 0 replies; 2+ messages in thread
From: Rinitha, SX @ 2025-03-21 4:46 UTC (permalink / raw)
To: Rand Deeb, Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S. Miller, Dumazet, Eric, Jakub Kicinski, Paolo Abeni,
moderated list:INTEL ETHERNET DRIVERS,
open list:NETWORKING DRIVERS, open list
Cc: deeb.rand@confident.ru, lvc-project@linuxtesting.org,
voskresenski.stanislav@confident.ru
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Rand Deeb
> Sent: 06 March 2025 15:42
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; moderated list:INTEL ETHERNET DRIVERS <intel-wired-lan@lists.osuosl.org>; open list:NETWORKING DRIVERS <netdev@vger.kernel.org>; open list <linux-kernel@vger.kernel.org>
> Cc: deeb.rand@confident.ru; lvc-project@linuxtesting.org; voskresenski.stanislav@confident.ru; Rand Deeb <rand.sec96@gmail.com>
> Subject: [Intel-wired-lan] [PATCH] 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.
>
> Signed-off-by: Rand Deeb <rand.sec96@gmail.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-21 4:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 10:12 [PATCH] ixgbe: Fix unreachable retry logic in combined and byte I2C write functions Rand Deeb
2025-03-21 4:46 ` [Intel-wired-lan] " Rinitha, SX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).