From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khorenko Date: Mon, 24 Aug 2026 15:50:10 +0200 Subject: [Devel] [PATCH vz10 v2] selftests: netdevsim: skip the rate tc-bw check without tool support In-Reply-To: <20260821164137.813192-2-eva.kurchatova@virtuozzo.com> References: <20260821164137.813192-2-eva.kurchatova@virtuozzo.com> Message-ID: <20260824135010.454450-1-khorenko@virtuozzo.com> List-Id: From: Eva Kurchatova The tc-bw attribute was added to devlink in iproute2 6.17, together with the kernel side in v6.17. An older devlink has no such option and the rate test fails on "Unknown option" instead of skipping. Probe once in rate_test() and skip the tc-bw checks as a whole, so that a missing option costs a single skip line rather than one per rate object. https://virtuozzo.atlassian.net/browse/VSTOR-139651 Feature: fix selftests Signed-off-by: Eva Kurchatova Signed-off-by: Konstantin Khorenko --- Changes in v2: - probe once in rate_test() and guard both tc-bw blocks, instead of probing inside rate_attr_tc_bw_check(). v1 ran the probe on every call, so a devlink without tc-bw produced five identical skip lines, one per rate object, and five devlink invocations. - say what is actually missing in the skip message, in the form the bonding tests already use. - commit message: name the iproute2 release that added the option instead of the distribution that ships an older one. .../drivers/net/netdevsim/devlink.sh | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh index 030762b203d7..fd17fb0ec020 100755 --- a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh +++ b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh @@ -668,6 +668,13 @@ rate_test() { RET=0 + local tc_bw_supported=false + if devlink port function rate help 2>&1 | grep -q tc-bw; then + tc_bw_supported=true + else + log_test_skip "rate tc-bw" "Current iproute doesn't support rate option 'tc-bw'." + fi + echo $VF_COUNT > /sys/bus/netdevsim/devices/$DEV_NAME/sriov_numvfs devlink dev eswitch set $DL_HANDLE mode switchdev local leafs=`rate_leafs_get $DL_HANDLE` @@ -691,12 +698,14 @@ rate_test() rate=$(($rate+100)) done - local tc_bw="0:0 1:40 2:0 3:0 4:0 5:0 6:60 7:0" - for r_obj in $leafs - do - rate_attr_tc_bw_check "$r_obj" "$tc_bw" \ - "$DEBUGFS_DIR"/ports/"${r_obj##*/}" - done + if $tc_bw_supported; then + local tc_bw="0:0 1:40 2:0 3:0 4:0 5:0 6:60 7:0" + for r_obj in $leafs + do + rate_attr_tc_bw_check "$r_obj" "$tc_bw" \ + "$DEBUGFS_DIR"/ports/"${r_obj##*/}" + done + fi local node1_name='group1' local node1="$DL_HANDLE/$node1_name" @@ -716,9 +725,11 @@ rate_test() $DEBUGFS_DIR/rate_nodes/${node1##*/}/tx_max - local tc_bw="0:20 1:0 2:0 3:0 4:0 5:20 6:60 7:0" - rate_attr_tc_bw_check $node1 "$tc_bw" \ - "$DEBUGFS_DIR"/rate_nodes/"${node1##*/}" + if $tc_bw_supported; then + local tc_bw="0:20 1:0 2:0 3:0 4:0 5:20 6:60 7:0" + rate_attr_tc_bw_check $node1 "$tc_bw" \ + "$DEBUGFS_DIR"/rate_nodes/"${node1##*/}" + fi rate_node_del "$node1" -- 2.47.1