[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJ+HfNj0BQbTUV+EP8uVfo33NuxQhu=bm45amBRYq=HULn3t3Q@mail.gmail.com>
Date: Fri, 31 May 2019 19:13:40 +0200
From: Björn Töpel <bjorn.topel@...il.com>
To: Jonathan Lemon <jonathan.lemon@...il.com>
Cc: Björn Töpel <bjorn.topel@...el.com>,
Netdev <netdev@...r.kernel.org>,
"Karlsson, Magnus" <magnus.karlsson@...el.com>,
Kernel Team <kernel-team@...com>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH v2 bpf-next 1/2] bpf: Allow bpf_map_lookup_elem() on an xskmap
On Fri, 31 May 2019 at 18:27, Jonathan Lemon <jonathan.lemon@...il.com> wrote:
>
> On 31 May 2019, at 4:49, Björn Töpel wrote:
>
> > On 2019-05-30 20:57, Jonathan Lemon wrote:
> >> Currently, the AF_XDP code uses a separate map in order to
> >> determine if an xsk is bound to a queue. Instead of doing this,
> >> have bpf_map_lookup_elem() return the queue_id, as a way of
> >> indicating that there is a valid entry at the map index.
> >>
> >> Rearrange some xdp_sock members to eliminate structure holes.
> >>
> >> Signed-off-by: Jonathan Lemon <jonathan.lemon@...il.com>
> >> ---
> >> include/net/xdp_sock.h | 6 +++---
> >> kernel/bpf/verifier.c | 6 +++++-
> >> kernel/bpf/xskmap.c | 4 +++-
> >> .../selftests/bpf/verifier/prevent_map_lookup.c | 15 ---------------
> >> 4 files changed, 11 insertions(+), 20 deletions(-)
> >>
> >> diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
> >> index d074b6d60f8a..7d84b1da43d2 100644
> >> --- a/include/net/xdp_sock.h
> >> +++ b/include/net/xdp_sock.h
> >> @@ -57,12 +57,12 @@ struct xdp_sock {
> >> struct net_device *dev;
> >> struct xdp_umem *umem;
> >> struct list_head flush_node;
> >> - u16 queue_id;
> >> - struct xsk_queue *tx ____cacheline_aligned_in_smp;
> >> - struct list_head list;
> >> + u32 queue_id;
> >
> > Why the increase of size?
>
> Currently xskmaps are defined as size=4, so the returned pointer for
> bpf must have that many bytes. I was kicking around the idea of using
> a union and returning { qid, zc }, but Alexei pointed out that doesn't
> make a good API.
>
> Besides, queue_index in struct xdp_rxq_info is already a u32.
(Resending w/o HTML from mobile client.)
Makes sense. Thanks for clarifying!
Björn
> --
> Jonathan
>
Powered by blists - more mailing lists