[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210222091047.39b4644c@carbon>
Date: Mon, 22 Feb 2021 09:10:47 +0100
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Björn Töpel <bjorn.topel@...il.com>
Cc: brouer@...hat.com, ast@...nel.org, daniel@...earbox.net,
netdev@...r.kernel.org, bpf@...r.kernel.org,
Björn Töpel
<bjorn.topel@...el.com>, maciej.fijalkowski@...el.com,
hawk@...nel.org, toke@...hat.com, magnus.karlsson@...el.com,
john.fastabend@...il.com, kuba@...nel.org, davem@...emloft.net
Subject: Re: [PATCH bpf-next v3 2/2] bpf, xdp: restructure redirect actions
On Sun, 21 Feb 2021 21:09:54 +0100
Björn Töpel <bjorn.topel@...il.com> wrote:
> From: Björn Töpel <bjorn.topel@...el.com>
>
> The XDP_REDIRECT implementations for maps and non-maps are fairly
> similar, but obviously need to take different code paths depending on
> if the target is using a map or not. Today, the redirect targets for
> XDP either uses a map, or is based on ifindex.
>
> Here, an explicit redirect type is added to bpf_redirect_info, instead
> of the actual map. Redirect type, map item/ifindex, and the map_id (if
> any) is passed to xdp_do_redirect().
>
> In addition to making the code easier to follow, using an explicit
> type in bpf_redirect_info has a slight positive performance impact by
> avoiding a pointer indirection for the map type lookup, and instead
> use the cacheline for bpf_redirect_info.
>
> Since the actual map is not passed via bpf_redirect_info anymore, the
> map lookup is only done in the BPF helper. This means that the
> bpf_clear_redirect_map() function can be removed. The actual map item
> is RCU protected.
>
> The bpf_redirect_info flags member is not used by XDP, and not
> read/written any more. The map member is only written to when
> required/used, and not unconditionally.
>
> v1->v2 : Removed warning when CONFIG_BPF_SYSCALL was not set. (lkp)
> : Cleaned up case-clause in xdp_do_generic_redirect_map(). (Toke)
> rfc->v1: Use map_id, and remove bpf_clear_redirect_map(). (Toke)
>
> Acked-by: Toke Høiland-Jørgensen <toke@...hat.com>
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
> ---
> include/linux/bpf.h | 1 +
> include/linux/filter.h | 11 ++-
> include/trace/events/xdp.h | 66 +++++++++------
> kernel/bpf/cpumap.c | 1 -
> kernel/bpf/devmap.c | 1 -
> net/core/filter.c | 165 ++++++++++++++++---------------------
> net/xdp/xskmap.c | 1 -
> 7 files changed, 122 insertions(+), 124 deletions(-)
I like it! :-)
Acked-by: Jesper Dangaard Brouer <brouer@...hat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists