Skip to content

Commit

Permalink
selftests: netdevsim: add ethtool features to macsec offload tests
Browse files Browse the repository at this point in the history
The test verifies that available features aren't changed by toggling
offload on the device. Creating a device with offload off and then
enabling it later should result in the same features as creating the
device with offload enabled directly.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: NipaLocal <nipa@local>
  • Loading branch information
qsn authored and NipaLocal committed Nov 10, 2024
1 parent bcc46a8 commit 9df5f8b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tools/testing/selftests/drivers/net/netdevsim/macsec-offload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,39 @@ for dev in ${MACSEC_NETDEV}{,2,3} ; do
done


#
# test ethtool features when toggling offload
#

ip link add link $NSIM_NETDEV $MACSEC_NETDEV type macsec offload mac
TMP_FEATS_ON_1="$(ethtool -k $MACSEC_NETDEV)"

ip link set $MACSEC_NETDEV type macsec offload off
TMP_FEATS_OFF_1="$(ethtool -k $MACSEC_NETDEV)"

ip link set $MACSEC_NETDEV type macsec offload mac
TMP_FEATS_ON_2="$(ethtool -k $MACSEC_NETDEV)"

[ "$TMP_FEATS_ON_1" = "$TMP_FEATS_ON_2" ]
check $?

ip link del $MACSEC_NETDEV

ip link add link $NSIM_NETDEV $MACSEC_NETDEV type macsec
check $?

TMP_FEATS_OFF_2="$(ethtool -k $MACSEC_NETDEV)"
[ "$TMP_FEATS_OFF_1" = "$TMP_FEATS_OFF_2" ]
check $?

ip link set $MACSEC_NETDEV type macsec offload mac
check $?

TMP_FEATS_ON_3="$(ethtool -k $MACSEC_NETDEV)"
[ "$TMP_FEATS_ON_1" = "$TMP_FEATS_ON_3" ]
check $?


if [ $num_errors -eq 0 ]; then
echo "PASSED all $((num_passes)) checks"
exit 0
Expand Down

0 comments on commit 9df5f8b

Please sign in to comment.