1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 4# A driver for the ETS selftest that implements testing in offloaded datapath. 5lib_dir=$(dirname $0)/../../../net/forwarding 6source $lib_dir/sch_ets_core.sh 7source $lib_dir/devlink_lib.sh 8 9ALL_TESTS=" 10 ping_ipv4 11 priomap_mode 12 ets_test_strict 13 ets_test_mixed 14 ets_test_dwrr 15" 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 1G 24 defer tc qdisc del dev $swp2 root handle 3: 25 26 ets_switch_create 27 28 # Set the ingress quota high and use the three egress TCs to limit the 29 # amount of traffic that is admitted to the shared buffers. This makes 30 # sure that there is always enough traffic of all types to select from 31 # for the DWRR process. 32 devlink_port_pool_th_save $swp1 0 33 devlink_port_pool_th_set $swp1 0 12 34 defer devlink_port_pool_th_restore $swp1 0 35 36 devlink_tc_bind_pool_th_save $swp1 0 ingress 37 devlink_tc_bind_pool_th_set $swp1 0 ingress 0 12 38 defer devlink_tc_bind_pool_th_restore $swp1 0 ingress 39 40 devlink_port_pool_th_save $swp2 4 41 devlink_port_pool_th_set $swp2 4 12 42 defer devlink_port_pool_th_restore $swp2 4 43 44 devlink_tc_bind_pool_th_save $swp2 7 egress 45 devlink_tc_bind_pool_th_set $swp2 7 egress 4 5 46 defer devlink_tc_bind_pool_th_restore $swp2 7 egress 47 48 devlink_tc_bind_pool_th_save $swp2 6 egress 49 devlink_tc_bind_pool_th_set $swp2 6 egress 4 5 50 defer devlink_tc_bind_pool_th_restore $swp2 6 egress 51 52 devlink_tc_bind_pool_th_save $swp2 5 egress 53 devlink_tc_bind_pool_th_set $swp2 5 egress 4 5 54 defer devlink_tc_bind_pool_th_restore $swp2 5 egress 55 56 # Note: sch_ets_core.sh uses VLAN ingress-qos-map to assign packet 57 # priorities at $swp1 based on their 802.1p headers. ingress-qos-map is 58 # not offloaded by mlxsw as of this writing, but the mapping used is 59 # 1:1, which is the mapping currently hard-coded by the driver. 60} 61 62# Callback from sch_ets_tests.sh 63collect_stats() 64{ 65 local -a streams=("$@") 66 local stream 67 68 # Wait for qdisc counter update so that we don't get it mid-way through. 69 busywait_for_counter 1000 +1 \ 70 qdisc_parent_stats_get $swp2 10:$((${streams[0]} + 1)) .bytes \ 71 > /dev/null 72 73 for stream in ${streams[@]}; do 74 qdisc_parent_stats_get $swp2 10:$((stream + 1)) .bytes 75 done 76} 77 78bail_on_lldpad "configure DCB" "configure Qdiscs" 79ets_run 80