Files
linux-cryptodev-2.6/tools/testing/selftests/drivers/net/mlxsw/mlxsw_lib.sh
Amit Cohen 5ab0cf142b selftests: mlxsw: Add QOS test for maximum use of descriptors
Add an equivalent test to qos_burst, the test's purpose is same, but the
new test uses simpler topology and does not require forcing low speed.
In addition, it can be run Spectrum-2 and not only Spectrum-3+. The idea
is to use a shaper in order to limit the traffic and create congestion.

qos_burst test uses small pool, sends many small packets, and verify that
packets are not dropped, which means that many descriptors can be handled.
This test should check the change that commit c864769add
("mlxsw: Configure descriptor buffers") pushed.

Instead, the new test tries to use more than 85% of maximum supported
descriptors. The idea is to use big pool (as much as the ASIC supports),
such that the pool size does not limit the traffic, then send many small
packets, which means that many descriptors are used, and check how many
packets the switch can handle.

The usage of shaper allows to run the test in all ASICs, regardless of
the CPU abilities, as it is able to create the congestion with low rate
of packets.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-09-19 18:07:59 -07:00

78 lines
1.4 KiB
Bash

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
##############################################################################
# Defines
if [[ ! -v MLXSW_CHIP ]]; then
MLXSW_CHIP=$(devlink -j dev info $DEVLINK_DEV | jq -r '.[][]["driver"]')
if [ -z "$MLXSW_CHIP" ]; then
echo "SKIP: Device $DEVLINK_DEV doesn't support devlink info command"
exit 1
fi
fi
MLXSW_SPECTRUM_REV=$(case $MLXSW_CHIP in
mlxsw_spectrum)
echo 1 ;;
mlxsw_spectrum*)
echo ${MLXSW_CHIP#mlxsw_spectrum} ;;
*)
echo "Couldn't determine Spectrum chip revision." \
> /dev/stderr ;;
esac)
mlxsw_on_spectrum()
{
local rev=$1; shift
local op="=="
local rev2=${rev%+}
if [[ $rev2 != $rev ]]; then
op=">="
fi
((MLXSW_SPECTRUM_REV $op rev2))
}
__mlxsw_only_on_spectrum()
{
local rev=$1; shift
local caller=$1; shift
local src=$1; shift
if ! mlxsw_on_spectrum "$rev"; then
log_test_skip $src:$caller "(Spectrum-$rev only)"
return 1
fi
}
mlxsw_only_on_spectrum()
{
local caller=${FUNCNAME[1]}
local src=${BASH_SOURCE[1]}
local rev
for rev in "$@"; do
if __mlxsw_only_on_spectrum "$rev" "$caller" "$src"; then
return 0
fi
done
return 1
}
mlxsw_max_descriptors_get()
{
local spectrum_rev=$MLXSW_SPECTRUM_REV
case $spectrum_rev in
1) echo 81920 ;;
2) echo 136960 ;;
3) echo 204800 ;;
4) echo 220000 ;;
*) echo "Unknown max descriptors for chip revision." > /dev/stderr
return 1 ;;
esac
}