[PATCH net-next v8 0/2] net: dsa: qca8k: preserve port state across MTU changes

From: Yongzhao Chen

Date: Wed Nov 04 2026 - 07:05:16 EST


The qca8k MTU callback pauses the CPU MACs on ports 0 and 6, writes
MAX_FRAME_SIZE and then enables both MACs unconditionally. That can undo
a phylink link-down decision, and phylink callbacks, which run without
RTNL, can enable a MAC during the update. Patch 2 saves and restores the
port state under a new lock that all PORT_STATUS writers take.

Sashiko's review of v7 [1] showed that readers that do not take that
lock, such as the PCS poll, can still corrupt the saved state: the qca8k
regmap is created with disable_locking, so concurrent accesses share
regmap's work_buf. Patch 1, from Stanislaw Pal, lets regmap take its own
lock. Stanislaw posted it to net [2] and offered that I carry it here
[3].

As Andrew asked [4], the series targets net-next: the problem was found
by review and has not been seen in production. Both patches keep their
Fixes tags.

LLM coding assistants helped write both patches. Stanislaw, checkpatch
on net-next reports the Assisted-by trailer as non-standard, so I
dropped it from patch 1 and mention the assistance here instead; nothing
else in your patch changed.

Testing: the affected arm64 objects build with W=1, with CONFIG_PM_SLEEP
enabled and disabled. A local KUnit test on UML, not part of this
series, runs the driver's regmap config, register, PCS and phylink
callbacks, MTU and suspend code against the real regmap core, with a
register-file MDIO bus. It forces the work_buf value interleaving from
[1] on that bus. It also covers both CPU MACs running, port 6 down or
disabled, failed pause and restore writes, the second CPU callback after
a commit, retries and a newer link-down decision. All cases pass, and
PROVE_LOCKING reports nothing on the exercised paths. Without patch 1,
the two interleaving cases fail: MAX_FRAME_SIZE is written with the port
0 MAC enabled, and a PCS poll of port 6 reports port 0's link. Not
tested on hardware or over the Ethernet management path.

Changes in v8:
- Target net-next [4].
- Add patch 1 from Stanislaw [2], which v7 was missing [1].
- Rebase on net-next. qca8k_port_set_status() needed manual resolution
against regmap_assign_bits(); the MTU and PORT_STATUS code is the same
as v7.
- Say in patch 2's commit message how the problem was found [5].
- Drop the Assisted-by trailers from both patches and describe the LLM
assistance in this letter instead.

v7: https://lore.kernel.org/netdev/20261022155837.760-1-yongzhao.derek@xxxxxxxxx/
v6: https://lore.kernel.org/netdev/20261019173716.198475-1-yongzhao.derek@xxxxxxxxx/
v5: https://lore.kernel.org/netdev/20261015104550.43169-1-yongzhao.derek@xxxxxxxxx/

[1] https://lore.kernel.org/netdev/179303171241.3134.15019965307136674652@xxxxxxxxxx/
[2] https://lore.kernel.org/netdev/20261022192933.384898-2-kuncy7@xxxxxxxxx/
[3] https://lore.kernel.org/netdev/20261028145622.195730-1-kuncy7@xxxxxxxxx/
[4] https://lore.kernel.org/netdev/47e9713f-815e-4caf-8928-a7ec12d0087b@xxxxxxx/
[5] https://lore.kernel.org/netdev/179268501671.3290.6623232109527554630@xxxxxxxxxx/

Stanislaw Pal (1):
net: dsa: qca8k: let regmap serialize register access

Yongzhao Chen (1):
net: dsa: qca8k: preserve port state across MTU changes

drivers/net/dsa/qca/qca8k-8xxx.c | 34 ++++++-
drivers/net/dsa/qca/qca8k-common.c | 149 +++++++++++++++++++++++++----
drivers/net/dsa/qca/qca8k.h | 15 +++
3 files changed, 175 insertions(+), 23 deletions(-)


base-commit: 7b6ab4dbc156e2f96419715130b3d5738a306c93
--
2.43.0