net/af_xdp: shared UMEM support
Subsystems (2)
v3 cover net/af_xdp: shared UMEM support
This patch integrates support for shared UMEMs into the AF_XDP PMD. The feature is currently available in the linux-next tree [1] and should be available in the v5.10 kernel.
Detailed information on the shared UMEM feature can be found in the kernel documentation.
Support for the kernel feature is detected in DPDK by querying the LINUX_KERNEL_VERSION and ensuring a kernel >= 5.10.0. Since this kernel is not yet released, if one wishes to test this patch now it is suggested to use the aforementioned linux-next tree and modify the version check to align with the version of that tree. Once the kernel is released (~December) this will no longer be necessary.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=acabf32805f7
Ciara Loftus (1):
net/af_xdp: shared UMEM support
doc/guides/nics/af_xdp.rst | 6 +- drivers/net/af_xdp/compat.h | 41 ++++ drivers/net/af_xdp/meson.build | 4 + drivers/net/af_xdp/rte_eth_af_xdp.c | 302 ++++++++++++++++++++++------ 4 files changed, 289 insertions(+), 64 deletions(-) create mode 100644 drivers/net/af_xdp/compat.h
Signature · 1 line
2.17.1
PATCH v3 1/1 net/af_xdp: shared UMEM support
Kernel v5.10 will introduce the ability to efficiently share a UMEM between AF_XDP sockets bound to different queue ids on the same or different devices. This patch integrates that functionality into the AF_XDP PMD.
A PMD will attempt to share a UMEM with others if the shared_umem=1 vdev arg is set. UMEMs can only be shared across PMDs with the same mempool, up to a limited number of PMDs goverened by the size of the given mempool. Sharing UMEMs is not supported for non-zero-copy (aligned) mode.
The benefit of sharing UMEM across PMDs is a saving in memory due to not having to register the UMEM multiple times. Throughput was measured to remain within 2% of the default mode (not sharing UMEM).
A version of libbpf >= v0.2.0 is required and the appropriate pkg-config file for libbpf must be installed such that meson can determine the version.
---
v3:
* Rebase
v2:
* added function to compat.h
* fixed copyright header
* init refcnt for non shared umem case
doc/guides/nics/af_xdp.rst | 6 +- drivers/net/af_xdp/compat.h | 41 ++++ drivers/net/af_xdp/meson.build | 4 + drivers/net/af_xdp/rte_eth_af_xdp.c | 302 ++++++++++++++++++++++------ 4 files changed, 289 insertions(+), 64 deletions(-) create mode 100644 drivers/net/af_xdp/compat.h
doc/guides/nics/af_xdp.rst +5 -1
@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright(c) 2019 Intel Corporation. + Copyright(c) 2019-2020 Intel Corporation. AF_XDP Poll Mode Driver ==========================
@@ -32,6 +32,8 @@ The following options can be provided to set up an af_xdp port in DPDK. * ``iface`` - name of the Kernel interface to attach to (required); * ``start_queue`` - starting netdev queue id (optional, default 0); * ``queue_count`` - total netdev queue number (optional, default 1); +* ``shared_umem`` - PMD will attempt to share UMEM with others (optional, + default 0); Prerequisites -------------
@@ -45,6 +47,8 @@ This is a Linux-specific PMD, thus the following prerequisites apply: * A Kernel bound interface to attach to; * For need_wakeup feature, it requires kernel version later than v5.3-rc1; * For PMD zero copy, it requires kernel version later than v5.4-rc1; +* For shared_umem, it requires kernel version v5.10 or later and libbpf version + v0.2.0 or later. Set up an af_xdp interface -----------------------------
drivers/net/af_xdp/compat.h new file +41 -0
41 lines not on this page · raw message
drivers/net/af_xdp/meson.build +4 -0
@@ -10,6 +10,10 @@ endif if bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('linux/if_xdp.h') ext_deps += bpf_dep + bpf_ver_dep = dependency('libbpf', version : '>=0.2.0', required: false) + if bpf_ver_dep.found() + dpdk_conf.set('RTE_LIBRTE_AF_XDP_PMD_SHARED_UMEM', 1) + endif else build = false reason = 'missing dependency, "libbpf"'
drivers/net/af_xdp/rte_eth_af_xdp.c +239 -63
584 lines not on this page · raw message
Signature · 1 line
2.17.1
Ferruh Yigit
AppliedQuoted 10 lines · Ciara Loftus
Kernel v5.10 will introduce the ability to efficiently share a UMEM between
AF_XDPsockets bound to different queue ids on the same or different devices. This patch integrates that functionality into theAF_XDPPMD.A PMD will attempt to share a UMEM with others if the shared_umem=1 vdev arg is set. UMEMs can only be shared across PMDs with the same mempool, up to a limited number of PMDs goverened by the size of the given mempool. Sharing UMEMs is not supported for non-zero-copy (aligned) mode.
Quoted 7 lines
The benefit of sharing UMEM across PMDs is a saving in memory due to not having to register the UMEM multiple times. Throughput was measured to remain within 2% of the default mode (not sharing UMEM).
A version of libbpf >= v0.2.0 is required and the appropriate pkg-config file for libbpf must be installed such that meson can determine the version.
Tested providing the devarg when kernel/library support is not there cause gracefully exit. Not able to test the functionality, relying Ciara on it.
Quoted 2 lines
Signed-off-by Ciara Loftus <[email protected]>
Applied to dpdk-next-net/main, thanks.