All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@mellanox.com>
To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org
Cc: davem@davemloft.net, shuah@kernel.org, idosch@mellanox.com,
	jiri@mellanox.com
Subject: [PATCH net-next 06/10] selftests: forwarding: lib: Extract trap_{,un}install()
Date: Thu, 24 May 2018 16:27:35 +0200	[thread overview]
Message-ID: <62e6587e5459918306bda15380ac6b5e37024b4f.1527171860.git.petrm@mellanox.com> (raw)
In-Reply-To: <cover.1527171860.git.petrm@mellanox.com>

A mirror-to-vlan test that's coming next needs to install the trap
unconditionally. Therefore extract from slow_path_trap_{,un}install()
a more generic functions trap_install() and trap_uninstall(), and covert
the former two to conditional wrappers around these.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 11c481c..e78ee7e 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -472,26 +472,35 @@ tc_offload_check()
 	return 0
 }
 
-slow_path_trap_install()
+trap_install()
 {
 	local dev=$1; shift
 	local direction=$1; shift
 
-	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
-		# For slow-path testing, we need to install a trap to get to
-		# slow path the packets that would otherwise be switched in HW.
-		tc filter add dev $dev $direction pref 1 \
-		   flower skip_sw action trap
-	fi
+	# For slow-path testing, we need to install a trap to get to
+	# slow path the packets that would otherwise be switched in HW.
+	tc filter add dev $dev $direction pref 1 flower skip_sw action trap
 }
 
-slow_path_trap_uninstall()
+trap_uninstall()
 {
 	local dev=$1; shift
 	local direction=$1; shift
 
+	tc filter del dev $dev $direction pref 1 flower skip_sw
+}
+
+slow_path_trap_install()
+{
+	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
+		trap_install "$@"
+	fi
+}
+
+slow_path_trap_uninstall()
+{
 	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
-		tc filter del dev $dev $direction pref 1 flower skip_sw
+		trap_uninstall "$@"
 	fi
 }
 
-- 
2.4.11

WARNING: multiple messages have this Message-ID (diff)
From: petrm at mellanox.com (Petr Machata)
Subject: [PATCH net-next 06/10] selftests: forwarding: lib: Extract trap_{,un}install()
Date: Thu, 24 May 2018 16:27:35 +0200	[thread overview]
Message-ID: <62e6587e5459918306bda15380ac6b5e37024b4f.1527171860.git.petrm@mellanox.com> (raw)
In-Reply-To: <cover.1527171860.git.petrm@mellanox.com>

A mirror-to-vlan test that's coming next needs to install the trap
unconditionally. Therefore extract from slow_path_trap_{,un}install()
a more generic functions trap_install() and trap_uninstall(), and covert
the former two to conditional wrappers around these.

Signed-off-by: Petr Machata <petrm at mellanox.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 11c481c..e78ee7e 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -472,26 +472,35 @@ tc_offload_check()
 	return 0
 }
 
-slow_path_trap_install()
+trap_install()
 {
 	local dev=$1; shift
 	local direction=$1; shift
 
-	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
-		# For slow-path testing, we need to install a trap to get to
-		# slow path the packets that would otherwise be switched in HW.
-		tc filter add dev $dev $direction pref 1 \
-		   flower skip_sw action trap
-	fi
+	# For slow-path testing, we need to install a trap to get to
+	# slow path the packets that would otherwise be switched in HW.
+	tc filter add dev $dev $direction pref 1 flower skip_sw action trap
 }
 
-slow_path_trap_uninstall()
+trap_uninstall()
 {
 	local dev=$1; shift
 	local direction=$1; shift
 
+	tc filter del dev $dev $direction pref 1 flower skip_sw
+}
+
+slow_path_trap_install()
+{
+	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
+		trap_install "$@"
+	fi
+}
+
+slow_path_trap_uninstall()
+{
 	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
-		tc filter del dev $dev $direction pref 1 flower skip_sw
+		trap_uninstall "$@"
 	fi
 }
 
-- 
2.4.11

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: petrm@mellanox.com (Petr Machata)
Subject: [PATCH net-next 06/10] selftests: forwarding: lib: Extract trap_{,un}install()
Date: Thu, 24 May 2018 16:27:35 +0200	[thread overview]
Message-ID: <62e6587e5459918306bda15380ac6b5e37024b4f.1527171860.git.petrm@mellanox.com> (raw)
Message-ID: <20180524142735.2RC3zocgs29bwgPBLtFwmor4Gyhs5AydYRWy82uh5LM@z> (raw)
In-Reply-To: <cover.1527171860.git.petrm@mellanox.com>

A mirror-to-vlan test that's coming next needs to install the trap
unconditionally. Therefore extract from slow_path_trap_{,un}install()
a more generic functions trap_install() and trap_uninstall(), and covert
the former two to conditional wrappers around these.

Signed-off-by: Petr Machata <petrm at mellanox.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 11c481c..e78ee7e 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -472,26 +472,35 @@ tc_offload_check()
 	return 0
 }
 
-slow_path_trap_install()
+trap_install()
 {
 	local dev=$1; shift
 	local direction=$1; shift
 
-	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
-		# For slow-path testing, we need to install a trap to get to
-		# slow path the packets that would otherwise be switched in HW.
-		tc filter add dev $dev $direction pref 1 \
-		   flower skip_sw action trap
-	fi
+	# For slow-path testing, we need to install a trap to get to
+	# slow path the packets that would otherwise be switched in HW.
+	tc filter add dev $dev $direction pref 1 flower skip_sw action trap
 }
 
-slow_path_trap_uninstall()
+trap_uninstall()
 {
 	local dev=$1; shift
 	local direction=$1; shift
 
+	tc filter del dev $dev $direction pref 1 flower skip_sw
+}
+
+slow_path_trap_install()
+{
+	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
+		trap_install "$@"
+	fi
+}
+
+slow_path_trap_uninstall()
+{
 	if [ "${tcflags/skip_hw}" != "$tcflags" ]; then
-		tc filter del dev $dev $direction pref 1 flower skip_sw
+		trap_uninstall "$@"
 	fi
 }
 
-- 
2.4.11

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-05-24 14:27 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 14:27 [PATCH net-next 00/10] Mirroring tests involving VLAN Petr Machata
2018-05-24 14:27 ` Petr Machata
2018-05-24 14:27 ` petrm
2018-05-24 14:27 ` [PATCH net-next 01/10] selftests: forwarding: Split mirror_gre_topo_lib.sh Petr Machata
2018-05-24 14:27   ` Petr Machata
2018-05-24 14:27   ` petrm
2018-05-24 14:27 ` [PATCH net-next 02/10] selftests: forwarding: mirror_gre_lib: Extract generic functions Petr Machata
2018-05-24 14:27   ` Petr Machata
2018-05-24 14:27   ` petrm
2018-05-24 14:27 ` [PATCH net-next 03/10] selftests: forwarding: Add $h3's clsact to mirror_topo_lib.sh Petr Machata
2018-05-24 14:27   ` Petr Machata
2018-05-24 14:27   ` petrm
2018-05-24 14:27 ` [PATCH net-next 04/10] selftests: forwarding: lib: Support VLAN devices Petr Machata
2018-05-24 14:27   ` Petr Machata
2018-05-24 14:27   ` petrm
2018-05-24 14:27 ` [PATCH net-next 05/10] selftests: forwarding: mirror_gre_lib: Support VLAN Petr Machata
2018-05-24 14:27   ` Petr Machata
2018-05-24 14:27   ` petrm
2018-05-24 14:27 ` Petr Machata [this message]
2018-05-24 14:27   ` [PATCH net-next 06/10] selftests: forwarding: lib: Extract trap_{,un}install() Petr Machata
2018-05-24 14:27   ` petrm
2018-05-24 14:27 ` [PATCH net-next 07/10] selftests: forwarding: Test mirror-to-vlan Petr Machata
2018-05-24 14:27   ` Petr Machata
2018-05-24 14:27   ` petrm
2018-05-24 14:27 ` [PATCH net-next 08/10] selftests: forwarding: Test mirror-to-gre w/ UL VLAN+802.1q Petr Machata
2018-05-24 14:27   ` Petr Machata
2018-05-24 14:27   ` petrm
2018-05-24 14:28 ` [PATCH net-next 09/10] selftests: forwarding: Test mirror-to-gre w/ UL VLAN Petr Machata
2018-05-24 14:28   ` Petr Machata
2018-05-24 14:28   ` petrm
2018-05-24 14:28 ` [PATCH net-next 10/10] selftests: forwarding: Test mirror-to-gre w/ UL 802.1d+VLAN Petr Machata
2018-05-24 14:28   ` Petr Machata
2018-05-24 14:28   ` petrm
2018-05-25  2:26 ` [PATCH net-next 00/10] Mirroring tests involving VLAN David Miller
2018-05-25  2:26   ` David Miller
2018-05-25  2:26   ` davem

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=62e6587e5459918306bda15380ac6b5e37024b4f.1527171860.git.petrm@mellanox.com \
    --to=petrm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.