Skip to content

Commit 2f6324a

Browse files
magnus-karlssonborkmann
authored andcommitted
libbpf: Support shared umems between queues and devices
Add support for shared umems between hardware queues and devices to the AF_XDP part of libbpf. This so that zero-copy can be achieved in applications that want to send and receive packets between HW queues on one device or between different devices/netdevs. In order to create sockets that share a umem between hardware queues and devices, a new function has been added called xsk_socket__create_shared(). It takes the same arguments as xsk_socket_create() plus references to a fill ring and a completion ring. So for every socket that share a umem, you need to have one more set of fill and completion rings. This in order to maintain the single-producer single-consumer semantics of the rings. You can create all the sockets via the new xsk_socket__create_shared() call, or create the first one with xsk_socket__create() and the rest with xsk_socket__create_shared(). Both methods work. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Björn Töpel <bjorn.topel@intel.com> Link: https://lore.kernel.org/bpf/1598603189-32145-14-git-send-email-magnus.karlsson@intel.com
1 parent a113243 commit 2f6324a

File tree

3 files changed

+254
-132
lines changed

3 files changed

+254
-132
lines changed

tools/lib/bpf/libbpf.map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,4 +306,5 @@ LIBBPF_0.2.0 {
306306
perf_buffer__buffer_fd;
307307
perf_buffer__epoll_fd;
308308
perf_buffer__consume_buffer;
309+
xsk_socket__create_shared;
309310
} LIBBPF_0.1.0;

0 commit comments

Comments
 (0)