From: Liu Jian <liujian56@huawei.com>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <jiri@resnulli.us>,
<vladimir.oltean@nxp.com>, <andrew@lunn.ch>,
<d-tatianin@yandex-team.ru>, <justin.chen@broadcom.com>,
<rkannoth@marvell.com>, <idosch@nvidia.com>, <jdamato@fastly.com>,
<netdev@vger.kernel.org>
Cc: <liujian56@huawei.com>
Subject: [PATCH net v3 2/2] selftests: add vlan hw filter tests
Date: Sat, 16 Dec 2023 15:52:19 +0800 [thread overview]
Message-ID: <20231216075219.2379123-3-liujian56@huawei.com> (raw)
In-Reply-To: <20231216075219.2379123-1-liujian56@huawei.com>
Add one basic vlan hw filter test.
Signed-off-by: Liu Jian <liujian56@huawei.com>
---
tools/testing/selftests/net/Makefile | 1 +
tools/testing/selftests/net/vlan_hw_filter.sh | 29 +++++++++++++++++++
2 files changed, 30 insertions(+)
create mode 100755 tools/testing/selftests/net/vlan_hw_filter.sh
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 5b2aca4c5f10..9e5bf59a20bf 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -91,6 +91,7 @@ TEST_PROGS += test_bridge_neigh_suppress.sh
TEST_PROGS += test_vxlan_nolocalbypass.sh
TEST_PROGS += test_bridge_backup_port.sh
TEST_PROGS += fdb_flush.sh
+TEST_PROGS += vlan_hw_filter.sh
TEST_FILES := settings
diff --git a/tools/testing/selftests/net/vlan_hw_filter.sh b/tools/testing/selftests/net/vlan_hw_filter.sh
new file mode 100755
index 000000000000..7bc804ffaf7c
--- /dev/null
+++ b/tools/testing/selftests/net/vlan_hw_filter.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+readonly NETNS="ns-$(mktemp -u XXXXXX)"
+
+ret=0
+
+cleanup() {
+ ip netns del $NETNS
+}
+
+trap cleanup EXIT
+
+fail() {
+ echo "ERROR: ${1:-unexpected return code} (ret: $_)" >&2
+ ret=1
+}
+
+ip netns add ${NETNS}
+ip netns exec ${NETNS} ip link add bond0 type bond mode 0
+ip netns exec ${NETNS} ip link add bond_slave_1 type veth peer veth2
+ip netns exec ${NETNS} ip link set bond_slave_1 master bond0
+ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
+ip netns exec ${NETNS} ip link add link bond_slave_1 name bond_slave_1.0 type vlan id 0
+ip netns exec ${NETNS} ip link add link bond0 name bond0.0 type vlan id 0
+ip netns exec ${NETNS} ip link set bond_slave_1 nomaster
+ip netns exec ${NETNS} ip link del veth2 || fail "Please check vlan HW filter function"
+
+exit $ret
--
2.34.1
next prev parent reply other threads:[~2023-12-16 8:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-16 7:52 [PATCH net v3 0/2] check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev() Liu Jian
2023-12-16 7:52 ` [PATCH net v3 1/2] net: " Liu Jian
2023-12-16 7:52 ` Liu Jian [this message]
2023-12-18 6:52 ` [PATCH net v3 2/2] selftests: add vlan hw filter tests Hangbin Liu
2023-12-19 12:20 ` [PATCH net v3 0/2] check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev() 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=20231216075219.2379123-3-liujian56@huawei.com \
--to=liujian56@huawei.com \
--cc=andrew@lunn.ch \
--cc=d-tatianin@yandex-team.ru \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=jdamato@fastly.com \
--cc=jiri@resnulli.us \
--cc=justin.chen@broadcom.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=vladimir.oltean@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