I want to implement XDP_SHARED_UMEM: https://www.kernel.org/doc/html/latest/networking/af_xdp.html#xdp-shared-umem-bind-flag
The libbpf
library function xsk_socket__create
(https://github.com/libbpf/libbpf/blob/master/src/xsk.c) checks the xsk_umem->refcount
value. In case it is greater than 1, the XDP_SHARED_UMEM
option of a struct sockaddr_xdp
is set.
So as far as I understand correctly, I "just" need to pass the original umem struct of the socket I want to share the umem with and the rest is done by libbpf
.
The way I tried to do it was to let the first process copy its umem
-struct into a shared-memory area where the second process could load it from. But because struct xsk_umem
is defined in xsk.c
it is hidden from the user and I am not able to do something like this:
memcpy(shdm_ptr, umem, sizeof(struct xsk_umem))
I don't know how they expect someone to use the shared umem feature?