18th of April 2023 Update
Here is some information to prevent repeat questions directed at me. This won't be on 22.03, only newer versions will have it as the patch was made at that time frame, and there's no need to spend time and effort backporting to older versions.
For the devices listed under the "RGMII2 pins are used with an external phy on these:" and "RGMII2 pins are used as GPIO on these:" lists, the feature will work with changes on the devicetree of the said device, except some rare cases. You're expected to do the changes yourself.
21st of August 2022 Update
The pull request is applied to the master branch!
10th of July 2022 Update
PR is open on GitHub.
It is possible to achieve 2 Gbps routing in total on devices with MT7621 SoCs.
Currently you can only get a maximum of 500/500 Mbps (download/upload) speed on LAN/WAN routing (this includes NAT too). The reason is explained at the bottom of the post.
With this patch, 1000/1000 Mbps routing or 2 Gbps total bandwidth to the CPU is possible.
Speed Test
Here are the results for iperf3 bidirectional speed test with hardware offloading.
Routing and NAT performance is identical.
Without the patch
[ 5][RX-S] 0.00-20.00 sec 353 MBytes 148 Mbits/sec receiver
[ 8][TX-S] 0.00-20.00 sec 1.79 GBytes 769 Mbits/sec 0 sender
With the patch
[ 5][RX-S] 0.00-20.00 sec 2.16 GBytes 926 Mbits/sec receiver
[ 8][TX-S] 0.00-20.00 sec 1.80 GBytes 775 Mbits/sec 0 sender
Devices That Benefit This
Check out the changes of the phy muxing commit for supported devices.
Devices confirmed working:
See GitHub PR above.
Devices That Can't Benefit This
List
Single port devices:
- mt7621_asus_rp-ac56.dts
- mt7621_asus_rp-ac87.dts
- mt7621_edimax_re23s.dts
- mt7621_thunder_timecloud.dts
- mt7621_ubnt_unifi.dtsi
- mt7621_ubnt_unifi-6-lite.dts
- mt7621_ubnt_unifi-nanohd.dts
- mt7621_zyxel_nwa55axe.dts
No muxable phy on these:
- mt7621_xiaomi_mi-router-3g.dts
RGMII2 pins are used with an external phy on these:
- mt7621_gnubee_gb-pc2.dts
- mt7621_mikrotik_routerboard-760igs.dts
- mt7621_ubnt_edgerouter-x-sfp.dts
- mt7621_zyxel_wap6805.dts
RGMII2 pins are used as GPIO on these:
- mt7621_alfa-network_quad-e4g.dts
- mt7621_bolt_arion.dts
- mt7621_d-team_newifi-d2.dts
- mt7621_d-team_pbr-m1.dts
- mt7621_dual-q_h721.dts
- mt7621_firefly_firewrt.dts
- mt7621_mikrotik_routerboard-m11g.dts
- mt7621_mtc_wr1201.dts
- mt7621_netgear_ex6150.dts
- mt7621_sercomm_na502.dts
- mt7621_sercomm_na502s.dts
- mt7621_telco-electronics_x1.dts
- mt7621_tplink_archer-x6-v3.dtsi
- mt7621_tplink_archer-a6-v3.dts
- mt7621_tplink_archer-c6-v3.dts
- mt7621_tplink_re350-v1.dts
- mt7621_tplink_re650-v2.dts
- mt7621_tplink_rexx0-v1.dtsi
- mt7621_tplink_re500-v1.dts
- mt7621_tplink_re650-v1.dts
- mt7621_tplink_tl-wpa8631p-v3.dts
- mt7621_wavlink_wl-wn53xax.dtsi
- mt7621_wavlink_wl-wn531a6.dts
- mt7621_wavlink_wl-wn533a8.dts
- mt7621_wevo_w2914ns-v2.dtsi
- mt7621_wevo_11acnas.dts
- mt7621_wevo_w2914ns-v2.dts
- mt7621_zio_freezio.dts
- mt7621_winstars_ws-wn583a6.dts
- mt7621_xzwifi_creativebox-v1.dts
- mt7621_zbtlink_zbt-wg2626.dts
- mt7621_zbtlink_zbt-wg3526.dtsi
- mt7621_zbtlink_zbt-wg3526-16m.dts
- mt7621_zbtlink_zbt-wg3526-32m.dts
- mt7621_zyxel_lte3301-plus.dts
- mt7621_zyxel_nwa50ax.dts
500/500 Mbps Speed Example
You download a file from internet with 1000 Mbps speed.[*] Traffic will flow through wan to lan. On the CPU port, this causes 1000/1000 Mbps load because it receives 1 Gbps traffic from wan then transmits 1 Gbps traffic to lan.
Let's say someone uploads a file with 1000 Mbps speed at the same time. Traffic will flow through lan to wan. Since there's no bandwidth left on the CPU port it will halve the speed.
Therefore, you can only download a file at 500 Mbps and upload a file at 500 Mbps at the same time.
With this patch, wan port is connected directly to the CPU on a second link.
Now, you can download and upload a file at 1 Gbps at the same time.
[*] In a real life scenario, your computer downloading the file has to send some packets back (upload) because the TCP packets for downloading the file may be out of order, some of it may have to be re-sent, etc.. So you won't even get to download your file with 1 Gbps download speed on a single link to CPU.
Therefore, this patch should also improve 1 Gbps speed for just downloading or uploading.
My Speed Testing Method
I do the test on a single computer. I have two gigabit ports on my motherboard.
I isolate a port by putting it on another network namespace to do the test.
Client Network
iperf client: 192.168.2.2/24
router: 192.168.2.1/24
Server Network
router: 192.168.3.2/24
iperf server: 192.168.3.1/24
iperf Client
ip a add 192.168.2.2/24 dev enp9s0
ip l set up enp9s0
ip route add 192.168.3.1 via 192.168.2.1
iperf3 -c 192.168.3.1 --bidir -t 20
iperf Server
ip netns add iperfserver
ip link set dev eno1 netns iperfserver
ip netns exec iperfserver ip a add 192.168.3.1/24 dev eno1
ip netns exec iperfserver ip l set up eno1
ip netns exec iperfserver iperf3 -s
Exceptions
The ports called "wan" are muxed where possible. On a minority of devices, this is not possible. Those cases:
mt7621_ampedwireless_ally-r1900k.dts: lan3
mt7621_ubnt_edgerouter-x.dts: eth0
mt7621_gnubee_gb-pc1.dts: ethblue
mt7621_linksys_re6500.dts: lan1
mt7621_netgear_wac104.dts: lan4
mt7621_tplink_eap235-wall-v1.dts: lan0
mt7621_tplink_eap615-wall-v1.dts: lan0
mt7621_ubnt_usw-flex.dts: lan1
The "wan" port is just what the vendor designated on the board/plastic chasis of the device. On a technical level, there is no difference between a lan and wan port on MT7621AT/MT7621ST SoCs. Prefer connecting to WAN via the port described above for these devices to benefit the feature brought with this patch.