Skip to content

Commit 8fb6ac4

Browse files
pmachatadavem330
authored andcommitted
selftests: mlxsw: RED: Test offload of trapping on RED qevents
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 <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 54a9238 commit 8fb6ac4

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,17 +568,12 @@ do_drop_test()
568568
busywait 1100 until_counter_is ">= $((base + 1))" $fetch_counter >/dev/null
569569
check_fail $? "Spurious packets observed without buffer pressure"
570570

571-
qevent_rule_uninstall_$subtest
572-
573571
# Push to the queue until it's at the limit. The configured limit is
574572
# rounded by the qdisc and then by the driver, so this is the best we
575-
# can do to get to the real limit of the system. Do this with the rules
576-
# uninstalled so that the inevitable drops don't get counted.
573+
# can do to get to the real limit of the system.
577574
build_backlog $vlan $((3 * limit / 2)) udp >/dev/null
578575

579-
qevent_rule_install_$subtest
580576
base=$($fetch_counter)
581-
582577
send_packets $vlan udp 11
583578

584579
now=$(busywait 1100 until_counter_is ">= $((base + 10))" $fetch_counter)
@@ -631,3 +626,31 @@ do_drop_mirror_test()
631626

632627
tc filter del dev $h2 ingress pref 1 handle 101 flower
633628
}
629+
630+
qevent_rule_install_trap()
631+
{
632+
tc filter add block 10 pref 1234 handle 102 matchall skip_sw \
633+
action trap hw_stats disabled
634+
}
635+
636+
qevent_rule_uninstall_trap()
637+
{
638+
tc filter del block 10 pref 1234 handle 102 matchall
639+
}
640+
641+
qevent_counter_fetch_trap()
642+
{
643+
local trap_name=$1; shift
644+
645+
devlink_trap_rx_packets_get "$trap_name"
646+
}
647+
648+
do_drop_trap_test()
649+
{
650+
local vlan=$1; shift
651+
local limit=$1; shift
652+
local trap_name=$1; shift
653+
654+
do_drop_test "$vlan" "$limit" "$trap_name" trap \
655+
"qevent_counter_fetch_trap $trap_name"
656+
}

tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ALL_TESTS="
88
red_test
99
mc_backlog_test
1010
red_mirror_test
11+
red_trap_test
1112
"
1213
: ${QDISC:=ets}
1314
source sch_red_core.sh
@@ -94,6 +95,16 @@ red_mirror_test()
9495
uninstall_qdisc
9596
}
9697

98+
red_trap_test()
99+
{
100+
install_qdisc qevent early_drop block 10
101+
102+
do_drop_trap_test 10 $BACKLOG1 early_drop
103+
do_drop_trap_test 11 $BACKLOG2 early_drop
104+
105+
uninstall_qdisc
106+
}
107+
97108
trap cleanup EXIT
98109

99110
setup_prepare

0 commit comments

Comments
 (0)