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>,
	"Jiong Wang" <jiong.wang@netronome.com>
Subject: Re: [PATCH bpf-next v2] libbpf: use implicit XSKMAP lookup from AF_XDP XDP program
Date: Tue, 22 Oct 2019 09:16:11 +0200	[thread overview]
Message-ID: <CAJ+HfNgGTL-P-Qe5zOh=s0RBRMJGx0NXDLTj7DAunwk-HoVdxg@mail.gmail.com> (raw)
In-Reply-To: <87v9sip0i8.fsf@toke.dk>

On Mon, 21 Oct 2019 at 17:43, Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Björn Töpel <bjorn.topel@gmail.com> writes:
>
> > On Mon, 21 Oct 2019 at 15:37, Björn Töpel <bjorn.topel@gmail.com> wrote:
> >>
> >> On Mon, 21 Oct 2019 at 14:19, Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> >> >
> >> > Björn Töpel <bjorn.topel@gmail.com> writes:
> >> >
> >> [...]
> >> > >
> >> > > bpf_redirect_map() returns a 32-bit signed int, so the upper 32-bit
> >> > > will need to be cleared. Having an explicit AND is one instruction
> >> > > less than two shifts. So, it's an optimization (every instruction is
> >> > > sacred).
> >> >
> >> > OIC. Well, a comment explaining that might be nice (since you're doing
> >> > per-instruction comments anyway)? :)
> >> >
> >>
> >> Sure, I can do a v3 with a comment, unless someone has a better idea
> >> avoiding both shifts and AND.
> >>
> >> Thanks for taking a look!
> >>
> >
> > Now wait, there are the JMP32 instructions that Jiong added. So,
> > shifts/AND can be avoided. Now, regarding backward compat... JMP32 is
> > pretty new. I need to think a bit how to approach this. I mean, I'd
> > like to be able to use new BPF instructions.
>
> Well, they went into kernel 5.1 AFAICT; does AF_XDP even work properly
> in kernels older than that? For the xdp-tutorial we've just been telling
> people to upgrade their kernels to use it (see, e.g.,
> https://github.com/xdp-project/xdp-tutorial/issues/76).
>

Yeah, let's take that route, i.e. using JMP32 and one program. One
could argue that libbpf could do runtime checks and load the simpler
program w/o the fallback for post-5.3 only, and avoiding the branching
all together.


Björn


> -Toke
>

      reply	other threads:[~2019-10-22  7:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 10:59 Björn Töpel
2019-10-21 11:50 ` Toke Høiland-Jørgensen
2019-10-21 12:02   ` Björn Töpel
2019-10-21 12:19     ` Toke Høiland-Jørgensen
2019-10-21 13:37       ` Björn Töpel
2019-10-21 14:35         ` Björn Töpel
2019-10-21 15:43           ` Toke Høiland-Jørgensen
2019-10-22  7:16             ` 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+HfNgGTL-P-Qe5zOh=s0RBRMJGx0NXDLTj7DAunwk-HoVdxg@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=jiong.wang@netronome.com \
    --cc=magnus.karlsson@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sridhar.samudrala@intel.com \
    --cc=toke@redhat.com \
    --subject='Re: [PATCH bpf-next v2] libbpf: use implicit XSKMAP lookup from AF_XDP XDP program' \
    /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

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