From: Jesper Dangaard Brouer <brouer@redhat.com>
To: "Björn Töpel" <bjorn.topel@gmail.com>
Cc: brouer@redhat.com, ast@kernel.org, daniel@iogearbox.net,
netdev@vger.kernel.org, bpf@vger.kernel.org,
"Björn Töpel" <bjorn.topel@intel.com>,
maciej.fijalkowski@intel.com, hawk@kernel.org, toke@redhat.com,
magnus.karlsson@intel.com, john.fastabend@gmail.com,
kuba@kernel.org, davem@davemloft.net
Subject: Re: [PATCH bpf-next v3 2/2] bpf, xdp: restructure redirect actions
Date: Mon, 22 Feb 2021 09:10:47 +0100 [thread overview]
Message-ID: <20210222091047.39b4644c@carbon> (raw)
In-Reply-To: <20210221200954.164125-3-bjorn.topel@gmail.com>
On Sun, 21 Feb 2021 21:09:54 +0100
Björn Töpel <bjorn.topel@gmail.com> wrote:
> From: Björn Töpel <bjorn.topel@intel.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@redhat.com>
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Signed-off-by: Björn Töpel <bjorn.topel@intel.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@redhat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
prev parent reply other threads:[~2021-02-22 8:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-21 20:09 [PATCH bpf-next v3 0/2] Optimize bpf_redirect_map()/xdp_do_redirect() Björn Töpel
2021-02-21 20:09 ` [PATCH bpf-next v3 1/2] bpf, xdp: per-map bpf_redirect_map functions for XDP Björn Töpel
2021-02-22 7:23 ` Jesper Dangaard Brouer
2021-02-24 23:38 ` Daniel Borkmann
2021-02-25 6:39 ` Björn Töpel
2021-02-21 20:09 ` [PATCH bpf-next v3 2/2] bpf, xdp: restructure redirect actions Björn Töpel
2021-02-22 8:10 ` Jesper Dangaard Brouer [this message]
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=20210222091047.39b4644c@carbon \
--to=brouer@redhat.com \
--cc=ast@kernel.org \
--cc=bjorn.topel@gmail.com \
--cc=bjorn.topel@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=toke@redhat.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).