Skip to content

Commit

Permalink
selftests: mlxsw: Use shapers in QOS tests instead of forcing speed
Browse files Browse the repository at this point in the history
QOS tests create congestion and verify the switch behavior. To create
congestion, they need to have more traffic than the port can handle, so
some of them force 1Gbps speed.

The tests assume that 1Gbps speed is supported, otherwise, they will fail.
Spectrum-4 ASIC will not support this speed in all ports, so to be able
to run QOS tests there, some adjustments are required. Use shapers to
limit the traffic instead of forcing speed. Note that for several ports,
the speed configuration is just for autoneg issues, so shaper is not needed
instead.

In tests that already use shapers, set the existing shaper to be a child of
a new TBF shaper which is added as a root qdisc and acts as a port shaper.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Amit Cohen authored and Jakub Kicinski committed Sep 20, 2022
1 parent 2dc81a0 commit 9e7aaa7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
5 changes: 3 additions & 2 deletions tools/testing/selftests/drivers/net/mlxsw/qos_ets_strict.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ switch_create()

ip link set dev $swp3 up
mtu_set $swp3 10000
ethtool -s $swp3 speed 1000 autoneg off
tc qdisc replace dev $swp3 root handle 101: tbf rate 1gbit \
burst 128K limit 1G

vlan_create $swp1 111
vlan_create $swp2 222
Expand Down Expand Up @@ -193,7 +194,7 @@ switch_destroy()
vlan_destroy $swp2 222
vlan_destroy $swp1 111

ethtool -s $swp3 autoneg on
tc qdisc del dev $swp3 root handle 101:
mtu_restore $swp3
ip link set dev $swp3 down
lldptool -T -i $swp3 -V ETS-CFG up2tc=0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0
Expand Down
9 changes: 5 additions & 4 deletions tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ switch_create()
vlan_create $swp2 111
vlan_create $swp3 111

ethtool -s $swp3 speed 1000 autoneg off
tc qdisc replace dev $swp3 root handle 3: \
prio bands 8 priomap 7 7 7 7 7 7 7 7
tc qdisc replace dev $swp3 root handle 3: tbf rate 1gbit \
burst 128K limit 1G
tc qdisc replace dev $swp3 parent 3:3 handle 33: \
prio bands 8 priomap 7 7 7 7 7 7 7 7

ip link add name br1 type bridge vlan_filtering 0
ip link set dev br1 up
Expand Down Expand Up @@ -172,8 +173,8 @@ switch_destroy()
ip link del dev br111
ip link del dev br1

tc qdisc del dev $swp3 parent 3:3 handle 33:
tc qdisc del dev $swp3 root handle 3:
ethtool -s $swp3 autoneg on

vlan_destroy $swp3 111
vlan_destroy $swp2 111
Expand Down
15 changes: 8 additions & 7 deletions tools/testing/selftests/drivers/net/mlxsw/sch_ets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ ALL_TESTS="
ets_test_dwrr
"

PARENT="parent 3:3"

switch_create()
{
ets_switch_create

# Create a bottleneck so that the DWRR process can kick in.
ethtool -s $h2 speed 1000 autoneg off
ethtool -s $swp2 speed 1000 autoneg off
tc qdisc replace dev $swp2 root handle 3: tbf rate 1gbit \
burst 128K limit 1G

ets_switch_create

# Set the ingress quota high and use the three egress TCs to limit the
# amount of traffic that is admitted to the shared buffers. This makes
Expand Down Expand Up @@ -55,10 +57,9 @@ switch_destroy()
devlink_tc_bind_pool_th_restore $swp1 0 ingress
devlink_port_pool_th_restore $swp1 0

ethtool -s $swp2 autoneg on
ethtool -s $h2 autoneg on

ets_switch_destroy

tc qdisc del dev $swp2 root handle 3:
}

# Callback from sch_ets_tests.sh
Expand Down

0 comments on commit 9e7aaa7

Please sign in to comment.