From: Ido Schimmel <idosch@nvidia.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Antoine Tenart <atenart@kernel.org>,
UNGLinuxDriver@microchip.com, Hongbo Wang <hongbo.wang@nxp.com>,
Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Colin Foster <colin.foster@in-advantage.com>,
Horatiu Vultur <horatiu.vultur@microchip.com>,
Hangbin Liu <liuhangbin@gmail.com>,
Petr Machata <petrm@nvidia.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 08/14] selftests: net: bridge_vlan_aware: test that other TPIDs are seen as untagged
Date: Thu, 15 Aug 2024 12:11:07 +0300 [thread overview]
Message-ID: <Zr3GK3NeZGGt2lpx@shredder.mtl.com> (raw)
In-Reply-To: <20240815000707.2006121-9-vladimir.oltean@nxp.com>
On Thu, Aug 15, 2024 at 03:07:01AM +0300, Vladimir Oltean wrote:
> The bridge VLAN implementation w.r.t. VLAN protocol is described in
> merge commit 1a0b20b25732 ("Merge branch 'bridge-next'"). We are only
> sensitive to those VLAN tags whose TPID is equal to the bridge's
> vlan_protocol. Thus, an 802.1ad VLAN should be treated as 802.1Q-untagged.
>
> Add 3 tests which validate that:
> - 802.1ad-tagged traffic is learned into the PVID of an 802.1Q-aware
> bridge
> - Double-tagged traffic is forwarded when just the PVID of the port is
> present in the VLAN group of the ports
> - Double-tagged traffic is not forwarded when the PVID of the port is
> absent from the VLAN group of the ports
>
> The test passes with both veth and ocelot.
Thanks for the test. Passes with mlxsw as well.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
One question below
> ---
> .../net/forwarding/bridge_vlan_aware.sh | 54 ++++++++++++++++++-
> 1 file changed, 53 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
> index 64bd00fe9a4f..90f8a244ea90 100755
> --- a/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
> +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
> @@ -1,7 +1,7 @@
> #!/bin/bash
> # SPDX-License-Identifier: GPL-2.0
>
> -ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn"
> +ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn other_tpid"
> NUM_NETIFS=4
> CHECK_TC="yes"
> source lib.sh
> @@ -142,6 +142,58 @@ extern_learn()
> bridge fdb del de:ad:be:ef:13:37 dev $swp1 master vlan 1 &> /dev/null
> }
>
> +other_tpid()
> +{
> + local mac=de:ad:be:ef:13:37
> +
> + # Test that packets with TPID 802.1ad VID 3 + TPID 802.1Q VID 5 are
> + # classified as untagged by a bridge with vlan_protocol 802.1Q, and
> + # are processed in the PVID of the ingress port (here 1). Not VID 3,
> + # and not VID 5.
> + RET=0
> +
> + tc qdisc add dev $h2 clsact
> + tc filter add dev $h2 ingress protocol all pref 1 handle 101 \
> + flower dst_mac $mac action drop
> + ip link set $h2 promisc on
> + ethtool -K $h2 rx-vlan-filter off rx-vlan-stag-filter off
Any reason not to undo it at the end of the test like other settings?
> +
> + $MZ -q $h1 -c 1 -b $mac -a own "88:a8 00:03 81:00 00:05 08:00 aa-aa-aa-aa-aa-aa-aa-aa-aa"
> + sleep 1
> +
> + # Match on 'self' addresses as well, for those drivers which
> + # do not push their learned addresses to the bridge software
> + # database
> + bridge -j fdb show $swp1 | \
> + jq -e ".[] | select(.mac == \"$(mac_get $h1)\") | select(.vlan == 1)" &> /dev/null
> + check_err $? "FDB entry was not learned when it should"
> +
> + log_test "FDB entry in PVID for VLAN-tagged with other TPID"
> +
> + RET=0
> + tc -j -s filter show dev $h2 ingress \
> + | jq -e ".[] | select(.options.handle == 101) \
> + | select(.options.actions[0].stats.packets == 1)" &> /dev/null
> + check_err $? "Packet was not forwarded when it should"
> + log_test "Reception of VLAN with other TPID as untagged"
> +
> + bridge vlan del dev $swp1 vid 1
> +
> + $MZ -q $h1 -c 1 -b $mac -a own "88:a8 00:03 81:00 00:05 08:00 aa-aa-aa-aa-aa-aa-aa-aa-aa"
> + sleep 1
> +
> + RET=0
> + tc -j -s filter show dev $h2 ingress \
> + | jq -e ".[] | select(.options.handle == 101) \
> + | select(.options.actions[0].stats.packets == 1)" &> /dev/null
> + check_err $? "Packet was forwarded when should not"
> + log_test "Reception of VLAN with other TPID as untagged (no PVID)"
> +
> + bridge vlan add dev $swp1 vid 1 pvid untagged
> + ip link set $h2 promisc off
> + tc qdisc del dev $h2 clsact
> +}
> +
> trap cleanup EXIT
>
> setup_prepare
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-08-15 9:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 0:06 [PATCH net 00/14] VLAN fixes for Ocelot driver Vladimir Oltean
2024-08-15 0:06 ` [PATCH net 01/14] selftests: net: local_termination: refactor macvlan creation/deletion Vladimir Oltean
2024-08-15 0:06 ` [PATCH net 02/14] selftests: net: local_termination: parameterize sending interface Vladimir Oltean
2024-08-15 0:06 ` [PATCH net 03/14] selftests: net: local_termination: parameterize test name Vladimir Oltean
2024-08-15 0:06 ` [PATCH net 04/14] selftests: net: local_termination: add one more test for VLAN-aware bridges Vladimir Oltean
2024-08-15 0:06 ` [PATCH net 05/14] selftests: net: local_termination: introduce new tests which capture VLAN behavior Vladimir Oltean
2024-08-15 0:06 ` [PATCH net 06/14] selftests: net: local_termination: don't use xfail_on_veth() Vladimir Oltean
2024-08-15 0:07 ` [PATCH net 07/14] selftests: net: local_termination: add PTP frames to the mix Vladimir Oltean
2024-08-15 0:07 ` [PATCH net 08/14] selftests: net: bridge_vlan_aware: test that other TPIDs are seen as untagged Vladimir Oltean
2024-08-15 9:11 ` Ido Schimmel [this message]
2024-08-15 9:38 ` Vladimir Oltean
2024-08-15 0:07 ` [PATCH net 09/14] net: mscc: ocelot: use ocelot_xmit_get_vlan_info() also for FDMA and register injection Vladimir Oltean
2024-08-15 0:07 ` [PATCH net 10/14] net: mscc: ocelot: fix QoS class for injected packets with "ocelot-8021q" Vladimir Oltean
2024-08-15 0:07 ` [PATCH net 11/14] net: mscc: ocelot: serialize access to the injection/extraction groups Vladimir Oltean
2024-08-15 0:07 ` [PATCH net 12/14] net: dsa: provide a software untagging function on RX for VLAN-aware bridges Vladimir Oltean
2024-08-15 0:07 ` [PATCH net 13/14] net: dsa: felix: fix VLAN tag loss on CPU reception with ocelot-8021q Vladimir Oltean
2024-08-15 0:07 ` [PATCH net 14/14] net: mscc: ocelot: treat 802.1ad tagged traffic as 802.1Q-untagged Vladimir Oltean
2024-08-16 9:10 ` [PATCH net 00/14] VLAN fixes for Ocelot driver patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zr3GK3NeZGGt2lpx@shredder.mtl.com \
--to=idosch@nvidia.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=atenart@kernel.org \
--cc=claudiu.manoil@nxp.com \
--cc=colin.foster@in-advantage.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hongbo.wang@nxp.com \
--cc=horatiu.vultur@microchip.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=vladimir.oltean@nxp.com \
--cc=xiaoliang.yang_1@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox