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] [PATCH v3] net/axgbe: wait for SFP cage I2C readiness on first probe
Date: Mon, 23 Nov 2026 10:43:27 -0800	[thread overview]
Message-ID: <20261123104327.4e45da0d@phoenix.local> (raw)
In-Reply-To: <20261123115224.2199549-1-Ajit.Kumar@amd.com>

On Mon, 23 Nov 2026 17:22:24 +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 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.

Yes, dealing with real hardware is hard, and seems reasonable.

AI review said:

Subject: Re: [PATCH v3] net/axgbe: wait for SFP cage I2C readiness on first probe

Applies on top of the bus mutex patch and builds clean. A delay
before the first probe is the right shape, and it fixes both v2
problems. But nothing says what the delay waits for, and nothing
shows that 2ms is enough.

Warning

The delay is not tied to any hardware event. axgbe_i2c_start() only
sets pdata->i2c.started, and the controller is enabled separately for
each transfer in axgbe_i2c_xfer(). So "after starting the I2C
controller" there is nothing new to settle. Before the delay,
axgbe_phy_set_mode() has already run the redriver programming (I2C or
MDIO) and a firmware rate change mailbox command that it waits on.
Whatever the expander is waiting for, it is not i2c_start().

Please say what the cage is waiting for: power or reset release
after phy_stop(), the mux left on a channel, or firmware still using
the bus after the rate change. Then wait for that condition instead
of a fixed delay. If a fixed delay really is the only option, say
where 2ms comes from, such as a datasheet value or measured margin.

v3 has no test result. The v2 validation was for a different change.
Please report results for this exact patch on the CRB and FWA-1081,
including whether the -ETIMEDOUT case (a full 1s stall) goes away
with a 2ms pre-delay. That would be surprising and needs data.

Info

The second paragraph of the commit message is v2 history; move it
below "---". The commit message should describe this change only.

The subject has "[PATCH] [PATCH v3]"; use --subject-prefix="PATCH v3"
or -v3 only.

The new comment can be one line once the cause is known, for example:

	/* SFP GPIO expander needs <N>us after <event> */


      reply	other threads:[~2026-11-23 18:43 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   ` [PATCH] [PATCH v3] net/axgbe: wait for SFP cage I2C readiness on first probe Ajit Kumar
2026-11-23 18:43     ` Stephen Hemminger [this message]

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=20261123104327.4e45da0d@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