Repository navigation
ramips: mt7620: add upstream MediaTek Ethernet support - #24557
dormancygrace wants to merge 8 commits into
Conversation
958ede4 to
03ee341
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
03ee3414"ramips: mt7620: add upstream MediaTek Ethernet support" — the message says "Keep the legacy Ralink Ethernet path available for swconfig profiles. The optionalkmod-dsa-mt7620package selects the generic MediaTek driver", but the diff setsCONFIG_NET_MEDIATEK_SOC=yintarget/linux/ramips/mt7620/config-6.18, which builds the generic driver into every mt7620 image regardless of whether the package is selected, and preventsmtk_eth.kofrom ever being built as a module. Details inline.03ee3414— the message does not mention that the patch renames the generic MediaTek platform driver frommtk_soc_ethtomtk_eth_upstream. That is a cross-target change (the patch lives intarget/linux/ramips/patches-6.18/, so it also hits mt7621) with a user-visible side effect outside this SoC; it deserves a line in the message even if the inline concern is resolved differently.
Note on scope: 5 of the 6 commits here are the stacked series from #24493, and this PR carries no prior review, so the whole branch was in scope. The inline comments are all on 03ee3414, this PR's own contribution; the earlier commits' messages match their diffs (including the deliberately-scoped patch-offset refreshes in 7c086e6f and 976de981).
CI on 03ee34147ea9a8cef0f06662d62518c82c5328ef reports no completed checks, so nothing was grounded in build logs.
Generated by Claude Code
4a0241d to
3d2e6aa
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Re-reviewed at 3d2e6aa1. The five earlier commits are byte-identical to the previously reviewed revision (same git patch-id), so only 3d2e6aa1 was in scope. The four points from the last round are addressed: CONFIG_NET_MEDIATEK_SOC is now is not set in the target config, CONFIG_PCS_MTK_LYNXI is listed explicitly in KernelPackage/dsa-mt7620, patches 337–339 are folded into 336, and the generic driver keeps its upstream mtk_soc_eth platform-driver name.
I checked the packaging consequence of NET_MEDIATEK_SOC=m on mt7620: PHYLINK is covered by kmod-dsa's +kmod-phylink, DIMLIB is already =y from target/linux/generic/config-6.18:1483, and PAGE_POOL_STATS/GENERIC_ALLOCATOR are bool, so no unshipped .ko results. I also confirmed the legacy-driver rename does not affect packet-steering.uc: that driver adds NAPI directly on the netdev (netif_napi_add_weight(netdev, &priv->rx_napi, ...)), so the napi/mtk_eth- branch never applied to it, and the generic napi/<netdev>-N branch still matches.
Commit checks
3d2e6aa1"ramips: mt7620: add upstream MediaTek Ethernet support" — the message says "Give only its MT7620 build a distinct platform-driver name", but the guard added to the legacy driver is#ifdef CONFIG_SOC_MT7620, which is also=yon the mt76x8 subtarget. As written the rename applies to MT7628/MT7688 builds too. Details inline.
CI on 3d2e6aa17e7cef147209905f49fc10d16e240d75 is green across all three workflow runs (Build PR Profile, Build Kernel, Build all core packages), so nothing here is grounded in build logs.
Generated by Claude Code
c366f45 to
b40b2f1
Compare
|
Synced this series onto the current #24493 head and restored the offloads provided by the legacy MT7620 Ethernet driver. IPv4 TX/RX checksum is enabled on all revisions; ECO 5 and newer additionally advertise SG, TSO, TSO6 and IPv6 TX checksum. Hardware VLAN insertion remains disabled pending separate validation. The combined Ethernet + DSA + PPE tree applies with zero fuzz and completes a clean ramips/mt7620 kernel build. The PR description now includes the live feature verification and IPv4/IPv6 throughput results. |
|
I noticed the commit: "ramips: mt7620: restore Ethernet offloads". I'm curious what performance impact this has on routers with an external switch via RGMII. Are there any throughput/CPU-load numbers before and after this change? Edit: if the downstream chip is a Realtek switch attached via DSA, this patch changes nothing for that traffic. RTL8_4 disables the offload path via mtk_features_check() clearing NETIF_F_CSUM_MASK/NETIF_F_GSO_MASK, and RTL8_4T disables it because the tagger already checksums in software before this driver sees the frame (ip_summed is no longer CHECKSUM_PARTIAL). Either way, SG/TSO/TSO6/IPv6-checksum never engage regardless of the ECO ≥5 gate added here. |
|
@namiltd Your edit matches my reading. I am not claiming a benefit for traffic traversing an external Realtek DSA switch with The measurements in the PR are from the native integrated MT7620 switch path only. On that path, a local-originating IPv4 TCP test at about 93--94 Mbit/s reduced router CPU busy from 64.7% with SG/TSO disabled to 45.0% with them enabled. For IPv6, TSO6 reduced CPU busy from 56.8% to 48.1% at 92--93 Mbit/s. RX checksum was exercised without errors, although the receive-side test saturated the CPU in both modes and did not provide a useful performance delta. I will keep the external RGMII/Realtek limitation explicit in the PR description. Supporting that path would require tagger-specific work and hardware validation rather than another MT7620 feature bit. The new GDMA jumbo change I am validating is likewise for the integrated-switch path; I will not present it as external-switch coverage. |
|
Added This is the same code already exercised in the flashed WE826 integration image. Untagged IPv4 and IPv6 passed bidirectionally at IP MTU 2026; tagged VLAN 400 passed bidirectionally at IP MTU 2024, which is the MikroTik peers fixed limit. The new patch was normalized by two consecutive The PR body now also makes the external RGMII/Realtek limitation explicit, as discussed above. |
openwrt-ai
left a comment
There was a problem hiding this comment.
Re-reviewed at 13bc77d8, against my last review at 3d2e6aa1. The first five commits are byte-identical to the previously reviewed revision (same git patch-id), so the scope was: the reworked 2e86ff85 ("add upstream MediaTek Ethernet support"), plus the two new commits b40b2f19 and 13bc77d8.
The only change inside 2e86ff85 versus 3d2e6aa1 is the added eth->netdev[0] NULL guard before netif_keep_dst() / mtk_dsa_metadata_init() — good, and it does not invalidate the previous round's conclusions. The CONFIG_SOC_MT7620-vs-mt76x8 rename concern I raised last time is gone with the rename itself.
I checked b40b2f19 against the legacy driver it restores: NETIF_F_IP_CSUM | NETIF_F_RXCSUM plus the mt7620_get_eco() >= 5 gate for SG/TSO/TSO6/IPV6_CSUM matches mt7620_init_data() exactly, minus the deliberately-omitted `NETIF_F_HW_VLAN_CTAG_TX`, and the `vlan_features`/`features` derivation matches [the legacy probe](https://github.com/openwrt/openwrt/blob/13bc77d82a4fc1ccb73502b540116397a416e605/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c#L1635-L1638).`` The descriptor bits line up too: TX_DMA_CHKSUM (0x7 << 29) / TX_DMA_TSO BIT(28) are identical in both drivers and do not collide with MT7620_TX_DMA_FP_BMAP (27:20), and MT7620_RX_DMA_L4_VALID BIT(23) matches the legacy MT7620_L4_VALID. mt7620_get_eco() is a static inline in asm/mach-ralink/mt7620.h, so the new include adds no link dependency for the other ramips subtargets that build this driver. No findings there.
For 13bc77d8 I also checked the RX-buffer side: mtk_max_frag_size() floors at MTK_MAX_RX_LENGTH_2K, so ring->buf_size >= 2048 regardless of MTU and raising the GDMA limit cannot overrun the RX buffers. The one issue I found is that the jumbo programming is not re-applied after a frame-engine reset — details inline.
Commit checks
13bc77d8"ramips: mt7620: enable GDMA jumbo frames" — the message says the "jumbo enable and length fields" are updated "fromndo_change_mtu", but only the enable bit is derived from the MTU;MT7620_GDMA_JMB_LENis written as a constant2(2 KB) irrespective ofnew_mtu. The legacy driver did derive it,DIV_ROUND_UP(frag_size, 1024)(mtk_eth_soc.c:1614-1624).`` A constant 2 is defensible sincemax_mtuis `MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN` = 2030, but the message overstates what the code does. Minor, in the same commit: the body is written one sentence per paragraph, unlike the other seven commits in the series.
CI on 13bc77d82a4fc1ccb73502b540116397a416e605 was still running at review time (no failed check runs), so nothing here is grounded in build logs.
Generated by Claude Code
13bc77d to
abbf92f
Compare
|
Added |
7bf89c8 to
b5329cb
Compare
|
Rebased to |
b5329cb to
8302148
Compare
|
Refreshed the MT7620 VLAN-TX kernel patch against the current series and force-updated the branch to Validation:
The ramips/mt7620 upstream kernel jobs are now queued on the refreshed head. |
8302148 to
ff10d56
Compare
|
Rebased onto the refreshed DSA head/current main. This incorporates the exact Realtek rtl838x context correction identified by the previous kernel-matrix failure. Validation on the resulting stack: target/linux/clean, target/linux/refresh, a clean git diff after refresh, and full ramips/mt7620 target/linux/compile all passed. |
Complete the upstream Ethernet conversion with PHY link interrupts, DSA hardware mirroring and PDMA VLAN insertion. Let embedded PHY user ports take negotiated link, speed, duplex and pause from PPSC. Clear PMCR_FORCE in the link callbacks and remove software programming of those parameters, including the obsolete speed helper. Select MAC-managed PHY interrupts before DSA registration and program the switch PHY polling range for the embedded PHYs. Enable link interrupts after user PHY attachment. Resynchronize already-up and reopened PHYs with delayed work, restarting autonegotiation where enabled. Quiesce the IRQ before cancelling that work and restore PHY polling on teardown. Support ingress and egress mirroring with a single shared destination, and disable the mirror engine when its last source is removed. MT7620 TX descriptors encode a VLAN table index rather than a full VID. Keep each assigned mapping until device removal so table updates cannot retag an skb already past the feature check or a descriptor owned by DMA. Reserve slot 0 for priority-tagged VID 0. Other slots retain their first VID; aliases use software insertion even after that VID is removed. Restore the same table on FE reset. Use ordered MMIO and a readback before publishing a newly assigned slot to the lockless feature check. Extend the ramips-local Ralink metadata tagger so DSA user ports inherit VLAN TX offload from capable conduits. Keep the generic flowtable and its two-VLAN limit unchanged. Publish the conduit only after MDIO succeeds, and keep registration failure cleanup in one block. Pass the shared switch pointer to the DSA child as copied platform data and validate it in both probe and remove. Propagate IRQ lookup failures. The conduit VLAN references added here rely on the teardown order established by the earlier Ethernet-support commit: the DSA child is unregistered before the conduit is cleared, so port_vlan_del() can call vlan_vid_del(). Link: openwrt#24557 (comment) Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
39356b8 to
7ff466b
Compare
|
VLAN hardware validation for revision
All 80 functional checks passed. These short paced tests do not establish line-rate performance or coverage of MT7620N, older ECOs, forced hardware reset, all PCP values or QinQ. TX descriptors were not instrumented; path selection was checked from source, feature state and the registered map. Testing/report preparation assisted by Codex (OpenAI GPT-6). |
Complete the upstream Ethernet conversion with PHY link interrupts, DSA hardware mirroring and PDMA VLAN insertion. Let embedded PHY user ports take negotiated link, speed, duplex and pause from PPSC. Clear PMCR_FORCE in the link callbacks and remove software programming of those parameters, including the obsolete speed helper. Select MAC-managed PHY interrupts before DSA registration and program the switch PHY polling range for the embedded PHYs. Enable link interrupts after user PHY attachment. Resynchronize already-up and reopened PHYs with delayed work, restarting autonegotiation where enabled. Quiesce the IRQ before cancelling that work and restore PHY polling on teardown. Support ingress and egress mirroring with a single shared destination, and disable the mirror engine when its last source is removed. Use the shared mt7620a/mt7620n identity for package-specific embedded-PHY tuning in both legacy and upstream paths. Propagate missing-identity errors and release the switch-device reference. Remove the unused revision offset; the actual PHY tuning values and mode-control syscon accesses are unchanged. MT7620 TX descriptors encode a VLAN table index rather than a full VID. Keep each assigned mapping until device removal so table updates cannot retag an skb already past the feature check or a descriptor owned by DMA. Reserve slot 0 for priority-tagged VID 0. Other slots retain their first VID; aliases use software insertion even after that VID is removed. Restore the same table on FE reset. Use ordered MMIO and a readback before publishing a newly assigned slot to the lockless feature check. Register only 802.1Q VIDs, and use software insertion for DEI=1 because the descriptor has no DEI bit. Preserve PCP, VID and DEI in software fallback. Extend the ramips-local Ralink metadata tagger so DSA user ports inherit VLAN TX offload from capable conduits. Keep the generic flowtable and its two-VLAN limit unchanged. Publish the conduit only after MDIO succeeds, and keep registration failure cleanup in one block. Pass the shared switch pointer to the DSA child as copied platform data and validate it in both probe and remove. Propagate IRQ lookup failures. The conduit VLAN references added here rely on the teardown order established by the earlier Ethernet-support commit: the DSA child is unregistered before the conduit is cleared, so port_vlan_del() can call vlan_vid_del(). Link: openwrt#24557 (comment) Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
7ff466b to
ea67885
Compare
ea67885 to
7d21f55
Compare
Complete the upstream Ethernet conversion with PHY link interrupts, DSA hardware mirroring and PDMA VLAN insertion. Let embedded PHY user ports take negotiated link, speed, duplex and pause from PPSC. Clear PMCR_FORCE in the link callbacks and remove software programming of those parameters, including the obsolete speed helper. Select MAC-managed PHY interrupts before DSA registration and program the switch PHY polling range for the embedded PHYs. Enable link interrupts after user PHY attachment. Resynchronize already-up and reopened PHYs with delayed work, restarting autonegotiation where enabled. Quiesce the IRQ before cancelling that work and restore PHY polling on teardown. Support ingress and egress mirroring with a single shared destination, and disable the mirror engine when its last source is removed. Use the shared mt7620a/mt7620n identity for package-specific embedded-PHY tuning in both legacy and upstream paths. Propagate missing-identity errors and release the switch-device reference. Remove the unused revision offset; the actual PHY tuning values and mode-control syscon accesses are unchanged. MT7620 TX descriptors encode a VLAN table index rather than a full VID. Keep each assigned mapping until device removal so table updates cannot retag an skb already past the feature check or a descriptor owned by DMA. Reserve slot 0 for priority-tagged VID 0. Other slots retain their first VID; aliases use software insertion even after that VID is removed. Restore the same table on FE reset. Use ordered MMIO and a readback before publishing a newly assigned slot to the lockless feature check. Register only 802.1Q VIDs, and use software insertion for DEI=1 because the descriptor has no DEI bit. Preserve PCP, VID and DEI in software fallback. Extend the ramips-local Ralink metadata tagger so DSA user ports inherit VLAN TX offload from capable conduits. Keep the generic flowtable and its two-VLAN limit unchanged. Publish the conduit only after MDIO succeeds, and keep registration failure cleanup in one block. Pass the shared switch pointer to the DSA child as copied platform data and validate it in both probe and remove. Propagate IRQ lookup failures. The conduit VLAN references added here rely on the teardown order established by the earlier Ethernet-support commit: the DSA child is unregistered before the conduit is cleared, so port_vlan_del() can call vlan_vid_del(). Link: openwrt#24557 (comment) Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
7d21f55 to
4017ad9
Compare
|
@dangowrt Following your recommendation to send the Ethernet changes to net-next, could you review the current series in this PR and the MT7620 integration v7 before I submit the Ethernet patches to netdev? The latest changes cover VLAN TX, checksum handling, shared SoC/ECO identification and counters. Integration and validation notes. Linux v7 hardware validation is still pending. |
The early metadata allocation used by MT7620 also ran for newer NETSYS devices, although their original open path returned before allocation. Retain the original NETSYS generation condition while allocating metadata before PHY connection and DMA startup on the legacy path. An allocation failure must not prevent a newer NETSYS device from opening when those metadata destinations are unused. The extracted open function reproduces an unexpected -ENOMEM with a newer NETSYS configuration and forced metadata allocation failure. The guard preserves the MT7620 error unwind and restores the newer behavior. Fixes: cb00ac4 ("net: ethernet: mediatek: carry MT7620 DSA ports in DMA metadata") Assisted-by: LLM [sparse]
Complete the upstream Ethernet conversion with PHY link interrupts, DSA hardware mirroring and PDMA VLAN insertion. Let embedded PHY user ports take negotiated link, speed, duplex and pause from PPSC. Clear PMCR_FORCE in the link callbacks and remove software programming of those parameters, including the obsolete speed helper. Select MAC-managed PHY interrupts before DSA registration and program the switch PHY polling range for the embedded PHYs. Enable link interrupts after user PHY attachment. Resynchronize already-up and reopened PHYs with delayed work, restarting autonegotiation where enabled. Quiesce the IRQ before cancelling that work and restore PHY polling on teardown. Support ingress and egress mirroring with a single shared destination, and disable the mirror engine when its last source is removed. Use the shared mt7620a/mt7620n identity for package-specific embedded-PHY tuning in both legacy and upstream paths. Propagate missing-identity errors and release the switch-device reference. Remove the unused revision offset; the actual PHY tuning values and mode-control syscon accesses are unchanged. MT7620 TX descriptors encode a VLAN table index rather than a full VID. Keep each assigned mapping until device removal so table updates cannot retag an skb already past the feature check or a descriptor owned by DMA. Reserve slot 0 for priority-tagged VID 0. Other slots retain their first VID; aliases use software insertion even after that VID is removed. Restore the same table on FE reset. Use ordered MMIO and a readback before publishing a newly assigned slot to the lockless feature check. Register only 802.1Q VIDs, and use software insertion for DEI=1 because the descriptor has no DEI bit. Preserve PCP, VID and DEI in software fallback. Extend the ramips-local Ralink metadata tagger so DSA user ports inherit VLAN TX offload from capable conduits. Keep the generic flowtable and its two-VLAN limit unchanged. Publish the conduit only after MDIO succeeds, and keep registration failure cleanup in one block. Pass the shared switch pointer to the DSA child as copied platform data and validate it in both probe and remove. Propagate IRQ lookup failures. The conduit VLAN references added here rely on the teardown order established by the earlier Ethernet-support commit: the DSA child is unregistered before the conduit is cleared, so port_vlan_del() can call vlan_vid_del(). Link: openwrt#24557 (comment) Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
4017ad9 to
f50f591
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
68fbd142"ramips: mt7620: expose frame-engine traffic counters": the message says it will "drain counters before DMA stops", but the finalmt7620_stats_read()inmtk_stop()runs aftermtk_stop_dma(). Only the polling cancel happens before. The patch body ("drain remaining counters on close") gets this right.
Generated by Claude Code
Complete the upstream Ethernet conversion with PHY link interrupts, DSA hardware mirroring and PDMA VLAN insertion. Let embedded PHY user ports take negotiated link, speed, duplex and pause from PPSC. Clear PMCR_FORCE in the link callbacks and remove software programming of those parameters, including the obsolete speed helper. Select MAC-managed PHY interrupts before DSA registration and program the switch PHY polling range for the embedded PHYs. Enable link interrupts after user PHY attachment. Resynchronize already-up and reopened PHYs with delayed work, restarting autonegotiation where enabled. Quiesce the IRQ before cancelling that work and restore PHY polling on teardown. Support ingress and egress mirroring with a single shared destination, and disable the mirror engine when its last source is removed. Use the shared mt7620a/mt7620n identity for package-specific embedded-PHY tuning in both legacy and upstream paths. Propagate missing-identity errors and release the switch-device reference. Remove the unused revision offset; the actual PHY tuning values and mode-control syscon accesses are unchanged. MT7620 TX descriptors encode a VLAN table index rather than a full VID. Keep each assigned mapping until device removal so table updates cannot retag an skb already past the feature check or a descriptor owned by DMA. Reserve slot 0 for priority-tagged VID 0. Other slots retain their first VID; aliases use software insertion even after that VID is removed. Restore the same table on FE reset. Use ordered MMIO and a readback before publishing a newly assigned slot to the lockless feature check. Register only 802.1Q VIDs, and use software insertion for DEI=1 because the descriptor has no DEI bit. Preserve PCP, VID and DEI in software fallback. Extend the ramips-local Ralink metadata tagger so DSA user ports inherit VLAN TX offload from capable conduits. Keep the generic flowtable and its two-VLAN limit unchanged. Publish the conduit only after MDIO succeeds, and keep registration failure cleanup in one block. Pass the shared switch pointer to the DSA child as copied platform data and validate it in both probe and remove. Propagate IRQ lookup failures. The conduit VLAN references added here rely on the teardown order established by the earlier Ethernet-support commit: the DSA child is unregistered before the conduit is cleared, so port_vlan_del() can call vlan_vid_del(). Link: openwrt#24557 (comment) Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
f50f591 to
fc5f4ef
Compare
The generic MediaTek Ethernet driver describes MT7620, but cannot probe the current ramips device tree and lacks the legacy PDMA handling required by the Ralink DSA metadata tagger. Add MT7620 probe, reset, clock, DMA and integrated-switch handoff support. Copy DSA TXD4 metadata into the descriptor consumed by legacy PDMA and keep RX switch source-port metadata on GMAC0 as the conduit. Reset the software TX producer cursor when PDMA restarts. Initialize DSA RX metadata before registering the conduit and order probe, remove and IRQ handling so repeated close/open cycles and modular teardown remain safe. Keep these corrections in the initial MT7620 kernel patch instead of adding introduce-then-fix patches in the same Git commit. Add a built-in SoC bus provider sharing the MTMIPS clock/reset syscon regmap. Publish mt7620a/mt7620n and decimal silicon version.ECO before driver probes, and require an identified model in the generic FE probe. Skip the duplicate architecture registration only on MT7620A/N, preserving MT7628/MT7688. Select the provider for SOC_MT7620 and retain the existing legacy helpers. Keep the legacy Ralink Ethernet path available for swconfig profiles during the staged migration. Give only its MT7620 build a distinct platform-driver name, preserving the generic driver's upstream mtk_soc_eth name and existing packet-steering behaviour on MT7621. Retain an opt-in MT7620 compatible for the generic path because the built-in legacy and modular generic drivers must coexist until individual boards migrate; sharing a compatible would let the legacy driver claim the node first. Leave NET_MEDIATEK_SOC disabled in the target config so the optional kmod-dsa-mt7620 package can select it as a module. Explicitly select and ship the LynxI PCS module required by the generic driver's Kconfig dependencies. Declare the conduit pointer with the initial switch lifecycle support, so cleanup builds before the later switch offload additions. Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
Keep receive checksum offload on all MT7620 revisions, but restrict IPv4 and IPv6 transmit checksums, scatter-gather, TSO and TSO6 to ECO 5 or later. The early-ECO workaround applies to IPv4 TX checksums as well as the other transmit offloads; the legacy driver's broader IPv4 advertisement should not be copied into the generic driver. Match the model and decimal version.ECO published by the preceding shared SoC provider, including both one-digit ECOs 5--9 and two-digit ECOs 10--15. Do not read architecture-specific registers in the network driver. The generic MediaTek paths already program and parse the corresponding legacy PDMA descriptor bits. VLAN insertion is enabled separately by the later switch-feature commit. Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
The integrated switch accepts frames up to 2048 bytes, but GDMA1 remains limited to 1518 bytes unless its jumbo fields are programmed. Update the jumbo enable and length fields from ndo_change_mtu. This lets DSA user ports use the advertised maximum MTU and returns GDMA1 to standard mode when the MTU is lowered. This revision only refreshes the patch coordinates after the preceding SoC and offload changes; jumbo behavior is unchanged. Earlier integration tests on a ZBT-WE826 passed bidirectional IPv4 and IPv6 at IP MTU 2026 with GDM1_FWD_CFG 0x20790000. Those measurements predate this SoC-provider revision. At standard MTU, both jumbo fields are cleared; the length field is irrelevant while jumbo mode is disabled. Signed-off-by: Gleb Pesin <[email protected]>
Complete the upstream Ethernet conversion with PHY link interrupts, DSA hardware mirroring and PDMA VLAN insertion. Let embedded PHY user ports take negotiated link, speed, duplex and pause from PPSC. Clear PMCR_FORCE in the link callbacks and remove software programming of those parameters, including the obsolete speed helper. Select MAC-managed PHY interrupts before DSA registration and program the switch PHY polling range for the embedded PHYs. Enable link interrupts after user PHY attachment. Resynchronize already-up and reopened PHYs with delayed work, restarting autonegotiation where enabled. Quiesce the IRQ before cancelling that work and restore PHY polling on teardown. Support ingress and egress mirroring with a single shared destination, and disable the mirror engine when its last source is removed. Use the shared mt7620a/mt7620n identity for package-specific embedded-PHY tuning in both legacy and upstream paths. Propagate missing-identity errors and release the switch-device reference. Remove the unused revision offset; the actual PHY tuning values and mode-control syscon accesses are unchanged. MT7620 TX descriptors encode a VLAN table index rather than a full VID. Keep each assigned mapping until device removal so table updates cannot retag an skb already past the feature check or a descriptor owned by DMA. Reserve slot 0 for priority-tagged VID 0. Other slots retain their first VID; aliases use software insertion even after that VID is removed. Restore the same table on FE reset. Use ordered MMIO and a readback before publishing a newly assigned slot to the lockless feature check. Register only 802.1Q VIDs, and use software insertion for DEI=1 because the descriptor has no DEI bit. Preserve PCP, VID and DEI in software fallback. Extend the ramips-local Ralink metadata tagger so DSA user ports inherit VLAN TX offload from capable conduits. Keep the generic flowtable and its two-VLAN limit unchanged. Publish the conduit only after MDIO succeeds, and keep registration failure cleanup in one block. Pass the shared switch pointer to the DSA child as copied platform data and validate it in both probe and remove. Propagate IRQ lookup failures. The conduit VLAN references added here rely on the teardown order established by the earlier Ethernet-support commit: the DSA child is unregistered before the conduit is cleared, so port_vlan_del() can call vlan_vid_del(). Link: openwrt#24557 (comment) Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
The MT7620 FE statistics path currently returns zero. Backport the twelve CPU GDM1 clear-on-read registers and protected 64-bit totals from the Linux integration, with one-second polling while open and cached queries while down. Cancel polling before DMA stops and drain the final counters on close. Keep rtnetlink RX and completed-TX skb counts separate from hardware counts, which include segmentation and parser errors. Report twelve MT7620 ethtool counters; existing switch port MIBs stay independent. Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
The receive parser can remain enabled after ethtool disables RX checksum offload. Require NETIF_F_RXCSUM before trusting its result and marking an skb CHECKSUM_UNNECESSARY. Backport the Linux integration condition so disabling this feature lets the network stack verify checksums. Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
RX metadata allocation can fail after DMA, NAPI and queues have started. Backport allocation before PHY connection and DMA startup so an error leaves the conduit closed. Preserve the original legacy NETSYS guard; newer NETSYS devices do not use these destinations and must not depend on their allocation. Extracted open-function checks cover metadata, PHY and DMA failures and verify that a newer NETSYS open ignores forced metadata ENOMEM. Resource APIs are mocked; this is not hardware allocation-failure injection. Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
Backport the Linux integration FE-reset fallback when MT7620 DMA stays busy after the bounded stop wait. Drain clear-on-read statistics before resetting FE and freeing descriptor rings. Restore RX/TX interrupt moderation, pinned CDMA VLAN assignments and the checksum parser before every DMA start. FE reset clears registers while software assignments and accumulated statistics survive. GDMA setup then restores MTU and forwarding before queues start. Assisted-by: Codex (OpenAI GPT-6) Signed-off-by: Gleb Pesin <[email protected]>
Use the generic MediaTek Ethernet driver for the optional MT7620 DSA path. Existing swconfig profiles keep the Ralink driver. This builds on #24493; board migrations and PPE support (#24515) remain separate.
Changes
soc_device_match(). Report MT7620A/N and decimal version/ECO, retaining the existing MT7628/MT7688 registration.kmod-dsa-mt7620select the modular FE and required PCS support.The corresponding net-next preparation includes the VLAN port and switch-counter cadence. Its new TX registration API requires subsystem review; Linux v7 hardware validation remains pending.
Validation
After rebasing on current OpenWrt main, the series passes a fresh ramips/mt7620 kernel/module build against Linux 6.18.54, native prepare and two refresh runs without patch changes. The changed SoC, FE, DSA and tagger objects pass W=1 and Werror; the generic and legacy FE paths also compile at every commit in the series. Sparse comparison found no new warning classes or affected driver functions; existing baseline warnings remain.
The delay-interrupt recovery change passes the fresh kernel/module build and W=1/Werror FE compilation. An ASan/UBSan fixture extracts the real stop/start and DIM helpers, models FE reset, and checks 25 RX/TX profile pairs, ordinary close, DMA initialization failure and non-MT7620 controls. MMIO and reset APIs are mocked; this is not hardware failure injection. Sparse warnings match the preceding source under identical commands. Embedded patch sign-offs now match their owning commits.
The hardware tests below were performed before this rebase on WE826-T2, MT7620A version 2 / ECO 6, Linux 6.18.44, with FE and DSA loaded as modules. Those runtime tests have not been repeated on 6.18.54 or with the later delay-interrupt recovery fix.
The author also hardware-tested D-Link DWR-921 C3 (MT7620N), confirming operation comparable to MT7620A. The detailed test counts above are from WE826-T2.
These are short correctness tests. Older ECO-specific coverage, external Realtek switches, forced busy-DMA failure, sustained line rate and QinQ remain untested. Earlier jumbo/mirroring/performance results are recorded in the historical comments; this update does not add runtime coverage for them or PPE.
Prior work: 2021 MT7620 DSA/PPE discussion, 2025 MediaTek Ethernet cleanup series.