82 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.03 4# A driver for the ETS selftest that implements testing in offloaded datapath.5lib_dir=$(dirname $0)/../../../net/forwarding6source $lib_dir/sch_ets_core.sh7source $lib_dir/devlink_lib.sh8 9ALL_TESTS="10 ping_ipv411 priomap_mode12 ets_test_strict13 ets_test_mixed14 ets_test_dwrr15"16 17PARENT="parent 3:3"18 19switch_create()20{21 # Create a bottleneck so that the DWRR process can kick in.22 tc qdisc replace dev $swp2 root handle 3: tbf rate 1gbit \23 burst 128K limit 1G24 25 ets_switch_create26 27 # Set the ingress quota high and use the three egress TCs to limit the28 # amount of traffic that is admitted to the shared buffers. This makes29 # sure that there is always enough traffic of all types to select from30 # for the DWRR process.31 devlink_port_pool_th_save $swp1 032 devlink_port_pool_th_set $swp1 0 1233 devlink_tc_bind_pool_th_save $swp1 0 ingress34 devlink_tc_bind_pool_th_set $swp1 0 ingress 0 1235 devlink_port_pool_th_save $swp2 436 devlink_port_pool_th_set $swp2 4 1237 devlink_tc_bind_pool_th_save $swp2 7 egress38 devlink_tc_bind_pool_th_set $swp2 7 egress 4 539 devlink_tc_bind_pool_th_save $swp2 6 egress40 devlink_tc_bind_pool_th_set $swp2 6 egress 4 541 devlink_tc_bind_pool_th_save $swp2 5 egress42 devlink_tc_bind_pool_th_set $swp2 5 egress 4 543 44 # Note: sch_ets_core.sh uses VLAN ingress-qos-map to assign packet45 # priorities at $swp1 based on their 802.1p headers. ingress-qos-map is46 # not offloaded by mlxsw as of this writing, but the mapping used is47 # 1:1, which is the mapping currently hard-coded by the driver.48}49 50switch_destroy()51{52 devlink_tc_bind_pool_th_restore $swp2 5 egress53 devlink_tc_bind_pool_th_restore $swp2 6 egress54 devlink_tc_bind_pool_th_restore $swp2 7 egress55 devlink_port_pool_th_restore $swp2 456 devlink_tc_bind_pool_th_restore $swp1 0 ingress57 devlink_port_pool_th_restore $swp1 058 59 ets_switch_destroy60 61 tc qdisc del dev $swp2 root handle 3:62}63 64# Callback from sch_ets_tests.sh65collect_stats()66{67 local -a streams=("$@")68 local stream69 70 # Wait for qdisc counter update so that we don't get it mid-way through.71 busywait_for_counter 1000 +1 \72 qdisc_parent_stats_get $swp2 10:$((${streams[0]} + 1)) .bytes \73 > /dev/null74 75 for stream in ${streams[@]}; do76 qdisc_parent_stats_get $swp2 10:$((stream + 1)) .bytes77 done78}79 80bail_on_lldpad "configure DCB" "configure Qdiscs"81ets_run82