Re: [PATCH net-next v3 9/9] selftests: drivers: hw: add test for the ethtool standard counters
From: Petr Machata
Date: Fri Mar 20 2026 - 07:43:00 EST
Ioana Ciornei <ioana.ciornei@xxxxxxx> writes:
> Add a new selftest - ethtool_std_stats.sh - which validates the
> eth-ctrl, eth-mac and pause standard statistics exported by an
> interface. Collision related eth-mac counters as well as the error ones
> will be checked against zero since that is the most likely correct
> scenario.
>
> The central part of this patch is the traffic_test() function which
> gathers the 'before' counter values, sends a batch of traffic and then
> interrogates again the same counters in order to determine if the delta
> is on target. The function receives an array through which the caller
> can request what counters to be interrogated and, for each of them, what
> is their target delta value.
>
> The output from this selftest looks as follows on a LX2160ARDB board:
>
> $ ./run_kselftest.sh -t drivers/net/hw:ethtool_std_stats.sh
> TAP version 13
> 1..1
> # timeout set to 0
> # selftests: drivers/net/hw: ethtool_std_stats.sh
> # TEST: eth-ctrl-MACControlFramesTransmitted on endpmac17 [ OK ]
> # TEST: eth-ctrl-MACControlFramesReceived on endpmac17 [ OK ]
> # TEST: eth-mac-FrameCheckSequenceErrors on endpmac17 [ OK ]
> # TEST: eth-mac-AlignmentErrors on endpmac17 [ OK ]
> # TEST: eth-mac-FramesLostDueToIntMACXmitError on endpmac17 [ OK ]
> # TEST: eth-mac-CarrierSenseErrors on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-FramesLostDueToIntMACRcvError on endpmac17 [ OK ]
> # TEST: eth-mac-InRangeLengthErrors on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-OutOfRangeLengthField on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-FrameTooLongErrors on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-FramesAbortedDueToXSColls on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-SingleCollisionFrames on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-MultipleCollisionFrames on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-FramesWithDeferredXmissions on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-LateCollisions on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-FramesWithExcessiveDeferral on endpmac17 (not supported) [SKIP]
> # TEST: eth-mac-BroadcastFramesXmittedOK on endpmac17 [ OK ]
> # TEST: eth-mac-OctetsTransmittedOK on endpmac17 [ OK ]
> # TEST: eth-mac-BroadcastFramesReceivedOK on endpmac17 [ OK ]
> # TEST: eth-mac-OctetsReceivedOK on endpmac17 [ OK ]
> # TEST: eth-mac-FramesTransmittedOK on endpmac17 [ OK ]
> # TEST: eth-mac-MulticastFramesXmittedOK on endpmac17 [ OK ]
> # TEST: eth-mac-FramesReceivedOK on endpmac17 [ OK ]
> # TEST: eth-mac-MulticastFramesReceivedOK on endpmac17 [ OK ]
> # TEST: pause-tx_pause_frames on endpmac17 [ OK ]
> # TEST: pause-rx_pause_frames on endpmac17 [ OK ]
> ok 1 selftests: drivers/net/hw: ethtool_std_stats.sh # SKIP
>
> Please note that not all MACs are counting the software injected pause
> frames as real Tx pause. For example, on a LS1028ARDB the selftest
> output will reflect the fact that neither the ENETC MAC, nor the Felix
> switch MAC are able to detect Tx pause frames injected by software.
>
> $ ./run_kselftest.sh -t drivers/net/hw:ethtool_std_stats.sh
> (...)
> # TEST: pause-tx_pause_frames on eno0 (software sent pause frames not detected) [XFAIL]
> # TEST: pause-rx_pause_frames on eno0 [ OK ]
>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@xxxxxxx>
Acked-by: Petr Machata <petrm@xxxxxxxxxx>