Skip to content

Commit 9df5f8b

Browse files
qsnNipaLocal
authored and
NipaLocal
committed
selftests: netdevsim: add ethtool features to macsec offload tests
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 <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent bcc46a8 commit 9df5f8b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tools/testing/selftests/drivers/net/netdevsim/macsec-offload.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,39 @@ for dev in ${MACSEC_NETDEV}{,2,3} ; do
7575
done
7676

7777

78+
#
79+
# test ethtool features when toggling offload
80+
#
81+
82+
ip link add link $NSIM_NETDEV $MACSEC_NETDEV type macsec offload mac
83+
TMP_FEATS_ON_1="$(ethtool -k $MACSEC_NETDEV)"
84+
85+
ip link set $MACSEC_NETDEV type macsec offload off
86+
TMP_FEATS_OFF_1="$(ethtool -k $MACSEC_NETDEV)"
87+
88+
ip link set $MACSEC_NETDEV type macsec offload mac
89+
TMP_FEATS_ON_2="$(ethtool -k $MACSEC_NETDEV)"
90+
91+
[ "$TMP_FEATS_ON_1" = "$TMP_FEATS_ON_2" ]
92+
check $?
93+
94+
ip link del $MACSEC_NETDEV
95+
96+
ip link add link $NSIM_NETDEV $MACSEC_NETDEV type macsec
97+
check $?
98+
99+
TMP_FEATS_OFF_2="$(ethtool -k $MACSEC_NETDEV)"
100+
[ "$TMP_FEATS_OFF_1" = "$TMP_FEATS_OFF_2" ]
101+
check $?
102+
103+
ip link set $MACSEC_NETDEV type macsec offload mac
104+
check $?
105+
106+
TMP_FEATS_ON_3="$(ethtool -k $MACSEC_NETDEV)"
107+
[ "$TMP_FEATS_ON_1" = "$TMP_FEATS_ON_3" ]
108+
check $?
109+
110+
78111
if [ $num_errors -eq 0 ]; then
79112
echo "PASSED all $((num_passes)) checks"
80113
exit 0

0 commit comments

Comments
 (0)