All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Prashant Batra <prbatra.mail@gmail.com>,
	Magnus Karlsson <magnus.karlsson@gmail.com>
Cc: "Fijalkowski, Maciej" <maciej.fijalkowski@intel.com>,
	xdp-newbies@vger.kernel.org, Maryam Tahhan <mtahhan@redhat.com>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Subject: Re: Redirect to AF_XDP socket not working with bond interface in native mode
Date: Fri, 19 Jan 2024 14:04:07 +0100	[thread overview]
Message-ID: <87zfx14gqg.fsf@toke.dk> (raw)
In-Reply-To: <CAAAYKZPeCFbyTadsVJEUUv=HTHN8pnMOwF_i3NfCv-py1FtYDg@mail.gmail.com>

Prashant Batra <prbatra.mail@gmail.com> writes:

> Just to get your expert opinion on this, I am sharing at a very high
> level what my objectives are-
> For Rx handling:
> Demultiplex the packets received on the physical/bond interface based
> on the packet's src + dst combination and direct it to the process
> (Pn) handling that src + dst packets.
>     a) One way of doing this is to pick all packets in userspace in a
> central process (Pc) using AF_XDP socket (ZC with phy device and
> XDP_DRV with bond) and then Pc passes it using shared memory to the
> correct process (Pn) for further handling.
> ens1f0/bond (AF_XDP) -> Pc -> Pn
>     b) The other way is to run a xdp code attached to the phy/bond
> device which based on the src + dst redirects the packets to the veth
> pair (one per process Pn). The packet is then forwarded to the other
> end of the veth-pair over which there is an AF_XDP socket opened.The
> advantage here is that the packet demultiplex happens in the kernel
> and there is no Pc process needed.
> ens1f0/bond (XDP_REDIRECT_IF) ->vethext -> vethint ( AF_XDP) -> Pn

Adding in Jesper, Lorenzo and Maryam, as we've had various discussions
around improving AF_XDP support in containers, which seems to have some
overlap with your use case. Basically, what we have been discussing is
that your (b) approach has many desirable properties, also from a
container management PoV, and we believe it is possible to make it
perform reasonably well on both RX and TX.

It's most likely never going to be completely zero-copy because of the
veth traversal, but we should be able to get it down to a single copy at
least.

However, there is some work to be done before we can realise this
potential; but having more people interested in the use case may help
here :)

> Regarding netkit, I don't see much documentation or samples available
> except the selftest available in the kernel code. If you have or know
> of some samples that might fit in the above requirements that will
> surely help. Does it fit in the above requirement?

Netkit does not support XDP at all, and I doubt it ever will. Rather, it
is meant for optimising the use of BPF in the kernel stack (skb) path,
so it doesn't sound like it's a good fit for your use case if you want
to go directly from XDP to userspace.

-Toke


  reply	other threads:[~2024-01-19 13:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 10:45 Redirect to AF_XDP socket not working with bond interface in native mode Prashant Batra
2023-12-19 10:58 ` Prashant Batra
2023-12-19 13:47 ` Magnus Karlsson
2023-12-19 20:18   ` Prashant Batra
2023-12-20  8:24     ` Magnus Karlsson
2023-12-21 12:39       ` Prashant Batra
2023-12-21 13:45         ` Magnus Karlsson
2023-12-22 11:23           ` Prashant Batra
2024-01-02  9:57             ` Magnus Karlsson
2024-01-11 10:41               ` Prashant Batra
2024-01-15  9:22                 ` Magnus Karlsson
2024-01-16 12:48                   ` Prashant Batra
2024-01-16 12:59                     ` Magnus Karlsson
2024-01-17  6:07                       ` Prashant Batra
2024-01-17  7:41                         ` Magnus Karlsson
2024-01-19 12:43                           ` Prashant Batra
2024-01-19 13:04                             ` Toke Høiland-Jørgensen [this message]
     [not found]                               ` <CAD0p+fUM5DcG44cxYXU3fMd9PgTjhTaMCH_oy=4iejJ41zxHpA@mail.gmail.com>
2024-03-18 18:41                                 ` Christian Deacon
2024-03-19  7:52                                   ` Magnus Karlsson
2024-03-19 11:57                                     ` Toke Høiland-Jørgensen
2024-03-19 12:29                                       ` Magnus Karlsson

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=87zfx14gqg.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=hawk@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@gmail.com \
    --cc=mtahhan@redhat.com \
    --cc=prbatra.mail@gmail.com \
    --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.