From: Stephen Hemminger <stephen@networkplumber.org>
To: Ajit Kumar <Ajit.Kumar@amd.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH] net/axgbe: serialize PHY and link status access
Date: Sun, 15 Nov 2026 13:23:21 -0800 [thread overview]
Message-ID: <20261115132321.0dc24dfa@phoenix.local> (raw)
In-Reply-To: <20261112135611.2757325-1-Ajit.Kumar@amd.com>
On Thu, 12 Nov 2026 19:26:11 +0530
Ajit Kumar <Ajit.Kumar@amd.com> wrote:
> From: Ajit Kumar <ajit.kumar@amd.com>
>
> Concurrent link status polling and PHY access can result in
> simultaneous I2C/MDIO bus transactions. On systems with multiple
> AXGBE ports this may lead to I2C transfer failures such as
> -EAGAIN, -ENOTCONN, or -ETIMEDOUT and can cause incorrect link
> status reporting.
>
> Serialize access to shared PHY communication resources by
> protecting PHY status updates and introducing a mutex around
> I2C/MDIO ownership acquisition. Also add retry delays for
> recoverable I2C transfer failures.
>
> Signed-off-by: Ajit Kumar <ajit.kumar@amd.com>
> ---
AI found some issues that still need addressing before merge
Subject: Re: [PATCH] net/axgbe: serialize PHY and link status access
The global axgbe_i2c_mdio_bus_mutex is the right fix; it matches
xgbe_phy_comm_lock in the Linux xgbe driver, which DPDK lost when the
global lock became the per-port pdata->phy_mutex. The other two
changes do not belong with it as written.
Warning
1. link_status_mutex does nothing useful.
It is per-port and only taken in axgbe_dev_link_update(). It
cannot serialize bus access between ports (the problem in the
commit message); the new bus mutex already does that inside
axgbe_phy_get_comm_ownership(). It is also not taken by
axgbe_dev_interrupt_handler() -> an_isr, the only other path
touching PHY/AN state. Two concurrent link_update calls on the
same port are control-vs-control, which ethdev does not promise
to make safe. If they can happen, the lock must cover the ISR
too; if not, there is no point in it. Drop the mutex, the struct
member and the init.
2. Retrying -ETIMEDOUT and -ENOTCONN.
axgbe_i2c_xfer() already waits up to 1 s before returning
-ETIMEDOUT. One retry doubles that per phase, and it now happens
with the global bus mutex held, so every other port's
link_update blocks behind it. -ENOTCONN is an address NAK
(IC_TX_ABRT_7B_ADDR_NOACK), meaning nothing answered at that
target, not bus contention.
If the bus mutex fixes the concurrent access, these errors
should not occur any more, and retrying them hides a different
fault. Keep the -EAGAIN (arbitration lost) retry only, or explain
in the commit message what still causes the other two after
serialization.
In the second hunk "ret &&" is redundant, and the closing brace
in the first hunk is indented one level too shallow:
if (ret) {
if (ret == -EAGAIN && retry--) {
rte_delay_ms(AXGBE_I2C_RETRY_DELAY_MS);
goto again1;
}
return ret;
}
...
if (ret == -EAGAIN && retry--) {
rte_delay_ms(AXGBE_I2C_RETRY_DELAY_MS);
goto again2;
}
3. Missing Fixes and stable tags. The per-port lock dates from the
initial PHY code:
Fixes: a5c7273771e8 ("net/axgbe: add phy programming APIs")
Cc: stable@dpdk.org
Info
4. The static mutex only covers ports in one process. When ports of
the same device belong to different DPDK processes, or one port
stays with the kernel xgbe driver, the only arbitration is the
hardware mutex. axgbe_phy_get_comm_ownership() writes
AXGBE_MUTEX_RELEASE to XP_I2C_MUTEX/XP_MDIO_MUTEX unconditionally
before acquiring, which can take ownership away from the other
agent. This bug is older than the patch, but the commit message should
say the fix applies to ports in a single process.
5. Suggested commit message body, once 1 and 2 are addressed:
The I2C and MDIO buses are shared by all ports on the device.
axgbe_phy_get_comm_ownership() takes the per-port phy_mutex,
which does not stop two ports in the same process from using
the bus at once, causing I2C failures and wrong link status.
Add a driver-wide mutex taken before the per-port one, as the
Linux xgbe driver does.
prev parent reply other threads:[~2026-11-15 21:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 13:56 [PATCH] net/axgbe: serialize PHY and link status access Ajit Kumar
2026-11-15 21:23 ` 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=20261115132321.0dc24dfa@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.