Skip to content

Commit c8659bd

Browse files
vladimirolteandavem330
authored andcommitted
selftests: forwarding: ethtool_mm: fall back to aggregate if device does not report pMAC stats
Some devices do not support individual 'pmac' and 'emac' stats. For such devices, resort to 'aggregate' stats. Cc: Shuah Khan <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Tested-by: Roger Quadros <[email protected]> Signed-off-by: Roger Quadros <[email protected]> Tested-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2491d66 commit c8659bd

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tools/testing/selftests/net/forwarding/ethtool_mm.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ traffic_test()
2525
local after=
2626
local delta=
2727

28+
if [ ${has_pmac_stats[$if]} = false ]; then
29+
src="aggregate"
30+
fi
31+
2832
before=$(ethtool_std_stats_get $if "eth-mac" "FramesTransmittedOK" $src)
2933

3034
$MZ $if -q -c $num_pkts -p 64 -b bcast -t ip -R $PREEMPTIBLE_PRIO
@@ -317,6 +321,13 @@ for netif in ${NETIFS[@]}; do
317321
echo "SKIP: $netif does not support MAC Merge"
318322
exit $ksft_skip
319323
fi
324+
325+
if check_ethtool_pmac_std_stats_support $netif eth-mac; then
326+
has_pmac_stats[$netif]=true
327+
else
328+
has_pmac_stats[$netif]=false
329+
echo "$netif does not report pMAC statistics, falling back to aggregate"
330+
fi
320331
done
321332

322333
trap cleanup EXIT

tools/testing/selftests/net/forwarding/lib.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ check_ethtool_counter_group_support()
155155
fi
156156
}
157157

158+
check_ethtool_pmac_std_stats_support()
159+
{
160+
local dev=$1; shift
161+
local grp=$1; shift
162+
163+
[ 0 -ne $(ethtool --json -S $dev --all-groups --src pmac 2>/dev/null \
164+
| jq ".[].\"$grp\" | length") ]
165+
}
166+
158167
check_locked_port_support()
159168
{
160169
if ! bridge -d link show | grep -q " locked"; then

0 commit comments

Comments
 (0)