xdp-project / xdp-tutorial

XDP tutorial
2.33k stars 562 forks source link

SHARED_UMEM creation #427

Open jaydizz opened 3 weeks ago

jaydizz commented 3 weeks ago

Hi all, currently I am writing a pure golang library for using AF_XDP sockets. Little heads up: I do not want or need any support in my go code :) I rather have a question regarding the creation of multiple sockets sharing UMEM. I have been reading the source-code of the tutorials here as well as the source of libxdp and I am none the wiser. If I understand correctly, to create multiple XSKs with a single shared UMEM you would go along the lines of this: For the first socket:

  1. Create the first socket.
  2. MMAP Umem, FR/CR RX/TX-Rings.
  3. Register them.
  4. Bind to the socket.

For all further sockets:

  1. Create the socket.
  2. MMAP RX/TX-Ring.
  3. Register RX/TX.
  4. Register shared UMEM from first socket, as well as FR/CR
  5. Bind with flags |= XDP_SHARED_UMEM and set the shared_umem_fd to the fd of the first socket.

If I do that, the bind-syscall returns "EINVAL" and after countless hours of debugging I am out of options of what values are considered invalid. Right now I am questioning if I am understanding this procedure correctly of if I am missing something. Maybe someone here can help me.

Much appreciated!