Skip to content

mlxsw: Support traffic redirection from a locked bridge port

Petr Machata netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesApplied 4/4

Patches in v1 All 4 applied

#Subject and filesSizeRepliesApplied
1/4mlxsw: core_acl_flex_actions: Add IGNORE_ACTIONdrivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h+42 -00 repliesApplied
2/4mlxsw: spectrum_flower: Disable learning and security lookup when redirectingdrivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c+22 -00 repliesApplied
3/4mlxsw: spectrum: Stop ignoring learning notifications from redirected trafficdrivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c+0 -170 repliesApplied
4/4selftests: forwarding: Add test case for traffic redirection from a locked porttools/testing/selftests/net/forwarding/bridge_locked_port.sh+36 -00 repliesApplied

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchPetr Machata
1/4R-b
2/4R-b
3/4R-b
4/4R-b

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

Read the v1 thread

Cover letter [PATCH net-next 0/4] mlxsw: Support traffic redirection from a locked bridge port

Ido Schimmel writes:

It is possible to add a filter that redirects traffic from the ingress of a bridge port that is locked (i.e., performs security / SMAC lookup) and has learning enabled. For example:

 # ip link add name br0 type bridge
 # ip link set dev swp1 master br0
 # bridge link set dev swp1 learning on locked on mab on
 # tc qdisc add dev swp1 clsact
 # tc filter add dev swp1 ingress pref 1 proto ip flower skip_sw src_ip 192.0.2.1 action mirred egress redirect dev swp2

In the kernel's Rx path, this filter is evaluated before the Rx handler of the bridge, which means that redirected traffic should not be affected by bridge port configuration such as learning.

However, the hardware data path is a bit different and the redirect action (FORWARDING_ACTION in hardware) merely attaches a pointer to the packet, which is later used by the L2 lookup stage to understand how to forward the packet. Between both stages - ingress ACL and L2 lookup - learning and security lookup are performed, which means that redirected traffic is affected by bridge port configuration, unlike in the kernel's data path.

The learning discrepancy was handled in commit 577fa14d2100 ("mlxsw:
spectrum: Do not process learned records with a dummy FID") by simply ignoring learning notifications generated by the redirected traffic. A similar solution is not possible for the security / SMAC lookup since
- unlike learning - the CPU is not involved and packets that failed the lookup are dropped by the device.

Instead, solve this by prepending the ignore action to the redirect action and use it to instruct the device to disable both learning and the security / SMAC lookup for redirected traffic.

Patch #1 adds the ignore action.

Patch #2 prepends the action to the redirect action in flower offload code.

Patch #3 removes the workaround in commit 577fa14d2100 ("mlxsw:
spectrum: Do not process learned records with a dummy FID") since it is no longer needed.

Patch #4 adds a test case.

Ido Schimmel (4):
mlxsw: core_acl_flex_actions: Add IGNORE_ACTION
mlxsw: spectrum_flower: Disable learning and security lookup when
redirecting
mlxsw: spectrum: Stop ignoring learning notifications from redirected
traffic
selftests: forwarding: Add test case for traffic redirection from a
locked port

 .../mellanox/mlxsw/core_acl_flex_actions.c    | 40 +++++++++++++++++++
 .../mellanox/mlxsw/core_acl_flex_actions.h    |  2 +
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |  4 +-
 .../ethernet/mellanox/mlxsw/spectrum_acl.c    |  9 +++++
 .../ethernet/mellanox/mlxsw/spectrum_fid.c    | 10 -----
 .../ethernet/mellanox/mlxsw/spectrum_flower.c | 10 +++++
 .../mellanox/mlxsw/spectrum_switchdev.c       |  6 ---
 .../net/forwarding/bridge_locked_port.sh      | 36 +++++++++++++++++
 8 files changed, 100 insertions(+), 17 deletions(-)
Signature · 1 line
2.41.0