Skip to content

kernel: fix incorrect dst MAC address for hw flow offload - #2815

Closed
kv-y wants to merge 1 commit into
openwrt:masterfrom
kv-y:master
Closed

kv-y wants to merge 1 commit into
openwrt:masterfrom
kv-y:master

Conversation

@kv-y

@kv-y kv-y commented Mar 8, 2020 •

Copy link
Copy Markdown

I tested hw flow offload engine (router DIR-882 - ramips mt7621, master branch) and found that it's broken:

  1. All packets are forwarded by CPU
  2. There are no entries with state BIND in debugfs (mtk_ppe/all_entry).

Network Topology:
PC--(LAN 192.168.0.0/24)--[DUT]--(WAN 192.168.1.0/24)--SERVER (it's not default gw)

PC: 192.168.0.2
DUT LAN: 192.168.0.1 (MAC address: XX:XX:XX:XX:XX:AB)
DUT WAN: 192.168.1.200 (MAC address: XX:XX:XX:XX:XX:AA)
SERVER: 192.168.1.100
DEFAULT GW: 192.168.1.1

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 iperf3 on SERVER (port 5201) and PC (random port 45678) to test TCP.
Now we have the next flows:

192.168.0.2:45678-->192.168.1.100:5201 (ORIGINAL)
192.168.1.100:5201-->192.168.1.200:45678 (REPLY)

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 is eth0.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_v4 address and dst_cache from the same tuple. In this case dst_neigh_lookup returns 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 and flow_offload_check_path returns an error.

There is a solution in upstream kernel from wenxu (since Jan 2020). So I decided to backport it.

1. [f31ad71c] netfilter: nf_flow_table_offload: check the status of dst_neigh
2. [1b67e506] netfilter: nf_flow_table_offload: fix incorrect ethernet dst address

With these patches we have an additional validation for neighbour's nud_state (use only NUD_VALID)
But more important - we use src_v4 and dst_cache from different tuples. As a result, dst_neigh_lookup now 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 state BIND).
BTW, Maybe this bug was already discussed, but I didn't find an appropriate issue.

@ynezz ynezz added fix pull request contains fix for some issue kernel pull request/issue with Linux kernel related changes labels Mar 8, 2020
@ynezz

ynezz commented Mar 8, 2020

Copy link
Copy Markdown
Member

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]>
@kv-y

kv-y commented Mar 9, 2020

Copy link
Copy Markdown
Author

Description was added.
Fix was tested for IPoE NAPT, IPoE routing (without Masquerade) and PPPoE.

@kv-y

kv-y commented Mar 14, 2020

Copy link
Copy Markdown
Author

@nbd168
Could you please review this PR?
It seems it's a critical bug. At least in my case hardware flow offloading is totally broken without this patch. But it's strange that other ramips users didn't report this bug. I found only one opened issue.
If it's not actual due to switching all platforms to the kernel 5.4, I can close this PR.

@LearZhou

Copy link
Copy Markdown

@hisirbr, to apply your patch, is it enough just download the patches to the target/linux/generic/pending-4.14/ and make?

@kv-y

kv-y commented Mar 15, 2020

Copy link
Copy Markdown
Author

@LearZhou
yes, it's enough

@LearZhou

Copy link
Copy Markdown

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.

@kv-y

kv-y commented Mar 15, 2020

Copy link
Copy Markdown
Author

@LearZhou
These patches are for all models that support HW NAT.
Please try to clone master branch, apply my patch and compile:

git clone https://github.com/openwrt/openwrt.git
cd openwrt
wget https://github.com/hisirbr/openwrt/commit/d8bc0cc41bcf913317c3a5f1d51a2fdb363975b0.patch
git am ./d8bc0cc41bcf913317c3a5f1d51a2fdb363975b0.patch
make menuconfig ==> select DIR-860B1 ==> save before exit
make

I've just tested and successfully got a firmware for 860 in bin/targets/ramips/mt7621.

@LearZhou

LearZhou commented Mar 15, 2020 •

Copy link
Copy Markdown

These warnings are generated when I apply the patches the way you mentioned:

Applying: kernel: fix incorrect dst MAC address for hw flow offload
.git/rebase-apply/patch:33: space before tab in indent.
 	struct flow_offload_hw_path dest;
.git/rebase-apply/patch:35: trailing whitespace.
 
.git/rebase-apply/patch:39: space before tab in indent.
 					struct flow_offload_hw_path *path)
.git/rebase-apply/patch:41: space before tab in indent.
 	struct net_device *dev = path->dev;
.git/rebase-apply/patch:42: space before tab in indent.
 	struct neighbour *n;
warning: squelched 37 whitespace errors
warning: 42 lines add whitespace errors.

I thought it should be okay, but there're still errors. Now I am trying from scratch, will see what happened.

@kv-y

kv-y commented Mar 15, 2020

Copy link
Copy Markdown
Author

This is just git warnings about whitespaces. You can ignore them.

@Mushoz

Mushoz commented Mar 18, 2020

Copy link
Copy Markdown
Contributor

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.

@ynezz

ynezz commented Mar 18, 2020

Copy link
Copy Markdown
Member

Could somebody please review this patch?

@Mushoz Could someone run-test this patch and give me Tested-by: including the device info?

@LearZhou

Copy link
Copy Markdown

Successfully tested by Enig123, D-Link DIR-860L B1.

@kv-y

kv-y commented Mar 21, 2020

Copy link
Copy Markdown
Author

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
@981213
@nbd168
Someone from maintainers who have access to mt7621 could review/test this PR?
I didn't mark this PR for ramips-only because this bug in generic code for hw flow offload used in openwrt. But in fact, hw offload implementation in openwrt-19.07 is available only for mt7621.
I see that most of ramips maintainers are busy now porting platform to linux-5.4.
But this bug is critical because hw offload doesn't work in stable release 19.07 without this fix.

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.

@yoonsikp

yoonsikp commented Mar 21, 2020 •

Copy link
Copy Markdown

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.

@kv-y

kv-y commented Mar 22, 2020

Copy link
Copy Markdown
Author

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?
For ~900Mbps over IPoE you need to use RPS at least. According to my test CPU load will be more than 75% in this case.
Don't forget that PPPoE is required more CPU resources even with SW offload.
Small UDP packets are also required more CPU comparing to TCP.
And don't forget that instead of forwarding LAN<-->WAN traffic CPU can do many other useful stuff (handle WiFi traffic, USB, different userspace processes). It's more critical for single core device of course.

mt7621 in linux-5.4 will use only SW offload.
But for linux-4.14 hw offload works fine, just need to fix a logic error in nf_flow_table_hw module.
And I don't understand why we shouldn't use it in 19.07.

@yoonsikp

Copy link
Copy Markdown

Whoops, you are right, I miscalculated my CPU usage, and it is actually 46-48%.

@lantsem

lantsem commented Mar 22, 2020

Copy link
Copy Markdown

Successfully tested with ASUS RT-AC65P. HWNAT is working.

@yoonsikp

Copy link
Copy Markdown

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.

[  732.217891] INFO: rcu_sched self-detected stall on CPU
[  732.228155] 	1-...: (1 GPs behind) idle=ab2/2/0 softirq=24841/24842 fqs=3000 
[  732.237880] INFO: rcu_sched detected stalls on CPUs/tasks:
[  732.242338] 	
[  732.242356] 	1-...: (1 GPs behind) idle=ab2/2/0 softirq=24841/24842 fqs=3001 
[  732.253247]  (t=6003 jiffies g=5831 c=5830 q=202)
[  732.256361] 	
[  732.270544] NMI backtrace for cpu 1
[  732.279888] (detected by 2, t=6006 jiffies, g=5831, c=5830, q=202)
[  732.283012] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.172 #0
[  732.314305] Stack : 00000000 80580000 00000000 8007269c 805a0000 80546538 00000000 00000000
[  732.330948]         80512110 8fc0b904 8fc3c33c 805808e7 8050cf00 00000001 8fc0b8a8 5326164d
[  732.347593]         00000000 00000000 806e0000 00003728 00000000 000000cc 00000008 00000000
[  732.364234]         00000000 80580000 00045184 00000000 00000000 805a0000 00000000 00000001
[  732.380875]         80586420 8057e0cc 000000e0 80580000 00000000 80299228 00000004 806e0004
[  732.397517]         ...
[  732.402377] Call Trace:
[  732.407265] [<8000c7b0>] show_stack+0x58/0x100
[  732.416127] [<8044fc34>] dump_stack+0xa4/0xe0
[  732.424799] [<80456c44>] nmi_cpu_backtrace+0xe4/0x108
[  732.434846] [<80456d30>] nmi_trigger_cpumask_backtrace+0xc8/0x168
[  732.446980] [<80087128>] rcu_dump_cpu_stacks+0xc4/0x13c
[  732.457372] [<80086578>] rcu_check_callbacks+0x3b4/0x8b8
[  732.467946] [<80089cec>] update_process_times+0x34/0x78
[  732.478365] [<8009ad38>] tick_handle_periodic+0x34/0xd0
[  732.488774] [<80319624>] gic_compare_interrupt+0x70/0x80
[  732.499351] [<80079ec8>] handle_percpu_devid_irq+0xbc/0x1a8
[  732.510459] [<800741e0>] generic_handle_irq+0x40/0x58
[  732.520527] [<8024c814>] gic_handle_local_int+0x9c/0xe8
[  732.530921] [<8024c9d4>] gic_irq_dispatch+0x10/0x20
[  732.540622] [<800741e0>] generic_handle_irq+0x40/0x58
[  732.550694] [<8046d994>] do_IRQ+0x1c/0x2c
[  732.558668] [<8024c090>] plat_irq_dispatch+0xfc/0x138
[  732.568715] [<80007588>] except_vec_vi_end+0xb8/0xc4
[  732.578593] [<8006ca90>] queued_spin_lock_slowpath+0x140/0x2e0
[  732.590222] [<8ef318d8>] flow_offload_add+0xb8/0xaf4 [nf_flow_table]
[  732.602865] [<8ef8584c>] 0x8ef8584c
[  732.609819] Sending NMI from CPU 2 to CPUs 1:
[  732.836865] NMI backtrace for cpu 1
[  732.843827] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.172 #0
[  732.855951] task: 8fc3bfc0 task.stack: 8fc5c000
[  732.864953] $ 0   : 00000000 00000001 000c9857 00009857
[  732.875353] $ 4   : 00000000 00080000 00009857 00009857
[  732.885751] $ 8   : 0000ffff ffff0000 00000002 8fd44340
[  732.896149] $12   : 8f70a500 8f70a544 804983a0 00000001
[  732.906546] $16   : 8f70a27c 81224300 8057e1e8 00080000
[  732.916945] $20   : 805da300 0000005f 8f708000 8fc0bcfc
[  732.927343] $24   : b4f459c6 00000000                  
[  732.937741] $28   : 8fc5c000 8fc0bc68 8e9bc680 8006ca90
[  732.948139] Hi    : 00000000
[  732.953853] Lo    : 00000000
[  732.959588] epc   : 8006cb48 queued_spin_lock_slowpath+0x1f8/0x2e0
[  732.971877] ra    : 8006ca90 queued_spin_lock_slowpath+0x140/0x2e0
[  732.984161] Status: 11007c03	KERNEL EXL IE 
[  732.992482] Cause : 50800400 (ExcCode 00)
[  733.000447] PrId  : 0001992f (MIPS 1004Kc)
[  733.008588] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.172 #0
[  733.020699] Stack : 00000000 80580000 00000001 8007269c 805a0000 80546538 00000000 00000000
[  733.037332]         80512110 8fc0b944 8fc3c33c 805808e7 8050cf00 00000001 8fc0b8e8 5326164d
[  733.053962]         00000000 00000000 806e0000 000042a0 00000000 000000fb 00000008 00000000
[  733.070591]         00000000 80580000 0000218c 00000000 00000000 805a0000 00000000 00000001
[  733.087222]         8051471c 80571420 8051230c 80580000 00000000 80299228 00000004 806e0004
[  733.103853]         ...
[  733.108712] Call Trace:
[  733.113583] [<8000c7b0>] show_stack+0x58/0x100
[  733.122440] [<8044fc34>] dump_stack+0xa4/0xe0
[  733.131110] [<80456c24>] nmi_cpu_backtrace+0xc4/0x108
[  733.141157] [<80009448>] handle_backtrace+0x10/0x50
[  733.150866] [<800a2420>] flush_smp_call_function_queue+0x18c/0x1d8
[  733.163167] [<80011e60>] ipi_call_interrupt+0x10/0x20
[  733.173213] [<80074ddc>] __handle_irq_event_percpu+0x78/0x18c
[  733.184642] [<80074f10>] handle_irq_event_percpu+0x20/0x64
[  733.195550] [<80074fb4>] handle_irq_event+0x60/0xac
[  733.205258] [<800790b0>] handle_edge_irq+0x210/0x268
[  733.215143] [<800741e0>] generic_handle_irq+0x40/0x58
[  733.225205] [<8024c968>] gic_handle_shared_int+0x108/0x164
[  733.236116] [<800741e0>] generic_handle_irq+0x40/0x58
[  733.246183] [<8046d994>] do_IRQ+0x1c/0x2c
[  733.254154] [<8024c090>] plat_irq_dispatch+0xfc/0x138
[  733.264202] [<80007588>] except_vec_vi_end+0xb8/0xc4
[  733.274075] [<8006ca90>] queued_spin_lock_slowpath+0x140/0x2e0
[  733.285700] [<8ef318d8>] flow_offload_add+0xb8/0xaf4 [nf_flow_table]
[  733.298342] [<8ef8584c>] 0x8ef8584c

@kv-y

kv-y commented Mar 23, 2020

Copy link
Copy Markdown
Author

@yoonsikp

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.

@yoonsikp

Copy link
Copy Markdown

@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/
#2847
(enforced disable of flow control by removing if-else statement)
#2815

@bluehj777

Copy link
Copy Markdown

@yoonsikp

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.

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

  1. If P2P software is downloaded at full speed, the CPU consumption is generally less than 20%, but a random restart will occur within 20-30 minutes

  2. If I only use the router normally, there is no large traffic to download the application. A reboot usually occurs within 10-20 hours

  3. If the patch is not used, the router will return to normal

@yoonsikp

Copy link
Copy Markdown

@bluehj777 I can confirm that the crashes happened much more frequently after turning on my bittorent client

@yoonsikp

Copy link
Copy Markdown

@bluehj777
Would you be able to test the following patch? I have enabled HW offload and it is working great now.

diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c
index 89be239007..5f56b1ab9e 100644
--- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c
+++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c
@@ -98,15 +98,13 @@ static void mt7621_hw_init(struct mt7620_gsw *gsw, struct device_node *np)
 	mt7530_mdio_w32(gsw, 0x7000, 0x3);
 	usleep_range(10, 20);
 
-	if ((rt_sysc_r32(SYSC_REG_CHIP_REV_ID) & 0xFFFF) == 0x0101) {
-		/* (GE1, Force 1000M/FD, FC ON, MAX_RX_LENGTH 1536) */
-		mtk_switch_w32(gsw, 0x2305e30b, GSW_REG_MAC_P0_MCR);
-		mt7530_mdio_w32(gsw, 0x3600, 0x5e30b);
-	} else {
-		/* (GE1, Force 1000M/FD, FC ON, MAX_RX_LENGTH 1536) */
-		mtk_switch_w32(gsw, 0x2305e33b, GSW_REG_MAC_P0_MCR);
-		mt7530_mdio_w32(gsw, 0x3600, 0x5e33b);
-	}
+	mtk_switch_w32(gsw, 0x2305e30b, GSW_REG_MAC_P0_MCR);
+	mt7530_mdio_w32(gsw, 0x3600, 0x5e30b);
+
+	val = mt7530_mdio_r32(gsw, 0x1FE0);
+	val &= ~BIT(31);
+	mt7530_mdio_w32(gsw, 0x1FE0, val);
+
 
 	/* (GE2, Link down) */
 	mtk_switch_w32(gsw, 0x8000, GSW_REG_MAC_P1_MCR);

@bluehj777

Copy link
Copy Markdown

@bluehj777
Would you be able to test the following patch? I have enabled HW offload and it is working great now.

diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c
index 89be239007..5f56b1ab9e 100644
--- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c
+++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c
@@ -98,15 +98,13 @@ static void mt7621_hw_init(struct mt7620_gsw *gsw, struct device_node *np)
 	mt7530_mdio_w32(gsw, 0x7000, 0x3);
 	usleep_range(10, 20);
 
-	if ((rt_sysc_r32(SYSC_REG_CHIP_REV_ID) & 0xFFFF) == 0x0101) {
-		/* (GE1, Force 1000M/FD, FC ON, MAX_RX_LENGTH 1536) */
-		mtk_switch_w32(gsw, 0x2305e30b, GSW_REG_MAC_P0_MCR);
-		mt7530_mdio_w32(gsw, 0x3600, 0x5e30b);
-	} else {
-		/* (GE1, Force 1000M/FD, FC ON, MAX_RX_LENGTH 1536) */
-		mtk_switch_w32(gsw, 0x2305e33b, GSW_REG_MAC_P0_MCR);
-		mt7530_mdio_w32(gsw, 0x3600, 0x5e33b);
-	}
+	mtk_switch_w32(gsw, 0x2305e30b, GSW_REG_MAC_P0_MCR);
+	mt7530_mdio_w32(gsw, 0x3600, 0x5e30b);
+
+	val = mt7530_mdio_r32(gsw, 0x1FE0);
+	val &= ~BIT(31);
+	mt7530_mdio_w32(gsw, 0x1FE0, val);
+
 
 	/* (GE2, Link down) */
 	mtk_switch_w32(gsw, 0x8000, GSW_REG_MAC_P1_MCR);

Okay, I'll try it and give it feedback

@bluehj777

Copy link
Copy Markdown

@bluehj777
Would you be able to test the following patch? I have enabled HW offload and it is working great now.
hi@yoonsikp ,Just this patch directly? Or still need the d8bc0cc,then use this

@yoonsikp

Copy link
Copy Markdown

@bluehj777 Yes with both patches!

@kv-y

kv-y commented Mar 24, 2020

Copy link
Copy Markdown
Author

@yoonsikp

I had added the following patches when I encountered the kernel lockups:

That's interesting because I tested master branch with this commit: c8f8e59

@bluehj777

Copy link
Copy Markdown

@bluehj777 Yes with both patches!

@yoonsikp
I've been testing patched firmware on my XiaoYu C5 for more than 20 hours, and random reboots still happen, just less often than before

@yoonsikp

Copy link
Copy Markdown

@bluehj777 I got a crash as well, this time after 30 hours, so less often I agree, but not a complete fix.

@yoonsikp

Copy link
Copy Markdown

@hisirbr There is a long history of crashes with HW NAT, so it's probably not the cause of this PR

@kv-y

kv-y commented Mar 25, 2020

Copy link
Copy Markdown
Author

@yoonsikp

In 5.4 mt7621 is switching to DSA and HWNAT will be no longer supported (#2798)
So I recommend you and other to compile and test firmware from this repo and provide a feedback.
It will be more useful rather than we will try to debug HWNAT for 19.07.
BTW, it seems RPS script is broken in 5.4 branch, so I recommend you to manually enable RPS for better performance: echo e > /sys/class/net/eth0/queues/rx-0/rps_cpus
In my tests of linux-5.4 branch with enabled software flow offload I got 850-900Mbps (IPoE).

About this PR and lockups:
My patch is fixing only bug in generic HW NAPT code (when you are looking for a destination MAC address for ipv4 flow in arp cache). Without it kernel simply doesn't add this flow in the hardware table. It doesn't change HW NAT code specific for mt7621. That's why I think that my patch can't lead to these lockups.

But anyway I'll try to repeat and debug this bug because it's interesting for me.
You and @bluehj777 mentioned additional things that in theory can affect:

  • P2P traffic;
  • 100M WAN link instead of 1Gbps.

@MeIsReallyBa

MeIsReallyBa commented Apr 1, 2020 •

Copy link
Copy Markdown

HWNAT works fine now. 900Mb/S over pppoe and CPU consumption is 0%.
By the way, Is it possible to make hwnat work when handle wifi traffic?

@yoonsikp

yoonsikp commented Apr 1, 2020

Copy link
Copy Markdown

@MeIsReallyBa HWNAT is the offloading of the translation from the LAN to WAN, WiFi traffic is automatically bridged to LAN.

@LearZhou

LearZhou commented Apr 1, 2020

Copy link
Copy Markdown

What if the case of guest WiFi which has ip different than lan ips?

@yoonsikp

yoonsikp commented Apr 1, 2020

Copy link
Copy Markdown

@LearZhou Doesn't matter, any internal LAN IP that is being forwarded to WAN will match the netfilter, which would then be hardware offloaded.

@adschm adschm added the release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release label Apr 6, 2020
@MeIsReallyBa

Copy link
Copy Markdown

@MeIsReallyBa HWNAT is the offloading of the translation from the LAN to WAN, WiFi traffic is automatically bridged to LAN.

During my test,HWNAT is not working while handle wifi traffic.Maybe u could have a try.

@Mushoz

Mushoz commented May 12, 2020

Copy link
Copy Markdown
Contributor

Any news on this? The 19.07 branch still has broken HW Flow Offload due to this bug.

@Mushoz

Mushoz commented May 26, 2020

Copy link
Copy Markdown
Contributor

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.

@ynezz

ynezz commented May 26, 2020

Copy link
Copy Markdown
Member

It's very unfortunate that regressions that have been discovered and fixed months ago can still remain in a stable branch for so long.

  1. Regression is in experimental feature, which is disabled by default, that's probably why this has low priority
  2. Fix was tested by some users already and it seems to be producing other regressions. No Tested-by: so far (but tl;dr whole discussion, just Ctrl+F for Tested-by)

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 Tested-by: finally which might convince some of the committers to merge this into stable branch.

@kv-y

kv-y commented May 26, 2020

Copy link
Copy Markdown
Author

Hi @ynezz

It seems this bug was already fixed in other commit: 6786dc2
So I assume that mentioned commit should be backported to 19.07.
Also it means that we can close my PR then.

it seems to be producing other regressions

Some users reported about regressions specific to mt7621 hardware when hw napt is enabled.
My PR and 6786dc2 don't affect them and change only generic code.

@ynezz

ynezz commented May 26, 2020

Copy link
Copy Markdown
Member

@ynezz ynezz closed this May 26, 2020
jow- pushed a commit that referenced this pull request Jun 1, 2020
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)
phs07 pushed a commit to phs07/openwrt that referenced this pull request Oct 3, 2020
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)
@Mushoz

Mushoz commented Oct 9, 2020 •

Copy link
Copy Markdown
Contributor

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.

@Jeronimo17

Copy link
Copy Markdown

Nombre del host
OpenWrt
Modelo
Newifi-D2
Arquitectura
MediaTek MT7621 ver:1 eco:3
Versión del firmware
OpenWrt 19.07.4 r11208-ce6496d796 / LuCI openwrt-19.07 branch git-20.247.75781-0d0ab01
Versión del Kernel
4.14.195

With hwoffload it seems that after 3 days or earlier this happens randomly

https://pastebin.com/M0p0RSQA

biliwala pushed a commit to biliwala/friendlywrt that referenced this pull request Oct 16, 2020
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)
@marianvlaza

Copy link
Copy Markdown

Successfully tested with ASUS RT-AC65P. HWNAT is working.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix pull request contains fix for some issue kernel pull request/issue with Linux kernel related changes needs reviewer release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.