From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: netdev@vger.kernel.org
Cc: "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>, Ido Schimmel <idosch@nvidia.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net 05/14] selftests: net: local_termination: introduce new tests which capture VLAN behavior
Date: Thu, 15 Aug 2024 03:06:58 +0300 [thread overview]
Message-ID: <20240815000707.2006121-6-vladimir.oltean@nxp.com> (raw)
In-Reply-To: <20240815000707.2006121-1-vladimir.oltean@nxp.com>
Add more coverage to the local termination selftest as follows:
- 8021q upper of $h2
- 8021q upper of $h2, where $h2 is a port of a VLAN-unaware bridge
- 8021q upper of $h2, where $h2 is a port of a VLAN-aware bridge
- 8021q upper of VLAN-unaware br0, which is the upper of $h2
- 8021q upper of VLAN-aware br0, which is the upper of $h2
Especially the cases with traffic sent through the VLAN upper of a
VLAN-aware bridge port will be immediately relevant when we will start
transmitting PTP packets as an additional kind of traffic.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
.../net/forwarding/local_termination.sh | 117 ++++++++++++++++--
1 file changed, 110 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/local_termination.sh b/tools/testing/selftests/net/forwarding/local_termination.sh
index 5aa364b40e33..e22c6a693bef 100755
--- a/tools/testing/selftests/net/forwarding/local_termination.sh
+++ b/tools/testing/selftests/net/forwarding/local_termination.sh
@@ -1,7 +1,9 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
-ALL_TESTS="standalone vlan_unaware_bridge vlan_aware_bridge"
+ALL_TESTS="standalone vlan_unaware_bridge vlan_aware_bridge test_vlan \
+ vlan_over_vlan_unaware_bridged_port vlan_over_vlan_aware_bridged_port \
+ vlan_over_vlan_unaware_bridge vlan_over_vlan_aware_bridge"
NUM_NETIFS=2
PING_COUNT=1
REQUIRE_MTOOLS=yes
@@ -231,6 +233,30 @@ h2_destroy()
simple_if_fini $h2 $H2_IPV4/24 $H2_IPV6/64
}
+h1_vlan_create()
+{
+ simple_if_init $h1
+ vlan_create $h1 100 v$h1 $H1_IPV4/24 $H1_IPV6/64
+}
+
+h1_vlan_destroy()
+{
+ vlan_destroy $h1 100
+ simple_if_fini $h1
+}
+
+h2_vlan_create()
+{
+ simple_if_init $h2
+ vlan_create $h2 100 v$h2 $H2_IPV4/24 $H2_IPV6/64
+}
+
+h2_vlan_destroy()
+{
+ vlan_destroy $h2 100
+ simple_if_fini $h2
+}
+
bridge_create()
{
local vlan_filtering=$1
@@ -241,14 +267,10 @@ bridge_create()
ip link set $h2 master br0
ip link set $h2 up
-
- simple_if_init br0 $H2_IPV4/24 $H2_IPV6/64
}
bridge_destroy()
{
- simple_if_fini br0 $H2_IPV4/24 $H2_IPV6/64
-
ip link del br0
}
@@ -272,7 +294,7 @@ standalone()
h2_create
macvlan_create $h2
- run_test $h1 $h2
+ run_test $h1 $h2 "$h2"
macvlan_destroy
h2_destroy
@@ -285,11 +307,13 @@ test_bridge()
h1_create
bridge_create $vlan_filtering
+ simple_if_init br0 $H2_IPV4/24 $H2_IPV6/64
macvlan_create br0
- run_test $h1 br0
+ run_test $h1 br0 "vlan_filtering=$vlan_filtering bridge"
macvlan_destroy
+ simple_if_fini br0 $H2_IPV4/24 $H2_IPV6/64
bridge_destroy
h1_destroy
}
@@ -304,6 +328,85 @@ vlan_aware_bridge()
test_bridge 1
}
+test_vlan()
+{
+ h1_vlan_create
+ h2_vlan_create
+ macvlan_create $h2.100
+
+ run_test $h1.100 $h2.100 "VLAN upper"
+
+ macvlan_destroy
+ h2_vlan_destroy
+ h1_vlan_destroy
+}
+
+vlan_over_bridged_port()
+{
+ local vlan_filtering=$1
+
+ h1_vlan_create
+ h2_vlan_create
+ bridge_create $vlan_filtering
+ macvlan_create $h2.100
+
+ run_test $h1.100 $h2.100 "VLAN over vlan_filtering=$vlan_filtering bridged port"
+
+ macvlan_destroy
+ bridge_destroy
+ h2_vlan_destroy
+ h1_vlan_destroy
+}
+
+vlan_over_vlan_unaware_bridged_port()
+{
+ vlan_over_bridged_port 0
+}
+
+vlan_over_vlan_aware_bridged_port()
+{
+ vlan_over_bridged_port 1
+}
+
+vlan_over_bridge()
+{
+ local vlan_filtering=$1
+
+ h1_vlan_create
+ bridge_create $vlan_filtering
+ simple_if_init br0
+ vlan_create br0 100 vbr0 $H2_IPV4/24 $H2_IPV6/64
+ macvlan_create br0.100
+
+ if [ $vlan_filtering = 1 ]; then
+ bridge vlan add dev $h2 vid 100 master
+ bridge vlan add dev br0 vid 100 self
+ fi
+
+ run_test $h1.100 br0.100 "VLAN over vlan_filtering=$vlan_filtering bridge"
+
+ if [ $vlan_filtering = 1 ]; then
+ bridge vlan del dev br0 vid 100 self
+ bridge vlan del dev $h2 vid 100 master
+ fi
+
+ macvlan_destroy
+ vlan_destroy br0 100
+ simple_if_fini br0
+ bridge_destroy
+ h1_vlan_destroy
+}
+
+vlan_over_vlan_unaware_bridge()
+{
+ vlan_over_bridge 0
+}
+
+vlan_over_vlan_aware_bridge()
+{
+ vlan_over_bridge 1
+}
+
cleanup()
{
pre_cleanup
--
2.34.1
next prev parent reply other threads:[~2024-08-15 0:09 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 ` Vladimir Oltean [this message]
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
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=20240815000707.2006121-6-vladimir.oltean@nxp.com \
--to=vladimir.oltean@nxp.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=idosch@nvidia.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=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
all inboxes | Powered by JetHome®