* [PATCH net-next v2] selftests: forwarding: lib: rewrite processing of command line arguments
@ 2026-04-07 10:20 Ioana Ciornei
2026-04-07 12:57 ` Petr Machata
2026-04-09 2:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Ioana Ciornei @ 2026-04-07 10:20 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, linux-kernel, petrm, willemb,
linux-kselftest, Shuah Khan, Hangbin Liu
The piece of code which processes the command line arguments and
populates NETIFS based on them is really unobvious. Rewrite it so that
the intention is clear and the code is easy to follow.
Suggested-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
Changes in v2:
- added back 'count=0'
tools/testing/selftests/net/forwarding/lib.sh | 21 ++++++++++---------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index d8cc4c64148d..d2bdbff68075 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -467,17 +467,18 @@ if [ "${DRIVER_TEST_CONFORMANT}" = "yes" ]; then
TARGETS[$remote_netif]="$REMOTE_TYPE:$REMOTE_ARGS"
else
count=0
+ # Prime NETIFS from the command line, but retain if none given.
+ if [[ $# -gt 0 ]]; then
+ unset NETIFS
+ declare -A NETIFS
- while [[ $# -gt 0 ]]; do
- if [[ "$count" -eq "0" ]]; then
- unset NETIFS
- declare -A NETIFS
- fi
- count=$((count + 1))
- NETIFS[p$count]="$1"
- TARGETS[$1]="local:"
- shift
- done
+ while [[ $# -gt 0 ]]; do
+ count=$((count + 1))
+ NETIFS[p$count]="$1"
+ TARGETS[$1]="local:"
+ shift
+ done
+ fi
fi
##############################################################################
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] selftests: forwarding: lib: rewrite processing of command line arguments
2026-04-07 10:20 [PATCH net-next v2] selftests: forwarding: lib: rewrite processing of command line arguments Ioana Ciornei
@ 2026-04-07 12:57 ` Petr Machata
2026-04-09 2:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Petr Machata @ 2026-04-07 12:57 UTC (permalink / raw)
To: Ioana Ciornei
Cc: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, linux-kernel, petrm,
willemb, linux-kselftest, Shuah Khan, Hangbin Liu
Ioana Ciornei <ioana.ciornei@nxp.com> writes:
> The piece of code which processes the command line arguments and
> populates NETIFS based on them is really unobvious. Rewrite it so that
> the intention is clear and the code is easy to follow.
>
> Suggested-by: Petr Machata <petrm@nvidia.com>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Thanks for cleaning this up!
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] selftests: forwarding: lib: rewrite processing of command line arguments
2026-04-07 10:20 [PATCH net-next v2] selftests: forwarding: lib: rewrite processing of command line arguments Ioana Ciornei
2026-04-07 12:57 ` Petr Machata
@ 2026-04-09 2:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-04-09 2:40 UTC (permalink / raw)
To: Ioana Ciornei
Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, horms,
linux-kernel, petrm, willemb, linux-kselftest, shuah, liuhangbin
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 7 Apr 2026 13:20:58 +0300 you wrote:
> The piece of code which processes the command line arguments and
> populates NETIFS based on them is really unobvious. Rewrite it so that
> the intention is clear and the code is easy to follow.
>
> Suggested-by: Petr Machata <petrm@nvidia.com>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
>
> [...]
Here is the summary with links:
- [net-next,v2] selftests: forwarding: lib: rewrite processing of command line arguments
https://git.kernel.org/netdev/net-next/c/fff75dba7992
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:[~2026-04-09 2:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 10:20 [PATCH net-next v2] selftests: forwarding: lib: rewrite processing of command line arguments Ioana Ciornei
2026-04-07 12:57 ` Petr Machata
2026-04-09 2:40 ` 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