From: Petr Machata <petrm@nvidia.com>
To: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: <netdev@vger.kernel.org>, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
<linux-kernel@vger.kernel.org>, <petrm@nvidia.com>,
<willemb@google.com>, <linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH net-next v5 2/9] selftests: net: extend lib.sh to parse drivers/net/net.config
Date: Mon, 30 Mar 2026 18:42:23 +0200 [thread overview]
Message-ID: <87zf3p2r81.fsf@nvidia.com> (raw)
In-Reply-To: <20260330152933.2195885-3-ioana.ciornei@nxp.com>
Ioana Ciornei <ioana.ciornei@nxp.com> writes:
> Extend lib.sh so that it's able to parse driver/net/net.config and
> environment variables such as NETIF, REMOTE_TYPE, LOCAL_V4 etc described
> in drivers/net/README.rst.
>
> In order to make the transition towards running with a single local
> interface smoother for the bash networking driver tests, beside sourcing
> the net.config file also translate the new env variables into the old
> style based on the NETIFS array. Since the NETIFS array only holds the
> network interface names, also add a new array - TARGETS - which keeps
> track of the target on which a specific interfaces resides - local,
> netns or accesible through an ssh command.
>
> For example, a net.config which looks like below:
>
> NETIF=eth0
> LOCAL_V4=192.168.1.1
> REMOTE_V4=192.168.1.2
> REMOTE_TYPE=ssh
> REMOTE_ARGS=root@192.168.1.2
>
> will generate the NETIFS and TARGETS arrays with the following data.
>
> NETIFS[p1]="eth0"
> NETIFS[p2]="eth2"
>
> TARGETS[eth0]="local:"
> TARGETS[eth2]="ssh:root@192.168.1.2"
>
> The above will be true if on the remote target, the interface which has
> the 192.168.1.2 address is named eth2.
>
> Since the TARGETS array is indexed by the network interface name,
> document a new restriction README.rst which states that the remote
> interface cannot have the same name as the local one. Keep the old way
> of populating the NETIFS variable based on the command line arguments.
> This will be invoked in case DRIVER_TEST_CONFORMANT = "no".
>
> Also add a couple of helpers which can be used by tests which need to
> run a specific bash command on a different target than the local system,
> be it either another netns or a remote system accessible through ssh.
> The __run_on() function is passed through $1 the target on which the
> command should be executed while run_on() is passed the name of the
> interface that is then used to retrieve the target from the TARGETS
> array.
>
> Also add a stub run_on() function in net/lib.sh so that users of the
> net/lib.sh are going through the stub only since neither NETIFS nor
> TARGETS are valid in that circumstance.
>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
> +else
> + count=0
> +
> + while [[ $# -gt 0 ]]; do
> + if [[ "$count" -eq "0" ]]; then
> + unset NETIFS
> + declare -A NETIFS
> + fi
> + count=$((count + 1))
This is coming from the original as well, but I find the piece of code
really unobvious. I'm not going to block the patchset over this, but
this would IMHO be a better way to express the intent:
# Prime NETIFS from the command line, but retain if none given.
if [[ $# -gt 0 ]]; then
unset NETIFS
declare -A NETIFS
while [[ $# -gt 0 ]]; do
((count++))
etc
done
fi
If there is a v6, please roll it in.
> + NETIFS[p$count]="$1"
> + TARGETS[$1]="local:"
> + shift
> + done
> +fi
next prev parent reply other threads:[~2026-03-30 16:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 15:29 [PATCH net-next v5 0/9] selftests: drivers: bash support for remote traffic generators Ioana Ciornei
2026-03-30 15:29 ` [PATCH net-next v5 1/9] selftests: forwarding: extend ethtool_std_stats_get with pause statistics Ioana Ciornei
2026-03-30 15:29 ` [PATCH net-next v5 2/9] selftests: net: extend lib.sh to parse drivers/net/net.config Ioana Ciornei
2026-03-30 16:42 ` Petr Machata [this message]
2026-03-30 15:29 ` [PATCH net-next v5 3/9] selftests: net: update some helpers to use run_on Ioana Ciornei
2026-03-30 15:29 ` [PATCH net-next v5 4/9] selftests: drivers: hw: cleanup shellcheck warnings in the rmon test Ioana Ciornei
2026-03-30 15:29 ` [PATCH net-next v5 5/9] selftests: drivers: hw: test rmon counters only on first interface Ioana Ciornei
2026-03-30 15:29 ` [PATCH net-next v5 6/9] selftests: drivers: hw: replace counter upper limit with UINT32_MAX in rmon test Ioana Ciornei
2026-03-30 15:29 ` [PATCH net-next v5 7/9] selftests: drivers: hw: move to KTAP output Ioana Ciornei
2026-04-02 10:10 ` Paolo Abeni
2026-04-02 10:18 ` Ioana Ciornei
2026-04-03 13:46 ` Ioana Ciornei
2026-03-30 15:29 ` [PATCH net-next v5 8/9] selftests: drivers: hw: update ethtool_rmon to work with a single local interface Ioana Ciornei
2026-03-30 15:29 ` [PATCH net-next v5 9/9] selftests: drivers: hw: add test for the ethtool standard counters Ioana Ciornei
2026-04-02 10:20 ` [PATCH net-next v5 0/9] selftests: drivers: bash support for remote traffic generators patchwork-bot+netdevbpf
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=87zf3p2r81.fsf@nvidia.com \
--to=petrm@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.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