xdp-newbies.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Shared UMEM with interfaces in different network namespaces
@ 2021-12-07 17:28 Bastien Dhiver
  0 siblings, 0 replies; only message in thread
From: Bastien Dhiver @ 2021-12-07 17:28 UTC (permalink / raw)
  To: xdp-newbies

Hi,

I am using AF_XDP to forward packets between two Veth interfaces that are in two different network namespaces. The way I am currently doing this is by having one UMEM and one AF_XDP socket handled by a thread in each network namespace. When a packet arrives on the XSK RX ring in network namespace A, a pointer to the data frame (with the data length) is shared with thread B, which then copies it into a new descriptor in the XSK TX ring and submits it.

My goal is to reduce the memory consumption and improve performance by having a single UMEM shared between both Veth interfaces in order to forward packets without copying them from one interface to the other.

The first idea that I had was to create the UMEM in the root namespace and then to create the XSK in the threads with the same UMEM pointer. No errors arise from wiring it this way, but peeking on the RXQ always returns 0.

Here is a code snippet to illustrate the previous paragraph: https://gist.github.com/Dhiver/b821006c0166834a871fb00d50274770. Descriptors are only received when the UMEM is also created in "test-ns" network namespace.

What am I doing wrong? Is it even possible?

Best regards,
Bastien

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-07 17:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 17:28 Shared UMEM with interfaces in different network namespaces Bastien Dhiver

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).