DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ajit Kumar <Ajit.Kumar@amd.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH v2] net/axgbe: retry transient SFP I2C read failures
Date: Sun, 22 Nov 2026 09:30:50 -0800	[thread overview]
Message-ID: <20261122093050.2936faed@phoenix.local> (raw)
In-Reply-To: <20261119173506.840405-1-Ajit.Kumar@amd.com>

On Thu, 19 Nov 2026 23:05:06 +0530
Ajit Kumar <Ajit.Kumar@amd.com> wrote:

> From: Ajit Kumar <ajit.kumar@amd.com>
> 
> A port's first I2C access to its SFP cage can fail right after
> axgbe_phy_init(), even alone on the bus: a quick NACK (-ENOTCONN) or
> a full stall until axgbe_i2c_xfer()'s own 1s timeout (-ETIMEDOUT).
> This is separate from the cross-port race fixed by
> axgbe_i2c_mdio_bus_mutex; it shows up on a single port with no
> sibling active, so serializing the bus doesn't help.
> 
> axgbe_phy_i2c_read() only retried -EAGAIN. Retry -ENOTCONN and
> -ETIMEDOUT too, with a short settle delay, but only until the port's
> bus has one successful transfer since phy_init(). After that, a
> repeat is a real fault, not a settling device, and shouldn't cost
> every later poll an extra second while holding the shared mutex.
> 
> Validated on AMD CRB V3C48 and Advantech FWA-1081: 0 I2C errors
> across 30 iterations of the cross-port repro plus a solo-access
> repro that now links up cleanly on both; both failed every time
> without this change.
> 
> Depends on axgbe_i2c_mdio_bus_mutex from "net/axgbe: serialize PHY
> and link status access" for the cross-port case; otherwise applies
> independently.
> 
> Fixes: a5c7273771e8 ("net/axgbe: add phy programming APIs")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ajit Kumar <ajit.kumar@amd.com>

I haven't looked into all the complexities here, but AI warnings
seem valid:

Subject: Re: [PATCH v2] net/axgbe: retry transient SFP I2C read failures

Applies on top of the bus mutex patch and builds clean with
-Dwerror=true. Two problems with how the retry window is gated.

Warning

1. The settled flag follows the wrong lifecycle.

phy_data is allocated once by axgbe_phy_init() at probe
(axgbe_ethdev.c:2410) and sfp_i2c_settled is never cleared. The
first I2C access is not after phy_init(); it is in axgbe_phy_start(),
right after i2c_start(), via axgbe_phy_sfp_detect(). That runs on
every dev_start. After a stop/start or port reset the flag is
already 1, so the case this patch targets gets no retry.

The comment and commit message should also say phy_start, not
phy_init.

2. A fault present from the start is still retried on every poll.

The v2 changelog says a persistent fault no longer pays the retry
cost. That is only true if some transfer has succeeded. If the GPIO
expander never answers, axgbe_phy_sfp_signals() fails on every link
poll (axgbe_phy_link_status -> axgbe_phy_sfp_detect), the flag is
never set, and each poll can spend about 2s per transfer in two
1s axgbe_i2c_xfer() timeouts while holding the driver-wide bus
mutex. That stalls link_update on every port.

Gate the window by when the access happens, not by success. Both
issues go away if the extended retry only applies during the
phy_start probe:

	case AXGBE_PORT_MODE_SFP:
		phy_data->sfp_i2c_probe = 1;
		axgbe_phy_sfp_detect(pdata);
		phy_data->sfp_i2c_probe = 0;
		break;

and in axgbe_phy_i2c_read() test sfp_i2c_probe instead of
!sfp_i2c_settled, dropping the assignment after the read.

Info

What is the root cause? Linux xgbe does the same sequence with an
-EAGAIN-only retry. If the expander needs time after the I2C
controller is enabled, one delay in axgbe_phy_start() before
sfp_detect would be simpler than per-transfer retries. Also, after a
device has already stalled for the full 1s, does a 2ms sleep and a
second try ever succeed in your testing, or was only -ENOTCONN seen
to recover?

The "Depends on" paragraph belongs below "---", and the commit
message should not name axgbe_i2c_mdio_bus_mutex, since that symbol
may be renamed.

  reply	other threads:[~2026-11-22 17:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  3:51 [PATCH] net/axgbe: retry transient SFP I2C read failures Ajit Kumar
2026-11-19 16:36 ` Stephen Hemminger
2026-11-19 17:35 ` [PATCH v2] " Ajit Kumar
2026-11-22 17:30   ` Stephen Hemminger [this message]
2026-11-23 11:52   ` [PATCH] [PATCH v3] net/axgbe: wait for SFP cage I2C readiness on first probe Ajit Kumar
2026-11-23 18:43     ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261122093050.2936faed@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=Ajit.Kumar@amd.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox