bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: "Björn Töpel" <bjorn.topel@gmail.com>,
	netdev@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net
Cc: "Björn Töpel" <bjorn.topel@intel.com>,
	bpf@vger.kernel.org, magnus.karlsson@gmail.com,
	magnus.karlsson@intel.com, sridhar.samudrala@intel.com
Subject: Re: [PATCH bpf-next] libbpf: remove explicit XSKMAP lookup from AF_XDP XDP program
Date: Sun, 20 Oct 2019 21:53:19 +0200	[thread overview]
Message-ID: <87pnirb3dc.fsf@toke.dk> (raw)
In-Reply-To: <20191020170711.22082-1-bjorn.topel@gmail.com>

Björn Töpel <bjorn.topel@gmail.com> writes:

> From: Björn Töpel <bjorn.topel@intel.com>
> In commit 43e74c0267a3 ("bpf_xdp_redirect_map: Perform map lookup in
> eBPF helper") the bpf_redirect_map() helper learned to do map lookup,
> which means that the explicit lookup in the XDP program for AF_XDP is
> not needed.
> This commit removes the map lookup, which simplifies the BPF code and
> improves the performance for the "rx_drop" [1] scenario with ~4%.

Nice, 4% is pretty good!

I wonder if the program needs to be backwards-compatible (with pre-5.3
kernels), though?

You can do that by something like this:

ret = bpf_redirect_map(&xsks_map, index, XDP_PASS);
if (ret > 0)
  return ret;

if (bpf_map_lookup_elem(&xsks_map, &index))
   return bpf_redirect_map(&xsks_map, index, 0);
return XDP_PASS;

This works because bpf_redirect_map() prior to 43e74c0267a3 will return
XDP_ABORTED on a non-0 flags value.


  reply	other threads:[~2019-10-20 19:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-20 17:07 Björn Töpel
2019-10-20 19:53 ` Toke Høiland-Jørgensen [this message]
2019-10-21  5:03   ` Björn Töpel

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnirb3dc.fsf@toke.dk \
    --to=toke@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=magnus.karlsson@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sridhar.samudrala@intel.com \
    --subject='Re: [PATCH bpf-next] libbpf: remove explicit XSKMAP lookup from AF_XDP XDP program' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).