Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: mlxsw: Test port shaper

TBF can be used as a root qdisc, in which case it is supposed to configure
port shaper. Add a test that verifies that this is so by installing a root
TBF with a ETS or PRIO below it, and then expecting individual bands to all
be shaped according to the root TBF configuration.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Petr Machata and committed by
Jakub Kicinski
2b11e24e 3d5290ea

+28
+28
tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh
··· 4 4 ALL_TESTS=" 5 5 ping_ipv4 6 6 tbf_test 7 + tbf_root_test 7 8 " 8 9 source $lib_dir/sch_tbf_core.sh 10 + 11 + QDISC_TYPE=${QDISC% *} 9 12 10 13 tbf_test_one() 11 14 { ··· 25 22 26 23 tbf_test() 27 24 { 25 + log_info "Testing root-$QDISC_TYPE-tbf" 26 + 28 27 # This test is used for both ETS and PRIO. Even though we only need two 29 28 # bands, PRIO demands a minimum of three. 30 29 tc qdisc add dev $swp2 root handle 10: $QDISC 3 priomap 2 1 0 31 30 tbf_test_one 128K 31 + tc qdisc del dev $swp2 root 32 + } 33 + 34 + tbf_root_test() 35 + { 36 + local bs=128K 37 + 38 + log_info "Testing root-tbf-$QDISC_TYPE" 39 + 40 + tc qdisc replace dev $swp2 root handle 1: \ 41 + tbf rate 400Mbit burst $bs limit 1M 42 + tc qdisc replace dev $swp2 parent 1:1 handle 10: \ 43 + $QDISC 3 priomap 2 1 0 44 + tc qdisc replace dev $swp2 parent 10:3 handle 103: \ 45 + bfifo limit 1M 46 + tc qdisc replace dev $swp2 parent 10:2 handle 102: \ 47 + bfifo limit 1M 48 + tc qdisc replace dev $swp2 parent 10:1 handle 101: \ 49 + bfifo limit 1M 50 + 51 + do_tbf_test 10 400 $bs 52 + do_tbf_test 11 400 $bs 53 + 32 54 tc qdisc del dev $swp2 root 33 55 } 34 56