lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 18 Feb 2021 10:33:24 +0100
From:   Björn Töpel <bjorn.topel@...il.com>
To:     Ciara Loftus <ciara.loftus@...el.com>
Cc:     Netdev <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>,
        Weqaar Janjua <weqaar.a.janjua@...el.com>
Subject: Re: [PATCH bpf-next 3/4] selftests/bpf: restructure xsk selftests

On Wed, 17 Feb 2021 at 17:33, Ciara Loftus <ciara.loftus@...el.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@...el.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

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ