From: "Björn Töpel" <bjorn.topel@gmail.com>
To: Ciara Loftus <ciara.loftus@intel.com>
Cc: Netdev <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
"Karlsson, Magnus" <magnus.karlsson@intel.com>,
Weqaar Janjua <weqaar.a.janjua@intel.com>
Subject: Re: [PATCH bpf-next 3/4] selftests/bpf: restructure xsk selftests
Date: Thu, 18 Feb 2021 10:33:24 +0100 [thread overview]
Message-ID: <CAJ+HfNjUttwjKU0cKcHp46aD670TjrzBLDFmrVNkg4uaNcPaYw@mail.gmail.com> (raw)
In-Reply-To: <20210217160214.7869-4-ciara.loftus@intel.com>
On Wed, 17 Feb 2021 at 17:33, Ciara Loftus <ciara.loftus@intel.com> wrote:
>
> Prior to this commit individual xsk tests were launched from the
> shell script 'test_xsk.sh'. When adding a new test type, two new test
> configurations had to be added to this file - one for each of the
> supported XDP 'modes' (skb or drv). Should zero copy support be added to
> the xsk selftest framework in the future, three new test configurations
> would need to be added for each new test type. Each new test type also
> typically requires new CLI arguments for the xdpxceiver program.
>
> This commit aims to reduce the overhead of adding new tests, by launching
> the test configurations from within the xdpxceiver program itself, using
> simple loops. Every test is run every time the C program is executed. Many
> of the CLI arguments can be removed as a result.
>
> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
> tools/testing/selftests/bpf/test_xsk.sh | 112 +-----------
> tools/testing/selftests/bpf/xdpxceiver.c | 199 ++++++++++++---------
> tools/testing/selftests/bpf/xdpxceiver.h | 27 ++-
> tools/testing/selftests/bpf/xsk_prereqs.sh | 24 +--
> 4 files changed, 139 insertions(+), 223 deletions(-)
>
I like where this is going! Nice!
[...]
> diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
> index 8af746c9a6b6..7cb4a13597d0 100644
> --- a/tools/testing/selftests/bpf/xdpxceiver.c
> +++ b/tools/testing/selftests/bpf/xdpxceiver.c
[...]
>
> +static int configure_skb(void)
> +{
> +
> + char cmd[80];
> +
> + snprintf(cmd, sizeof(cmd), "ip link set dev %s xdpdrv off", ifdict[0]->ifname);
> + if (system(cmd)) {
> + ksft_test_result_fail("Failed to configure native mode on iface %s\n",
> + ifdict[0]->ifname);
> + return -1;
> + }
> + snprintf(cmd, sizeof(cmd), "ip netns exec %s ip link set dev %s xdpdrv off",
> + ifdict[1]->nsname, ifdict[1]->ifname);
> + if (system(cmd)) {
> + ksft_test_result_fail("Failed to configure native mode on iface/ns %s\n",
> + ifdict[1]->ifname, ifdict[1]->nsname);
> + return -1;
> + }
> +
> + cur_mode = TEST_MODE_SKB;
> +
> + return 0;
> +
> +}
> +
> +static int configure_drv(void)
> +{
> + char cmd[80];
> +
> + snprintf(cmd, sizeof(cmd), "ip link set dev %s xdpgeneric off", ifdict[0]->ifname);
> + if (system(cmd)) {
> + ksft_test_result_fail("Failed to configure native mode on iface %s\n",
> + ifdict[0]->ifname);
> + return -1;
> + }
> + snprintf(cmd, sizeof(cmd), "ip netns exec %s ip link set dev %s xdpgeneric off",
> + ifdict[1]->nsname, ifdict[1]->ifname);
> + if (system(cmd)) {
> + ksft_test_result_fail("Failed to configure native mode on iface/ns %s\n",
> + ifdict[1]->ifname, ifdict[1]->nsname);
> + return -1;
> + }
> +
> + cur_mode = TEST_MODE_DRV;
> +
> + return 0;
> +}
> +
We're already using libbpf, so please use the libbpf APIs instead of
calling iproute2.
Björn
[...]
next prev parent reply other threads:[~2021-02-18 10:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-17 16:02 [PATCH bpf-next 0/4] selftests/bpf: xsk improvements and new stats tests Ciara Loftus
2021-02-17 16:02 ` [PATCH bpf-next 1/4] selftest/bpf: make xsk tests less verbose Ciara Loftus
2021-02-22 11:58 ` Maciej Fijalkowski
2021-02-17 16:02 ` [PATCH bpf-next 2/4] selftests/bpf: expose debug arg to shell script for xsk tests Ciara Loftus
2021-02-19 13:12 ` Magnus Karlsson
2021-02-22 14:29 ` Loftus, Ciara
2021-02-17 16:02 ` [PATCH bpf-next 3/4] selftests/bpf: restructure xsk selftests Ciara Loftus
2021-02-18 9:33 ` Björn Töpel [this message]
2021-02-22 11:23 ` Maciej Fijalkowski
2021-02-23 8:24 ` Loftus, Ciara
2021-02-17 16:02 ` [PATCH bpf-next 4/4] selftests/bpf: introduce xsk statistics tests Ciara Loftus
2021-02-22 11:56 ` Maciej Fijalkowski
2021-02-22 14:33 ` Loftus, Ciara
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=CAJ+HfNjUttwjKU0cKcHp46aD670TjrzBLDFmrVNkg4uaNcPaYw@mail.gmail.com \
--to=bjorn.topel@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=ciara.loftus@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=weqaar.a.janjua@intel.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;
as well as URLs for NNTP newsgroup(s).