All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: Petr Machata <petrm@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: [PATCH net-next 7/7] selftests: mlxsw: Add a trap_fwd test to devlink_trap_control
Date: Thu, 8 Apr 2021 15:38:29 +0200	[thread overview]
Message-ID: <20210408133829.2135103-8-petrm@nvidia.com> (raw)
In-Reply-To: <20210408133829.2135103-1-petrm@nvidia.com>

Test that trap_fwd'd packets show up under the correct trap.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
---
 .../drivers/net/mlxsw/devlink_trap_control.sh | 23 ++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_control.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_control.sh
index a37273473c1b..8bca4c58819b 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_control.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_control.sh
@@ -83,6 +83,7 @@ ALL_TESTS="
 	ptp_general_test
 	flow_action_sample_test
 	flow_action_trap_test
+	flow_action_trap_fwd_test
 "
 NUM_NETIFS=4
 source $lib_dir/lib.sh
@@ -663,14 +664,18 @@ flow_action_sample_test()
 	tc qdisc del dev $rp1 clsact
 }
 
-flow_action_trap_test()
+__flow_action_trap_test()
 {
+	local action=$1; shift
+	local trap=$1; shift
+	local description=$1; shift
+
 	# Install a filter that traps a specific flow.
 	tc qdisc add dev $rp1 clsact
 	tc filter add dev $rp1 ingress proto ip pref 1 handle 101 flower \
-		skip_sw ip_proto udp src_port 12345 dst_port 54321 action trap
+		skip_sw ip_proto udp src_port 12345 dst_port 54321 action $action
 
-	devlink_trap_stats_test "Flow Trapping (Logging)" "flow_action_trap" \
+	devlink_trap_stats_test "$description" $trap \
 		$MZ $h1 -c 1 -a own -b $(mac_get $rp1) \
 		-A 192.0.2.1 -B 198.51.100.1 -t udp sp=12345,dp=54321 -p 100 -q
 
@@ -678,6 +683,18 @@ flow_action_trap_test()
 	tc qdisc del dev $rp1 clsact
 }
 
+flow_action_trap_test()
+{
+	__flow_action_trap_test trap flow_action_trap \
+				"Flow Trapping (Logging)"
+}
+
+flow_action_trap_fwd_test()
+{
+	__flow_action_trap_test trap_fwd flow_action_trap_fwd \
+				"Flow Trap-and-forwarding (Logging)"
+}
+
 trap cleanup EXIT
 
 setup_prepare
-- 
2.26.2


      parent reply	other threads:[~2021-04-08 13:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 13:38 [PATCH net-next 0/7] tc: Introduce a trap-and-forward action Petr Machata
2021-04-08 13:38 ` [PATCH net-next 1/7] net: sched: Add " Petr Machata
2021-04-08 14:05   ` Jamal Hadi Salim
2021-04-08 21:25     ` Jakub Kicinski
2021-04-09 11:13       ` Jamal Hadi Salim
2021-04-09 11:03     ` Petr Machata
2021-04-09 11:44       ` Jamal Hadi Salim
2021-04-09 13:43         ` Petr Machata
2021-04-11 19:23           ` Jamal Hadi Salim
2021-04-08 13:38 ` [PATCH net-next 2/7] net: sched: Make the action trap_fwd offloadable Petr Machata
2021-04-08 13:38 ` [PATCH net-next 3/7] devlink: Add a new trap for the trap_fwd action Petr Machata
2021-04-08 13:38 ` [PATCH net-next 4/7] mlxsw: Propagate extack to mlxsw_afa_block_commit() Petr Machata
2021-04-08 13:38 ` [PATCH net-next 5/7] mlxsw: Offload trap_fwd Petr Machata
2021-04-08 13:38 ` [PATCH net-next 6/7] selftests: forwarding: Add a test for TC trapping behavior Petr Machata
2021-04-08 13:38 ` Petr Machata [this message]

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=20210408133829.2135103-8-petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=idosch@nvidia.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.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 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.