Commit 6ce7bdbc authored by Abhinav Jain's avatar Abhinav Jain Committed by Jakub Kicinski

selftests: net: Add on/off checks for non-fixed features of interface

Implement on/off testing for all non-fixed features via while loop.
Signed-off-by: default avatarAbhinav Jain <jain.abhinav177@gmail.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240821171903.118324-3-jain.abhinav177@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1820b84f
......@@ -124,7 +124,40 @@ kci_netdev_ethtool()
return 1
fi
echo "PASS: $netdev: ethtool list features"
#TODO for each non fixed features, try to turn them on/off
while read -r FEATURE VALUE FIXED; do
[ "$FEATURE" != "Features" ] || continue # Skip "Features"
[ "$FIXED" != "[fixed]" ] || continue # Skip fixed features
feature="${FEATURE%:*}"
ethtool --offload "$netdev" "$feature" off
if [ $? -eq 0 ]; then
echo "PASS: $netdev: Turned off feature: $feature"
else
echo "FAIL: $netdev: Failed to turn off feature:" \
"$feature"
fi
ethtool --offload "$netdev" "$feature" on
if [ $? -eq 0 ]; then
echo "PASS: $netdev: Turned on feature: $feature"
else
echo "FAIL: $netdev: Failed to turn on feature:" \
"$feature"
fi
#restore the feature to its initial state
ethtool --offload "$netdev" "$feature" "$VALUE"
if [ $? -eq 0 ]; then
echo "PASS: $netdev: Restore feature $feature" \
"to initial state $VALUE"
else
echo "FAIL: $netdev: Failed to restore feature" \
"$feature to initial state $VALUE"
fi
done < "$TMP_ETHTOOL_FEATURES"
rm "$TMP_ETHTOOL_FEATURES"
kci_netdev_ethtool_test 74 'dump' "ethtool -d $netdev"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment