Skip to content

nft_flow_offload: add L2 bridge offload support - #22533

Closed
rchen14b wants to merge 2 commits into
openwrt:mainfrom
rchen14b:nft-flow-offload-bridge
Closed

rchen14b wants to merge 2 commits into
openwrt:mainfrom
rchen14b:nft-flow-offload-bridge

Conversation

@rchen14b

@rchen14b rchen14b commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bridged traffic (e.g. WiFi client to wired LAN through br-lan) currently
cannot be offloaded via nft_flow_offload. Only routed/NAT flows get
picked up by the flowtable. This means AP/bridge mode setups always go
through the full kernel bridge + conntrack + netfilter path for every
packet, regardless of hardware capabilities.

These patches add bridge awareness to nft_flow_offload:

  • Detect bridged packets by looking up the destination MAC in the bridge FDB
  • Build flow entries using bridge port in/out interfaces instead of L3 routes
  • Handle WDMA path for WiFi bridge offload (MT7996)
  • Support VLAN passthrough when bridge VLAN filtering is disabled

This benefits both software and hardware flowtable users:

  • Software flowtable (flow_offloading=1): bridged traffic takes the
    kernel fast path, skipping per-packet conntrack/firewall/FDB lookups.
    Works on any device, no PPE or hardware offload needed.
  • Hardware offload (flow_offloading_hw=1): bridged flows are pushed
    to PPE hardware on MediaTek and Airoha platforms for wire-speed forwarding.

The second commit enables the required infrastructure on the Airoha AN7581
target (kmod-br-netfilter, sysctl, WiFi flowtable hotplug).

Based on MediaTek SDK patches (999-ppe-15, 999-ppe-16, 999-ppe-24) by
Bo-Cun Chen and chak-kei.lam. Adapted and tested on Airoha AN7581.

The PPE drivers on both MediaTek (mtk_ppe) and Airoha (airoha_ppe) already
support PPE_PKT_TYPE_BRIDGE entries — these patches complete the netfilter
side of the pipeline.

Test results

  • Airoha AN7581 (Gemtek W1700K) in AP/bridge mode: verified [HW_OFFLOAD]
    for both wired and WiFi bridged flows
  • MediaTek MT7981 (Cudy TR3000 v1) tested by @ttc0419: CPU usage reduced
    from 24% to 8% on 250Mbps WAN, flows bound correctly
  • Router mode (NAT) offload: no regression
  • Devices without PPE: no behavior change, code paths only activate when
    a flowtable is configured

Test plan

  • Build for airoha target, verify patches apply cleanly
  • Boot in AP/bridge mode, verify bridged flows get [HW_OFFLOAD]
  • Confirm router mode NAT offload still works
  • Build and test on mediatek/filogic (MT7981) — confirmed by @ttc0419
  • Test software-only flowtable (no hardware offload) on a device without PPE

@rchen14b

Copy link
Copy Markdown
Contributor Author

@Ansuel @LorenzoBianconi This patch will get rid of the need for bridger for L2 offload. And With the bridger plugin, my wifi offload in eagle platform is very buggy and download constantly dropped to 1M, after removed bridger and applied this patch, everything works fine. I also included a screenshoot of my Airoha NPU app that shows the debug counters and live block diagram with the new patches.
Screenshot 2026-03-20 at 16 17 44

@OpenWRT-fanboy OpenWRT-fanboy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works well. Should probably be sent upstream at some point.

@github-actions github-actions Bot added kernel pull request/issue with Linux kernel related changes target/airoha pull request/issue for airoha target labels Mar 21, 2026
@nicefile

Copy link
Copy Markdown

bridger can work independently from flow_offloading_hw=1 effectively allows for SQM + WED configuration. Will this work the same? Also will this allows to offload bridge between eth0 and eth1 in mt798x ? I'm willing to do tests on mt7981 based WR3000H

@ttc0419

ttc0419 commented Mar 22, 2026 •

Copy link
Copy Markdown

bridger can work

The bridger package is broken on snapshot the last I checked it, no flows were bound.

This PR works flawlessly on a 250Mbps wan, CPU usage is reduced from 24% to 8% according to top and flows are bound correctly according to /sys/kernel/debug/ppe0/bind and /proc/net/nf_conntrack.

Build system: x86/64
Build-tested: mediatek/filogic (Cudy TR3000 v1 (OpenWrt U-Boot layout))
Run-tested: mediatek/filogic (Cudy TR3000 v1 (OpenWrt U-Boot layout))

@rchen14b

Copy link
Copy Markdown
Contributor Author

bridger can work independently from flow_offloading_hw=1 effectively allows for SQM + WED configuration. Will this work the same? Also will this allows to offload bridge between eth0 and eth1 in mt798x ? I'm willing to do tests on mt7981 based WR3000H

This should work as well, as long as you make sure the wireless interfaces added to the flow table.

@LorenzoBianconi

LorenzoBianconi commented Mar 22, 2026 via email

Copy link
Copy Markdown
Contributor

@rchen14b

Copy link
Copy Markdown
Contributor Author

ttc0419 left a comment (openwrt/openwrt#22533)
<#22533 (comment)> bridger can work The bridger package is broken on snapshot the last I checked it, no flows were bound <nbd168/bridger#9>. This PR works flawlessly on a 250Mbps wan, CPU usage is reduced from 24% to 8% according to top and flows are bind correctly according to /sys/kernel/debug/ppe0/bind and /proc/net/nf_conntrack. Build system: x86/64 Build-tested: mediatek/filogic (Cudy TR3000 v1 (OpenWrt U-Boot layout)) Run-tested: mediatek/filogic (Cudy TR3000 v1 (OpenWrt U-Boot layout)) — Reply to this email directly, view it on GitHub <#22533?email_source=notifications&email_token=AAOA2CKK3JEUWX62QK3RKMD4R66QXA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJQGU4TMNZXHAZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4105967782>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOA2CLAGKQI56F5B75YGP34R66QXAVCNFSM6AAAAACWZTER6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCMBVHE3DONZYGI . You are receiving this because you were mentioned.Message ID: @.***>
I fixed briger with this PR: nbd168/bridger#11
…
-- UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep

@LorenzoBianconi The bridger also caused the wireless offload issue under eagle platform with all your patches included the wireless download speed randomly drop to 1M, but with this patch it does not cause that problem. Any thought what might be the cause?

@hauke

hauke commented Mar 22, 2026

Copy link
Copy Markdown
Member

Please refresh the patches with make target/{clean,refresh}

@hauke

This comment was marked as duplicate.

@brada4 brada4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is official upstream bridge flowtable eg https://patchwork.ozlabs.org/project/netdev/cover/[email protected]/

This should not be a one-device thing with global patches.

@hauke

This comment was marked as duplicate.

@github-actions

This comment was marked as duplicate.

@hauke

hauke commented Mar 23, 2026

Copy link
Copy Markdown
Member

/claude

@github-actions

github-actions Bot commented Mar 23, 2026 •

Copy link
Copy Markdown

Claude finished @hauke's task in 2m 27s —— View job


Code Review Complete

I've analyzed this PR which adds L2 bridge offload support to nft_flow_offload. The implementation looks solid overall with good test results, but there are several important concerns to address.

🔴 Critical Issues

1. Upstream Compatibility Concern

As @brada4 noted, there is official upstream bridge flowtable support from Pablo Neira Ayuso (netfilter maintainer). The existing target/linux/generic/hack-6.12/650-netfilter-add-xt_FLOWOFFLOAD-target.patch already handles DEV_PATH_BRIDGE for xt_FLOWOFFLOAD.

Questions:

  • How does this approach differ from the upstream bridge flowtable work?
  • Will this conflict when the upstream patches are eventually merged?
  • Should this be rebased on top of the upstream bridge flowtable patches instead?

This needs clarification before merging to avoid technical debt.

2. Direct Bridge Header Include

target/linux/generic/pending-6.12/675-02-nft_flow_offload-add-bridging-support.patch:32:

+#include "../bridge/br_private.h"

This is a major red flag. Including private bridge headers with relative paths is fragile and not upstream-acceptable. When this breaks (and it will during kernel updates), it will be painful to maintain.

Better approaches:

  • Export necessary bridge functions properly via public headers
  • Work with upstream to add proper APIs for what you need
  • At minimum, use a more robust include mechanism

Fix this →

⚠️ Important Issues

3. Patch Numbering and Placement

The patches are numbered 675-* which suggests they should be in the pending series. However:

  • The pending-6.12 directory is for patches that are pending upstream acceptance
  • These patches don't appear to be submitted upstream yet
  • They might be better placed in hack-6.12 if they're OpenWrt-specific workarounds

Per @hauke's request: Please refresh the patches with make target/{clean,refresh} to ensure proper formatting and context lines.

4. IPv6 FLOWI_FLAG_ANYSRC Question

@hauke asked about IPv6 saddr setting at line 266. While @rchen14b explained it's needed because IPv6 lacks FLOWI_FLAG_ANYSRC, the implementation seems inconsistent:

target/linux/generic/pending-6.12/675-02-nft_flow_offload-add-bridging-support.patch:266-271:

+	case NFPROTO_IPV6:
+		fl.u.ip6.saddr = ct->tuplehash[!dir].tuple.dst.u3.in6;
+		fl.u.ip6.daddr = ct->tuplehash[!dir].tuple.src.u3.in6;
+		fl.u.ip6.flowi6_oif = ifindex;
+		fl.u.ip6.flowlabel = ip6_flowinfo(ipv6_hdr(pkt->skb));
+		fl.u.ip6.flowi6_mark = pkt->skb->mark;
+		fl.u.ip6.flowi6_flags = FLOWI_FLAG_ANYSRC;

Wait, you do set flowi6_flags = FLOWI_FLAG_ANYSRC on line 271. So why also set saddr explicitly? This contradicts the earlier explanation. Either:

  • The saddr line is unnecessary (if FLOWI_FLAG_ANYSRC works)
  • Or FLOWI_FLAG_ANYSRC doesn't actually exist for IPv6 and line 271 is wrong

Please clarify and fix the inconsistency.

5. VLAN Underflow Fix Lacks Explanation

target/linux/generic/pending-6.12/675-02-nft_flow_offload-add-bridging-support.patch:141-146:

 			case DEV_PATH_BR_VLAN_UNTAG:
-				if (WARN_ON_ONCE(info->num_encaps-- == 0)) {
-					info->indev = NULL;
-					break;
-				}
+				if (info->num_encaps > 0)
+					info->num_encaps--;
 				break;

This silently changes behavior by removing the WARN_ON_ONCE and error handling when num_encaps is already 0. While preventing underflow is good, removing the warning means you'll miss kernel bugs that cause this condition. Why not keep the warning?

6. Zero Source MAC Behavior Change

target/linux/generic/pending-6.12/675-02-nft_flow_offload-add-bridging-support.patch:90-91:

+	if (!is_zero_ether_addr(ha))
+		goto out;

This inverts the logic - now if ha is not zero, skip the neighbor lookup. This seems backwards unless bridged flows pre-populate ha before calling this function (which they do at lines 188-196). This is fine but deserves a comment explaining why we skip neighbor lookup for bridged flows.

✅ Good Practices

7. Proper RCU Usage

The bridge port and FDB lookups properly use RCU locking throughout. Good defensive programming.

8. Comprehensive Testing

The NPU statistics screenshot shows the implementation working with good offload percentages (77.4% on CDM1, 67.2% on CDM2). The WiFi WDMA path shows proper offload via the NPU, which validates patch 3's fix.

9. Clean Error Handling

target/linux/generic/pending-6.12/675-02-nft_flow_offload-add-bridging-support.patch:315-320:

+err_route_dir2:
+	dst_release(route->tuple[!dir].dst);
+err_route_dir1:
+	dst_release(route->tuple[dir].dst);
+	return ret;

Proper cleanup on error paths with labeled gotos. Well done.

📝 Minor Issues

10. Airoha Configuration

The hotplug script in target/linux/airoha/an7581/base-files/etc/uci-defaults/15-w1700k-flow-offload is device-specific (W1700K) but applies to all AN7581 boards. Consider:

  • Moving to device-specific files if other AN7581 boards don't need this
  • Or renaming to indicate it's generic AN7581 behavior
  • The 5-second delay seems arbitrary - is this the minimum needed?

11. Missing Documentation

The patches should include documentation about:

  • When to use bridged vs routed offload
  • The interaction with bridger package (which this replaces for some use cases)
  • Whether both can coexist or one must be disabled

🧪 Testing Recommendations

Before merging, please test:

  • MediaTek MT7988/BPI-R4 (as mentioned in test plan but no confirmation yet)
  • Mixed bridged + routed traffic on the same device
  • What happens when bridge VLAN filtering is toggled dynamically
  • Behavior with SQM enabled (per @nicefile's question about bridger alternatives)
  • Devices without PPE support (should be no-op per description)

Summary

The implementation is well-structured and shows real performance benefits, but the upstream compatibility concern and br_private.h include are blocking issues that need resolution before merge. The IPv6 FLOWI_FLAG_ANYSRC inconsistency also needs clarification.

After addressing these and refreshing patches per @hauke's request, this could be a valuable addition for bridge offload on MediaTek/Airoha platforms.


@brada4

brada4 commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Kind of bridge conntrack is old as the world, never fully embraced here.
@hauke can summary be made to not exceed input? either way surprising it is to the point.

@ttc0419

ttc0419 commented Mar 23, 2026 •

Copy link
Copy Markdown

I fixed briger with this PR: nbd168/bridger#11

Tried your patch, some of the initial flows are bound correctly but the all later flows seem still failed to bind. It's an earlier bug if I recall correctly.

@rchen14b
rchen14b force-pushed the nft-flow-offload-bridge branch from 4b38e08 to ad5f371 Compare March 23, 2026 21:23
@rchen14b

Copy link
Copy Markdown
Contributor Author

Please refresh the patches with make target/{clean,refresh}

Refreshed patches.

@rchen14b

Copy link
Copy Markdown
Contributor Author

There is official upstream bridge flowtable eg https://patchwork.ozlabs.org/project/netdev/cover/[email protected]/

This should not be a one-device thing with global patches.

That series from 2020 was never merged upstream — nft_flow_offload still has no bridge support in mainline as of 6.12. These patches fill that gap based on what MediaTek ships in their vendor SDK (999-ppe-15/16/24) which has been in production use on MT7988 platforms.

Regarding global patches — the generic kernel patches are a no-op on devices without hardware flow offload. The code paths only activate when a flowtable with flags offload is configured and the hardware driver supports TC flower. The airoha-specific commit (sysctl, kmod, hotplug) is correctly scoped to the an7581 target only.

@ttc0419 confirmed it also works on MediaTek filogic (MT7981), so this benefits both platforms.

@brada4

brada4 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Just to point out that there is competing upstream work

@geldot

geldot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

The upstream suggestion looks more comprehensive but dead in the water for five years. I like that @rchen14b's solution is already widely deployed and lightweight, so easy to revert if something better comes along.

This kind of workflow to integrate with firewall is unfortunate though:

# Reload once per boot (flag cleared on reboot via /tmp)
[ -f /tmp/.flow-offload-wifi-done ] && exit 0
touch /tmp/.flow-offload-wifi-done

# Delay to let all WiFi interfaces finish coming up
(sleep 5 && /etc/init.d/firewall reload) 2>/dev/null &

@lukasz1992

Copy link
Copy Markdown

I do not like this sleep 5 approach. It'd be much better to add the script directly (without sleep) inside /etc/hotplug.d/ieee80211 - as this would be executed after creating phy*-ap interfaces.

Maybe some trigger instead of restart would be better - I mean something like:

ubus call firewall reload

@brada4

brada4 commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

The bigger problem is that HW offload does not work at all with any kind of roaming. Between wifi netdevs or to wired extender., as all states are fixed between macs + netdevs for sysctl-able expiration timer.

@rchen14b

Copy link
Copy Markdown
Contributor Author

I do not like this sleep 5 approach. It'd be much better to add the script directly (without sleep) inside /etc/hotplug.d/ieee80211 - as this would be executed after creating phy*-ap interfaces.

Maybe some trigger instead of restart would be better - I mean something like:

ubus call firewall reload

That approach was the only one I could think at the time when testing it, I think the firewall restart might be a better approach, will do some testing and update here.

@taylorkline

Copy link
Copy Markdown

The bigger problem is that HW offload does not work at all with any kind of roaming. Between wifi netdevs or to wired extender., as all states are fixed between macs + netdevs for sysctl-able expiration timer.

Is this a valid concern to you @rchen14b ?

@ttc0419

ttc0419 commented Apr 1, 2026 •

Copy link
Copy Markdown

The bigger problem is that HW offload does not work at all with any kind of roaming. Between wifi netdevs or to wired extender., as all states are fixed between macs + netdevs for sysctl-able expiration timer.

It works on my redmi ax6s with 802.11r with usteer 802.11kv. Ping tests only drop <=1 packet during roaming. However, the mediatek team thinks it might still happen as they have patches to improve roaming support by removing flow entries dynamically: 999-eth-42-mtk_eth_soc-add-roaming-handler.patch, 999-ppe-08-mtk_ppe-add-roaming-handler.patch.

@chbgdn

chbgdn commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Not working. bridge flows are not offloaded. any configs needed? firewall is enabled with hardware flow offload selected.

kmod-nf-conntrack-bridge package and enabled hw offload is enouth for me. Can you show me nft list flowtables output?

@glassd00r

Copy link
Copy Markdown

Not working. bridge flows are not offloaded. any configs needed? firewall is enabled with hardware flow offload selected.

kmod-nf-conntrack-bridge package and enabled hw offload is enouth for me. Can you show me nft flowtables list output?

sorry. since it was not working. I have flashed back my usual stable firmware. Maybe someone else can also try it out.

@d687r02j8g

Copy link
Copy Markdown

Not working. bridge flows are not offloaded. any configs needed? firewall is enabled with hardware flow offload selected.

kmod-nf-conntrack-bridge package and enabled hw offload is enouth for me. Can you show me nft flowtables list output?

I have 2 ax3000t setup as access points, when I enable wed, roaming doesn't work, even with the bridger package installed. Would your patches fix this? If so, I can give it a go to see if it works?

@chbgdn

chbgdn commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

sorry. since it was not working. I have flashed back my usual stable firmware. Maybe someone else can also try it out.

Sure. For me it working ok with wlan<->lan offload, but my w1700k is not working as dummy AP.

I have 2 ax3000t setup as access points, when I enable wed, roaming doesn't work, even with the bridger package installed. Would your patches fix this? If so, I can give it a go to see if it works?

I'm not tested it on filogic yet, but you can try.

@d687r02j8g

Copy link
Copy Markdown

sorry. since it was not working. I have flashed back my usual stable firmware. Maybe someone else can also try it out.

Sure. For me it working ok with wlan<->lan offload, but my w1700k is not working as dummy AP.

I have 2 ax3000t setup as access points, when I enable wed, roaming doesn't work, even with the bridger package installed. Would your patches fix this? If so, I can give it a go to see if it works?

I'm not tested it on filogic yet, but you can try.

Would you be able to create an image for me if possible with the following packages, plus any additional required for offloading

collectd-mod-thermal curl getrandom hostapd-utils htop iperf3 irqbalance kmod-cfg80211 kmod-crypto-aead kmod-crypto-authenc kmod-crypto-ccm kmod-crypto-cmac kmod-crypto-des kmod-crypto-gcm kmod-hwmon-core kmod-lib-crc-ccitt kmod-libphy kmod-mac80211 kmod-mt76-connac kmod-phy-aquantia kmod-ppp kmod-pppoe libuclient luci-app-attendedsysupgrade luci-app-firewall luci-app-package-manager luci-app-statistics luci-app-usteer luci-light luci-ssl owut wpad-mbedtls -nftables -wpad-basic-mbedtls

No problem if you can't, I'll try to figure it out.

@chbgdn

chbgdn commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Would you be able to create an image for me if possible with the following packages, plus any additional required for offloading

Sorry, but I don't want to brick your APs :)
I'll try to test it on filogic in few days, when I'll have access to my mt7986 device.

@GreyXor

GreyXor commented Jul 1, 2026

Copy link
Copy Markdown

Would you be able to create an image for me if possible with the following packages, plus any additional required for offloading

Sorry, but I don't want to brick your APs :) I'll try to test it on filogic in few days, when I'll have access to my mt7986 device.

I have ASUS BT8 and i'm also interested in the WED functionnaly for it! Thanks for your work

@OpenWRT-fanboy

Copy link
Copy Markdown

@danpawlik If the mailing list didn't like br_netfilter, why not ask AI to re-write the patch without it?

You know, like this:
nft_flow_offload_wo_br_netfilter.patch

@danpawlik

Copy link
Copy Markdown
Contributor

@danpawlik If the mailing list didn't like br_netfilter, why not ask AI to re-write the patch without it?

You know, like this: nft_flow_offload_wo_br_netfilter.patch

I assumed that the kernel community would prefer to go with Eric solution. To avoid additional work that probably would not be merged, I make a step back to see how Eric change works, wait for it and then make additional patches.

danpawlik added a commit to danpawlik/openwrt that referenced this pull request Jul 1, 2026
…ered flows

When vlan_filtering is enabled and a packet arrives without a VLAN tag
(bridged via the port PVID), the bridge offload path places the PVID
into the path context for the forward-path walk but not into
info->num_encaps. When the walk reaches an untagged destination port
and emits DEV_PATH_BR_VLAN_UNTAG, the handler finds num_encaps==0 and
cannot decrement it, resulting in incorrect or absent hardware offload
entries. WiFi clients on untagged VLANs cannot communicate with wired
ports.

Tagged VLAN flows (skb_vlan_tag_present) are not affected and continue
to use hardware offload correctly.

Only skip bridge offload when the packet has no VLAN tag and VLAN
filtering is active. Such flows fall through to software bridging, which
handles PVID-based forwarding correctly.

Closes: openwrt#22533 (comment)
Reported-by: gongtao0607 <[email protected]>
Signed-off-by: Daniel Pawlik <[email protected]>
@gongtao0607

gongtao0607 commented Jul 2, 2026 •

Copy link
Copy Markdown

@chbgdn Hi, thanks for the effort.

To report back, I have briefly tested your patches rebased to fanboy/ubi2 (Thanks @OpenWRT-fanboy ) on a w1700k AP. SSID on untagged vlan now works normally (Yay). On top of that, I can see BND traffic in the ppe status when HW offload is enabled.
WIFI client iperf test is topped around 800Mbps up/900 down (2 NSS). 0% sirq when HW offload is enabled, 8% to 20% sriq when disabled. No obvious bandwidth difference w/wo HW offload. Single client next to the AP, 10gbe lan.

With that being said, the patch needs a fix: I got this compile error when building all kmods:

make[5]: Entering directory '/home/tao/openwrt-w1700k/build_dir/target-aarch64_cortex-a53_musl/linux-airoha_an7581/linux-6.18.37'
  AR      net/netfilter/built-in.a
  LD [M]  net/netfilter/nf_conntrack.o
  LD [M]  net/netfilter/nf_conntrack_h323.o
  LD [M]  net/netfilter/nf_nat.o
  LD [M]  net/netfilter/nf_tables.o
  LD [M]  net/netfilter/nf_flow_table.o
  CC [M]  net/netfilter/xt_FLOWOFFLOAD.o
net/netfilter/xt_FLOWOFFLOAD.c: In function 'nf_dev_path_info':
net/netfilter/xt_FLOWOFFLOAD.c:328:25: error: enumeration value 'DEV_PATH_BR_VLAN_KEEP_HW' not handled in switch [-Werror=switch]
  328 |                         switch (path->bridge.vlan_mode) {
      |                         ^~~~~~
cc1: all warnings being treated as errors
make[9]: *** [scripts/Makefile.build:287: net/netfilter/xt_FLOWOFFLOAD.o] Error 1

(Maybe there is more)

Another issue I found but may or may not related to your patch is that once I add kmod-br-netfilter, the device is softbricked (reboot loop)

@glassd00r

glassd00r commented Jul 2, 2026 •

Copy link
Copy Markdown

Sure. For me it working ok with wlan<->lan offload, but my w1700k is not working as dummy AP.

Just tried another build. And this time it seems to work well. Bridge flows are properly offloaded. Putting it through more tests to be sure.

Edit:
@danpawlik will be great if you test this as well. Passes all initial test on w1700k setup as an AP. I will probably test wired ports on Vlan as well as wireless ssid on vlans later on. Just eyeballing the patches, seems minimal addon to eric's effort. So upsteaming should be possible

Edit 2:
tried a few reboots. On some reboots the fw4 starts well before the wireless interfaces are up. Had to reload firewall manually. similar fix using hotplug scipt is already used in this PR.

Edit 3:
@chbgdn time to spin off into a new PR? So it gets more eyeballs and testing?

@skramstad

skramstad commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

@danpawlik @gongtao0607 I've backported Eric Woudstra's bridge fastpath series to 6.18, fixed a bug in the bridge fastpath that left hw_ifidx at 0 (breaking PPE offload), and taught firewall4 to generate a bridge flowtable automatically. Pushed to w1700k-ericwoud - would be great if you guys could give it a spin.

7 commits on top of main:

1. kernel: add kmod-nf-conntrack-bridge package (`CONFIG_NF_CONNTRACK_BRIDGE=m`)

2. generic: Eric Woudstra's 11 patches - bridge conntrack (double VLAN/PPPoE), DEV_PATH_BR_VLAN_KEEP_HW, port-to-port bridge fwd path, dev_fill_bridge_path(), nf_flow_rule_bridge(), NFPROTO_BRIDGE flowtable, bridge flow eval

3. airoha: fix Lorenzo's DSCP offload for bridge refactoring

4. generic: set hw_ifidx in bridge fastpath so PPE finds the egress port

5. firewall4: generate bridge flowtable (table bridge fw4 fb) when offload devices include bridge ports, respects flow_offloading_hw uci toggle

6. airoha: an7581: added kmod-nf-conntrack-bridge to DEFAULT_PACKAGES

7. generic: removed a WARN_ON_ONCE in dev_fill_bridge_path that would spam the kernel log on flooded bridge traffic (unknown unicast, broadcast, multicast) - replaced with silent return -1, the flow offload simply skips those

Key differences from the old approach:

* Needs kmod-nf-conntrack-bridge instead of kmod-br-netfilter

* No br-netfilter sysfs hacks, no uci-defaults workarounds, no fake dst allocation

* Proper NFPROTO_BRIDGE flowtable - separate from routing

* Works with flow_offloading_hw toggle in uci/LuCI as usual

Just built and testing your work. So far working as expected. HW Offload is working by looking at btop doing wifi transfers. I'm using mine as a WAP on a W1700k HW1.0.
Build: w1700k SNAPSHOT, r35200+13-4b370c5097.

@danpawlik

Copy link
Copy Markdown
Contributor

@chbgdn please create new pull request, that we can make comments. Right now, we are mixing solution in one PR that might be confusing to someone who is reading last comments.

@rchen14b what you would like to do with this PR? From one side, kernel maintainers would not merge that solution, from other, dont' see any reply from OpenWrt core reviewers if they would approve that. I think decision is yours.

@chbgdn

chbgdn commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@gongtao0607 @glassd00r @skramstad @danpawlik Thanks all for testing, I'll prepare new PR today (or maybe it will need few PRs, idk).

@d687r02j8g

Copy link
Copy Markdown

@gongtao0607 @glassd00r @skramstad @danpawlik Thanks all for testing, I'll prepare new PR today (or maybe it will need few PRs, idk).

I managed to get an image made. It didn't brick my device, but enabling wed, /sys/kernel/debug/ppe0/bind was empty. Some devices were unable to connect to some wireless networks which were on the non default vlan.
I'd be happy to test once you need volunteers. I can recover from a brick if needed 🤣

@skramstad

Copy link
Copy Markdown
Contributor

@gongtao0607 @glassd00r @skramstad @danpawlik Thanks all for testing, I'll prepare new PR today (or maybe it will need few PRs, idk).

I managed to get an image made. It didn't brick my device, but enabling wed, /sys/kernel/debug/ppe0/bind was empty. Some devices were unable to connect to some wireless networks which were on the non default vlan. I'd be happy to test once you need volunteers. I can recover from a brick if needed 🤣

Mine cat /sys/kernel/debug/ppe/bind is working. I only have ppe btw...

@d687r02j8g

Copy link
Copy Markdown

@gongtao0607 @glassd00r @skramstad @danpawlik Thanks all for testing, I'll prepare new PR today (or maybe it will need few PRs, idk).

I managed to get an image made. It didn't brick my device, but enabling wed, /sys/kernel/debug/ppe0/bind was empty. Some devices were unable to connect to some wireless networks which were on the non default vlan. I'd be happy to test once you need volunteers. I can recover from a brick if needed 🤣

Mine cat /sys/kernel/debug/ppe/bind is working. I only have ppe btw...

Which device do you have? I still have the image and can flash it or compile a new one if required

@skramstad

Copy link
Copy Markdown
Contributor

@gongtao0607 @glassd00r @skramstad @danpawlik Thanks all for testing, I'll prepare new PR today (or maybe it will need few PRs, idk).

I managed to get an image made. It didn't brick my device, but enabling wed, /sys/kernel/debug/ppe0/bind was empty. Some devices were unable to connect to some wireless networks which were on the non default vlan. I'd be happy to test once you need volunteers. I can recover from a brick if needed 🤣

Mine cat /sys/kernel/debug/ppe/bind is working. I only have ppe btw...

Which device do you have? I still have the image and can flash it or compile a new one if required

W1700k.

@chbgdn

chbgdn commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

I managed to get an image made. It didn't brick my device, but enabling wed, /sys/kernel/debug/ppe0/bind was empty. Some devices were unable to connect to some wireless networks which were on the non default vlan.
I'd be happy to test once you need volunteers. I can recover from a brick if needed 🤣

Thanks, can you share output of nft list flowtables and verify that you have kmod-nf-conntrack-bridge package installed in your build?

@danpawlik @glassd00r @skramstad @gongtao0607 @d687r02j8g I created new draft-PR #24038 so lets move our conversation in it.

@danpawlik

Copy link
Copy Markdown
Contributor

@Notupus

Notupus commented Jul 4, 2026

Copy link
Copy Markdown

Just a thought, usually if we are doing sqm we disable offloading for it, it would be better in my opinion for this to be a seperate toggle for this kind of offloading since its not usual to do any qos on bridges since the bandwidth is usually adequate. Same idea in #24038 should apply if that was to be merged.

@glassd00r

Copy link
Copy Markdown

Just a thought, usually if we are doing sqm we disable offloading for it, it would be better in my opinion for this to be a seperate toggle for this kind of offloading since its not usual to do any qos on bridges since the bandwidth is usually adequate. Same idea in #24038 should apply if that was to be merged.

imho.. if bridger works as intended there will be no need for this or other variation of bridge offload via nft_flow_offload.

@Notupus

Notupus commented Jul 4, 2026

Copy link
Copy Markdown

Just a thought, usually if we are doing sqm we disable offloading for it, it would be better in my opinion for this to be a seperate toggle for this kind of offloading since its not usual to do any qos on bridges since the bandwidth is usually adequate. Same idea in #24038 should apply if that was to be merged.

imho.. if bridger works as intended there will be no need for this or other variation of bridge offload via nft_flow_offload.

I do support this too but also i do acknowledge that some people might want to do weird stuff on their bridges and would want this off.

@glassd00r

Copy link
Copy Markdown

Just a thought, usually if we are doing sqm we disable offloading for it, it would be better in my opinion for this to be a seperate toggle for this kind of offloading since its not usual to do any qos on bridges since the bandwidth is usually adequate. Same idea in #24038 should apply if that was to be merged.

imho.. if bridger works as intended there will be no need for this or other variation of bridge offload via nft_flow_offload.

I do support this too but also i do acknowledge that some people might want to do weird stuff on their bridges and would want this off.

easy to exclude the bridge from the offload flow table.

@peterwillcn peterwillcn left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rchen14b Please rebase branch main, thx.
git fetch upstream main
git rebase upstream/main

@danpawlik

Copy link
Copy Markdown
Contributor

@peterwillcn it is superseded with #24038

@rchen14b

Copy link
Copy Markdown
Contributor Author

#24038

I have been busy on other stuff so I would close this pull request and you can move to #24038 instead.

@rchen14b rchen14b closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel pull request/issue with Linux kernel related changes target/airoha pull request/issue for airoha target

Projects

None yet

Development

Successfully merging this pull request may close these issues.