Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 # SPDX-License-Identifier: GPL-2.0
0003 
0004 # A driver for the ETS selftest that implements testing in offloaded datapath.
0005 lib_dir=$(dirname $0)/../../../net/forwarding
0006 source $lib_dir/sch_ets_core.sh
0007 source $lib_dir/devlink_lib.sh
0008 source qos_lib.sh
0009 
0010 ALL_TESTS="
0011         ping_ipv4
0012         priomap_mode
0013         ets_test_strict
0014         ets_test_mixed
0015         ets_test_dwrr
0016 "
0017 
0018 switch_create()
0019 {
0020         ets_switch_create
0021 
0022         # Create a bottleneck so that the DWRR process can kick in.
0023         ethtool -s $h2 speed 1000 autoneg off
0024         ethtool -s $swp2 speed 1000 autoneg off
0025 
0026         # Set the ingress quota high and use the three egress TCs to limit the
0027         # amount of traffic that is admitted to the shared buffers. This makes
0028         # sure that there is always enough traffic of all types to select from
0029         # for the DWRR process.
0030         devlink_port_pool_th_save $swp1 0
0031         devlink_port_pool_th_set $swp1 0 12
0032         devlink_tc_bind_pool_th_save $swp1 0 ingress
0033         devlink_tc_bind_pool_th_set $swp1 0 ingress 0 12
0034         devlink_port_pool_th_save $swp2 4
0035         devlink_port_pool_th_set $swp2 4 12
0036         devlink_tc_bind_pool_th_save $swp2 7 egress
0037         devlink_tc_bind_pool_th_set $swp2 7 egress 4 5
0038         devlink_tc_bind_pool_th_save $swp2 6 egress
0039         devlink_tc_bind_pool_th_set $swp2 6 egress 4 5
0040         devlink_tc_bind_pool_th_save $swp2 5 egress
0041         devlink_tc_bind_pool_th_set $swp2 5 egress 4 5
0042 
0043         # Note: sch_ets_core.sh uses VLAN ingress-qos-map to assign packet
0044         # priorities at $swp1 based on their 802.1p headers. ingress-qos-map is
0045         # not offloaded by mlxsw as of this writing, but the mapping used is
0046         # 1:1, which is the mapping currently hard-coded by the driver.
0047 }
0048 
0049 switch_destroy()
0050 {
0051         devlink_tc_bind_pool_th_restore $swp2 5 egress
0052         devlink_tc_bind_pool_th_restore $swp2 6 egress
0053         devlink_tc_bind_pool_th_restore $swp2 7 egress
0054         devlink_port_pool_th_restore $swp2 4
0055         devlink_tc_bind_pool_th_restore $swp1 0 ingress
0056         devlink_port_pool_th_restore $swp1 0
0057 
0058         ethtool -s $swp2 autoneg on
0059         ethtool -s $h2 autoneg on
0060 
0061         ets_switch_destroy
0062 }
0063 
0064 # Callback from sch_ets_tests.sh
0065 collect_stats()
0066 {
0067         local -a streams=("$@")
0068         local stream
0069 
0070         # Wait for qdisc counter update so that we don't get it mid-way through.
0071         busywait_for_counter 1000 +1 \
0072                 qdisc_parent_stats_get $swp2 10:$((${streams[0]} + 1)) .bytes \
0073                 > /dev/null
0074 
0075         for stream in ${streams[@]}; do
0076                 qdisc_parent_stats_get $swp2 10:$((stream + 1)) .bytes
0077         done
0078 }
0079 
0080 bail_on_lldpad
0081 ets_run