Repository navigation
Conversation
|
Please try to read https://openwrt.org/submitting-patches again and adjust your commit accordingly, you're missing commit description etc. |
Current implementation of getting a destination ethernet address for original and reply traffic is broken. As a result, netfilter flows are not added to the hardware and traffic is forwarded by the CPU (tested on ramips/mt7621). This commit fixes this bug for Linux 4.14. Signed-off-by: Konstantin Vasin <[email protected]>
|
Description was added. |
|
@nbd168 |
|
@hisirbr, to apply your patch, is it enough just download the patches to the target/linux/generic/pending-4.14/ and make? |
|
@LearZhou |
|
The model I have is DIR-860L B1, the patches failed somehow. It couldn’t find the file to patch on. I thought the patches apply to any MT7621 models. |
|
@LearZhou I've just tested and successfully got a firmware for 860 in bin/targets/ramips/mt7621. |
|
These warnings are generated when I apply the patches the way you mentioned: I thought it should be okay, but there're still errors. Now I am trying from scratch, will see what happened. |
|
This is just git warnings about whitespaces. You can ignore them. |
|
Could somebody please review this patch? :) Flow offloading is broken both in 19.07 and master branch. Would love to get it back to working. |
@Mushoz Could someone run-test this patch and give me |
|
Successfully tested by Enig123, D-Link DIR-860L B1. |
|
mt7621 in linux-5.4 is switching to DSA. As I understand, it means hw flow offload will be no longer supported for this platform. Maybe it's possible to use hwnat even with cpu tag, but I'm not sure. But anyway, hardware offload support for netfilter is available in mainline linux since Nov 2019. And we should use in the future mainline implementation instead of openwrt patches for HWNAT (if some platform will support it). So this fix is really needed only for the openwrt-19.07 branch. @adrianschmutzler Some users also reported that with this patch hwnat is working again. But unfortunately, they did it only on the openwrt forum but not here. |
|
Might just be easier to disable HW NAT, the MT7621 uses only 17% CPU to do SW offload at around 940 Mbit unidirectional, and it has 2Cores/4Threads. |
It's not possible to get 940Mbps using only 17% CPU. How did you measure a CPU load? mt7621 in linux-5.4 will use only SW offload. |
|
Whoops, you are right, I miscalculated my CPU usage, and it is actually 46-48%. |
|
Successfully tested with ASUS RT-AC65P. HWNAT is working. |
|
I have received the following lockups after installing your patch and enabling HW NAT, essentially rendering the router useless. Sometimes these lockups happen immediately after boot. |
|
This patch doesn't change anything that can lead to these lockups. What device are you testing? And what is your test environment? I've tested D-Link DIR-882 (mt7621+2 x mt7615) with IPoE NAPT (/24 netmask on WAN and LAN), PPPoE NAPT, IPoE Routing and no lockups or any other bugs were detected. Other users also didn't report about something like this. Of course, current implementation of HW NAPT for ramips may contain other bugs. That's why HW NAPT is disabled by default and marked as experimental feature. |
|
@hisirbr I have an Ubiquiti ER-X, running the 19.07 SNAPSHOT, r10968-456e1c60d6. I had added the following patches when I encountered the kernel lockups: https://patchwork.ozlabs.org/patch/1186211/ |
When I use this patch, it causes the router to reboot randomly. My hardware test environment is newifi D2 and Xiaoyu C5 Network environment is pppoe (100M bandwidth) The kernel is 4.14.172
|
|
@bluehj777 I can confirm that the crashes happened much more frequently after turning on my bittorent client |
|
@bluehj777 |
Okay, I'll try it and give it feedback |
|
|
@bluehj777 Yes with both patches! |
@yoonsikp |
|
@bluehj777 I got a crash as well, this time after 30 hours, so less often I agree, but not a complete fix. |
|
@hisirbr There is a long history of crashes with HW NAT, so it's probably not the cause of this PR |
|
In 5.4 mt7621 is switching to DSA and HWNAT will be no longer supported (#2798) About this PR and lockups: But anyway I'll try to repeat and debug this bug because it's interesting for me.
|
|
HWNAT works fine now. 900Mb/S over pppoe and CPU consumption is 0%. |
|
@MeIsReallyBa HWNAT is the offloading of the translation from the LAN to WAN, WiFi traffic is automatically bridged to LAN. |
|
What if the case of guest WiFi which has ip different than lan ips? |
|
@LearZhou Doesn't matter, any internal LAN IP that is being forwarded to WAN will match the netfilter, which would then be hardware offloaded. |
During my test,HWNAT is not working while handle wifi traffic.Maybe u could have a try. |
|
Any news on this? The 19.07 branch still has broken HW Flow Offload due to this bug. |
|
And we seem to have missed the window to be included in 19.07.3. Can this pull request please be reviewed so we can try to get it in before 19.07.4 at least? It's very unfortunate that regressions that have been discovered and fixed months ago can still remain in a stable branch for so long. |
In order to increase the chance for merge, it would be better if author (or someone else) could take this fix through mailing list, where it might spark some interest, probably other pairs of eyes for review, possibly some |
|
Hi @ynezz It seems this bug was already fixed in other commit: 6786dc2
Some users reported about regressions specific to mt7621 hardware when hw napt is enabled. |
Make the driver work with recent upstream changes. Fixes: FS#2632 Ref: #2815 Signed-off-by: John Crispin <[email protected]> (cherry picked from commit 6786dc2)
Make the driver work with recent upstream changes. Fixes: FS#2632 Ref: openwrt#2815 Signed-off-by: John Crispin <[email protected]> (cherry picked from commit 6786dc2)
|
HW NAT still seems broken with IPv6 for me. Can anyone confirm they are seeing the same thing? IPv4 seems fine with virtually no CPU load during speedtests. Edit: Actually, let me rephrase that: IPv6 of course doesn't use NAT, so it's silly talking about HW NAT not working. What I meant was that HW Flow offloading seems broken with IPv6 on 19.07.4. |
|
Nombre del host With hwoffload it seems that after 3 days or earlier this happens randomly https://pastebin.com/M0p0RSQA |
Make the driver work with recent upstream changes. Fixes: FS#2632 Ref: openwrt#2815 Signed-off-by: John Crispin <[email protected]> (cherry picked from commit 6786dc2)
I just bought this router and flashed today SNAPSHOT r15225-bfc433efd4 kernel 5.4.83. I have a FibeLink 1000/500 connection but it looks like hwnat is not working because I only get ~ 300Mbps. Can you share your build because I am not technical enough to build it myself :) Thanks |
I tested hw flow offload engine (router DIR-882 - ramips
mt7621,masterbranch) and found that it's broken:Network Topology:
PC--(LAN 192.168.0.0/24)--[DUT]--(WAN 192.168.1.0/24)--SERVER (it's not default gw)sw offload and hw offload are enabled. All other settings are default.
After debugging I found the reason:
incorrect ethernet addresses calculation in
flow_offload_check_ethernet(nf_flow_table_hw.c)Explanation:
Start
iperf3on SERVER (port 5201) and PC (random port 45678) to test TCP.Now we have the next flows:
For the original tuple iiface is
br-lan, so we should use it to calculate eth addresses for the reply flow. For the reply tuple iiface iseth0.2, so we should use it to calculate eth addresses for the original flow.In both cases we get a src eth address as interface address:
memcpy(path->eth_src, path->dev->dev_addr, ETH_ALEN);But it's not possible to get dst mac address using
src_v4address anddst_cachefrom the same tuple. In this casedst_neigh_lookupreturns invalid values (all zeroes or eth address of the default gw). After that bridge stack can't find a valid entry in br-lan fdb for this invalid eth address andflow_offload_check_pathreturns an error.There is a solution in upstream kernel from wenxu (since Jan 2020). So I decided to backport it.
With these patches we have an additional validation for neighbour's nud_state (use only NUD_VALID)
But more important - we use
src_v4anddst_cachefrom different tuples. As a result,dst_neigh_lookupnow returns a valid neighbour entry and we can use its eth address to add flows to the hardware offload.Result: With this patch TCP and UDP traffic is forwarded correctly by hardware (0% CPU usage and entries in debugfs with stateBIND).BTW, Maybe this bug was already discussed, but I didn't find an appropriate issue.