mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-21 06:50:25 +00:00

The SKIP return should be used for cases where tooling of the machine under test is lacking. For cases where HW is lacking, the appropriate outcome is XFAIL. This is the case with ethtool_rmon and mlxsw_lib. For these, introduce a new helper, log_test_xfail(). Do the same for router_mpath_nh_lib. Note that it will be fixed using a more reusable way in a following patch. For the two resource_scale selftests, the log should simply not be written, because there is no problem. Cc: Tobias Waldekranz <tobias@waldekranz.com> Signed-off-by: Petr Machata <petrm@nvidia.com> Link: https://lore.kernel.org/r/3d668d8fb6fa0d9eeb47ce6d9e54114348c7c179.1711464583.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
77 lines
1.4 KiB
Bash
77 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_xfail $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
|
|
}
|