Xiaomi mi4a gigabit (mt7621AT) hardware NAT not working using master branch

Have you tried 19.07.8?

1 Like


The old switch driver had HW offload support. Im not sure the current DSA driver has HW offload support for the mt7621 cpu. So most likely why its not working.

For now only software offloading would work with dsa driver.

HW Offloading works fine, you need to enable it in firewall config first.

The official branch doesn't have the router in the target builds list, I found a fork which does work but it locks up sometimes, completely (https://gitlab.com/db260179/xiaomi-m4a/-/releases)
Still using it as it is extremely fast:

If i will solve the lockup issue (dropped wifi connection(2.4 and 5g) , dropped lan connection, and no luci or ssh connectivity) I will buy this router again at least 3 time :)) that's how impressed I am with it.

1 Like

Software offloading is nowhere near as fast and reliable (in my case, i use the router as a wireguard server when I'm not at home).

Would be great if someone would be able to implement hardware nat in the new builds.

Thank you for your reply.
I did enable it, it does not work :slight_smile:

I just noticed that the build that I'm currently using is made by you :)) .

Thank you so much for your work, extremely fast speed.
Do you have any idea why it locks up sometimes ?

When building the firmware i just include luci and wireguard.

Thank you x9000

hi, i personally dont use the offload feature as i need the sqm qos feature and that wont work with sw/hw offload feature.

Under certain load conditions it will lock up, its a bug in the mt7621, only the oem firmware get round this issue. Usually using the HW offload feature minimises this, but not always.

So to answer everyones question on this HW offload support - https://github.com/torvalds/linux/commit/502e84e2382d92654a2ecbc52cdbdb5a11cdcec7#diff-bd79cf61b7be352cb61be5cf1ac3f7586973776e496fd94516491c66c694deee

Was initially added in kernel 5.13, but only for IPV4 and not IPV6.

For the 21.02 kernel - there was this HW offload feature patched in the target/mediatek - https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=4fb58813f94ac6cc8167138e23a92189fe50b258

Initially, then support was added back for mt7621 - https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=b59d5c8f0eebb6d15d7cefe487c17fad0ee4a524

I haven't tested this as yet on the 21.02 branch for ramips, but it should work if the mt7621 SOC - remember there is no HW offload via switch to wifi. HW offload only works via ethernet, people always make this mistake. There is work in progress for HW offload wifi support.

So in regards to your lockup, does it lockup only on my firmware v19.07.8?

If so, then you could try the default openwrt mt76 driver - kmod-mt76 (you will have to use imagebuilder in the zip from my gitlab releases) and change from kmod-mt76-compat to kmod-mt76

See if that helps. Otherwise its the age old mt7621 bug that rears it ugly head on high load scenarios.

Some ipv6 support has been here https://www.spinics.net/lists/netdev/msg729577.html.
Also, where is the information about HW offload wifi support?

Just need someone to create a patch for that ipv6 support into the current 21.02 branch.

Working hardware flow offload for MT7620 - #9 by gaspare - someone has done a kernel driver to support HW on wifi which you quoted, lolz!

onemarfifty on youtube did a good speed test against oem and openwrt firmware - https://www.youtube.com/watch?v=a4fDwG3aEb8

1 Like

Ok, that's outstanding.
However, will this eventual release solve the random lockup that the current 19.07.8 has ?

The router runs superb, if only it would not lockup I would literally buy another 4 of them :)) .

I cannot reproduce the issue, I've tried with heavy traffic, no problem, then I do something random like logging in my my phone on my remote nextcloud instance, and everything goes down.

@db260179 I guess I'm lucky because I do not need sqm, but without hw nat, this router performs about the same with my old wr-1043Nv5.

Thank again everyone for each reply :slight_smile: greatly appreciated the effort and knowledge that has been put here

Hi, v19.07 is now on maintenance mode only now so, no.

I would suggest migrating to v21.02, which i will be doing over the christmas time and do my own tweaks if need be. I'll probably add the missing ipv6 HW offloading patch then submit the patch upstream.

Just need to get my head around the new DSA layout.



Great, thank you.
Please let me know if I can be of any help, testing/compiling etc.

Regards :slight_smile:

@db260179 Will you make a 21.02 release?

I will be doing a separate post on mt7621 devices and the ongoing hw offloading and other issues for 21.02.

So far i've done a couple of patches in my repo:

  • Enable HW Offloading support for IPV6 on mt7621 devices
  • Hacky way to disable the Flow Control on the ports (needs improvement and advice) as it seems enabling flow control on ports triggers the netdev timeout issues for the mt7621 devices. - work in progress!

Both of these need user feedback, if confirmed fixed then will push upstream to the openwrt repos.


What is your repository?
I have Xiaomi R3G v1. I possible test this.

1 Like

Download link in that forum page

Any feedback with logs etc via pastebin.com

1 Like