Skip to content

netfilter: Add bridge-fastpath

Eric Woudstra bridge netdev netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v12 Latest7 patches 11 repliesIn review

Changes in v12 from the cover letter

- Added Note 2, refer to selftest script
- Added patch: nft_flow_offload_eval() check thoff==0.
- flow_offload_bridge_init() removed unnecessary call to memset().

Patches in v12 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7bridge: Add filling forward path from port to portnet/bridge/br_device.c net/bridge/br_private.h net/bridge/br_vlan.c+21 -61 reply
2/7net: core: dev: Add dev_fill_bridge_path()include/linux/netdevice.h net/core/dev.c+55 -130 replies
3/7netfilter: nf_flow_table_offload: Add nf_flow_rule_bridge()include/net/netfilter/nf_flow_table.h net/netfilter/nf_flow_table_offload.c+16 -05 replies
4/7netfilter: nf_flow_table_inet: Add nf_flowtable_type flowtable_bridgenet/netfilter/nf_flow_table_inet.c+13 -00 replies
5/7netfilter: nft_flow_offload: nft_flow_offload_eval: check thoff==0net/netfilter/nft_flow_offload.c+6 -31 reply
6/7netfilter: nft_flow_offload: Add NFPROTO_BRIDGE to validatenet/netfilter/nft_flow_offload.c+2 -10 replies
7/7netfilter: nft_flow_offload: Add bridgeflow to nft_flow_offload_eval()include/net/netfilter/nf_flow_table.h net/netfilter/nf_flow_table_path.c net/netfilter/nft_flow_offload.c+146 -52 replies

Reviews trailers per patch

5 of 7 patches have a Reviewed-by or Acked-by.

PatchNikolay Aleksandrov
1/7A-b
2/7R-b
3/7R-b
4/7R-b
5/7
6/7R-b
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v12 thread

Cover letter [PATCH v12 nf-next 0/7] netfilter: Add bridge-fastpath

This patchset makes it possible to set up a software fastpath between bridged interfaces. One patch adds the flow rule for the hardware fastpath. This creates the possibility to have a hardware offloaded fastpath between bridged interfaces. More patches are added to solve issues found with the existing code.

To set up the fastpath, add this extra flowtable (with or without 'flags offload'):

table bridge filter {
        flowtable fb {
                hook ingress priority filter
                devices = { lan0, lan1, lan2, lan3, lan4, wlan0, wlan1 }
                flags offload
        }
        chain forward {
                type filter hook forward priority filter; policy accept;
		ct state established flow add @fb
        }
}

Creating a separate fastpath for bridges.

forward fastpath bypass
.----------------------------------------.
/ \

|                        IP - forwarding    |
|                       /                \  v
|                      /                  wan ...
|                     /
|                     |
|                     |
|                   brlan.1
|                     |
|    +-------------------------------+
|    |           vlan 1              |
|    |                               |
|    |     brlan (vlan-filtering)    |
|    +---------------+               |
|    |  DSA-SWITCH   |               |
|    |               |    vlan 1     |
|    |               |      to       |
|    |   vlan 1      |   untagged    |
|    +---------------+---------------+
.         /                   \
 ------>lan0                 wlan1
        .  ^                 ^
        .  |                 |
        .  \_________________/
        .  bridge fastpath bypass
        .
        ^
     vlan 1 tagged packets

Note: While testing direct transmit in the software forward-fastpath, without the capability of setting the offload flag, it is sometimes useful to enslave the wan interface to another bridge, brwan. This will make sure both directions of the software forward-fastpath use direct transmit, which also happens when the offload flag is set.

Note 2: For complete testing this patch-set, see:
[PATCH v5 nf-next] selftests: netfilter: Add bridge_fastpath.sh This mail also mentions other patches involved in this, some patches already applied, some patches are not.

Changes in v12:
- Added Note 2, refer to selftest script
- Added patch: nft_flow_offload_eval() check thoff==0.
- flow_offload_bridge_init() removed unnecessary call to memset().

Changes in v11:
- Dropped "Introduce DEV_PATH_BR_VLAN_KEEP_HW for bridge-fastpath" from this patch-set, it has moved to another patch-set.
- Updated nft_flow_offload_bridge_init() changing the way of accessing headers after fixing nft_do_chain_bridge().

v10 split from patch-set: bridge-fastpath and related improvements v9

Eric Woudstra (7):
bridge: Add filling forward path from port to port
net: core: dev: Add dev_fill_bridge_path()
netfilter: nf_flow_table_offload: Add nf_flow_rule_bridge()
netfilter: nf_flow_table_inet: Add nf_flowtable_type flowtable_bridge
netfilter: nft_flow_offload: nft_flow_offload_eval: check thoff==0
netfilter: nft_flow_offload: Add NFPROTO_BRIDGE to validate
netfilter: nft_flow_offload: Add bridgeflow to nft_flow_offload_eval()

 include/linux/netdevice.h             |   2 +
 include/net/netfilter/nf_flow_table.h |   8 ++
 net/bridge/br_device.c                |  19 +++-
 net/bridge/br_private.h               |   2 +
 net/bridge/br_vlan.c                  |   6 +-
 net/core/dev.c                        |  66 +++++++++++---
 net/netfilter/nf_flow_table_inet.c    |  13 +++
 net/netfilter/nf_flow_table_offload.c |  13 +++
 net/netfilter/nf_flow_table_path.c    | 126 ++++++++++++++++++++++++++
 net/netfilter/nft_flow_offload.c      |  32 +++++--
 10 files changed, 259 insertions(+), 28 deletions(-)
Signature · 1 line
2.53.0