bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn.topel@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Netdev <netdev@vger.kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Björn Töpel" <bjorn.topel@intel.com>, bpf <bpf@vger.kernel.org>,
	"Magnus Karlsson" <magnus.karlsson@gmail.com>,
	"Karlsson, Magnus" <magnus.karlsson@intel.com>,
	"Samudrala, Sridhar" <sridhar.samudrala@intel.com>
Subject: Re: [PATCH bpf-next] libbpf: remove explicit XSKMAP lookup from AF_XDP XDP program
Date: Mon, 21 Oct 2019 07:03:25 +0200	[thread overview]
Message-ID: <CAJ+HfNh+RFUQr852HDmq0DufxzrkyD_Tu99UtJUtd==L+tgB8w@mail.gmail.com> (raw)
In-Reply-To: <87pnirb3dc.fsf@toke.dk>

On Sun, 20 Oct 2019 at 21:53, Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> 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;
>

Ah, yes. Thanks for pointing that out. I'll do a respin.


Thanks,
Björn

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

      reply	other threads:[~2019-10-21  5:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-20 17:07 [PATCH bpf-next] libbpf: remove explicit XSKMAP lookup from AF_XDP XDP program Björn Töpel
2019-10-20 19:53 ` Toke Høiland-Jørgensen
2019-10-21  5:03   ` Björn Töpel [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='CAJ+HfNh+RFUQr852HDmq0DufxzrkyD_Tu99UtJUtd==L+tgB8w@mail.gmail.com' \
    --to=bjorn.topel@gmail.com \
    --cc=ast@kernel.org \
    --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 \
    --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).