From: Ido Schimmel <idosch@idosch.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, jiri@mellanox.com,
petrm@mellanox.com, amitc@mellanox.com, mlxsw@mellanox.com,
Ido Schimmel <idosch@mellanox.com>
Subject: [PATCH net-next 9/9] selftests: mlxsw: RED: Test offload of trapping on RED qevents
Date: Mon, 3 Aug 2020 19:11:41 +0300 [thread overview]
Message-ID: <20200803161141.2523857-10-idosch@idosch.org> (raw)
In-Reply-To: <20200803161141.2523857-1-idosch@idosch.org>
From: Petr Machata <petrm@mellanox.com>
Add a selftest for RED early_drop and mark qevents when a trap action is
attached at the associated block.
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
.../drivers/net/mlxsw/sch_red_core.sh | 35 +++++++++++++++----
.../drivers/net/mlxsw/sch_red_ets.sh | 11 ++++++
2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
index 45042105ead7..517297a14ecf 100644
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
@@ -568,17 +568,12 @@ do_drop_test()
busywait 1100 until_counter_is ">= $((base + 1))" $fetch_counter >/dev/null
check_fail $? "Spurious packets observed without buffer pressure"
- qevent_rule_uninstall_$subtest
-
# Push to the queue until it's at the limit. The configured limit is
# rounded by the qdisc and then by the driver, so this is the best we
- # can do to get to the real limit of the system. Do this with the rules
- # uninstalled so that the inevitable drops don't get counted.
+ # can do to get to the real limit of the system.
build_backlog $vlan $((3 * limit / 2)) udp >/dev/null
- qevent_rule_install_$subtest
base=$($fetch_counter)
-
send_packets $vlan udp 11
now=$(busywait 1100 until_counter_is ">= $((base + 10))" $fetch_counter)
@@ -631,3 +626,31 @@ do_drop_mirror_test()
tc filter del dev $h2 ingress pref 1 handle 101 flower
}
+
+qevent_rule_install_trap()
+{
+ tc filter add block 10 pref 1234 handle 102 matchall skip_sw \
+ action trap hw_stats disabled
+}
+
+qevent_rule_uninstall_trap()
+{
+ tc filter del block 10 pref 1234 handle 102 matchall
+}
+
+qevent_counter_fetch_trap()
+{
+ local trap_name=$1; shift
+
+ devlink_trap_rx_packets_get "$trap_name"
+}
+
+do_drop_trap_test()
+{
+ local vlan=$1; shift
+ local limit=$1; shift
+ local trap_name=$1; shift
+
+ do_drop_test "$vlan" "$limit" "$trap_name" trap \
+ "qevent_counter_fetch_trap $trap_name"
+}
diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh
index c8968b041bea..3f007c5f8361 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh
@@ -8,6 +8,7 @@ ALL_TESTS="
red_test
mc_backlog_test
red_mirror_test
+ red_trap_test
"
: ${QDISC:=ets}
source sch_red_core.sh
@@ -94,6 +95,16 @@ red_mirror_test()
uninstall_qdisc
}
+red_trap_test()
+{
+ install_qdisc qevent early_drop block 10
+
+ do_drop_trap_test 10 $BACKLOG1 early_drop
+ do_drop_trap_test 11 $BACKLOG2 early_drop
+
+ uninstall_qdisc
+}
+
trap cleanup EXIT
setup_prepare
--
2.26.2
next prev parent reply other threads:[~2020-08-03 16:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 16:11 [PATCH net-next 0/9] mlxsw: Add support for buffer drop traps Ido Schimmel
2020-08-03 16:11 ` [PATCH net-next 1/9] devlink: Add early_drop trap Ido Schimmel
2020-08-03 16:11 ` [PATCH net-next 2/9] devlink: Pass extack when setting trap's action and group's parameters Ido Schimmel
2020-08-03 16:11 ` [PATCH net-next 3/9] mlxsw: spectrum_trap: Use 'size_t' for array sizes Ido Schimmel
2020-08-03 16:11 ` [PATCH net-next 4/9] mlxsw: spectrum_span: On policer_id_base_ref_count, use dec_and_test Ido Schimmel
2020-08-03 16:11 ` [PATCH net-next 5/9] mlxsw: spectrum_trap: Allow for per-ASIC trap groups initialization Ido Schimmel
2020-08-03 16:11 ` [PATCH net-next 6/9] mlxsw: spectrum_trap: Allow for per-ASIC traps initialization Ido Schimmel
2020-08-03 16:11 ` [PATCH net-next 7/9] mlxsw: spectrum_trap: Add early_drop trap Ido Schimmel
2020-08-03 16:11 ` [PATCH net-next 8/9] mlxsw: spectrum_qdisc: Offload action trap for qevents Ido Schimmel
2020-08-03 16:11 ` Ido Schimmel [this message]
2020-08-04 1:13 ` [PATCH net-next 0/9] mlxsw: Add support for buffer drop traps David Miller
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=20200803161141.2523857-10-idosch@idosch.org \
--to=idosch@idosch.org \
--cc=amitc@mellanox.com \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=kuba@kernel.org \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=petrm@mellanox.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;
as well as URLs for NNTP newsgroup(s).