Repository navigation
ramips: mt7620: reset network blocks on restart - #24724
dormancygrace wants to merge 1 commit into
Conversation
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 1 new commit. The patch applies cleanly against the v6.18 arch/mips/ralink/reset.c (hunk header @@ -18,18 +18,27 @@ and the diffstat both check out), ralink_soc / MT762X_SOC_MT7620A / MT762X_SOC_MT7620N are already reachable via the existing asm/mach-ralink/ralink_regs.h include, and the FE (bit 21) / ESW (bit 23) bit assignments match resets = <&sysc 21>, <&sysc 23> in target/linux/ramips/dts/mt7620a.dtsi. Commit message matches the diff. Two nits inline.
Generated by Claude Code
4ad5ccb to
637056a
Compare
Add a DSA driver for the seven-port switch integrated in MT7620. Keep the existing swconfig path for device trees without a DSA ports node. Use RXD4 source-port and TXD4 forced-port metadata with the Ralink DSA tagger. The programming guide places TXD4 FP_BMAP at bits 27:20; use that layout instead of the stale unused bits 26:19 definition. Implement bridge isolation and STP, VLAN filtering, FDB and MDB offload, ageing, flood controls, phylink, MTU limits, and software-extended hardware MIB counters. DSA invokes port_stp_state_set() before updating its cached state, so pass the pending callback state as an override when recalculating port matrices instead of leaving hardware one transition behind. Correct the shared switch MIB enable register and enable all seven port counters. The old address was inside port 0 counter space, so this also fixes legacy swconfig initialization. Register DSA through a bound child of the frame-engine device. This gives the managed conduit device link the correct lifetime across driver unbind and reprobe while the switch registers remain owned by the existing GSW platform device. Package the driver and tagger as kmod-dsa-mt7620 for per-device opt-in. This keeps DSA and switchdev out of swconfig-only MT7620 images and prevents installing the DSA package together with swconfig. Also make MDIO and frame-engine teardown safe for deferred probes and runtime reprobes. Replace the legacy MDIO busy loop and -1 return with readl_poll_timeout_atomic() and its real error, and reset a still-busy frame engine before freeing DMA rings. Resolve FE and ESW resets by name so recovery can reset FE alone, and warn if a switch node provides neither named reset. The FE-only reset is a stop-path fallback when DMA fails to quiesce before its rings are freed. It does not recover network blocks left stale across a system restart; that separate condition is handled by the reset change linked below. The netdev is devm-managed, so leave NAPI deletion to free_netdev after unregister instead of deleting NAPI from fe_remove while the netdev is still registered. Tested on an MT7620N rev 2 eco 6 with 100BASE-T traffic, VLAN-aware hardware bridging, 2026-byte MTU, FDB/MDB offload, pending STP state, and driver unbind/rebind. The modular driver, tagger, package contents, DSA image composition, and swconfig-only kernel configuration were also verified. An independent TP-Link Archer C5 v4 test found no regression with an external RTL8367S DSA switch using the RTL8_4t tagger. Warm-reboot recovery was tested with the separate reset change applied and is not claimed by this DSA commit alone. Link: https://lists.infradead.org/pipermail/openwrt-devel/2021-December/037379.html Link: openwrt#23933 Link: openwrt#24242 Link: openwrt#24724 Signed-off-by: Gleb Pesin <[email protected]>
|
Addressed the Formality suggestion. The embedded reset patch now has a complete |
637056a to
04d4145
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed the changes since 4ad5ccb. The code payload is unchanged; the delta is the From <sha> header line and a new commit-message paragraph.
The new paragraph resolves the earlier MT7628/MT7688 scoping question well. The header-line change went the wrong direction though — see inline. Commit message still matches the diff, the hunk header (@@ -18,18 +18,27 @@) and diffstat (10 insertions, 1 deletion) both still check out against v6.18.44 arch/mips/ralink/reset.c, and CI is green on 04d4145.
Generated by Claude Code
Add a DSA driver for the seven-port switch integrated in MT7620. Keep the existing swconfig path for device trees without a DSA ports node. Use RXD4 source-port and TXD4 forced-port metadata with the Ralink DSA tagger. The programming guide places TXD4 FP_BMAP at bits 27:20; use that layout instead of the stale unused bits 26:19 definition. Implement bridge isolation and STP, VLAN filtering, FDB and MDB offload, ageing, flood controls, phylink, MTU limits, and software-extended hardware MIB counters. DSA invokes port_stp_state_set() before updating its cached state, so pass the pending callback state as an override when recalculating port matrices instead of leaving hardware one transition behind. Correct the shared switch MIB enable register and enable all seven port counters. The old address was inside port 0 counter space, so this also fixes legacy swconfig initialization. Register DSA through a bound child of the frame-engine device. This gives the managed conduit device link the correct lifetime across driver unbind and reprobe while the switch registers remain owned by the existing GSW platform device. Package the driver and tagger as kmod-dsa-mt7620 for per-device opt-in. This keeps DSA and switchdev out of swconfig-only MT7620 images and prevents installing the DSA package together with swconfig. Also make MDIO and frame-engine teardown safe for deferred probes and runtime reprobes. Replace the legacy MDIO busy loop and -1 return with readl_poll_timeout_atomic() and its real error, and reset a still-busy frame engine before freeing DMA rings. Resolve FE and ESW resets by name so recovery can reset FE alone, and warn if a switch node provides neither named reset. The FE-only reset is a stop-path fallback when DMA fails to quiesce before its rings are freed. It does not recover network blocks left stale across a system restart; that separate condition is handled by the reset change linked below. The netdev is devm-managed, so leave NAPI deletion to free_netdev after unregister instead of deleting NAPI from fe_remove while the netdev is still registered. Tested on an MT7620N rev 2 eco 6 with 100BASE-T traffic, VLAN-aware hardware bridging, 2026-byte MTU, FDB/MDB offload, pending STP state, and driver unbind/rebind. The modular driver, tagger, package contents, DSA image composition, and swconfig-only kernel configuration were also verified. An independent TP-Link Archer C5 v4 test exercised an external RTL8367S DSA switch using the RTL8_4t tagger as a regression check on the shared dsa_tag_protocol enum. It found no collision or external-switch regression; it does not validate the MT7620 integrated-switch path. Warm-reboot recovery was tested with the separate reset change from openwrt#24724 applied and is not claimed by this DSA commit. Link: openwrt#24242 Link: openwrt#24724 Signed-off-by: Gleb Pesin <[email protected]>
04d4145 to
912dd4a
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 1 new commit; no new issues found.
The delta since 04d4145 is exactly the two points raised last round: the nonexistent From 88d7abfc... Mon Sep 17 00:00:00 2001 envelope line is gone, and the MT7628/MT7688 paragraph now uses the same two-space sentence separation as the rest of the description. The code payload is unchanged.
Re-verified against head:
- The patch applies cleanly to
arch/mips/ralink/reset.cin v6.18.44 (patch -p1 --dry-run, no fuzz), and the inner diffstat (1 file changed, 10 insertions(+), 1 deletion(-)) matches the hunk. ralink_soc,MT762X_SOC_MT7620AandMT762X_SOC_MT7620Nare all reachable through the existingasm/mach-ralink/ralink_regs.hinclude (ralink_regs.h:24-30).ramipsonly carriespatches-6.18andKERNEL_PATCHVER:=6.18, so there is no second patch series needing the same change.- Commit message matches the diff.
- CI is green on
912dd4a(all five ramips subtarget kernel builds plusCheck Kernel patchessucceeded).
One heads-up so it doesn't cause a second round-trip: the FormalityCheck bot now warns that the patch is "Missing required Git header parameters (From <hash> Mon Sep 17 00:00:00 2001 ...)". The check itself still reports success, and the current form matches how locally-authored patches in this directory are written — 120-1-mips-pci-mt7620-fix-bridge-register-access.patch, 330-mt7620-avoid-direct-jal-in-random-helper.patch, 331-..., 332-..., 808-..., 809-... all start straight at From: (21 of the 46 patches in patches-6.18 omit that line). Re-adding a fabricated SHA to silence the warning would be worse than the warning; leaving it as-is looks right to me, but the maintainer may want to weigh in.
Generated by Claude Code
Add a DSA driver for the seven-port switch integrated in MT7620. Keep the existing swconfig path for device trees without a DSA ports node. Use RXD4 source-port and TXD4 forced-port metadata with the Ralink DSA tagger. The programming guide places TXD4 FP_BMAP at bits 27:20; use that layout instead of the stale unused bits 26:19 definition. Implement bridge isolation and STP, VLAN filtering, FDB and MDB offload, ageing, flood controls, phylink, MTU limits, and software-extended hardware MIB counters. DSA invokes port_stp_state_set() before updating its cached state, so pass the pending callback state as an override when recalculating port matrices instead of leaving hardware one transition behind. Correct the shared switch MIB enable register and enable all seven port counters. The old address was inside port 0 counter space, so this also fixes legacy swconfig initialization. Register DSA through a bound child of the frame-engine device. This gives the managed conduit device link the correct lifetime across driver unbind and reprobe while the switch registers remain owned by the existing GSW platform device. Package the driver and tagger as kmod-dsa-mt7620 for per-device opt-in. This keeps DSA and switchdev out of swconfig-only MT7620 images and prevents installing the DSA package together with swconfig. Also make MDIO and frame-engine teardown safe for deferred probes and runtime reprobes. Replace the legacy MDIO busy loop and -1 return with readl_poll_timeout_atomic() and its real error, and reset a still-busy frame engine before freeing DMA rings. Resolve FE and ESW resets by name so recovery can reset FE alone, and warn if a switch node provides neither named reset. The FE-only reset is a stop-path fallback when DMA fails to quiesce before its rings are freed. It does not recover network blocks left stale across a system restart; that separate condition is handled by the reset change linked below. The netdev is devm-managed, so leave NAPI deletion to free_netdev after unregister instead of deleting NAPI from fe_remove while the netdev is still registered. Tested on an MT7620N rev 2 eco 6 with 100BASE-T traffic, VLAN-aware hardware bridging, 2026-byte MTU, FDB/MDB offload, pending STP state, and driver unbind/rebind. The modular driver, tagger, package contents, DSA image composition, and swconfig-only kernel configuration were also verified. An independent TP-Link Archer C5 v4 test exercised an external RTL8367S DSA switch using the RTL8_4t tagger as a regression check on the shared dsa_tag_protocol enum. It found no collision or external-switch regression; it does not validate the MT7620 integrated-switch path. Warm-reboot recovery was tested with the separate reset change from openwrt#24724 applied and is not claimed by this DSA commit. Link: openwrt#24242 Link: openwrt#24724 Signed-off-by: Gleb Pesin <[email protected]>
912dd4a to
d59268b
Compare
d59268b to
16eb3f6
Compare
A system-only warm reset can leave the frame-engine PDMA unable to consume its first TX descriptor on the next boot. The failure survives driver reprobes and individual FE, ESW and PPE reset attempts. Reset FE, ESW and PPE together with the system on MT7620. This matches the combined reset that recovered the hardware during live diagnosis and passed repeated ordinary warm reboots. MT7628 and MT7688 expose matching FE and ESW reset bits, but the failure and required reset mask have not been verified there, and those SoCs do not expose the MT7620 PPE reset block. Keep the workaround scoped to tested MT7620 hardware. Signed-off-by: Gleb Pesin <[email protected]> Assisted-by: Codex:gpt-6.1-sol
16eb3f6 to
37d406c
Compare
config.lte3301 adds lldpd to the LTE3301-M209/Q222 leg: the devices sit in the test network without a console, and LLDP still reports one to the switch when its LAN address no longer matches after an upgrade. The fork branch lte3301 was reset to the PR state (switch under DSA) plus openwrt/openwrt#24724 and the jbootimage tool from openwrt/firmware-utils#81; the README says which commit is which. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Reset the MT7620 frame engine, embedded switch and PPE together with the system during restart.
A system-only warm reset can leave PDMA unable to consume its first TX descriptor on the next boot. The state survives driver reprobes and separate FE, ESW or PPE reset attempts. The combined reset is the sequence that recovered the hardware during diagnosis.
MT7628 and MT7688 expose the same FE and ESW reset bits, but this failure and the required reset mask have not been verified on those SoCs, and they do not expose the MT7620 PPE reset block. The workaround is therefore deliberately limited to tested MT7620 hardware.
Testing
After rebasing on current OpenWrt main: fresh native prepare, two idempotent refreshes and a complete ramips/mt7620 kernel/module build with Linux 6.18.54. The reset implementation is unchanged; the old hardware tests below predate this rebase.
Tested on MT7620N rev 2 eco 6 with repeated ordinary warm reboots. Ethernet returned after every reboot. This patch was also part of the previously green CI history of #24493 before being split out at reviewer request.
Extracted from: #24493