Re: [PATCH RFC/RFT net-next v2 3/5] selftests: no_forwarding: test VLAN uppers on VLAN aware bridged ports

Simon Horman
2025-12-01T14:19:45Z

On Mon, Dec 01, 2025 at 11:28:15AM +0100, Jonas Gorski wrote:
> Add a test (mainly for switchdev implementors) to test that multiple
> VLAN uppers on a VLAN aware bridge for the same VLAN do not enable
> forwarding of that VLAN between those ports.
>
> Since we are testing VLAN uppers, skip checking untagged traffic in
> those cases.
>
> Disallowing VLAN uppers on bridge ports is a valid choice for switchdev
> drivers, so test if we can create them first and skip the tests if not.
>
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> ---
> v1 -> v2:
> * new patch
>
> .../selftests/net/forwarding/no_forwarding.sh | 89 ++++++++++++++-----
> 1 file changed, 67 insertions(+), 22 deletions(-)
>
> diff --git a/tools/testing/selftests/net/forwarding/no_forwarding.sh b/tools/testing/selftests/net/forwarding/no_forwarding.sh
> index 694ece9ba3a7..c8adf04e1328 100755
> --- a/tools/testing/selftests/net/forwarding/no_forwarding.sh
> +++ b/tools/testing/selftests/net/forwarding/no_forwarding.sh
> @@ -1,7 +1,7 @@
> #!/bin/bash
> # SPDX-License-Identifier: GPL-2.0
>
> -ALL_TESTS="standalone two_bridges one_bridge_two_pvids"
> +ALL_TESTS="standalone two_bridges one_bridge_two_pvids bridge_aware_vlan_uppers"
> NUM_NETIFS=4
>
> source lib.sh
> @@ -90,6 +90,7 @@ check_rcv()
> run_test()
> {
> local test_name="$1"
> + local swp_uppers=${2:0}

Hi Jonas,

Should this be as follows?

local swp_uppers=${2:-0}

I.e. default to 0 if $2 is not set,
rather than take a substring of $2 at index 0 (which is all of $2)

Flagged by Claude Code with review-prompts.

https://netdev-ai.bots.linux.dev/ai-review.html?id=3d47057e-e740-4b66-9d60-9ec2a7ee92a1#patch-2

> local smac=$(mac_get $h1)
> local dmac=$(mac_get $h2)
> local h1_ipv6_lladdr=$(ipv6_lladdr_get $h1)

...

> +bridge_aware_vlan_uppers()
> +{

...

> + run_test "Switch ports in VLAN-aware bridge with VLAN uppers" 2
> +
> + ip link del br0
> +}
> +

...