* [PATCH net-next] selftests: forwarding: hw_stats_l3: Detect failure to install counters
@ 2023-04-05 14:25 Petr Machata
2023-04-06 8:48 ` Hangbin Liu
2023-04-07 2:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Petr Machata @ 2023-04-05 14:25 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
Cc: Shuah Khan, Danielle Ratson, Petr Machata, mlxsw, Hangbin Liu
Running this test makes little sense if the enabled l3_stats are not
actually reported as "used". This can signify a failure of a driver to
install the necessary counters, or simply lack of support for enabling
in-HW counters on a given netdevice. It is generally impossible to tell
from the outside which it is. But more likely than not, if somebody is
running this on veth pairs, they do not intend to actually test that a
certain piece of HW can install in-HW counters for the veth. It is more
likely they are e.g. running the test by mistake.
Therefore detect that the counter has not been actually installed. In that
case, if the netdevice is one end of a veth pair, SKIP. Otherwise FAIL.
Suggested-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
---
.../selftests/net/forwarding/hw_stats_l3.sh | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/forwarding/hw_stats_l3.sh b/tools/testing/selftests/net/forwarding/hw_stats_l3.sh
index 9c1f76e108af..432fe8469851 100755
--- a/tools/testing/selftests/net/forwarding/hw_stats_l3.sh
+++ b/tools/testing/selftests/net/forwarding/hw_stats_l3.sh
@@ -319,6 +319,19 @@ trap cleanup EXIT
setup_prepare
setup_wait
-tests_run
+used=$(ip -j stats show dev $rp1.200 group offload subgroup hw_stats_info |
+ jq '.[].info.l3_stats.used')
+kind=$(ip -j -d link show dev $rp1 |
+ jq -r '.[].linkinfo.info_kind')
+if [[ $used != true ]]; then
+ if [[ $kind == veth ]]; then
+ log_test_skip "l3_stats not offloaded on veth interface"
+ EXIT_STATUS=$ksft_skip
+ else
+ RET=1 log_test "l3_stats not offloaded"
+ fi
+else
+ tests_run
+fi
exit $EXIT_STATUS
--
2.39.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] selftests: forwarding: hw_stats_l3: Detect failure to install counters
2023-04-05 14:25 [PATCH net-next] selftests: forwarding: hw_stats_l3: Detect failure to install counters Petr Machata
@ 2023-04-06 8:48 ` Hangbin Liu
2023-04-07 2:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Hangbin Liu @ 2023-04-06 8:48 UTC (permalink / raw)
To: Petr Machata
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, Shuah Khan, Danielle Ratson, mlxsw
On Wed, Apr 05, 2023 at 04:25:12PM +0200, Petr Machata wrote:
> Running this test makes little sense if the enabled l3_stats are not
> actually reported as "used". This can signify a failure of a driver to
> install the necessary counters, or simply lack of support for enabling
> in-HW counters on a given netdevice. It is generally impossible to tell
> from the outside which it is. But more likely than not, if somebody is
> running this on veth pairs, they do not intend to actually test that a
> certain piece of HW can install in-HW counters for the veth. It is more
> likely they are e.g. running the test by mistake.
>
> Therefore detect that the counter has not been actually installed. In that
> case, if the netdevice is one end of a veth pair, SKIP. Otherwise FAIL.
>
> Suggested-by: Hangbin Liu <liuhangbin@gmail.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>
> Reviewed-by: Danielle Ratson <danieller@nvidia.com>
> ---
> .../selftests/net/forwarding/hw_stats_l3.sh | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/forwarding/hw_stats_l3.sh b/tools/testing/selftests/net/forwarding/hw_stats_l3.sh
> index 9c1f76e108af..432fe8469851 100755
> --- a/tools/testing/selftests/net/forwarding/hw_stats_l3.sh
> +++ b/tools/testing/selftests/net/forwarding/hw_stats_l3.sh
> @@ -319,6 +319,19 @@ trap cleanup EXIT
> setup_prepare
> setup_wait
>
> -tests_run
> +used=$(ip -j stats show dev $rp1.200 group offload subgroup hw_stats_info |
> + jq '.[].info.l3_stats.used')
> +kind=$(ip -j -d link show dev $rp1 |
> + jq -r '.[].linkinfo.info_kind')
> +if [[ $used != true ]]; then
> + if [[ $kind == veth ]]; then
> + log_test_skip "l3_stats not offloaded on veth interface"
> + EXIT_STATUS=$ksft_skip
> + else
> + RET=1 log_test "l3_stats not offloaded"
> + fi
> +else
> + tests_run
> +fi
>
> exit $EXIT_STATUS
> --
> 2.39.0
>
Tested-by: Hangbin Liu <liuhangbin@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] selftests: forwarding: hw_stats_l3: Detect failure to install counters
2023-04-05 14:25 [PATCH net-next] selftests: forwarding: hw_stats_l3: Detect failure to install counters Petr Machata
2023-04-06 8:48 ` Hangbin Liu
@ 2023-04-07 2:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-04-07 2:10 UTC (permalink / raw)
To: Petr Machata
Cc: davem, edumazet, kuba, pabeni, netdev, shuah, danieller, mlxsw,
liuhangbin
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 5 Apr 2023 16:25:12 +0200 you wrote:
> Running this test makes little sense if the enabled l3_stats are not
> actually reported as "used". This can signify a failure of a driver to
> install the necessary counters, or simply lack of support for enabling
> in-HW counters on a given netdevice. It is generally impossible to tell
> from the outside which it is. But more likely than not, if somebody is
> running this on veth pairs, they do not intend to actually test that a
> certain piece of HW can install in-HW counters for the veth. It is more
> likely they are e.g. running the test by mistake.
>
> [...]
Here is the summary with links:
- [net-next] selftests: forwarding: hw_stats_l3: Detect failure to install counters
https://git.kernel.org/netdev/net-next/c/a9fda7a0b033
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-07 2:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05 14:25 [PATCH net-next] selftests: forwarding: hw_stats_l3: Detect failure to install counters Petr Machata
2023-04-06 8:48 ` Hangbin Liu
2023-04-07 2:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox