From: Thomas Graf <tgraf@suug.ch>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Brenden Blanco <bblanco@plumgrid.com>,
John Fastabend <john.fastabend@gmail.com>,
Jesper Dangaard Brouer <brouer@redhat.com>,
Tom Herbert <tom@herbertland.com>,
Daniel Borkmann <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
ogerlitz@mellanox.com
Subject: Re: [RFC PATCH 1/5] bpf: add PHYS_DEV prog type for early driver filter
Date: Tue, 5 Apr 2016 00:04:39 +0200 [thread overview]
Message-ID: <20160404220439.GA9972@pox.localdomain> (raw)
In-Reply-To: <20160404200032.GA69842@ast-mbp.thefacebook.com>
On 04/04/16 at 01:00pm, Alexei Starovoitov wrote:
> Exactly. That the most important part of this rfc.
> Right now redirect to different queue, batching, prefetch and tons of
> other code are mising. We have to plan the whole project, so we can
> incrementally add features without breaking abi.
> So new IFLA, xdp_metadata struct and enum for bpf return codes are
> the main things to agree on.
+1
This is the most important statement in this thread so far. A plan
that gets us from this RFC series to a functional forwarding engine
with redirect and load/write is essential. [...]
> Another reason for going with 'pseudo skb' structure was to reuse
> load_byte/half/word instructions in bpf interpreter as-is.
> Right now these instructions have to see in-kernel
> 'struct sk_buff' as context (note we have mirror __sk_buff
> for user space), so to use load_byte for bpf_prog_type_phys_dev
> we have to give real 'struct sk_buff' to interpter with
> data, head, len, data_len fields initialized, so that
> interpreter 'just works'.
> The potential fix would be to add phys_dev specific load_byte/word
> instructions. Then we can drop all the legacy negative offset
> stuff that <1% uses, but it slows down everyone.
> We can also drop byteswap that load_word does (which turned out
> to be confusing and often programs do 2nd byteswap to go
> back to cpu endiannes).
[...] I would really like to see a common set of helpers which
applies to both cls_bpf and phys_dev. Given the existing skb based
helpers cannot be overloaded, at least the phys_dev helpers should
be made to work in cls_bpf context as well to allow for some
portability. Otherwise we'll end up with half a dozen flavours of
BPF which are all incompatible.
> And if we do it smart, we can drop length check as well,
> then new_load_byte will actually be single load byte cpu instruction.
> We can drop length check when offset is constant in the verfier
> and that constant is less than 64, since all packets are larger.
> As seen in 'perf report' from patch 5:
> 3.32% ksoftirqd/1 [kernel.vmlinux] [k] sk_load_byte_positive_offset
> this is 14Mpps and 4 assembler instructions in the above function
> are consuming 3% of the cpu. Making new_load_byte to be single
> x86 insn would be really cool.
Neat.
next prev parent reply other threads:[~2016-04-04 22:04 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-02 1:21 [RFC PATCH 0/5] Add driver bpf hook for early packet drop Brenden Blanco
2016-04-02 1:21 ` [RFC PATCH 1/5] bpf: add PHYS_DEV prog type for early driver filter Brenden Blanco
2016-04-02 16:39 ` Tom Herbert
2016-04-03 7:02 ` Brenden Blanco
2016-04-04 22:07 ` Thomas Graf
2016-04-05 8:19 ` Jesper Dangaard Brouer
2016-04-04 8:49 ` Daniel Borkmann
2016-04-04 13:07 ` Jesper Dangaard Brouer
2016-04-04 13:36 ` Daniel Borkmann
2016-04-04 14:09 ` Tom Herbert
2016-04-04 15:12 ` Jesper Dangaard Brouer
2016-04-04 15:29 ` Brenden Blanco
2016-04-04 16:07 ` John Fastabend
2016-04-04 16:17 ` Brenden Blanco
2016-04-04 20:00 ` Alexei Starovoitov
2016-04-04 22:04 ` Thomas Graf [this message]
2016-04-05 2:25 ` Alexei Starovoitov
2016-04-05 8:11 ` Jesper Dangaard Brouer
2016-04-05 9:29 ` Jesper Dangaard Brouer
2016-04-05 22:06 ` Alexei Starovoitov
2016-04-04 14:33 ` Eric Dumazet
2016-04-04 15:18 ` Edward Cree
2016-04-02 1:21 ` [RFC PATCH 2/5] net: add ndo to set bpf prog in adapter rx Brenden Blanco
2016-04-02 1:21 ` [RFC PATCH 3/5] rtnl: add option for setting link bpf prog Brenden Blanco
2016-04-02 1:21 ` [RFC PATCH 4/5] mlx4: add support for fast rx drop bpf program Brenden Blanco
2016-04-02 2:08 ` Eric Dumazet
2016-04-02 2:47 ` Alexei Starovoitov
2016-04-04 14:57 ` Jesper Dangaard Brouer
2016-04-04 15:22 ` Eric Dumazet
2016-04-04 18:50 ` Alexei Starovoitov
2016-04-05 14:15 ` Or Gerlitz
2016-04-06 4:05 ` Brenden Blanco
2016-04-03 6:15 ` Brenden Blanco
2016-04-05 2:20 ` Brenden Blanco
2016-04-05 2:44 ` Eric Dumazet
2016-04-05 18:59 ` Eran Ben Elisha
2016-04-02 8:23 ` Jesper Dangaard Brouer
2016-04-03 6:11 ` Brenden Blanco
2016-04-04 18:27 ` Alexei Starovoitov
2016-04-05 6:04 ` Jesper Dangaard Brouer
2016-04-02 18:40 ` Johannes Berg
2016-04-03 6:38 ` Brenden Blanco
2016-04-04 7:35 ` Johannes Berg
2016-04-04 9:57 ` Daniel Borkmann
2016-04-04 18:46 ` Alexei Starovoitov
2016-04-04 21:01 ` Daniel Borkmann
2016-04-05 1:17 ` Alexei Starovoitov
2016-04-04 8:33 ` Jesper Dangaard Brouer
2016-04-04 9:22 ` Daniel Borkmann
2016-04-02 1:21 ` [RFC PATCH 5/5] Add sample for adding simple drop program to link Brenden Blanco
2016-04-06 19:48 ` Jesper Dangaard Brouer
2016-04-06 20:01 ` Jesper Dangaard Brouer
2016-04-06 23:11 ` Alexei Starovoitov
2016-04-06 20:03 ` Daniel Borkmann
2016-04-02 16:47 ` [RFC PATCH 0/5] Add driver bpf hook for early packet drop Tom Herbert
2016-04-03 5:41 ` Brenden Blanco
2016-04-04 7:48 ` Jesper Dangaard Brouer
2016-04-04 18:10 ` Alexei Starovoitov
2016-04-02 18:41 ` Johannes Berg
2016-04-02 22:57 ` Tom Herbert
2016-04-03 2:28 ` Lorenzo Colitti
2016-04-04 7:37 ` Johannes Berg
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=20160404220439.GA9972@pox.localdomain \
--to=tgraf@suug.ch \
--cc=alexei.starovoitov@gmail.com \
--cc=bblanco@plumgrid.com \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@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 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).