XDP-Newbies Archive mirror
 help / color / mirror / Atom feed
From: Bastien Dhiver <bastn@pm.me>
To: "xdp-newbies@vger.kernel.org" <xdp-newbies@vger.kernel.org>
Subject: Shared UMEM with interfaces in different network namespaces
Date: Tue, 07 Dec 2021 17:28:09 +0000	[thread overview]
Message-ID: <7TYahw4vLEn_ahN4sB_sKjFiELK94NO6CBlyVLuVEZ6Rh_phtSSluM-6JamEldEprn1vkaPltRNhuxP9H9AsE905JuXTRHgPadDJqHifY0o=@pm.me> (raw)

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

                 reply	other threads:[~2021-12-07 17:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='7TYahw4vLEn_ahN4sB_sKjFiELK94NO6CBlyVLuVEZ6Rh_phtSSluM-6JamEldEprn1vkaPltRNhuxP9H9AsE905JuXTRHgPadDJqHifY0o=@pm.me' \
    --to=bastn@pm.me \
    --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 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 read-only IMAP folder(s) and NNTP newsgroup(s).