selftests: drivers: hw: Fix ethtool_rmon
authorPetr Machata <petrm@nvidia.com>
Fri, 12 Apr 2024 17:03:07 +0000 (19:03 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 16 Apr 2024 10:14:41 +0000 (12:14 +0200)
When rx-pktsNtoM reports a range that involves very low-valued range, such
as 0-64, the calculated length of the packet will be -4, because FCS is
subtracted from the value. mausezahn then confuses the value for an option
and bails out. As a result, the test dumps many mausezahn error messages.

Instead, cap the value at 0. mausezahn will use an appropriate minimum
packet length.

Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh

index e2a1c10d35035c382396a1ebb765ae3cc7f3ee8c..8f60c1685ad4b6c685bb25c5e427ab9059616c0f 100755 (executable)
@@ -44,6 +44,7 @@ bucket_test()
        # Mausezahn does not include FCS bytes in its length - but the
        # histogram counters do
        len=$((len - ETH_FCS_LEN))
+       len=$((len > 0 ? len : 0))
 
        before=$(ethtool --json -S $iface --groups rmon | \
                jq -r ".[0].rmon[\"${set}-pktsNtoM\"][$bucket].val")