From: Alexei Starovoitov <ast@fb.com>
To: Tom Herbert <tom@herbertland.com>, <davem@davemloft.net>,
<netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>, <tariqt@mellanox.com>,
<bblanco@plumgrid.com>, <alexei.starovoitov@gmail.com>,
<eric.dumazet@gmail.com>, <brouer@redhat.com>
Subject: Re: [PATCH RFC 1/3] xdp: Infrastructure to generalize XDP
Date: Tue, 20 Sep 2016 17:01:39 -0700 [thread overview]
Message-ID: <57E1CDE3.5030404@fb.com> (raw)
In-Reply-To: <1474408824-418864-2-git-send-email-tom@herbertland.com>
On 9/20/16 3:00 PM, Tom Herbert wrote:
> +static inline int __xdp_hook_run(struct list_head *list_head,
> + struct xdp_buff *xdp)
> +{
> + struct xdp_hook_ops *elem;
> + int ret = XDP_PASS;
> +
> + list_for_each_entry(elem, list_head, list) {
> + ret = elem->hook(elem->priv, xdp);
> + if (ret != XDP_PASS)
> + break;
> + }
> +
> + return ret;
> +}
> +
> +/* Run the XDP hooks for a napi device. Called from a driver's receive
> + * routine
> + */
> +static inline int xdp_hook_run(struct napi_struct *napi, struct xdp_buff *xdp)
> +{
> + struct net_device *dev = napi->dev;
> + int ret = XDP_PASS;
> +
> + if (static_branch_unlikely(&xdp_hooks_needed)) {
> + /* Run hooks in napi first */
> + ret = __xdp_hook_run(&napi->xdp_hook_list, xdp);
> + if (ret != XDP_PASS)
> + return ret;
> +
> + /* Now run device hooks */
> + ret = __xdp_hook_run(&dev->xdp_hook_list, xdp);
> + if (ret != XDP_PASS)
> + return ret;
> + }
> +
> + return ret;
> +}
it's an interesting idea to move prog pointer into napi struct,
but certainly not at such huge cost.
Right now it's 1 load + 1 cmp + 1 indirect jump per packet
to invoke the program, with above approach it becomes
6 loads + 3 cmp (just to get through run_needed_check() check)
+ 6 loads + 3 cmp + 2 indirect jumps.
(I may be little bit off +- few loads)
That is a non-starter.
When we were optimizing receive path of tc clast ingress hook
we saw 1Mpps saved for every load+cmp+indirect jump removed.
We're working on inlining of bpf_map_lookup to save one
indirect call per lookup, we cannot just waste them here.
We need to save cycles instead, especially when it doesn't
really solve your goals. It seems the goals are:
>- Allows alternative users of the XDP hooks other than the original
> BPF
this should be achieved by their own hooks while reusing
return codes XDP_TX, XDP_PASS to keep driver side the same.
I'm not against other packet processing engines, but not
at the cost of lower performance.
> - Allows a means to pipeline XDP programs together
this can be done already via bpf_tail_call. No changes needed.
> - Reduces the amount of code and complexity needed in drivers to
> manage XDP
hmm:
534 insertions(+), 144 deletions(-)
looks like increase in complexity instead.
> - Provides a more structured environment that is extensible to new
> features while being mostly transparent to the drivers
don't see that in these patches either.
Things like packet size change (that we're working on) still
has to be implemented for every driver.
Existing XDP_TX, XDP_DROP have to be implemented per driver as well.
Also introduction of xdp.h breaks existing UAPI.
That's not acceptable either.
next prev parent reply other threads:[~2016-09-21 0:01 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-20 22:00 [PATCH RFC 0/3] xdp: Generalize XDP Tom Herbert
2016-09-20 22:00 ` [PATCH RFC 1/3] xdp: Infrastructure to generalize XDP Tom Herbert
2016-09-20 22:37 ` Eric Dumazet
2016-09-20 22:40 ` Tom Herbert
2016-09-20 22:44 ` Thomas Graf
2016-09-20 22:49 ` Tom Herbert
2016-09-20 23:09 ` Thomas Graf
2016-09-20 23:18 ` Tom Herbert
2016-09-20 23:43 ` Thomas Graf
2016-09-20 23:59 ` Tom Herbert
2016-09-21 0:13 ` Alexei Starovoitov
2016-09-21 11:55 ` Thomas Graf
2016-09-21 14:19 ` Tom Herbert
2016-09-21 14:48 ` Thomas Graf
2016-09-21 15:08 ` Tom Herbert
2016-09-21 19:56 ` Jesper Dangaard Brouer
2016-09-22 13:14 ` Jesper Dangaard Brouer
2016-09-22 14:46 ` Eric Dumazet
2016-09-21 15:39 ` Alexei Starovoitov
2016-09-21 17:26 ` Jakub Kicinski
2016-09-20 23:22 ` Daniel Borkmann
2016-09-21 0:01 ` Alexei Starovoitov [this message]
2016-09-21 6:39 ` Jesper Dangaard Brouer
2016-09-21 8:42 ` Daniel Borkmann
2016-09-21 15:44 ` Alexei Starovoitov
2016-09-21 17:26 ` Jakub Kicinski
2016-09-21 17:39 ` Tom Herbert
2016-09-21 18:45 ` Jakub Kicinski
2016-09-21 18:50 ` Tom Herbert
2016-09-21 18:54 ` Jakub Kicinski
2016-09-21 18:58 ` Thomas Graf
2016-09-23 11:13 ` Jamal Hadi Salim
2016-09-23 13:00 ` Jesper Dangaard Brouer
2016-09-23 14:26 ` Alexei Starovoitov
2016-09-25 11:32 ` Jamal Hadi Salim
2016-09-23 14:14 ` Tom Herbert
2016-09-25 12:29 ` Jamal Hadi Salim
2016-09-20 22:00 ` [PATCH RFC 2/3] mlx4: Change XDP/BPF to use generic XDP infrastructure Tom Herbert
2016-09-20 22:00 ` [PATCH RFC 3/3] netdevice: Remove obsolete xdp_netdev_command Tom Herbert
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=57E1CDE3.5030404@fb.com \
--to=ast@fb.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bblanco@plumgrid.com \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=tariqt@mellanox.com \
--cc=tom@herbertland.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.