[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200803161141.2523857-10-idosch@idosch.org>
Date: Mon, 3 Aug 2020 19:11:41 +0300
From: Ido Schimmel <idosch@...sch.org>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, jiri@...lanox.com,
petrm@...lanox.com, amitc@...lanox.com, mlxsw@...lanox.com,
Ido Schimmel <idosch@...lanox.com>
Subject: [PATCH net-next 9/9] selftests: mlxsw: RED: Test offload of trapping on RED qevents
From: Petr Machata <petrm@...lanox.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@...lanox.com>
Signed-off-by: Ido Schimmel <idosch@...lanox.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
Powered by blists - more mailing lists