Skip to content

net: dsa: qca8k: preserve port state across MTU changes

Yongzhao Chen lkml netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest2 patches 4 repliesIn review
  2. v71 patch 4 repliesSuperseded
  3. v61 patch 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v51 patch1 replySuperseded

Changes in v8 from the cover letter

- 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.

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2net: dsa: qca8k: let regmap serialize register accessdrivers/net/dsa/qca/qca8k-8xxx.c+0 -14 replies
2/2net: dsa: qca8k: preserve port state across MTU changesdrivers/net/dsa/qca/qca8k-8xxx.c drivers/net/dsa/qca/qca8k-common.c drivers/net/dsa/qca/qca8k.h+175 -220 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v8 yet.

Read the v8 thread

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

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/[email protected]/
v6: https://lore.kernel.org/netdev/[email protected]/
v5: https://lore.kernel.org/netdev/[email protected]/

[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/[email protected]/
[4] https://lore.kernel.org/netdev/[email protected]/
[5] https://lore.kernel.org/netdev/[email protected]/

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

Signature · 1 line
2.43.0