bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn.topel@intel.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Björn Töpel" <bjorn.topel@gmail.com>,
	ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org,
	bpf@vger.kernel.org
Cc: magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
	kuba@kernel.org, jonathan.lemon@gmail.com, maximmi@nvidia.com,
	davem@davemloft.net, hawk@kernel.org, john.fastabend@gmail.com
Subject: Re: [RFC PATCH bpf-next] bpf, xdp: per-map bpf_redirect_map functions for XDP
Date: Mon, 1 Feb 2021 07:27:57 +0100	[thread overview]
Message-ID: <e77f259a-2381-1a6e-6e2c-f5afceb35c51@intel.com> (raw)
In-Reply-To: <87im7fy9nc.fsf@toke.dk>

On 2021-01-29 17:45, Toke Høiland-Jørgensen wrote:
> Björn Töpel <bjorn.topel@gmail.com> writes:
> 
>> From: Björn Töpel <bjorn.topel@intel.com>
>>
>> Currently the bpf_redirect_map() implementation dispatches to the
>> correct map-lookup function via a switch-statement. To avoid the
>> dispatching, this change adds one bpf_redirect_map() implementation per
>> map. Correct function is automatically selected by the BPF verifier.
>>
>> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
>> ---
>> Hi XDP-folks!
>>
>> This is another take on my bpf_redirect_xsk() patch [1]. I figured I
>> send it as an RFC for some early input. My plan is to include it as
>> part of the xdp_do_redirect() optimization of [1].
> 
> Assuming the maintainers are OK with the special-casing in the verifier,
> this looks like a neat way to avoid the runtime overhead to me. The
> macro hackery is not the prettiest; I wonder if the same effect could be
> achieved by using inline functions? If not, at least a comment
> explaining the reasoning (and that the verifier will substitute the
> right function) might be nice? Mostly in relation to this bit:
>

Yeah, I agree with the macro part. I'll replace it with a
__always_inline function, instead.


>>   static const struct bpf_func_proto bpf_xdp_redirect_map_proto = {
>> -	.func           = bpf_xdp_redirect_map,
>> +	.func           = bpf_xdp_redirect_devmap,
>

I'll try to clean this up as well.

Thanks for taking a look!
Björn


> Ah, if only we were writing the kernel in a language with proper macro
> support... One can dream! :)
> 
>>> For AF_XDP rxdrop this yields +600Mpps. I'll do CPU/DEVMAP
>>> measurements for the patch proper.
>>>
>>
>> Kpps, not Mpps. :-P
> 
> Aww, too bad ;)
> Still, nice!
> 
> -Toke
> 

  reply	other threads:[~2021-02-01  6:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210129153215.190888-1-bjorn.topel@gmail.com>
2021-01-29 16:45 ` [RFC PATCH bpf-next] bpf, xdp: per-map bpf_redirect_map functions for XDP Toke Høiland-Jørgensen
2021-02-01  6:27   ` Björn Töpel [this message]
2021-02-01  9:31     ` Jesper Dangaard Brouer
2021-02-01  9:49       ` Björn Töpel
     [not found] ` <CAJ+HfNiFtRd-KKMB1t3Mi3MZ=C+u5TTM5YFnzJFfR4Ruzc7c9Q@mail.gmail.com>
2021-01-29 18:06   ` 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=e77f259a-2381-1a6e-6e2c-f5afceb35c51@intel.com \
    --to=bjorn.topel@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=maximmi@nvidia.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).