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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ8uoz2EsL76DyfCNP4taFyF9_ES0riV34-FURDDV_KRAAVyvA@mail.gmail.com>
Date:   Tue, 19 Nov 2019 09:42:55 +0100
From:   Magnus Karlsson <magnus.karlsson@...il.com>
To:     Luigi Rizzo <lrizzo@...gle.com>
Cc:     "Karlsson, Magnus" <magnus.karlsson@...el.com>,
        Björn Töpel <bjorn.topel@...el.com>,
        Jonathan Lemon <jonathan.lemon@...il.com>,
        Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, rizzo@....unipi.it
Subject: Re: [PATCH v2] net-af_xdp: use correct number of channels from ethtool

On Tue, Nov 19, 2019 at 1:20 AM Luigi Rizzo <lrizzo@...gle.com> wrote:
>
> Drivers use different fields to report the number of channels, so take
> the maximum of all data channels (rx, tx, combined) when determining the
> size of the xsk map. The current code used only 'combined' which was set
> to 0 in some drivers e.g. mlx4.
>
> Tested: compiled and run xdpsock -q 3 -r -S on mlx4
> Signed-off-by: Luigi Rizzo <lrizzo@...gle.com>
> ---
>  tools/lib/bpf/xsk.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
> index 74d84f36a5b24..37921375f4d45 100644
> --- a/tools/lib/bpf/xsk.c
> +++ b/tools/lib/bpf/xsk.c
> @@ -431,13 +431,18 @@ static int xsk_get_max_queues(struct xsk_socket *xsk)
>                 goto out;
>         }
>
> -       if (err || channels.max_combined == 0)
> +       if (err) {
>                 /* If the device says it has no channels, then all traffic
>                  * is sent to a single stream, so max queues = 1.
>                  */
>                 ret = 1;
> -       else
> -               ret = channels.max_combined;
> +       } else {
> +               /* Take the max of rx, tx, combined. Drivers return
> +                * the number of channels in different ways.
> +                */
> +               ret = max(channels.max_rx, channels.max_tx);
> +               ret = max(ret, (int)channels.max_combined);
> +       }
>
>  out:
>         close(fd);
> --
> 2.24.0.432.g9d3f5f5b63-goog
>

Thanks Luigi.

Acked-by: Magnus Karlsson <magnus.karlsson@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ