From: "Björn Töpel" <firstname.lastname@example.org> To: "Toke Høiland-Jørgensen" <email@example.com> Cc: Netdev <firstname.lastname@example.org>, "Alexei Starovoitov" <email@example.com>, "Daniel Borkmann" <firstname.lastname@example.org>, "Björn Töpel" <email@example.com>, bpf <firstname.lastname@example.org>, "Magnus Karlsson" <email@example.com>, "Karlsson, Magnus" <firstname.lastname@example.org>, "Samudrala, Sridhar" <email@example.com>, "Jiong Wang" <firstname.lastname@example.org> 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: <email@example.com> On Mon, 21 Oct 2019 at 17:43, Toke Høiland-Jørgensen <firstname.lastname@example.org> wrote: > > Björn Töpel <email@example.com> writes: > > > On Mon, 21 Oct 2019 at 15:37, Björn Töpel <firstname.lastname@example.org> wrote: > >> > >> On Mon, 21 Oct 2019 at 14:19, Toke Høiland-Jørgensen <email@example.com> wrote: > >> > > >> > Björn Töpel <firstname.lastname@example.org> 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 >
prev parent 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' \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.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).