Commit 9e7aaa7c authored by Amit Cohen's avatar Amit Cohen Committed by Jakub Kicinski
Browse files

selftests: mlxsw: Use shapers in QOS tests instead of forcing speed



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: default avatarAmit Cohen <amcohen@nvidia.com>
Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2dc81a0e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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
@@ -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
+5 −4
Original line number Diff line number Diff line
@@ -129,8 +129,9 @@ 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: \
	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
@@ -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
+8 −7
Original line number Diff line number Diff line
@@ -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
@@ -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