From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Ilya Goslhtein <ilejn@yandex.ru>
Cc: xdp-newbies@vger.kernel.org, brouer@redhat.com
Subject: Re: bidirectional: => AF_XDP , <= XDP_REDIRECT
Date: Wed, 30 Oct 2019 17:39:02 +0100 [thread overview]
Message-ID: <20191030173902.09311289@carbon> (raw)
In-Reply-To: <ac54dbc6-245a-c1b6-4bef-47296c69ec75@yandex.ru>
On Wed, 30 Oct 2019 18:44:27 +0300 Ilya Goslhtein <ilejn@yandex.ru> wrote:
> Hello,
>
> playing with xdpbridge https://github.com/ilejn/xdpbridge/ I've observed
> a limitation which is serious for me.
Hmm... I took a short look at your code.
Sorry for this candid/blunt evaluation: I think you are doing it wrong.
Both on how you use other FOSS code and how you use BPF/XDP.
First of all you are using bpf_load.c[1], which everybody should stop
using (sorry, I know I sort of started that trend). Instead everybody
should use libbpf[2]. Second you have copied over bpf_load.c and
re-indented the entire file, which is bad, because it makes it very
hard to track the difference between the original FOSS project and your
project.
You *also* use libbpf, but directly from the kernel tree. We don't
recommend doing it this way. Facebook engineers are maintaining a
libbpf mirror on github[2], which can be used as a git-submodule.
Before all distros start shipping libbpf, the easiest way to get
started is to use libbpf as a git-submodule.
[1] https://github.com/ilejn/xdpbridge/blob/master/bpf_load.c
[2] https://github.com/libbpf/libbpf
> xdpbridge is basically a combination of xdp_redirect_map sample
> (world=>client path) and slightly more advanced l2fwd mode of xdpsock
> (client=>world path),
> where AF_XDP sockets are bound to two different interfaces (vanilla
> l2fwd mode uses same interface as ingress and egress) and where
> multithreading is supported.
IMHO choosing AF_XDP for a bridge implementation is the wrong approach.
I would implement this in the XDP BPF-program, and use fallback to the
normal Linux bridging code (for broadcasting, ARP etc).
> xdpbridge sets options for client and egress interfaces independently.
>
> So, setting zerocopy bind flag for world interface (-z command line
> parameter) prevents this interface from working as ingress for
> world=>client path, although different queues are used. No errors, just
> no data transfer.
Sounds like you want part of the traffic to reach the normal kernel
networking stack. In that case, the XDP program should sort that out
(and call XDP_PASS) before doing the XDP_REDIRECT step into AF_XDP.
> It would be nice to understand if this issue fundamental or specific
> for the kernel (5.0.0-31-generic #33~18.04.1-Ubuntu) or card (Intel
> Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01))
> or driver.
> Or, may be, it is just my mistake.
>
> I do appreciate any comments or suggestions.
I'm glad that you are open to feedback.
I recommend you look at our XDP-tutorial[3], to see an example of how
Toke and I recommend structuring a project that want to use XDP/BPF.
[3] https://github.com/xdp-project/xdp-tutorial
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
> On 10.09.2019 17:38, Toke Høiland-Jørgensen wrote:
> > Ilya Goslhtein <ilejn@yandex.ru> writes:
> >
> >> Hello Toke,
> >>
> >> thanks for the response.
> >>
> >> I do not think that it is the case.
> >>
> >> The interface I am trying to share is outgoing for xdpbridge and
> >> incoming for xdp_bridge_map.
> >>
> >> xdpbridge does not load xdp program for outgoing interface (while loads
> >> for incoming).
> >>
> >> xdp_bridge_map loads dummy XDP program for outgoing redirect, while it
> >> is Ok if it is already exists.
> >>
> >>
> >> It seems that if I use different queues for incoming and outgoing
> >> packets, everything is Ok, while I am not 100% sure yet. Does it look
> >> realistic?
> > Oh, right, yeah, the AF_XDP socket will need to configure a hardware
> > queue to use; depending on your hardware, that could be incompatible
> > with running a regular XDP program on the same hardware queue.
> >
> > Incidently, we are working on a way to make this work better; talk
> > starts in five minutes at LPC:
> > https://linuxplumbersconf.org/event/4/contributions/462/
> >
> > -Toke
>
next prev parent reply other threads:[~2019-10-30 16:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 14:01 bidirectional: => AF_XDP , <= XDP_REDIRECT Ilya Goslhtein
2019-09-10 14:21 ` Toke Høiland-Jørgensen
2019-09-10 14:32 ` Ilya Goslhtein
2019-09-10 14:38 ` Toke Høiland-Jørgensen
2019-10-30 15:44 ` Ilya Goslhtein
2019-10-30 16:39 ` Jesper Dangaard Brouer [this message]
2019-10-30 16:59 ` Ilya Goslhtein
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=20191030173902.09311289@carbon \
--to=brouer@redhat.com \
--cc=ilejn@yandex.ru \
--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.