2 Gbps WAN/LAN NAT Routing on ramips MT7621 devices

This makes sense for the use case of switching frames between switch ports.

Also read this post.

Wireless is directly connected to the CPU, you can use any switch port to switch frames between. There won't be any effect to performance.

thanks for the reply, it's clear
I edited my previous post with some screenshots

is there any possibility to make the use of this patch an option (like the hw/sw offloading checkbox) ?

I’ve read the edit. That’s not possible, for now.

Hi
I have tested the latest (29/8) snapshot on a Netgear R6220. CPU load was monitored with htop

  • native : 580 Mbit/s, heavy CPU load
  • SW offloading : 750 Mbit/s, still heavy CPU load
  • both SW and HW offloading : 940 Mbit/s, negligible CPU load (can't remember ... 2 or 3% ?)

So the patch seems to work very well on bandwidth tests. Nevertheless, I don't use this device as a router, it was just a test. So I can't confirm stability on the long run, someone will.

I use an x64 router as main device, and I keep an old x64 as spare router in case. I know now that I can use back the R6220 as spare router with a Gbit/s fiber.

Thank you for this important contribution.

2 Likes

Cheers! By the way, the section for selecting software and hardware offload on LuCI is inaccurate. Either hardware or software offloading can be used. They cannot be used at the same time.

Agreed, it is obvious.
What I meant, and I assume you understood, is that I clicked on both checkboxes in Luci.
As far as I understand, checking SW activates SW. Than checking HW deactivates SW to activate HW. I see this in some kind of two steps.
A change in Luci may clarify this ? A checkbox to activate offloading, than a radio to choose between SW or HW.

1 Like

That looks good. Maybe @jow could do this.

1 Like

something simple like this (forget about the colors, I picked up what I can to mimic)

enable offloading : :white_check_mark: software :red_circle: hardware :o:

SW/HW radios being disabled if the checkbox is not checked.
SW selected as default.

3 Likes

This patch achieves 2 Gbps total bandwidth to the CPU by muxing the MT7530 switch's phy0/4 to the SoC's gmac1 on devices where RGMII2 pins are available.So it means that phy0 or phy4 can benefit from this patch if it's used as wan port ? I use my er-x router's eth4 as wan port .Is eth4 the phy4? Because eth0 is phy0.Can this patch works to eth4 ?Thanks.

phy0 is assigned to gmac1 and phy4 to gmac0. What's the issue?

I use ubnt erx 's eth4 as wan port. In this case,Can eth4 benefit from this patch?Thanks.

I mean...you can edit the dts

or something similar to the other choices on this same FW page, a drop list:

image

Texte: Flow offloading

  • choice 1: Off/disable/No thanks ...
  • choice 2: Software
  • choice 3: Hardware
2 Likes

Hello arinc9,

Quick question, does the current 22.03.0 stable release include your patch(s) as well?
I tried reading the posted changelog but the bleepin' commit diff? is not in any alphabetical or numerical order. Unless there is some trick to it that I'm missing ...

Thanks.

Other than the patch for GB-PC, they are not on 22.03.

1 Like

Thanks for the reply.
Will stick with your release (saved previously) or snapshots. :slight_smile:

After a week of testing I've just taken the plunge and migrated my entire home/office network to this, including two separate telecommute/VPN users on gigabit fiber and 4 separate VLANs.

It's working spectacularly; total bandwidth and responsiveness are impressive; basically ~930mbps WAN:LAN(s), all you can expect with PPPoE -- and pretty nearly that bidirectionally -- and there's almost never any measurable CPU load.

The only negative result of moving away from a quad-NIC x86_64 solution is that now I only get a total 1Gb/s (aka "500/500" as noted above) bandwidth when routing internally between VLANs. But that's never going to be a problem in real life: my network design is such that it's very unusual to need to move large files between VLANs: everything with a disk drive sits on a single VLAN, the rest are either simple devices (e.g. IoT) and lightweight streamers on the one hand, or fully-isolated paths for VPN tunnels terminated on other devices on the other. The MT7621 in this scenario is all network appliance and no application.

Even DNS is handled by a separate device; I've connected up an old $5 Pi Zero to the router's USB2 port as an ethernet gadget and it's running AdGuard Home; the MT7621/OpenWRT/dnsmasq only handles local hostname resolution.

Admittedly one factor that makes this easy is I don't really need traffic shaping. If I ever do, I may still keep this device in an edge role to handle PPPoE/NAT, and put my x86_64 device back into service as a core router and shaper. Until then, there's a lot to be said for application-specific silicon over brute-force CPU.

3 Likes

I don't think we can preserve the section ids, flow_offloading and flow_offloading_hw this way, which would break compatibility with old uci configurations and break more things. I've made a small fix with a friend which hides the other option when one is selected.

@badulesia @vevere

1 Like

Getting these errors now and again running builds from latest master on a Xiaomi R4G used as a simple dumb AP hooked to main gateway over ethernet.

 9006.683212] mt7530 mdio-bus:1f: port 3 failed to delete 4e:5e:30:46:9b:fc vid 0 from fdb: -2
[ 9006.691731] mt7530 mdio-bus:1f: port 2 failed to delete 4e:5e:30:46:9b:fc vid 0 from fdb: -2
[ 9006.700202] mt7530 mdio-bus:1f: port 2 failed to delete 4e:5e:30:46:9b:fc vid 0 from fdb: -2
[ 9006.708727] mt7530 mdio-bus:1f: port 2 failed to delete 4e:5e:30:46:9b:fc vid 0 from fdb: -2
[ 9770.989287] ------------[ cut here ]------------
[ 9770.993939] WARNING: CPU: 2 PID: 1482 at target-mipsel_24kc_musl/linux-ramips_mt7621/mt76-2022-10-01-72b87836/mt7603/mac.c:208 mt7603_filter_tx+0x178/0x180 [mt7603e]
[ 9771.008743] Modules linked in: pppoe ppp_async nft_fib_inet nf_flow_table_ipv6 nf_flow_table_ipv4 nf_flow_table_inet pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_objref nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_ct nft_counter nft_chain_nat nf_tables nf_nat nf_flow_table nf_conntrack mt76x2e mt76x2_common mt76x02_lib mt7603e mt76 mac80211 cfg80211 slhc nfnetlink nf_reject_ipv6 nf_reject_ipv4 nf_log_syslog nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c crc_ccitt compat cls_flower act_vlan cls_bpf act_bpf sch_tbf sch_ingress sch_htb sch_hfsc em_u32 cls_u32 cls_tcindex cls_route cls_matchall cls_fw cls_flow cls_basic act_skbedit act_mirred act_gact sha256_generic libsha256 sha1_generic seqiv jitterentropy_rng drbg md5 hmac des_generic libdes cmac authencesn authenc leds_gpio gpio_button_hotplug crc32c_generic
[ 9771.090388] CPU: 2 PID: 1482 Comm: hostapd Not tainted 5.15.72 #0
[ 9771.096469] Stack : 00000002 800869bc 807e0000 00000004 00000000 00000000 82a99994 80a40000
[ 9771.104826]         80880000 807af2cc 824cced8 80884e83 00000000 00000001 82a99940 80c71900
[ 9771.113191]         00000000 00000000 807af2cc 82a997d8 ffffefff 00000000 ffffffea 00000000
[ 9771.121552]         82a997e4 00000139 8088aa80 ffffffff 807af2cc 00000001 00000000 827a4834
[ 9771.129909]         00000009 00000002 00003a98 80000000 00000018 80421e3c 00000008 80a40008
[ 9771.138266]         ...
[ 9771.140705] Call Trace:
[ 9771.143138] [<80008194>] show_stack+0x28/0xf0
[ 9771.147509] [<80397ae0>] dump_stack_lvl+0x60/0x80
[ 9771.152225] [<80030434>] __warn+0xc0/0x12c
[ 9771.156331] [<800304fc>] warn_slowpath_fmt+0x5c/0xac
[ 9771.161296] [<827a4834>] mt7603_filter_tx+0x178/0x180 [mt7603e]
[ 9771.167224] [<827a1aa4>] mt7603_sta_remove+0x8c/0xf4 [mt7603e]
[ 9771.173050] [<82603320>] __mt76_sta_remove+0x78/0x110 [mt76]
[ 9771.178723] [<82603490>] mt76_sta_state+0xd8/0x210 [mt76]
[ 9771.184121] [<827097d0>] sta_set_sinfo+0xf6c/0xfec [mac80211]
[ 9771.190076] 
[ 9771.191688] ---[ end trace 49aef12bc958f3b5 ]---
[36088.718660] mt76x2e 0000:01:00.0: Firmware Version: 0.0.00
[36088.724444] mt76x2e 0000:01:00.0: Build: 1
[36088.728614] mt76x2e 0000:01:00.0: Build Time: 201607111443____
[36088.757487] mt76x2e 0000:01:00.0: Firmware running!
[36088.767639] ieee80211 phy1: Hardware restart was requested```

That’s an mt76 Wi-Fi driver crash

1 Like