From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Roger Quadros <rogerq@kernel.org>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, shuah@kernel.org, s-vadapalli@ti.com,
r-gunasekaran@ti.com, vigneshr@ti.com, srk@ti.com,
horms@kernel.org, p-varis@ti.com, netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] selftests: forwarding: ethtool_mm: support devices that don't support pmac stats
Date: Mon, 11 Dec 2023 15:24:15 +0200 [thread overview]
Message-ID: <20231211132415.ilhkajslbxf3wxjn@skbuf> (raw)
In-Reply-To: <20231211120138.5461-3-rogerq@kernel.org> <20231211120138.5461-3-rogerq@kernel.org>
On Mon, Dec 11, 2023 at 02:01:38PM +0200, Roger Quadros wrote:
> Some devices do not support individual 'pmac' and 'emac' stats.
> For such devices, resort to 'aggregate' stats.
>
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> ---
> tools/testing/selftests/net/forwarding/ethtool_mm.sh | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/testing/selftests/net/forwarding/ethtool_mm.sh b/tools/testing/selftests/net/forwarding/ethtool_mm.sh
> index 6212913f4ad1..e3f2e62029ca 100755
> --- a/tools/testing/selftests/net/forwarding/ethtool_mm.sh
> +++ b/tools/testing/selftests/net/forwarding/ethtool_mm.sh
> @@ -26,6 +26,13 @@ traffic_test()
> local delta=
>
> before=$(ethtool_std_stats_get $if "eth-mac" "FramesTransmittedOK" $src)
> + # some devices don't support individual pmac/emac stats,
> + # use aggregate stats for them.
> + if [ "$before" == null ]; then
> + src="aggregate"
> + before=$(ethtool_std_stats_get $if "eth-mac" "FramesTransmittedOO
> +K" $src)
> + fi
1. please follow the existing indentation scheme, don't mix tabs with spaces
2. someone mangled your patch into invalid bash syntax, splitting a line
into 2
3. "FramesTransmittedOOK" has an extra "O"
4. it would be preferable if you could evaluate only once whether pMAC
counters are reported, set a global variable, and in traffic_test(),
if that variable is true, override $src with "aggregate".
5. why did you split the selftest patches out of the am65-cpsw patch
set? It is for the am65-cpsw that they are needed.
>
> $MZ $if -q -c $num_pkts -p 64 -b bcast -t ip -R $PREEMPTIBLE_PRIO
>
> --
> 2.34.1
>
Something like this?
From ef5688a78908d99b607909fd7c93829c6a018b61 Mon Sep 17 00:00:00 2001
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: Mon, 11 Dec 2023 15:21:25 +0200
Subject: [PATCH] selftests: forwarding: ethtool_mm: fall back to aggregate if
device does not report pMAC stats
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
tools/testing/selftests/net/forwarding/ethtool_mm.sh | 11 +++++++++++
tools/testing/selftests/net/forwarding/lib.sh | 8 ++++++++
2 files changed, 19 insertions(+)
diff --git a/tools/testing/selftests/net/forwarding/ethtool_mm.sh b/tools/testing/selftests/net/forwarding/ethtool_mm.sh
index 39e736f30322..2740133f95ec 100755
--- a/tools/testing/selftests/net/forwarding/ethtool_mm.sh
+++ b/tools/testing/selftests/net/forwarding/ethtool_mm.sh
@@ -25,6 +25,10 @@ traffic_test()
local after=
local delta=
+ if [ has_pmac_stats[$netif] = false ]; then
+ src="aggregate"
+ fi
+
before=$(ethtool_std_stats_get $if "eth-mac" "FramesTransmittedOK" $src)
$MZ $if -q -c $num_pkts -p 64 -b bcast -t ip -R $PREEMPTIBLE_PRIO
@@ -284,6 +288,13 @@ for netif in ${NETIFS[@]}; do
echo "SKIP: $netif does not support MAC Merge"
exit $ksft_skip
fi
+
+ if check_ethtool_pmac_std_stats_support $netif; then
+ has_pmac_stats[$netif]=true
+ else
+ has_pmac_stats[$netif]=false
+ echo "$netif does not report pMAC statistics, falling back to aggregate"
+ fi
done
trap cleanup EXIT
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 8f6ca458af9a..82ac6a066729 100755
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -146,6 +146,14 @@ check_ethtool_mm_support()
fi
}
+check_ethtool_pmac_std_stats_support()
+{
+ local dev=$1; shift
+
+ [ -n "$(ethtool --json -S $dev --all-groups --src pmac 2>/dev/null | \
+ jq '.[]')" ]
+}
+
check_locked_port_support()
{
if ! bridge -d link show | grep -q " locked"; then
--
2.34.1
next prev parent reply other threads:[~2023-12-11 13:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 12:01 [PATCH 0/2] selftests: net: ethtool_mm: Support devices with higher rx-min-frag-size Roger Quadros
2023-12-11 12:01 ` [PATCH 1/2] selftests: forwarding: ethtool_mm: support " Roger Quadros
2023-12-11 12:01 ` [PATCH 2/2] selftests: forwarding: ethtool_mm: support devices that don't support pmac stats Roger Quadros
2023-12-11 13:24 ` Vladimir Oltean [this message]
2023-12-11 13:53 ` Roger Quadros
2023-12-12 14:07 ` Roger Quadros
2023-12-12 14:57 ` Vladimir Oltean
2023-12-12 19:48 ` Roger Quadros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231211132415.ilhkajslbxf3wxjn@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=p-varis@ti.com \
--cc=pabeni@redhat.com \
--cc=r-gunasekaran@ti.com \
--cc=rogerq@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=shuah@kernel.org \
--cc=srk@ti.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox