From: Jesper Dangaard Brouer <brouer@redhat.com>
To: John Fastabend <john.fastabend@gmail.com>
Cc: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
"xdp-newbies@vger.kernel.org" <xdp-newbies@vger.kernel.org>,
"Daniel Borkmann" <borkmann@iogearbox.net>,
"Andy Gospodarek" <andy@greyhouse.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"Paweł Staszewski" <pstaszewski@itcare.pl>,
brouer@redhat.com
Subject: Re: XDP redirect measurements, gotchas and tracepoints
Date: Wed, 23 Aug 2017 10:56:38 +0200 [thread overview]
Message-ID: <20170823105638.332a8348@redhat.com> (raw)
In-Reply-To: <599C6747.8010005@gmail.com>
On Tue, 22 Aug 2017 10:17:59 -0700
John Fastabend <john.fastabend@gmail.com> wrote:
> On 08/22/2017 10:09 AM, Alexei Starovoitov wrote:
> > On Tue, Aug 22, 2017 at 08:37:10AM +0200, Jesper Dangaard Brouer wrote:
> >>
> >>
> >>> Once tx-ing netdev added to devmap we can enable xdp on it automatically?
> >>
> >> I think you are referring to Gotcha-2 here:
> >
> > oops. yes :)
> >
> >>
> >> Second gotcha(2): you cannot TX out a device, unless it also have a
> >> xdp bpf program attached. (This is an implicit dependency, as the
> >> driver code need to setup XDP resources before it can ndo_xdp_xmit).
> >>
> >> Yes, we should work on improving this situation. Auto enabling XDP
> >> when a netdev is added to a devmap is a good solution. Currently this
> >> is tied to loading an XDP bpf_prog. Do you propose loading a dummy
> >> bpf_prog on the netdev? (then we need to handle 1. not replacing
> >> existing bpf_prog, 2. on take-down don't remove "later" loaded
> >> bpf_prog).
> >
> > right. these things need to be taken care of.
> > Technically for ndo_xdp_xmit to work the program doesn't need
> > to be attached, but the device needs to be in xdp mode with
> > configured xdp tx rings.
> > The easiest, of course, is just to document it :)
> > and may be add some sort of warning that if netdev is added
> > to devmap and it's not in xdp mode, return warning or error.
> >
>
> When I wrote this I assumed some user space piece could
> load the "dummy" nop program on devices as needed. It seemed
> easier than putting semi-complex logic in the kernel to load
> programs on update_elem, but only if the user hasn't already
> loaded a program and then unload it but again only if some
> criteria is met. Then we would have one more kernel path into
> load/unload BPF programs and would need all the tests and what
> not.
I agree, it is not good to add this kind of logic to the kernel. We
would create too many funny race conditions with userspace.
> +1 for documenting and userland usability patches.
We still don't have a good place for XDP documentation. My own[1]
attempt have gotten out-of-sync, and I need to restructure the
rst-docs, before I want to propose it for the kernel.
[1] https://prototype-kernel.readthedocs.io/en/latest/networking/XDP/index.html
I want to create some samples/examples with XDP_REDIRECT, that
highlight this property. Maybe the samples/bpf/xdp_redirect{,_map}
should automatically attach a XDP bpf_prog to the egress device?
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2017-08-23 8:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 19:25 XDP redirect measurements, gotchas and tracepoints Jesper Dangaard Brouer
2017-08-21 22:35 ` Alexei Starovoitov
2017-08-22 6:37 ` Jesper Dangaard Brouer
2017-08-22 17:09 ` Alexei Starovoitov
2017-08-22 17:17 ` John Fastabend
2017-08-23 8:56 ` Jesper Dangaard Brouer [this message]
2017-08-22 18:02 ` Michael Chan
2017-08-22 18:17 ` John Fastabend
2017-08-22 18:30 ` Duyck, Alexander H
2017-08-22 20:04 ` Michael Chan
2017-08-23 1:06 ` Alexander Duyck
2017-08-23 6:59 ` Michael Chan
2017-08-23 8:29 ` Jesper Dangaard Brouer
2017-08-25 3:36 ` Michael Chan
2017-08-25 12:45 ` Jesper Dangaard Brouer
2017-08-25 15:10 ` John Fastabend
2017-08-25 15:28 ` Michael Chan
2017-08-28 16:02 ` Andy Gospodarek
2017-08-28 16:11 ` Alexander Duyck
2017-08-29 13:26 ` Jesper Dangaard Brouer
2017-08-29 16:23 ` Alexander Duyck
2017-08-29 19:02 ` Andy Gospodarek
2017-08-29 19:52 ` Alexander Duyck
2017-08-28 16:14 ` John Fastabend
2017-08-28 19:39 ` Andy Gospodarek
2017-08-23 14:51 ` Alexander Duyck
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=20170823105638.332a8348@redhat.com \
--to=brouer@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andy@greyhouse.net \
--cc=borkmann@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pstaszewski@itcare.pl \
--cc=xdp-newbies@vger.kernel.org \
/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.