Skip to content

ramips: mt7620: add PPE hardware flow offload - #24515

Draft
dormancygrace wants to merge 13 commits into
openwrt:mainfrom
dormancygrace:mt7620-ppe
Draft

dormancygrace wants to merge 13 commits into
openwrt:mainfrom
dormancygrace:mt7620-ppe

Conversation

@dormancygrace

@dormancygrace dormancygrace commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add nftables flowtable hardware offload for the HNAT v2 PPE integrated in MT7620. The backend supports IPv4 and IPv6 TCP/UDP routing through the integrated-switch DSA path, IPv4 NAPT, 802.1Q VLAN and PPPoE encapsulation.

This revision uses the generic MediaTek Ethernet driver instead of adding PPE hooks to the legacy target-local Ralink driver. The common MT7620 DSA series from #24493 is now merged into main; this PR is rebased on that implementation and remains stacked on the MT7620 generic MediaTek Ethernet port in #24557.

It does not migrate an individual board. Legacy swconfig profiles continue to use the existing Ralink Ethernet driver and do not initialize this backend.

Implementation

  • use the modern TC_SETUP_FT control plane and the HNAT v2 two-way 4K FOE table;
  • use the global 80-byte entry format required for mixed IPv4/IPv6 operation;
  • reserve the eight entries per 128-entry block that cross 1 KiB hardware boundaries, so the allocator never selects an invalid entry;
  • accept exact IPv4/IPv6 TCP/UDP tuples for plain routing and IPv4 SNAT/DNAT;
  • use the documented HNAT v2 IPv6 5-tuple hash and entry layout;
  • own both directions of a netfilter flow and invalidate exact entries on deletion;
  • install entries as UNBOUND, then promote only the exact direction reported by the hardware HIT_UNBIND_RATE_REACH reason;
  • perform promotion in process context and serialize it with deletion and PPE lifecycle changes;
  • support integrated DSA user ports 0 through 4;
  • support up to two output encapsulation layers: two VLAN tags, or one VLAN tag plus PPPoE;
  • mark host FDB entries as MY_MAC and enable IPv4/IPv6 TPF steering;
  • preserve VLAN tags when TPF redirects frames through switch port 7;
  • increase the documented PPE-to-switch inter-frame gap from 72 ns to 96 ns while the backend is active, preventing port 7 RX_ARL_TOUT drops under full-duplex load;
  • bypass the 1518-byte-limited PPE GDM2 path only on DSA ports configured for jumbo MTU, while standard-MTU ports remain offloaded;
  • preserve the CPU miss, TTL expiry and TCP FIN/RST exception paths;
  • save and restore shared FE, switch and PPE registers;
  • reset the PPE by its named reset and update all PPE VLAN MTU registers from the active MAC MTU;
  • disable UDP offload before MT7620 ECO5 because of the documented defect.

The PPE backend is compiled only with the optional kmod-dsa-mt7620 package. The old NET_RALINK_MT7620_PPE backend is not part of this series.

Validation scope

The measurements below were collected on earlier integration images, before the shared Ethernet driver acquired its lifetime-pinned CDMA VLAN map on 6 September. They remain historical PPE results and do not establish hardware validation of the current combined series. The current CPU TX map reserves slot 0 for VID 0 and pins other slots to their first VID until driver removal; aliases, including VIDs 400 and 416, use CPU-path software tagging. PPE FOE egress encapsulation is a separate path and its VLAN implementation is unchanged by that fix.

The previous published head 33715594751c passed all five ramips kernel builds and the actual OpenWrt patch-refresh check. The 7 September shared-header cleanup and commit-message correction do not alter PPE logic. Exact local checks are recorded in the follow-up comment; new-head CI and current-revision device testing remain separate requirements.

Historical hardware testing

Earlier tests used a flashed squashfs image on an MT7620N rev 2 ECO6 ZBT-WE826 with the generic MediaTek Ethernet driver, integrated DSA switch and two independent 100BASE-T physical ports.

Full-duplex 400 Mbit/s physical load and small packets

The topology used for these stress measurements had Debian LXC endpoints connected over separate VLANs and a 10 Gbit/s Proxmox trunk to a MikroTik CRS326-24G-2S+. The CRS326 performs hardware-offloaded L2 forwarding only. At the time, its ether5 and ether6 ports connected to the LAN and WAN sides of the ZBT-WE826 over two independent 100BASE-T full-duplex links; the DUT is the only L3 hop. An aggregate 98.5 Mbit/s TBF on each LXC DUT-facing interface smooths the 10G-to-100M transition without limiting the requested 90 Mbit/s TCP payload in either direction.

The table shows the median of three literal iperf3 --bidir -P 2 runs under the same offered load:

Mode Upload receiver Download receiver DUT CPU busy
no flow offload 72.815 Mbit/s 69.006 Mbit/s 100.0%
software flowtable 89.786 Mbit/s 89.961 Mbit/s 64.9%
PPE 89.984 Mbit/s 89.984 Mbit/s 4.4%

All six PPE directional results had zero TCP retransmissions. The sums of the four simultaneous DUT physical counter directions were approximately 397.6, 398.0 and 400.1 Mbit/s. PPE port 7 TX and RX accounting matched exactly in each run, and the port 7 control/ingress/ARL, PSE, PDMA, CRS326 and endpoint qdisc drop counters remained at zero.

The small-packet comparison used an 18-byte UDP payload: a 46-byte IPv4 packet padded to the minimum 64-byte Ethernet frame including FCS. Each direction offered 140,000 datagrams/s, approximately 94.1 Mbit/s on the wire. These are the three-run median delivered rates:

Mode Upload receiver Download receiver DUT CPU busy
no flow offload 23,285 pps 23,289 pps 100.0%
software flowtable 27,589 pps 27,555 pps 100.0%
PPE 139,888 pps 139,931 pps 4.8-5.0%

The no-offload path saturates the CPU. The software flowtable reaches the full TCP target at 64.9% CPU, while its small-packet path saturates the CPU processing skb and memory traffic. PPE sustains both line-rate workloads at about 5% CPU. All PPE switch, PSE and PDMA drop counters remained at zero throughout the packet-rate matrix.

The MT7620 Programming Guide defines GPC2.FE2SW_IPG as (field + 2) * 8 ns and gives it an initial value of 0x07, or 72 ns. That setting caused PPE port 7 RX-control drops and RX_ARL_TOUT under simultaneous full-duplex load. Controlled tests bracketed the failure boundary between 72 and 80 ns. The driver now selects field 0x0a, or 96 ns, saves the complete GPC2 value before changing it and restores the previous value when the PPE backend stops.

IPv4 routing, NAPT, PPPoE and VLAN

The original IPv4 matrix used a real tagged physical path. Values are forward/reverse Mbit/s and router CPU busy:

Topology Mode TCP Mbit/s TCP CPU UDP Mbit/s UDP CPU
Route none 89.589 / 90.544 90.6 / 91.0% 11.572 / 8.228 92.4 / 92.9%
Route software 90.434 / 90.384 60.8 / 59.1% 57.685 / 49.577 90.4 / 87.8%
Route PPE 89.985 / 90.332 1.4 / 1.5% 76.683 / 76.723 2.2 / 2.5%
SNAT none 88.900 / 88.603 92.1 / 93.0% 21.801 / 8.804 92.4 / 93.1%
SNAT software 90.251 / 90.330 62.3 / 59.6% 67.102 / 47.595 88.6 / 89.0%
SNAT PPE 89.624 / 90.489 1.3 / 1.2% 76.202 / 76.382 2.5 / 2.4%

Both TCP and UDP independently reached HW_OFFLOAD. Exact translated FOE entries were BOUND with the expected translated address, DSA port and VLAN word.

VLAN plus a real local PPPoE session with SID 1 remained fully hardware offloaded:

Protocol Forward Mbit/s / CPU Reverse Mbit/s / CPU
TCP 89.685 / 1.3% 90.017 / 1.3%
UDP 75.208 / 2.5% 72.727 / 3.1%

The plain untagged path was tested independently at 87.483 Mbit/s. Both directions were BOUND with EtherType 0x0800 and no encapsulation.

Mixed IPv4/IPv6 and VLAN 400

A second clean flashed-image matrix used VLAN 400 from one physical DSA port to the other physical port:

Mode Family Sender Receiver Router CPU busy
no flow offload IPv4 91.1 Mbit/s 90.5 Mbit/s 78.6%
no flow offload IPv6 89.1 Mbit/s 88.0 Mbit/s 78.5%
software flow offload IPv4 90.6 Mbit/s 89.9 Mbit/s 39.1%
software flow offload IPv6 77.1 Mbit/s 77.0 Mbit/s 35.2%
PPE IPv4 90.8 Mbit/s 91.0 Mbit/s 3.7%
PPE IPv6 89.5 Mbit/s 88.7 Mbit/s 3.6%

Hardware-offloaded reverse traffic, which requires VLAN insertion on PPE egress, reached 91.8/91.6 Mbit/s at 3.5% CPU for IPv4 and 89.2/89.1 Mbit/s at 3.3% CPU for IPv6.

Thirty-second bidirectional runs delivered 45.0/46.1 Mbit/s for IPv4 and 44.2/44.9 Mbit/s for IPv6 at 1.4% router CPU. The FOE table remained stable, and no DMA, checksum, FCS, drop, watchdog, oops or call-trace errors appeared.

Jumbo and Ethernet offloads

With the PPE backend active but the jumbo test ports deliberately bypassing its 1518-byte-limited GDM2 path, the ordinary Ethernet/DSA path passed a total IP length of 2030 untagged and 2026 with VLAN in both directions. Both cases produce a 2048-byte Ethernet frame including the header, VLAN tag where present, and FCS, which is the documented MT7620 frame limit. Returning the DSA port to MTU 1500 re-enabled PPE steering.

RX/TX checksum, SG, TSO and TSO6 remained enabled. Local-origin traffic, which cannot use routed PPE, showed SG/TSO reducing IPv4 CPU busy from 64.7% to 45.0% at 93-94 Mbit/s and TSO6 reducing IPv6 CPU busy from 56.8% to 48.1% at 92-93 Mbit/s.

Additional testing covered TTL expiry, flowtable unbind/rebind, TCP teardown, two-way hash collisions, repeated Ethernet/PPE start-stop, interface close/open, network reload and warm reboot.

The external RGMII port 5 path remains excluded: cascading the Ralink metadata tag with RTL8_4 or RTL8_4T requires separate tagger work and hardware proof.

The common Ethernet source has changed since those hardware images, including conduit lifetime fixes and the CDMA VLAN mapping policy. No exact-source equivalence to the current PR or new device run is claimed. Board-profile, LTE, SafeMode and lab changes are not included.

Documentation and prior work

@openwrt openwrt Bot added kernel pull request/issue with Linux kernel related changes target/ipq40xx pull request/issue for ipq40xx target target/qualcommax pull request/issue for qualcommax target target/ramips pull request/issue for ramips target target/realtek pull request/issue for realtek target labels Aug 1, 2026

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all 7 commits (first review of this PR). Comparison points used: gregkh/linux v6.18.39 (matching KERNEL_PATCHVER:=6.18) for the DSA/flow-offload APIs and net/dsa/tag.c's generic METADATA_HW_PORT_MUX receive path, plus the in-tree tag_oob and mtk PPE offload code for the control-plane structure.

The tagger, the TC_SETUP_FT block handling, the mangle helpers and the FOE hash all match their upstream/mainline counterparts closely, and the reset/MDIO/NAPI lifecycle fixes look correct against the DSA and devres teardown ordering. Six comments inline; the most consequential are the FOE way-1 duplicate check and the fact that CONFIG_NET_RALINK_MT7620_PPE cannot currently resolve to y, which means the new PPE backend is not built by any default configuration (including CI).


Generated by Claude Code

Comment thread target/linux/ramips/mt7620/config-6.18 Resolved
@dormancygrace

Copy link
Copy Markdown
Contributor Author

The current FormalityCheck suggestion is inherited from stacked DSA commit 07e2849, not from the PPE change. It flags a pre-existing Realtek downstream patch whose hunk offsets are refreshed because the new tagger changes the same upstream Makefile/Kconfig. The rationale is recorded on the base DSA PR; no PPE-side change is needed.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 new commits; no new issues found.

The series was rewritten since 4e3029a; the net content change is confined to five files (gsw_mt7620_dsa.c, mt7620_ppe.c, mtk_eth_soc.c, modules.mk, mt7620/config-6.18). All six earlier findings are addressed:

  • the FOE way scan is now a duplicate-key pass over both ways followed by a separate free-way pass, so a free way 0 can no longer mask a duplicate in way 1;
  • CONFIG_NET_RALINK_MT7620_PPE=y moved from mt7620/config-6.18 into KernelPackage/dsa-mt7620's KCONFIG. Checked against scripts/kconfig/symbol.c in v6.18.39: a bool whose dependency evaluates to m (here NET_DSA_MT7620=m) is promoted to y, so the symbol does resolve, and the buildbot's kmod pass now compiles the backend;
  • the introduce-then-fix STP commit is folded into the DSA commit, and the DSA/long-calls commit messages now document the MDIO rewrite, the TXD4 FP_BMAP 27:20 correction and the 821-SPI-... offset refresh.

Also checked: <&sysc 31> is a valid reset index (clk-mtmips.c registers nr_resets = 32), the reset bit matches RSTCTL_RESET_PPE in patch 335, and the openwrt[bot] FormalityCheck warning about 721-net-dsa-add-support-for-tag-rtl-otto.patch is pre-existing in the base file — only hunk offsets changed. CI is green on 3d98164.


Generated by Claude Code

@dormancygrace

dormancygrace commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor Author

@namiltd Two related gaps came up while extending this PPE backend beyond plain IPv4 routing/NAPT. I would appreciate your help with either of them if your Archer C5 v4 is suitable.

External RGMII port 5

I can fully test the integrated MT7620 switch ports 0--4, including VLAN and PPPoE, but I have no hardware on which to validate PPE egress through external RGMII port 5. I am therefore keeping port 5/external-switch PPE support out of this revision. The Archer external RTL8367S/RTL8_4 DSA tag path likely needs separate treatment; simply forcing PPE output to GSW port 5 is not enough to establish that tagged traffic is correct. Would you be interested in handling that part or testing a follow-up on your board?

IPv6

I also built and tested an IPv6 5-tuple implementation locally. The working pieces are:

  • the documented global 80-byte FOE format (320 KiB for 4096 entries);
  • IPv6 source/destination addresses, TCP/UDP ports, L2 rewrite and forced DSA output in the HNAT v2 layout;
  • IPv6 5-tuple hashing and switch TPF steering using IPv6 MYUC plus learned/unknown unicast;
  • true bidirectional hardware forwarding on MT7620N ECO6: about 89.7/89.5 Mbit/s at 12.5/17.7% CPU, versus 87.9/89.7 Mbit/s at 49.7/52.6% CPU with software flow offload. The Ethernet conduit carried only about 0.025% of payload traffic, both conntrack directions had [HW_OFFLOAD], and the exact FOE timestamps advanced.

The blocker is coexistence with reliable IPv4 offload. In 80-byte mode, the vendor layout reserves offsets {12,25,38,51,76,89,102} in every 128-entry block (224 entries total) because those entries cross 1024-byte boundaries. Some two-way hash buckets therefore retain only one usable way. I reproduced a real four-stream IPv4 TCP case where the original and reply directions both hashed to bucket 2520: way 0 held the original direction and way 1 was a mandatory reserved slot, so the reply direction stayed on the CPU. Switching back to the 64-byte IPv4 format made both ways usable and the same collision class offloaded correctly.

That is where IPv6 work stopped. I do not want to merge an IPv6-capable table mode that silently makes ordinary bidirectional IPv4 acceleration hash-dependent. Do you know of another MT7620 table/hash configuration, a vendor technique for handling the 80-byte holes, or hardware behavior that would allow reliable IPv4 and IPv6 coexistence? Any documentation or a second hardware test would be very useful. Until this is solved, this PR will remain IPv4-only.

@namiltd

namiltd commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

With such a connection we will get a tag conflict: DSA_TAG_PROTO_RALINK vs DSA_TAG_PROTO_RTL8_4 or DSA_TAG_PROTO_RTL8_4t, I have Mercusys AC12 v1 which is very similar to the mentioned Archer C5 v4, but I do not have a pppoe connection.

@dormancygrace

Copy link
Copy Markdown
Contributor Author

Agreed — that Ralink/RTL tag conflict is exactly why I excluded external RGMII port 5 from this revision instead of treating it as another force-port value. The PPPoE results in the description use only the integrated MT7620 switch ports, so you do not need a PPPoE ISP connection for the external-switch question (my test session is generated by a local Linux PPPoE server). If you investigate the AC12 later, the useful follow-up would be how to avoid or translate the conflicting RALINK and RTL8_4[t] metadata/tag paths; I will not claim external-switch support in this PR without that work and hardware proof.

@dormancygrace

Copy link
Copy Markdown
Contributor Author

The branch has been rewritten on top of the generic MediaTek Ethernet port in #24557.

The native MT7620 HNAT v2 data plane is retained, but all legacy fe_priv hooks and NET_RALINK_MT7620_PPE integration are gone. The backend now attaches to struct mtk_eth, follows the generic driver lifecycle, and keeps the proven MY_MAC and PPE-port-7 VLAN handling.

I retested the complete upstream-Ethernet + DSA + PPE stack on hardware. Plain routing, SNAT, VLAN 5, PPPoE SID 1 and untagged TCP/UDP all reached hardware offload; hardware TCP used about 1.2--1.5% CPU and UDP about 2.2--3.1% CPU. The PR body now contains the final matrix, exact FOE evidence, dependency chain and the IPv6 help request.

The rewritten head is 1ea3efd91f; formalities are green and the build matrix is running.

@dormancygrace

Copy link
Copy Markdown
Contributor Author

The failed ramips/mt7620 patch check was the expected quilt normalization issue: patches 336--340 applied with offsets/fuzz. I reproduced the CI command with make target/linux/refresh, folded the resulting context-only changes into #24557 and this commit, and force-pushed with leases. No C semantics changed.

New heads: #24557 c11c86bf0a, this PR 5fd84b8a8b. The refreshed local tree is clean on a second comparison, and CI has restarted.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the 2 commits added since 3d98164 (958ede4 "add upstream MediaTek Ethernet support", 483842c "add PPE hardware flow offload"). The first five commits are unchanged SHAs, so this pass covers the rewrite onto the generic MediaTek driver: the new mtk_ppe_mt7620.{c,h}, the mt7620-gsw.h glue plus mt7620_gsw_upstream_*() in gsw_mt7620.c, patches 336-340, modules.mk and mt7620/config-6.18. Compared against gregkh/linux v6.18.41 (matching KERNEL_PATCHVER:=6.18) for mtk_eth_soc.c, mtk_ppe_offload.c and drivers/net/ethernet/mediatek/Kconfig, and against the in-tree 732-05-...-sending-fra.patch for mtk_tx_map_info().

Both commit messages match what their diffs do. Four comments inline; the packaging one is the consequential one — CONFIG_NET_MEDIATEK_SOC=y in the target config silently overrides the =m that KernelPackage/dsa-mt7620 wants, so the new mtk_eth.ko/pcs-mtk-lynxi.ko FILES entries can never resolve and the generic driver lands in every mt7620 image.

Also checked and found fine: the state->nbuf & 1 TXD4 copy in patch 337 targets the first buffer of each PDMA descriptor pair and setup_tx_buf() does not clobber txd4; MT7620_RX_DMA_SP is bounded against MTK_MAX_DSA_PORTS (7) before indexing eth->dsa_meta; mtk_remove() skipping phylink_disconnect_phy() on the MT7620 path is covered by mtk_uninit() (mtk_eth_soc.c:4320 in v6.18.41) running from unregister_netdev(); the restored foe_table/foe_flow_table fields in struct fe_priv match the pre-series base; mtk_mdio_cleanup() is NULL-safe for the MT7620 remove path that never called mtk_mdio_init(); and NET_MEDIATEK_MT7620_PPE being bool still resolves to y with NET_DSA_MT7620=m. CI is green on 483842c (Build Kernel / Build all core packages / Build PR Profile all success), and the outstanding FormalityCheck warning is the pre-existing realtek patch header already explained in the thread.


Generated by Claude Code

Comment thread target/linux/ramips/mt7620/config-6.18 Resolved
Comment thread target/linux/ramips/mt7620/config-6.18 Resolved
@dormancygrace
dormancygrace force-pushed the mt7620-ppe branch 2 times, most recently from 20b1b06 to bf26c39 Compare August 5, 2026 10:31

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the delta since 483842c. All seven commits were rebased (four got new SHAs), but the net content change is confined to four files: mtk_ppe_mt7620.c, gsw_mt7620_dsa.c, mt7620/config-6.18 and the realtek 721-...-tag-rtl-otto.patch.

All four findings from the previous pass are addressed:

  • the bind_pending bitmap is now consistently non-atomic-under-bind_lock: RX validates ppe->slots[hash] inside bind_lock and destruction publishes the NULL slot before clearing the bit under the same lock. Walked the interleavings — an RX that observed a live slot always sets its bit before mt7620_ppe_flow_destroy() can acquire the lock and clear it, and an RX that acquires the lock afterwards sees NULL, so no stale pending bit survives. No lock inversion either: mt7620_ppe_bind_work() drops bind_lock before taking ppe->lock, and the kfree() in destroy is serialized against the worker's slot dereference by ppe->lock;
  • CONFIG_NET_MEDIATEK_SOC is unset in the target config, so config_add() in scripts/kconfig.pl lets KernelPackage/dsa-mt7620's override promote it to m (the #undef skip only applies to values coming from the override) and both new FILES entries resolve. CONFIG_NET_VENDOR_MEDIATEK=y correctly stays so the symbol remains visible, and NET_MEDIATEK_MT7620_PPE=y still resolves as a bool under an =m dependency;
  • the stale # CONFIG_NET_RALINK_MT7620_PPE is not set line is gone;
  • the MT7620_VAWD2_EGRESS() continuation is aligned.

Three nits inline, all about which commit carries which hunk rather than about the code. CI is green on bf26c39 (Build Kernel, Build all core packages, Build PR Profile all success).

Commit checks

  • 7c086e6 "generic: add Ralink DMA metadata DSA tagger" — body says the ipq40xx/qualcommax/realtek patches are offset-refreshed and "their contents are unchanged", but the realtek patch also gains a new From 0000... header line.
  • 03ee341 "ramips: mt7620: add upstream MediaTek Ethernet support" — body says "The optional kmod-dsa-mt7620 package selects the generic MediaTek driver", but the commit pins CONFIG_NET_MEDIATEK_SOC=y in the target config, which defeats exactly that; bf26c39 reverts the line without mentioning it.

Generated by Claude Code

Comment thread target/linux/ramips/mt7620/config-6.18 Resolved
@dormancygrace
dormancygrace force-pushed the mt7620-ppe branch 2 times, most recently from f5469bd to 052f61c Compare August 5, 2026 23:17

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the delta since bf26c39. All seven commits were rebased onto a much newer main, but only three changed content or message: 0ffb6a2 (message only), 3d2e6aa and 052f61c. I diffed the PR-only patch sets at both heads to strip the rebase noise, so this pass covers exactly the new material.

All three findings from the previous pass are addressed:

  • 0ffb6a2's message no longer claims the refreshed patches' "contents are unchanged" and now documents the added git-am envelope header on the realtek tagger patch — FormalityCheck is fully green on this head;
  • # CONFIG_NET_MEDIATEK_SOC is not set moved out of the PPE commit into 3d2e6aa, which also introduces the mtk_eth.ko / pcs-mtk-lynxi.ko FILES entries, so the introduce-then-fix bisect point is gone. Confirmed CONFIG_PCS_MTK_LYNXI lands in 3d2e6aa too, and that 3d2e6aa's body accounts for both;
  • the two remaining plain ppe->slots[...] stores are now WRITE_ONCE(), matching the READ_ONCE() in mt7620_ppe_rx_process().

Also checked in the folded patch: 336 is byte-for-byte the union of the old 336+337+338+339 minus the generic driver's .name rename, so the fold introduced no new kernel code — the rename moved to the legacy driver instead. The err_cleanup_switch unwind now matches the upstream ladder (unregister → napi_del → free dummy → fall into err_deinit_ppe), and the MT7620 mtk_remove() ordering (mtk_cleanup() before netif_napi_del(), mtk_hw_deinit() last) is consistent with unregister_netdev() running mtk_stop(); dsa_meta allocated early in probe is still released by mtk_free_dev() (mtk_eth_soc.c:4470-4473 in v6.18.41). CONFIG_PCS_MTK_LYNXI is a prompt-less tristate selected by NET_MEDIATEK_SOC, so requesting =m from the kmod resolves consistently.

One nit inline, about the scope of the new #ifdef CONFIG_SOC_MT7620 guard. CI is green on 052f61c (Build Kernel, Build all core packages, Build PR Profile, FormalityCheck all success).


Generated by Claude Code

@dormancygrace

Copy link
Copy Markdown
Contributor Author

Mirrored #24557's review cleanup in b914897: removed the unused if_vlan.h include and documented the existing DSA-unregister-before-conduit-clear ordering in the owning switch commit. No C code or PPE logic changes.

Both series pass actual OpenWrt target/linux/prepare QUILT=1, twice target/linux/refresh with no second-pass diff, and full target/linux/compile with the generic Ethernet and DSA drivers enabled; the PPE configuration also builds its backend. Results/configuration hashes are saved locally. New-head GitHub CI is separate and has just been triggered.

The PR body now clearly labels older hardware measurements as historical and removes the obsolete claim that the current source exactly matches the accepted hardware image. CPU CDMA slot 0 is reserved for VID 0; VIDs 400/416 use software insertion there. PPE FOE egress encapsulation is a separate path. No new hardware run or current-revision throughput result is claimed.

Previous heads are retained on archive/mt7620-{eth,ppe}-pre-review-20260907. Both branches were updated atomically with explicit expected-head leases.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • 0296c121 "ramips: mt7620: restore switch hardware features" — the newly added sentence "During teardown, unregister the DSA child before clearing the conduit so port_vlan_del() can release its conduit VLAN references through vlan_vid_del()" describes mt7620_gsw_upstream_cleanup(), which this diff does not touch; that ordering is already in 5f631eff. Either phrase it as a dependency on the earlier commit or move it there.

Generated by Claude Code

@dormancygrace

Copy link
Copy Markdown
Contributor Author

Correct: the DSA-unregister-before-conduit-clear ordering is already established by the earlier Ethernet-support commit. I described it as a new change in the later switch commit without checking that commit against its parent.

Reworded the paragraph as a dependency in both series: the conduit VLAN references introduced by the switch commit rely on the teardown order supplied by the earlier Ethernet-support commit. Current heads: #24515 bedb23beda7e, #24557 a4d24092cecc.

Verified that the earlier and later cleanup functions both have the same ordering, and that the switch commit adds the conduit vlan_vid_del() call. Every corresponding old/new commit has an identical Git tree; only this one commit message per series changes. All other commit messages and author/signoff information are retained. No source, patch, configuration or runtime change, and no new build is claimed for this message-only correction. Previous heads are preserved on archive/mt7620-{eth,ppe}-pre-message-dependency-20260907.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • 5f631ef, 77e4f23, b3a46d0, 5987e4f — the commit message now ends with a blank line after Signed-off-by:; 984d894, 884b91d, 0d5206c, 54e3ad0, f947c62, bedb23b end with four. All 15 messages were clean at 914fc03, so this came in with the fold/rebase — strip the trailing blank lines.

Generated by Claude Code

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.

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.

Tested on an MT7620N rev 2 eco 6 with repeated interface close/open cycles,
1,000 ICMP packets, bidirectional TCP traffic above 90 Mbit/s, warm reboots
and modular DSA binding.

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]>
The legacy Ralink driver enabled IPv4 transmit and receive checksum
offload on every MT7620 revision. Silicon from ECO 5 also supports
scatter-gather, TSO, TSO6 and IPv6 transmit checksum offload.

The generic MediaTek paths already program and parse the matching legacy
PDMA descriptor bits. Advertise the proven feature set with the original
revision guard, while leaving hardware VLAN insertion disabled for
separate validation.

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.

mtk_gdm_config() rewrites GDM1_FWD_CFG during hardware initialization, so
reapply the MTU-derived jumbo fields there as well.

Tested on a ZBT-WE826 with bidirectional IPv4 and IPv6 traffic. The ordinary
Ethernet/DSA path passed a total IP length of 2030 untagged and 2026 with one
VLAN in both directions. Both cases produce a 2048-byte Ethernet frame
including the header, VLAN tag where present, and FCS. GDM1_FWD_CFG read
0x20790000. At the standard MTU this patch clears both jumbo fields; the
length field is irrelevant while jumbo mode is disabled.

Signed-off-by: Gleb Pesin <[email protected]>
@dormancygrace

Copy link
Copy Markdown
Contributor Author

Confirmed. The old history-rewrite script read messages through git show --format=%B, which added a formatter newline on each rewrite. Switching to raw commit-object reads stopped adding new lines but retained the blank lines already present.

Removed all trailing blank lines from every commit message in both series, leaving exactly one final LF. This normalizes 10 messages in #24515 and 4 in #24557. Current heads: 01bc1994c1ca and 39356b810f7d respectively.

Verified raw commit objects for all 17 old/new pairs: identical source trees, identical author records and trailers, and identical message text after excluding terminal newline padding. No source, patch or configuration changes; no new build or hardware result is claimed. Previous heads are preserved on archive/mt7620-{eth,ppe}-pre-message-whitespace-20260908. The history workflow now checks the final message newline count explicitly.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • 6e7d7c6d "ramips: mt7620: restore switch hardware features" — the body lists PHY link interrupts, mirroring, the CDMA VLAN map and the tagger, but not the link-mode change in the same diff: mt7620_gsw_mac_link_up() stops programming speed/duplex/pause (and mt7620_gsw_pmcr_speed() is deleted) while mac_link_down() no longer asserts PMCR_FORCE, so user ports now take link state from PPSC. Add a line for it.

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.

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]>
MT7620 integrates an HNAT v2 packet processing engine, but OpenWrt leaves it
unused.

Add a TC_SETUP_FT backend to the generic MediaTek Ethernet driver for IPv4
TCP and UDP routing, SNAT and DNAT. Program both directions in the 4K FOE
table and support untagged, VLAN and PPPoE output paths.

Keep PPE ownership with the Ethernet lifecycle and flowtable callbacks. Mark
host FDB entries as MY_MAC, preserve VLAN tags through switch port 7, reset
the PPE by name and track the active MAC MTU.

Serialize pending-flow publication and removal with RX processing, and use
single-copy accesses for the shared slot pointers so flow teardown cannot
race with a stale RX bind request.

Save and restore shared FE, switch and PPE registers. Preserve the CPU miss,
TTL and TCP teardown paths, and disable UDP offload on affected pre-ECO5
silicon.

Hardware tests on an MT7620N rev 2 eco 6 covered plain routing and SNAT, TCP
and UDP in both directions, tagged VLAN 5, PPPoE session 1, untagged traffic,
flow teardown and Ethernet close/open cycles.

Hardware offload sustained about 90 Mbit/s TCP and 76 Mbit/s UDP with roughly
1-3 percent router CPU usage. IPv6 remains on the software path.

Signed-off-by: Gleb Pesin <[email protected]>
Register an indirect flowtable callback so nftables can bind hardware
offload to VLAN and PPPoE upper devices.

Reconstruct VLAN and PPPoE encapsulation from the netdevice path only when
the flow actions did not already provide it. This avoids duplicate headers
when a flowtable is attached below the upper device.

On MT7620 hardware, IPv4 NAT, VLAN and PPPoE all sustained about 89 Mbit/s
with hardware offload and approximately 1 percent CPU use.

Signed-off-by: Gleb Pesin <[email protected]>
Enable IPv6 3-tuple and 5-tuple parsing and switch the FOE table to
the 80-byte format required by HNAT v2 for IPv6 entries.

Mark entries that cross 1 KiB hardware boundaries static so the allocator
never selects them. Use the HNAT v2 IPv6 hash and populate IPv6 5-tuple
entries without NAT.

Tested bidirectionally on ZBT-WE826 through a tagged VLAN 400 path. IPv4 and
IPv6 both sustain about 90 Mbit/s unidirectionally and 45 Mbit/s in each
direction simultaneously. Router CPU use drops from about 79% without
offload to 3.6% with PPE, and to 1.4% during the full-duplex runs.

Signed-off-by: Gleb Pesin <[email protected]>
The MT7620 PPE GDM2 path drops frames larger than 1518 bytes even when the
Ethernet MAC and integrated switch accept them.

Track the configured MTU of each DSA user port. Keep PPE traffic-policy
steering disabled only for ports using an MTU above 1500, while other ports
remain hardware offloaded. Re-enable steering automatically when the port
returns to a standard MTU.

Tested on ZBT-WE826 with PPE active. With the jumbo ports bypassing PPE, the
ordinary Ethernet/DSA path passed a total IP length of 2030 untagged and 2026
with one VLAN in both directions. Both cases produce a 2048-byte Ethernet
frame including the header, VLAN tag where present, and FCS. Returning the
port to MTU 1500 restores PPE steering and hardware-offloaded traffic.

Signed-off-by: Gleb Pesin <[email protected]>
Let hardware create each UNBIND entry before the driver fills the output
half and promotes it to BIND. This preserves the state learned by the PPE
instead of constructing a synthetic entry.

Add IPv6 3-tuple protocol slots and hashing. Select a 4096-entry table
on 64 MiB systems or 8192 entries on systems with at least 96 MiB of
available RAM. Keep the unmodified netfilter limit of two VLAN
encapsulations.

Expose ingress flower on the integrated DSA ports so non-TCP/UDP IPv6
tuples can be validated and managed through the normal classifier
lifecycle.

The 4K and 8K layouts, IPv6 3-tuple, IPv4/IPv6 5-tuple, VLAN, PPPoE
and learn-first paths were validated on MT7620 hardware.

Signed-off-by: Gleb Pesin <[email protected]>
The MT7620 Programming Guide encodes GPC2.FE2SW_IPG as
(FE2SW_IPG + 2) * 8 ns and gives the field an initial value of 0x07,
or 72 ns. At that setting, simultaneous full-duplex traffic returned
through PPE port 7 makes its RX control assert RX_ARL_TOUT and drop frames.

Set the field to 0x0a, or 96 ns, while the PPE backend is active. Save the
complete GPC2 register on start and restore it on stop so unrelated fields
and the pre-existing switch state remain untouched.

The observed failure boundary is between 72 and 80 ns. Three consecutive
90+90 Mbit/s TCP runs at 96 ns completed without retransmissions,
RX-control drops or ARL timeouts at about 5 percent CPU. A 95+95 Mbit/s
UDP control also remained fully hardware offloaded.

A three-run median comparison with literal iperf3 --bidir and two streams
in each direction produced these receive rates and DUT CPU loads:

                         upload / download             CPU
CPU forwarding          72.815 / 69.006 Mbit/s       100.0%
software flowtable      89.786 / 89.961 Mbit/s        64.9%
PPE                     89.984 / 89.984 Mbit/s         4.4%

The PPE result loads the four physical DUT port directions at approximately
400 Mbit/s in total and has zero TCP retransmissions.

With an 18-byte UDP payload, the median delivered packet rates were:

                         upload / download             CPU
CPU forwarding          23,285 / 23,289 pps          100.0%
software flowtable      27,589 / 27,555 pps          100.0%
PPE                    139,888 / 139,931 pps        4.8-5.0%

All PPE switch, PSE and PDMA drop counters remained at zero. The no-offload
path saturates the CPU. The software flowtable reaches the TCP target, but
its small-packet path also saturates the CPU while processing skb and
memory traffic. PPE sustains both workloads at about 5 percent CPU.

Signed-off-by: Gleb Pesin <[email protected]>
@dormancygrace

Copy link
Copy Markdown
Contributor Author

Added the missing link-mode description in both series. The switch commit now explicitly states that embedded PHY user ports take negotiated link, speed, duplex and pause from PPSC; the link callbacks clear PMCR_FORCE and no longer program those negotiated parameters, and the obsolete speed helper is removed.

I also checked the complete owning diff against its parent and expanded the related description of PHY IRQ setup/synchronization/teardown, the shared mirroring destination, and the copied DSA child platform data plus IRQ lookup error handling. The earlier conduit teardown ordering remains correctly described as a dependency.

Current heads: #24515 b7ae2b74d699, #24557 7ff466bb3927. Only the switch commit message changes in each series. All 17 corresponding Git trees remain identical, author records and trailers are retained, and every message still ends in exactly one LF. No source change or new runtime/build result is claimed. Previous heads are retained on archive/mt7620-{eth,ppe}-pre-switch-message-20260908.

Boilerplate4u pushed a commit to Boilerplate4u/openwrt that referenced this pull request Sep 8, 2026
The D-Link DAP-1620 A2 is a dual-band Wi-Fi range extender with one
Gigabit Ethernet port.

Hardware:
- MediaTek MT7620A, 580 MHz
- 64 MiB RAM
- 8 MiB SPI NOR flash
- Integrated MT7620 2.4 GHz Wi-Fi
- MediaTek MT7612E 5 GHz 802.11ac radio over PCIe
- Realtek RTL8211E Gigabit Ethernet PHY
- Reset and WPS buttons
- Red/green status LED and three signal-strength indicators

Connect the RTL8211E on MDIO address 1 to DSA user port 5 through
RGMII1. Use rgmii-id so the PHY supplies both internal clock delays
while the MT7620 MAC-side delays remain disabled. Describe port 6
as the fixed 1 Gbps full-duplex CPU connection.

Select kmod-mt76x2, kmod-phy-realtek, kmod-dsa-mt7620 and
dap1620-leds. Drop swconfig and rssileds, and configure the DSA lan
interface as the default LAN.

Flash layout, with exclusive end addresses:
- U-Boot:   0x000000-0x030000
- NVRAM:    0x030000-0x040000
- Factory:  0x040000-0x050000
- Firmware: 0x050000-0x800000

Calibration and MAC addresses:
- 2.4 GHz calibration: factory + 0x0000
- 5 GHz calibration:   factory + 0x8000
- Ethernet MAC:        factory + 0xffe8
- 2.4 GHz MAC:         Ethernet MAC incremented by 1
- 5 GHz MAC:           factory + 0xffd4

Preserve U-Boot, NVRAM and factory data as read-only partitions.
The MAC increment changes the address value, not the flash offset.

Flash constraints:

U-Boot, NVRAM and factory data occupy the first 320 KiB of the
8 MiB flash, leaving 7872 KiB for firmware. The image must fit
within this limit.

The tested development squashfs sysupgrade image, including
luci-light, dap1620-leds and the selected review changes, is
7,274,774 bytes, leaving approximately 768 KiB below the image
size limit.

Tested image:
  dap1620-20260908-090036-4c6a000-review1-sysupgrade.bin

SHA256:
  ce884451fc968af15d6eed9cecc02d5b0f0ad29f07b3a7865bec32c1f883ec98

These figures apply to this development image. Check the actual
size and presence of any newly built sysupgrade image before
flashing. The limited flash capacity constrains additional
packages. WPS functionality is not included.

LED behaviour:

Add the dap1620-leds service in place of rssileds. Show solid red
during Linux startup, blinking amber when the selected uplink is
unavailable, and solid green when it is connected.

In Ethernet mode, use physical carrier on lan as the uplink
condition and keep the signal indicators off. In repeater mode,
require an associated and authorized Wi-Fi station and follow
that station's signal strength. No DHCP, DNS or Internet
reachability checks are performed.

Use these configurable signal thresholds:
- Below -75 dBm: first indicator amber
- -75 to below -65 dBm: one green indicator
- -65 to below -55 dBm: two green indicators
- -55 dBm or stronger: three green indicators

These thresholds are policy defaults, not stock firmware values.
Keep the signal indicators off when disconnected or when RSSI
is unavailable. Require explicit station selection when multiple
STA configurations exist.

Installation:

Use the U-Boot serial console at 57600 baud, 8N1, without flow
control. Connect Ethernet to a TFTP server at 192.168.0.100.

Start from a cold power-on. Press 4 at the bootloader menu to
enter the command line. For RAM-only testing:

  setenv ipaddr 192.168.0.1
  setenv serverip 192.168.0.100
  tftpboot 0x81000000 openwrt-ramips-mt7620-dlink_dap-1620-a2-initramfs-kernel.bin
  bootm 0x81000000

This loads and runs OpenWrt without writing the firmware to flash.

For persistent installation, cold-start the device and select
U-Boot menu option 2, "Load system code then write to Flash via
TFTP". Confirm with Y and provide the device and server addresses
above and this filename:

  openwrt-ramips-mt7620-dlink_dap-1620-a2-squashfs-sysupgrade.bin

After flashing has completed, disconnect power, allow the device
to power down fully, and reconnect it. Verify that OpenWrt boots
from flash before considering installation complete.

Subsequent upgrades can use the normal OpenWrt sysupgrade procedure.

Testing:

Development testing on DAP-1620 A2 confirmed:
- DSA initialization and RTL8211E detection through MDIO
- Port 5 operating with rgmii-id
- 1 Gbps full-duplex Ethernet negotiation
- LAN traffic and link recovery
- Detection of both Wi-Fi radios
- Initramfs boot through U-Boot/TFTP
- Flashing and booting a squashfs sysupgrade image
- Cold power cycle after the initial flash
- Ethernet LED behaviour with carrier disconnected and connected
- Wi-Fi station association and authorized-state detection
- Three green signal indicators at an observed RSSI of -54 dBm

A 60-minute bidirectional TCP soak completed successfully at
approximately 250 Mbit/s DAP TX + 217 Mbit/s DAP RX. All iperf3
phases exited successfully. The sampled link status remained at
1 Gbps full duplex, with no observed link drops or increases in
the switch MIB bad-packet/error counters.

Additional 30-second TCP tests:
- DAP TX: 578 Mbit/s, 27 retransmissions
- DAP RX: 377 Mbit/s, 37 retransmissions
- Bidirectional: 254 + 221 Mbit/s, 0 + 231 retransmissions

CPU usage was close to saturation during the tests. The higher
retransmission count in the server-to-DAP direction during
bidirectional traffic could be related to CPU/softirq pressure,
but the cause has not been established. The generic rx_dropped
counter increased by 124 during the 60-minute soak.

These tests terminate TCP on the DUT itself and are not a
forwarding or hardware flow-offload benchmark. Hardware offload,
such as openwrt#24515, may help forwarding workloads, but is outside
the scope of this support. With only one external Ethernet port,
a conventional wired LAN-to-WAN forwarding test is not available.

The results support basic Ethernet/DSA stability under sustained
load. Speed negotiation at 100 Mbit/s and repeated link-cycle
testing remain separate tests. Weaker-RSSI LED threshold testing
also remains to be completed.

These results describe the tested development revision.

This support builds on Senthil Durairaj's original DAP-1620 A2
work in PR openwrt#17027 and the MT7620 DSA driver introduced in openwrt#24493.

Link: openwrt#17027
Link: openwrt#24493
Link: https://forum.openwrt.org/t/253264
Signed-off-by: Senthil Durairaj <[email protected]>
Signed-off-by: Boyler Fourcade <[email protected]>
Boilerplate4u pushed a commit to Boilerplate4u/openwrt that referenced this pull request Sep 8, 2026
The D-Link DAP-1620 A2 is a dual-band Wi-Fi range extender with one
Gigabit Ethernet port.

Hardware:
- MediaTek MT7620A, 580 MHz
- 64 MiB RAM
- 8 MiB SPI NOR flash
- Integrated MT7620 2.4 GHz Wi-Fi
- MediaTek MT7612E 5 GHz 802.11ac radio over PCIe
- Realtek RTL8211E Gigabit Ethernet PHY
- Reset and WPS buttons
- Red/green status LED and three signal-strength indicators

Connect the RTL8211E on MDIO address 1 to DSA user port 5 through
RGMII1. Use rgmii-id so the PHY supplies both internal clock delays
while the MT7620 MAC-side delays remain disabled. Describe port 6
as the fixed 1 Gbps full-duplex CPU connection.

Select kmod-mt76x2, kmod-phy-realtek, kmod-dsa-mt7620 and
dap1620-leds. Drop swconfig and rssileds, and configure the DSA lan
interface as the default LAN.

Flash layout, with exclusive end addresses:
- U-Boot:   0x000000-0x030000
- NVRAM:    0x030000-0x040000
- Factory:  0x040000-0x050000
- Firmware: 0x050000-0x800000

Calibration and MAC addresses:
- 2.4 GHz calibration: factory + 0x0000
- 5 GHz calibration:   factory + 0x8000
- Ethernet MAC:        factory + 0xffe8
- 2.4 GHz MAC:         Ethernet MAC incremented by 1
- 5 GHz MAC:           factory + 0xffd4

Preserve U-Boot, NVRAM and factory data as read-only partitions.
The MAC increment changes the address value, not the flash offset.

Flash constraints:

U-Boot, NVRAM and factory data occupy the first 320 KiB of the
8 MiB flash, leaving 7872 KiB for firmware. The image must fit
within this limit.

The tested development squashfs sysupgrade image, including
luci-light, dap1620-leds and the selected review changes, is
7,274,774 bytes, leaving approximately 768 KiB below the image
size limit.

Tested image:
  dap1620-20260908-090036-4c6a000-review1-sysupgrade.bin

SHA256:
  ce884451fc968af15d6eed9cecc02d5b0f0ad29f07b3a7865bec32c1f883ec98

These figures apply to this development image. Check the actual
size and presence of any newly built sysupgrade image before
flashing. The limited flash capacity constrains additional
packages. WPS functionality is not included.

LED behaviour:

Add the dap1620-leds service in place of rssileds. Show solid red
during Linux startup, blinking amber when the selected uplink is
unavailable, and solid green when it is connected.

In Ethernet mode, use physical carrier on lan as the uplink
condition and keep the signal indicators off. In repeater mode,
require an associated and authorized Wi-Fi station and follow
that station's signal strength. No DHCP, DNS or Internet
reachability checks are performed.

Use these configurable signal thresholds:
- Below -75 dBm: first indicator amber
- -75 to below -65 dBm: one green indicator
- -65 to below -55 dBm: two green indicators
- -55 dBm or stronger: three green indicators

These thresholds are policy defaults, not stock firmware values.
Keep the signal indicators off when disconnected or when RSSI
is unavailable. Require explicit station selection when multiple
STA configurations exist.

Installation:

Use the U-Boot serial console at 57600 baud, 8N1, without flow
control. Connect Ethernet to a TFTP server at 192.168.0.100.

Start from a cold power-on. Press 4 at the bootloader menu to
enter the command line. For RAM-only testing:

  setenv ipaddr 192.168.0.1
  setenv serverip 192.168.0.100
  tftpboot 0x81000000 openwrt-ramips-mt7620-dlink_dap-1620-a2-initramfs-kernel.bin
  bootm 0x81000000

This loads and runs OpenWrt without writing the firmware to flash.

For persistent installation, cold-start the device and select
U-Boot menu option 2, "Load system code then write to Flash via
TFTP". Confirm with Y and provide the device and server addresses
above and this filename:

  openwrt-ramips-mt7620-dlink_dap-1620-a2-squashfs-sysupgrade.bin

After flashing has completed, disconnect power, allow the device
to power down fully, and reconnect it. Verify that OpenWrt boots
from flash before considering installation complete.

Subsequent upgrades can use the normal OpenWrt sysupgrade procedure.

Testing:

Development testing on DAP-1620 A2 confirmed:
- DSA initialization and RTL8211E detection through MDIO
- Port 5 operating with rgmii-id
- 1 Gbps full-duplex Ethernet negotiation
- LAN traffic and link recovery
- Detection of both Wi-Fi radios
- Initramfs boot through U-Boot/TFTP
- Flashing and booting a squashfs sysupgrade image
- Cold power cycle after the initial flash
- Ethernet LED behaviour with carrier disconnected and connected
- Wi-Fi station association and authorized-state detection
- Three green signal indicators at an observed RSSI of -54 dBm

A 60-minute bidirectional TCP soak completed successfully at
approximately 250 Mbit/s DAP TX + 217 Mbit/s DAP RX. All iperf3
phases exited successfully. The sampled link status remained at
1 Gbps full duplex, with no observed link drops or increases in
the switch MIB bad-packet/error counters.

Additional 30-second TCP tests:
- DAP TX: 578 Mbit/s, 27 retransmissions
- DAP RX: 377 Mbit/s, 37 retransmissions
- Bidirectional: 254 + 221 Mbit/s, 0 + 231 retransmissions

CPU usage was close to saturation during the tests. The higher
retransmission count in the server-to-DAP direction during
bidirectional traffic could be related to CPU/softirq pressure,
but the cause has not been established. The generic rx_dropped
counter increased by 124 during the 60-minute soak.

These tests terminate TCP on the DUT itself and are not a
forwarding or hardware flow-offload benchmark. Hardware offload,
such as openwrt#24515, may help forwarding workloads, but is outside
the scope of this support. With only one external Ethernet port,
a conventional wired LAN-to-WAN forwarding test is not available.

The results support basic Ethernet/DSA stability under sustained
load. Speed negotiation at 100 Mbit/s and repeated link-cycle
testing remain separate tests. Weaker-RSSI LED threshold testing
also remains to be completed.

These results describe the tested development revision.

This support builds on Senthil Durairaj's original DAP-1620 A2
work in PR openwrt#17027 and the MT7620 DSA driver introduced in openwrt#24493.

Link: openwrt#17027
Link: openwrt#24493
Link: https://forum.openwrt.org/t/253264
Signed-off-by: Senthil Durairaj <[email protected]>
Signed-off-by: Boyler Fourcade <[email protected]>

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 new commits; no new issues found.


Generated by Claude Code

@Boilerplate4u

Copy link
Copy Markdown

@dormancygrace, good job so far! Once you think it's good enough for a semi-stable PR, give me a shout and I'll start testing on my DAP-1620.

@dormancygrace

Copy link
Copy Markdown
Contributor Author

@Boilerplate4u You're welcome to start testing on your DAP-1620 now. I already have more than 100 devices running the MTK Ethernet + DSA + PPE stack in production.

This PR remains a draft only because it depends on the Ethernet support in #24557, which has not been merged yet. The draft status is not a request to hold off on testing.

Feedback from your DAP-1620 would be very welcome. Please include the board revision and the commit you build when reporting results, so we can track device and revision coverage. Thanks for offering to test!

Boilerplate4u pushed a commit to Boilerplate4u/openwrt that referenced this pull request Sep 10, 2026
The D-Link DAP-1620 A2 is a dual-band Wi-Fi range extender with one
Gigabit Ethernet port.

Hardware:
- MediaTek MT7620A, 580 MHz
- 64 MiB RAM
- 8 MiB SPI NOR flash
- Integrated MT7620 2.4 GHz Wi-Fi
- MediaTek MT7612E 5 GHz 802.11ac radio over PCIe
- Realtek RTL8211E Gigabit Ethernet PHY
- Reset and WPS buttons
- Red/green status LED and three signal-strength indicators

Connect the RTL8211E on MDIO address 1 to DSA user port 5 through
RGMII1. Use rgmii-id so the PHY supplies both internal clock delays
while the MT7620 MAC-side delays remain disabled. Describe port 6
as the fixed 1 Gbps full-duplex CPU connection.

Select kmod-mt76x2, kmod-phy-realtek, kmod-dsa-mt7620 and
dap1620-leds. Drop swconfig and rssileds, and configure the DSA lan
interface as the default LAN.

Flash layout, with exclusive end addresses:
- U-Boot:   0x000000-0x030000
- NVRAM:    0x030000-0x040000
- Factory:  0x040000-0x050000
- Firmware: 0x050000-0x800000

Calibration and MAC addresses:
- 2.4 GHz calibration: factory + 0x0000
- 5 GHz calibration:   factory + 0x8000
- Ethernet MAC:        factory + 0xffe8
- 2.4 GHz MAC:         Ethernet MAC incremented by 1
- 5 GHz MAC:           factory + 0xffd4

Preserve U-Boot, NVRAM and factory data as read-only partitions.
The MAC increment changes the address value, not the flash offset.

Flash constraints:

U-Boot, NVRAM and factory data occupy the first 320 KiB of the
8 MiB flash, leaving 7872 KiB for firmware. The image must fit
within this limit.

The separately built AP test profile excludes PPP/PPPoE packages
that are not needed for the AP-only test configuration. These
package exclusions are not part of the upstream device defaults.

The verified AP test sysupgrade image is 7,078,166 bytes, leaving
982,762 bytes below the firmware partition limit.

Tested AP images:
  dap1620-20260909-aa0bbbb2-ap-no-ppp-sysupgrade.bin
  dap1620-20260909-aa0bbbb2-ap-no-ppp-initramfs.bin

SHA256:
  e3b9a5861a8b458ce6ff540f052b089cb4d274be84d0d4f430dd9f7d84997be1
  71c9eb3dbac933db7ea3731de2b516301791455069fe49629fbfa0866985935e

The AP build record identifies source commit
60a9fbe. The aa0bbbb string
in the image filenames is a build label and is not sufficient by
itself to identify Git provenance.

LED behaviour:

Use the normal OpenWrt boot LED handling. The status LED is red by
default during startup through the DTS default state. Once
dap1620-leds starts, show solid green when the selected uplink is
connected and blinking amber when it is unavailable.

In Ethernet mode, use physical carrier on lan as the uplink
condition and keep the signal indicators off. In repeater mode,
require an associated and authorized Wi-Fi station and follow
that station's signal strength. No DHCP, DNS or Internet
reachability checks are performed.

Load the LED configuration once when the daemon starts rather than
re-reading UCI on every two-second sample. Restart the service on
the existing dap1620-leds and wireless reload triggers so changed
settings are read again.

Use these configurable signal thresholds:
- Below -75 dBm: first indicator amber
- -75 to below -65 dBm: one green indicator
- -65 to below -55 dBm: two green indicators
- -55 dBm or stronger: three green indicators

These thresholds are policy defaults, not stock firmware values.
Keep the signal indicators off when disconnected or when RSSI
is unavailable. Require explicit station selection when multiple
STA configurations exist.

Do not ship a duplicate GPLv2 COPYING file for the LED shell-script
package; keep GPL-2.0-only package metadata and SPDX headers.

Installation:

Use the U-Boot serial console at 57600 baud, 8N1, without flow
control. Connect Ethernet to a TFTP server at 192.168.0.100.

Start from a cold power-on. Press 4 at the bootloader menu to enter
the command line. For RAM-only testing:

  setenv ipaddr 192.168.0.1
  setenv serverip 192.168.0.100
  tftpboot 0x81000000 openwrt-ramips-mt7620-dlink_dap-1620-a2-initramfs-kernel.bin
  bootm 0x81000000

For persistent installation, cold-start the device and select
U-Boot menu option 2, "Load system code then write to Flash via
TFTP". Confirm with Y and use:

  openwrt-ramips-mt7620-dlink_dap-1620-a2-squashfs-sysupgrade.bin

After flashing completes, disconnect power, allow the device to
power down fully, and reconnect it. Subsequent upgrades can use
the normal OpenWrt sysupgrade procedure.

Development testing on DAP-1620 A2 confirmed:
- DSA initialization and RTL8211E detection through MDIO
- Port 5 operating with rgmii-id
- 1 Gbps full-duplex Ethernet negotiation
- LAN traffic and link recovery
- Detection of both Wi-Fi radios
- Initramfs boot through U-Boot/TFTP
- Flashing and booting a squashfs sysupgrade image
- Cold power cycle after the initial flash
- Ethernet LED behaviour with carrier disconnected and connected
- Wi-Fi station association and authorized-state detection
- Three green signal indicators at an observed RSSI of -54 dBm

A 60-minute bidirectional TCP soak completed successfully at
approximately 250 Mbit/s DAP TX + 217 Mbit/s DAP RX. The sampled
link status remained at 1 Gbps full duplex with no observed link
drops or increases in the observed switch MIB bad-packet/error
counters.

The DUT itself terminated the TCP traffic, so these tests are not
a forwarding or hardware flow-offload benchmark. PPE work such as
openwrt#24515 is outside the scope of this support.

This support builds on Senthil Durairaj's original DAP-1620 A2
work in PR openwrt#17027 and the MT7620 DSA driver introduced in openwrt#24493.

Link: openwrt#17027
Link: openwrt#24493
Link: https://forum.openwrt.org/t/253264

Signed-off-by: Senthil Durairaj <[email protected]>
Signed-off-by: Boyler Fourcade <[email protected]>
Boilerplate4u pushed a commit to Boilerplate4u/openwrt that referenced this pull request Sep 10, 2026
The D-Link DAP-1620 A2 is a dual-band Wi-Fi range extender with one
Gigabit Ethernet port.

Hardware:
- MediaTek MT7620A, 580 MHz
- 64 MiB RAM
- 8 MiB SPI NOR flash
- Integrated MT7620 2.4 GHz Wi-Fi
- MediaTek MT7612E 5 GHz 802.11ac radio over PCIe
- Realtek RTL8211E Gigabit Ethernet PHY
- Reset and WPS buttons
- Red/green status LED and three signal-strength indicators

Connect the RTL8211E on MDIO address 1 to DSA user port 5 through
RGMII1. Use rgmii-id so the PHY supplies both internal clock delays
while the MT7620 MAC-side delays remain disabled. Describe port 6
as the fixed 1 Gbps full-duplex CPU connection.

Select kmod-mt76x2, kmod-phy-realtek, kmod-dsa-mt7620 and
dap1620-leds. Drop swconfig and rssileds, and configure the DSA lan
interface as the default LAN.

Flash layout, with exclusive end addresses:
- U-Boot:   0x000000-0x030000
- NVRAM:    0x030000-0x040000
- Factory:  0x040000-0x050000
- Firmware: 0x050000-0x800000

Calibration and MAC addresses:
- 2.4 GHz calibration: factory + 0x0000
- 5 GHz calibration:   factory + 0x8000
- Ethernet MAC:        factory + 0xffe8
- 2.4 GHz MAC:         Ethernet MAC incremented by 1
- 5 GHz MAC:           factory + 0xffd4

Preserve U-Boot, NVRAM and factory data as read-only partitions.
The MAC increment changes the address value, not the flash offset.

Flash constraints:

U-Boot, NVRAM and factory data occupy the first 320 KiB of the
8 MiB flash, leaving 7872 KiB for firmware. The image must fit
within this limit.

The separately built AP test profile excludes PPP/PPPoE packages
that are not needed for the AP-only test configuration. These
package exclusions are not part of the upstream device defaults.

The verified AP test sysupgrade image is 7,078,166 bytes, leaving
982,762 bytes below the firmware partition limit.

Tested AP images:
  dap1620-20260909-aa0bbbb2-ap-no-ppp-sysupgrade.bin
  dap1620-20260909-aa0bbbb2-ap-no-ppp-initramfs.bin

SHA256:
  e3b9a5861a8b458ce6ff540f052b089cb4d274be84d0d4f430dd9f7d84997be1
  71c9eb3dbac933db7ea3731de2b516301791455069fe49629fbfa0866985935e

The AP build record identifies source commit
60a9fbe. The aa0bbbb string
in the image filenames is a build label and is not sufficient by
itself to identify Git provenance.

LED behaviour:

Use the normal OpenWrt boot LED handling. The status LED is red by
default during startup through the DTS default state. Once
dap1620-leds starts, show solid green when the selected uplink is
connected and blinking amber when it is unavailable.

In Ethernet mode, use physical carrier on lan as the uplink
condition and keep the signal indicators off. In repeater mode,
require an associated and authorized Wi-Fi station and follow
that station's signal strength. No DHCP, DNS or Internet
reachability checks are performed.

Load the LED configuration once when the daemon starts rather than
re-reading UCI on every two-second sample. Restart the service on
the existing dap1620-leds and wireless reload triggers so changed
settings are read again.

Use these configurable signal thresholds:
- Below -75 dBm: first indicator amber
- -75 to below -65 dBm: one green indicator
- -65 to below -55 dBm: two green indicators
- -55 dBm or stronger: three green indicators

These thresholds are policy defaults, not stock firmware values.
Keep the signal indicators off when disconnected or when RSSI
is unavailable. Require explicit station selection when multiple
STA configurations exist.

Do not ship a duplicate GPLv2 COPYING file for the LED shell-script
package; keep GPL-2.0-only package metadata and SPDX headers.

Installation:

Use the U-Boot serial console at 57600 baud, 8N1, without flow
control. Connect Ethernet to a TFTP server at 192.168.0.100.

Start from a cold power-on. Press 4 at the bootloader menu to enter
the command line. For RAM-only testing:

  setenv ipaddr 192.168.0.1
  setenv serverip 192.168.0.100
  tftpboot 0x81000000 openwrt-ramips-mt7620-dlink_dap-1620-a2-initramfs-kernel.bin
  bootm 0x81000000

For persistent installation, cold-start the device and select
U-Boot menu option 2, "Load system code then write to Flash via
TFTP". Confirm with Y and use:

  openwrt-ramips-mt7620-dlink_dap-1620-a2-squashfs-sysupgrade.bin

After flashing completes, disconnect power, allow the device to
power down fully, and reconnect it. Subsequent upgrades can use
the normal OpenWrt sysupgrade procedure.

Development testing on DAP-1620 A2 confirmed:
- DSA initialization and RTL8211E detection through MDIO
- Port 5 operating with rgmii-id
- 1 Gbps full-duplex Ethernet negotiation
- LAN traffic and link recovery
- Detection of both Wi-Fi radios
- Initramfs boot through U-Boot/TFTP
- Flashing and booting a squashfs sysupgrade image
- Cold power cycle after the initial flash
- Ethernet LED behaviour with carrier disconnected and connected
- Wi-Fi station association and authorized-state detection
- Three green signal indicators at an observed RSSI of -54 dBm

A 60-minute bidirectional TCP soak completed successfully at
approximately 250 Mbit/s DAP TX + 217 Mbit/s DAP RX. The sampled
link status remained at 1 Gbps full duplex with no observed link
drops or increases in the observed switch MIB bad-packet/error
counters.

The DUT itself terminated the TCP traffic, so these tests are not
a forwarding or hardware flow-offload benchmark. PPE work such as
openwrt#24515 is outside the scope of this support.

This support builds on Senthil Durairaj's original DAP-1620 A2
work in PR openwrt#17027 and the MT7620 DSA driver introduced in openwrt#24493.

Link: openwrt#17027
Link: openwrt#24493
Link: https://forum.openwrt.org/t/253264

Signed-off-by: Senthil Durairaj <[email protected]>
Signed-off-by: Boyler Fourcade <[email protected]>
Boilerplate4u pushed a commit to Boilerplate4u/openwrt that referenced this pull request Sep 10, 2026
The D-Link DAP-1620 A2 is a dual-band Wi-Fi range extender with one
Gigabit Ethernet port.

Hardware:
- MediaTek MT7620A, 580 MHz
- 64 MiB RAM
- 8 MiB SPI NOR flash
- Integrated MT7620 2.4 GHz Wi-Fi
- MediaTek MT7612E 5 GHz 802.11ac radio over PCIe
- Realtek RTL8211E Gigabit Ethernet PHY
- Reset and WPS buttons
- Red/green status LED and three signal-strength indicators

Connect the RTL8211E on MDIO address 1 to DSA user port 5 through
RGMII1. Use rgmii-id so the PHY supplies both internal clock delays
while the MT7620 MAC-side delays remain disabled. Describe port 6
as the fixed 1 Gbps full-duplex CPU connection.

Select kmod-mt76x2, kmod-phy-realtek, kmod-dsa-mt7620 and
dap1620-leds. Drop swconfig and rssileds, and configure the DSA lan
interface as the default LAN.

Flash layout, with exclusive end addresses:
- U-Boot:   0x000000-0x030000
- NVRAM:    0x030000-0x040000
- Factory:  0x040000-0x050000
- Firmware: 0x050000-0x800000

Calibration and MAC addresses:
- 2.4 GHz calibration: factory + 0x0000
- 5 GHz calibration:   factory + 0x8000
- Ethernet MAC:        factory + 0xffe8
- 2.4 GHz MAC:         Ethernet MAC incremented by 1
- 5 GHz MAC:           factory + 0xffd4

Preserve U-Boot, NVRAM and factory data as read-only partitions.
The MAC increment changes the address value, not the flash offset.

Flash constraints:

U-Boot, NVRAM and factory data occupy the first 320 KiB of the
8 MiB flash, leaving 7872 KiB for firmware. The image must fit
within this limit.

The separately built AP test profile excludes PPP/PPPoE packages
that are not needed for the AP-only test configuration. These
package exclusions are not part of the upstream device defaults.

The verified AP test sysupgrade image is 7,078,166 bytes, leaving
982,762 bytes below the firmware partition limit.

Tested AP images:
  dap1620-20260909-aa0bbbb2-ap-no-ppp-sysupgrade.bin
  dap1620-20260909-aa0bbbb2-ap-no-ppp-initramfs.bin

SHA256:
  e3b9a5861a8b458ce6ff540f052b089cb4d274be84d0d4f430dd9f7d84997be1
  71c9eb3dbac933db7ea3731de2b516301791455069fe49629fbfa0866985935e

The AP build record identifies source commit
60a9fbe. The aa0bbbb string
in the image filenames is a build label and is not sufficient by
itself to identify Git provenance.

LED behaviour:

Use the normal OpenWrt boot LED handling. The status LED is red by
default during startup through the DTS default state. Once
dap1620-leds starts, show solid green when the selected uplink is
connected and blinking amber when it is unavailable.

In Ethernet mode, use physical carrier on lan as the uplink
condition and keep the signal indicators off. In repeater mode,
require an associated and authorized Wi-Fi station and follow
that station's signal strength. No DHCP, DNS or Internet
reachability checks are performed.

Load the LED configuration once when the daemon starts rather than
re-reading UCI on every two-second sample. Restart the service on
the existing dap1620-leds and wireless reload triggers so changed
settings are read again.

Use these configurable signal thresholds:
- Below -75 dBm: first indicator amber
- -75 to below -65 dBm: one green indicator
- -65 to below -55 dBm: two green indicators
- -55 dBm or stronger: three green indicators

These thresholds are policy defaults, not stock firmware values.
Keep the signal indicators off when disconnected or when RSSI
is unavailable. Require explicit station selection when multiple
STA configurations exist.

Do not ship a duplicate GPLv2 COPYING file for the LED shell-script
package; keep GPL-2.0-only package metadata and SPDX headers.

Installation:

Use the U-Boot serial console at 57600 baud, 8N1, without flow
control. Connect Ethernet to a TFTP server at 192.168.0.100.

Start from a cold power-on. Press 4 at the bootloader menu to enter
the command line. For RAM-only testing:

  setenv ipaddr 192.168.0.1
  setenv serverip 192.168.0.100
  tftpboot 0x81000000 openwrt-ramips-mt7620-dlink_dap-1620-a2-initramfs-kernel.bin
  bootm 0x81000000

For persistent installation, cold-start the device and select
U-Boot menu option 2, "Load system code then write to Flash via
TFTP". Confirm with Y and use:

  openwrt-ramips-mt7620-dlink_dap-1620-a2-squashfs-sysupgrade.bin

After flashing completes, disconnect power, allow the device to
power down fully, and reconnect it. Subsequent upgrades can use
the normal OpenWrt sysupgrade procedure.

Development testing on DAP-1620 A2 confirmed:
- DSA initialization and RTL8211E detection through MDIO
- Port 5 operating with rgmii-id
- 1 Gbps full-duplex Ethernet negotiation
- LAN traffic and link recovery
- Detection of both Wi-Fi radios
- Initramfs boot through U-Boot/TFTP
- Flashing and booting a squashfs sysupgrade image
- Cold power cycle after the initial flash
- Ethernet LED behaviour with carrier disconnected and connected
- Wi-Fi station association and authorized-state detection
- Three green signal indicators at an observed RSSI of -54 dBm

A 60-minute bidirectional TCP soak completed successfully at
approximately 250 Mbit/s DAP TX + 217 Mbit/s DAP RX. The sampled
link status remained at 1 Gbps full duplex with no observed link
drops or increases in the observed switch MIB bad-packet/error
counters.

The DUT itself terminated the TCP traffic, so these tests are not
a forwarding or hardware flow-offload benchmark. PPE work such as
openwrt#24515 is outside the scope of this support.

This support builds on Senthil Durairaj's original DAP-1620 A2
work in PR openwrt#17027 and the MT7620 DSA driver introduced in openwrt#24493.

Link: openwrt#17027
Link: openwrt#24493
Link: https://forum.openwrt.org/t/253264

Signed-off-by: Senthil Durairaj <[email protected]>
Signed-off-by: Boyler Fourcade <[email protected]>
Boilerplate4u pushed a commit to Boilerplate4u/openwrt that referenced this pull request Sep 10, 2026
The D-Link DAP-1620 A2 is a dual-band Wi-Fi range extender with one
Gigabit Ethernet port.

Hardware:
- MediaTek MT7620A, 580 MHz
- 64 MiB RAM
- 8 MiB SPI NOR flash
- Integrated MT7620 2.4 GHz Wi-Fi
- MediaTek MT7612E 5 GHz 802.11ac radio over PCIe
- Realtek RTL8211E Gigabit Ethernet PHY
- Reset and WPS buttons
- Red/green status LED and three signal-strength indicators

Connect the RTL8211E on MDIO address 1 to DSA user port 5 through
RGMII1. Use rgmii-id so the PHY supplies both internal clock delays
while the MT7620 MAC-side delays remain disabled. Describe port 6
as the fixed 1 Gbps full-duplex CPU connection.

Select kmod-mt76x2, kmod-phy-realtek, kmod-dsa-mt7620 and
dap1620-leds. Drop swconfig and rssileds, and configure the DSA lan
interface as the default LAN.

Flash layout, with exclusive end addresses:
- U-Boot:   0x000000-0x030000
- NVRAM:    0x030000-0x040000
- Factory:  0x040000-0x050000
- Firmware: 0x050000-0x800000

Calibration and MAC addresses:
- 2.4 GHz calibration: factory + 0x0000
- 5 GHz calibration:   factory + 0x8000
- Ethernet MAC:        factory + 0xffe8
- 2.4 GHz MAC:         Ethernet MAC incremented by 1
- 5 GHz MAC:           factory + 0xffd4

Preserve U-Boot, NVRAM and factory data as read-only partitions.
The MAC increment changes the address value, not the flash offset.

Flash constraints:

U-Boot, NVRAM and factory data occupy the first 320 KiB of the
8 MiB flash, leaving 7872 KiB for firmware. The image must fit
within this limit.

LED behaviour:

Use the normal OpenWrt boot LED handling. The status LED is red by
default during startup through the DTS default state. Once
dap1620-leds starts, show solid green when the selected uplink is
connected and blinking amber when it is unavailable.

In Ethernet mode, use physical carrier on lan as the uplink
condition and keep the signal indicators off. In repeater mode,
require an associated and authorized Wi-Fi station and follow
that station's signal strength. No DHCP, DNS or Internet
reachability checks are performed.

Load the LED policy configuration when the daemon starts. In auto
and repeater modes, load the wireless configuration to select the
station; explicit Ethernet mode does not depend on it. Restart the
service on the existing dap1620-leds and wireless reload triggers
so changed settings are read again.

Use these configurable signal thresholds:
- Below -75 dBm: first indicator amber
- -75 to below -65 dBm: one green indicator
- -65 to below -55 dBm: two green indicators
- -55 dBm or stronger: three green indicators

These thresholds are policy defaults, not stock firmware values.
Keep the signal indicators off when disconnected or when RSSI
is unavailable. Require explicit station selection when multiple
STA configurations exist.

Use GPL-2.0-only package metadata and SPDX headers for the LED
shell-script package.

Installation:

Use the U-Boot serial console at 57600 baud, 8N1, without flow
control. Connect Ethernet to a TFTP server at 192.168.0.100.

Start from a cold power-on. Press 4 at the bootloader menu to enter
the command line. For RAM-only testing:

  setenv ipaddr 192.168.0.1
  setenv serverip 192.168.0.100
  tftpboot 0x81000000 openwrt-ramips-mt7620-dlink_dap-1620-a2-initramfs-kernel.bin
  bootm 0x81000000

For persistent installation, cold-start the device and select
U-Boot menu option 2, "Load system code then write to Flash via
TFTP". Confirm with Y and use:

  openwrt-ramips-mt7620-dlink_dap-1620-a2-squashfs-sysupgrade.bin

After flashing completes, disconnect power, allow the device to
power down fully, and reconnect it. Subsequent upgrades can use
the normal OpenWrt sysupgrade procedure.

Development testing on DAP-1620 A2 confirmed:
- DSA initialization and RTL8211E detection through MDIO
- Port 5 operating with rgmii-id
- 1 Gbps full-duplex Ethernet negotiation
- LAN traffic and link recovery
- Detection of both Wi-Fi radios
- Initramfs boot through U-Boot/TFTP
- Flashing and booting a squashfs sysupgrade image
- Cold power cycle after the initial flash
- Ethernet LED behaviour with carrier disconnected and connected
- Wi-Fi station association and authorized-state detection
- Three green signal indicators at an observed RSSI of -54 dBm

A 60-minute bidirectional TCP soak completed successfully at
approximately 250 Mbit/s DAP TX + 217 Mbit/s DAP RX. The sampled
link status remained at 1 Gbps full duplex with no observed link
drops or increases in the observed switch MIB bad-packet/error
counters.

The DUT itself terminated the TCP traffic, so these tests are not
a forwarding or hardware flow-offload benchmark. PPE work such as
openwrt#24515 is outside the scope of this support.

This support builds on Senthil Durairaj's original DAP-1620 A2
work in PR openwrt#17027 and the MT7620 DSA driver introduced in openwrt#24493.

Link: openwrt#17027
Link: openwrt#24493
Link: https://forum.openwrt.org/t/253264

Signed-off-by: Senthil Durairaj <[email protected]>
Signed-off-by: Boyler Fourcade <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel pull request/issue with Linux kernel related changes target/ipq40xx pull request/issue for ipq40xx target target/qualcommax pull request/issue for qualcommax target target/ramips pull request/issue for ramips target target/realtek pull request/issue for realtek target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants