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: "Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	bpf <bpf@vger.kernel.org>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Björn Töpel" <bjorn.topel@intel.com>,
	"Karlsson, Magnus" <magnus.karlsson@intel.com>,
	Netdev <netdev@vger.kernel.org>,
	"Jesper Dangaard Brouer" <brouer@redhat.com>,
	"Fijalkowski, Maciej" <maciej.fijalkowski@intel.com>
Subject: Re: [RFC PATCH bpf-next 2/2] i40e: avoid xdp_do_redirect() call when "redirect_tail_call" is set
Date: Wed, 10 Jun 2020 13:12:37 +0200	[thread overview]
Message-ID: <CAJ+HfNiuag3MQ94K__vWfpS5wqTtzSs839t_cKQTpw1k_QZeYQ@mail.gmail.com> (raw)
In-Reply-To: <87r1uo81i5.fsf@toke.dk>

On Tue, 9 Jun 2020 at 21:47, 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>
> >
> > If an XDP program, where all the bpf_redirect_map() calls are tail
> > calls (as defined by the previous commit), the driver does not need to
> > explicitly call xdp_do_redirect().
> >
> > The driver checks the active XDP program, and notifies the BPF helper
> > indirectly via xdp_set_redirect_tailcall().
> >
> > This is just a naive, as-simple-as-possible implementation, calling
> > xdp_set_redirect_tailcall() for each packet.
>
> Do you really need the driver changes? The initial setup could be moved
> to bpf_prog_run_xdp(), and xdp_do_redirect() could be changed to an
> inline wrapper that just checks a flag and immediately returns 0 if the
> redirect action was already performed. Or am I missing some reason why
> this wouldn't work?
>

Indeed! That's a good idea!


Björn

> -Toke
>

  reply	other threads:[~2020-06-10 11:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 17:26 [RFC PATCH bpf-next 0/2] bpf_redirect_map() tail call detection and xdp_do_redirect() avoidance Björn Töpel
2020-06-09 17:26 ` [RFC PATCH bpf-next 1/2] bpf, xdp: add naive bpf_redirect_map() tail call detection Björn Töpel
2020-06-09 17:26 ` [RFC PATCH bpf-next 2/2] i40e: avoid xdp_do_redirect() call when "redirect_tail_call" is set Björn Töpel
2020-06-09 19:47   ` Toke Høiland-Jørgensen
2020-06-10 11:12     ` Björn Töpel [this message]
2020-06-09 20:10 ` [RFC PATCH bpf-next 0/2] bpf_redirect_map() tail call detection and xdp_do_redirect() avoidance Toke Høiland-Jørgensen
2020-06-10 12:21   ` Jesper Dangaard Brouer

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+HfNiuag3MQ94K__vWfpS5wqTtzSs839t_cKQTpw1k_QZeYQ@mail.gmail.com \
    --to=bjorn.topel@gmail.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --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).