Re: [PATCH v5 net-next 12/14] bridge: No DEV_PATH_BR_VLAN_UNTAG_HW for dsa foreign

Nikolay Aleksandrov
2025-02-06T14:31:11Z

On 2/4/25 21:49, Eric Woudstra wrote:
> In network setup as below:
>
> fastpath bypass
> .----------------------------------------.
> / \
> | IP - forwarding |
> | / \ v
> | / wan ...
> | /
> | |
> | |
> | brlan.1
> | |
> | +-------------------------------+
> | | vlan 1 |
> | | |
> | | brlan (vlan-filtering) |
> | | +---------------+
> | | | DSA-SWITCH |
> | | vlan 1 | |
> | | to | |
> | | untagged 1 vlan 1 |
> | +---------------+---------------+
> . / \
> ----->wlan1 lan0
> . .
> . ^
> ^ vlan 1 tagged packets
> untagged packets
>
> br_vlan_fill_forward_path_mode() sets DEV_PATH_BR_VLAN_UNTAG_HW when
> filling in from brlan.1 towards wlan1. But it should be set to
> DEV_PATH_BR_VLAN_UNTAG in this case. Using BR_VLFLAG_ADDED_BY_SWITCHDEV
> is not correct. The dsa switchdev adds it as a foreign port.
>
> The same problem for all foreignly added dsa vlans on the bridge.
>
> First add the vlan, trying only native devices.
> If this fails, we know this may be a vlan from a foreign device.
>
> Use BR_VLFLAG_TAGGING_BY_SWITCHDEV to make sure DEV_PATH_BR_VLAN_UNTAG_HW
> is set only when there if no foreign device involved.
>
> Signed-off-by: Eric Woudstra <ericwouds@gmail.com>
> ---
> include/net/switchdev.h | 1 +
> net/bridge/br_private.h | 10 ++++++++++
> net/bridge/br_switchdev.c | 15 +++++++++++++++
> net/bridge/br_vlan.c | 7 ++++++-
> net/switchdev/switchdev.c | 2 +-
> 5 files changed, 33 insertions(+), 2 deletions(-)
>

Acked-by: Nikolay Aleksandrov <razor@blackwall.org>