From: Ajit Kumar <Ajit.Kumar@amd.com>
To: <dev@dpdk.org>
Cc: <stephen@networkplumber.org>
Subject: [PATCH] [PATCH v3] net/axgbe: wait for SFP cage I2C readiness on first probe
Date: Mon, 23 Nov 2026 17:22:24 +0530 [thread overview]
Message-ID: <20261123115224.2199549-1-Ajit.Kumar@amd.com> (raw)
In-Reply-To: <20261119173506.840405-1-Ajit.Kumar@amd.com>
From: Ajit Kumar <ajit.kumar@amd.com>
A port's first I2C access to its SFP cage after axgbe_phy_start() can
fail with a quick NACK (-ENOTCONN) or a stall until the 1-second I2C
timeout (-ETIMEDOUT). This is distinct from the cross-port race fixed
by the driver-wide I2C/MDIO bus mutex: it reproduces on a single port
with no sibling active, right after that port's own phy_start().
v2 retried these codes inside axgbe_phy_i2c_read(), gated by a flag
set on first success. Two problems: the flag lives in phy_data,
allocated once at probe and never cleared across phy_start()/
phy_stop(), so it doesn't track the access it's meant to gate; and a
device that never responds never sets it, so a persistent fault pays
the extra retry on every later link_update() poll, unbounded. The
retry also ran while holding the bus mutex, blocking other ports for
its duration, the concern raised against the original combined patch.
Drop the retry and the flag. Instead, wait briefly in
axgbe_phy_start() before the first SFP probe, before the bus mutex is
even taken. Fixed, known cost per phy_start(), no state to go stale,
nothing held while waiting. axgbe_phy_i2c_read() reverts to its
original -EAGAIN-only retry, unchanged.
Fixes: a5c7273771e8 ("net/axgbe: add phy programming APIs")
Cc: stable@dpdk.org
Signed-off-by: Ajit Kumar <ajit.kumar@amd.com>
---
Depends on the driver-wide I2C/MDIO bus mutex from "net/axgbe:
serialize PHY and link status access" for the cross-port case;
applies independently otherwise.
v3: dropped the retry/flag design, replaced with a settle delay before
the first SFP probe in axgbe_phy_start(), outside the bus mutex.
axgbe_phy_i2c_read() is unchanged from upstream.
v2: gated the extended retry with a per-port settled flag (bounded to
first access, per CI bot); switched to a real sleep; shortened the
comment.
---
drivers/net/axgbe/axgbe_phy_impl.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c
index 55d45bfb7b..83e6a16753 100644
--- a/drivers/net/axgbe/axgbe_phy_impl.c
+++ b/drivers/net/axgbe/axgbe_phy_impl.c
@@ -2520,6 +2520,8 @@ static void axgbe_phy_stop(struct axgbe_port *pdata)
pdata->i2c_if.i2c_stop(pdata);
}
+#define AXGBE_SFP_I2C_SETTLE_DELAY_US 2000
+
static int axgbe_phy_start(struct axgbe_port *pdata)
{
struct axgbe_phy_data *phy_data = pdata->phy_data;
@@ -2536,9 +2538,16 @@ static int axgbe_phy_start(struct axgbe_port *pdata)
/* Reset CDR support */
axgbe_phy_cdr_track(pdata);
- /* After starting the I2C controller, we can check for an SFP */
+ /*
+ * After starting the I2C controller, we can check for an SFP. The
+ * cage's GPIO expander/mux may not yet be ready to respond to the
+ * very first access, so give it a short settle delay before the
+ * first probe instead of failing and leaving recovery to a later
+ * poll.
+ */
switch (phy_data->port_mode) {
case AXGBE_PORT_MODE_SFP:
+ rte_delay_us_sleep(AXGBE_SFP_I2C_SETTLE_DELAY_US);
axgbe_phy_sfp_detect(pdata);
break;
default:
--
2.43.0
next prev parent reply other threads:[~2026-11-23 12:57 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
2026-11-23 11:52 ` Ajit Kumar [this message]
2026-11-23 18:43 ` [PATCH] [PATCH v3] net/axgbe: wait for SFP cage I2C readiness on first probe 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=20261123115224.2199549-1-Ajit.Kumar@amd.com \
--to=ajit.kumar@amd.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.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