patch 'net/af_xdp: fix default device plugin path' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue Oct 27 12:48:30 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/29/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/ab3925c64aa835e02278f16c77581145137a7cd7

Thanks.

Luca Boccassi

---
>From ab3925c64aa835e02278f16c77581145137a7cd7 Mon Sep 17 00:00:00 2001
From: Anurag Mandal <anurag.mandal at intel.com>
Date: Wed, 12 Aug 2026 01:47:42 +0000
Subject: [PATCH] net/af_xdp: fix default device plugin path

[ upstream commit d881d7623f358dda896b6ea8aea8d9d175ed88be ]

When use_cni=1 or use_pinned_map=1 is passed without an explicit
dp_path, the PMD builds the path to the AF_XDP device plugin
endpoint itself.
That default was hardcoded to /tmp/afxdp_dp/<if_name>/.

A unix domain socket and a pinned map are runtime state.
DPDK exposes a location for such state through
rte_eal_get_runtime_dir(), which is per user, per
file prefix, and created with mode 0700, unlike
the shared /tmp/afxdp_dp directory.

The location cannot simply be moved as it is a contract
duplicated in the AF_XDP Device Plugin for Kubernetes,
which creates the socket and mounts it into the pod at
the /tmp path the PMD expects.
Changing only the PMD would break every existing deployment.

This patch fixes the default so that the endpoint is looked
up below the EAL runtime directory first, and /tmp/afxdp_dp
is only used when nothing is found there.
Use of the fallback is logged at notice level.
Existing plugin deployments keep working unchanged, while
a deployment that places the endpoint in the runtime
directory no longer has to pass dp_path.
An explicit dp_path still overrides both.

The <if_name> component is kept in both layouts. It is what
keeps the endpoints of several interfaces distinct when more
than one UDS server is mounted in a single pod.

The runtime directory prefix makes the built path longer,
so reject a dp_path that does not fit the sun_path field
of struct sockaddr_un instead of letting strlcpy()
silently truncate it.

The interface name check is moved ahead of the path
construction, as the default path is now built from it.

Bugzilla ID: 1973
Fixes: 9c1323736cf9 ("net/af_xdp: fix multi-interface support for k8s")
Fixes: 8a324b1c6464 ("net/af_xdp: support AF_XDP device plugin pinned maps")

Signed-off-by: Anurag Mandal <anurag.mandal at intel.com>
---
 doc/guides/howto/af_xdp_dp.rst      | 31 ++++++++++--
 doc/guides/nics/af_xdp.rst          | 32 +++++++++++--
 drivers/net/af_xdp/rte_eth_af_xdp.c | 73 ++++++++++++++++++++++++++---
 3 files changed, 122 insertions(+), 14 deletions(-)

diff --git a/doc/guides/howto/af_xdp_dp.rst b/doc/guides/howto/af_xdp_dp.rst
index 9da68e0bfa2..5cbc005d225 100644
--- a/doc/guides/howto/af_xdp_dp.rst
+++ b/doc/guides/howto/af_xdp_dp.rst
@@ -68,7 +68,27 @@ arguments to explicitly tell the AF_XDP PMD where to find either:
 2. The pinned xskmap to use when creating AF_XDP sockets.
 
 If this argument is not passed alongside the ``use_cni`` or ``use_pinned_map`` arguments
-then the AF_XDP PMD configures it internally to the `AF_XDP Device Plugin for Kubernetes`_.
+then the AF_XDP PMD builds the path itself.
+It looks for ``afxdp_dp/<if_name>/afxdp.sock``
+(or ``afxdp_dp/<if_name>/xsks_map``) in the EAL runtime directory,
+the conventional location for runtime state such as sockets.
+When no such entry exists, the PMD falls back to the same file below ``/tmp/afxdp_dp``,
+the location used by the `AF_XDP Device Plugin for Kubernetes`_.
+
+.. note::
+
+   The ``/tmp/afxdp_dp`` fallback exists only for compatibility with
+   deployments of the `AF_XDP Device Plugin for Kubernetes`_
+   that mount the endpoint there.
+   New deployments should mount the endpoint
+   below the EAL runtime directory,
+   or point at it explicitly with ``dp_path``.
+   A pinned map lives on a bpffs mount,
+   so it has to be bind mounted into that directory;
+   it cannot be pinned into the runtime directory itself.
+   The ``<if_name>`` component of the path must be kept in either location:
+   it is what distinguishes the endpoints
+   when several interfaces are mounted in a single pod.
 
 .. note::
 
@@ -80,8 +100,9 @@ then the AF_XDP PMD configures it internally to the `AF_XDP Device Plugin for Ku
    DPDK AF_XDP PMD > v23.11 will work with latest version of the AF_XDP Device Plugin
    through a combination of the ``dp_path`` and/or the ``use_cni`` parameter.
    In these versions of the PMD if a user doesn't explicitly set the ``dp_path`` parameter
-   when using ``use_cni`` then that path is transparently configured in the AF_XDP PMD
-   to the default `AF_XDP Device Plugin for Kubernetes`_ mount point path.
+   when using ``use_cni`` then the PMD looks for the endpoint
+   below the EAL runtime directory first,
+   and falls back to the default `AF_XDP Device Plugin for Kubernetes`_ mount point path.
    The path can be overridden by explicitly setting the ``dp_path`` param.
 
 .. note::
@@ -339,4 +360,6 @@ Run dpdk-testpmd with the AF_XDP Device Plugin + CNI
 .. note::
 
    If the ``dp_path`` parameter isn't explicitly set with ``use_cni`` or ``use_pinned_map``
-   the AF_XDP PMD will set the parameter values to the `AF_XDP Device Plugin for Kubernetes`_ defaults.
+   the AF_XDP PMD looks for the endpoint below the EAL runtime directory first,
+   and only then below the ``/tmp/afxdp_dp`` location
+   used by the `AF_XDP Device Plugin for Kubernetes`_.
diff --git a/doc/guides/nics/af_xdp.rst b/doc/guides/nics/af_xdp.rst
index 8bd17f04aed..57dc3b69186 100644
--- a/doc/guides/nics/af_xdp.rst
+++ b/doc/guides/nics/af_xdp.rst
@@ -196,11 +196,12 @@ The EAL vdev argument ``dp_path`` is used alongside
 the ``use_cni`` or ``use_pinned_map`` arguments
 to explicitly tell the AF_XDP PMD where to find either:
 
-1. The UDS to interact with the AF_XDP Device Plugin. OR
-2. The pinned xskmap to use when creating AF_XDP sockets.
+#. The UDS to interact with the AF_XDP Device Plugin. OR
+#. The pinned xskmap to use when creating AF_XDP sockets.
 
-If this argument is not passed alongside the ``use_cni`` or ``use_pinned_map`` arguments then
-the AF_XDP PMD configures it internally to the `AF_XDP Device Plugin for Kubernetes`_.
+For ``use_cni`` the path becomes a Unix socket address,
+so it must fit the ``sun_path`` field of ``struct sockaddr_un``
+(108 bytes on Linux).
 
 .. _AF_XDP Device Plugin for Kubernetes: https://github.com/redhat-et/afxdp-plugins-for-kubernetes
 
@@ -212,6 +213,29 @@ the AF_XDP PMD configures it internally to the `AF_XDP Device Plugin for Kuberne
 
    --vdev=net_af_xdp0,use_pinned_map=1,dp_path="/tmp/afxdp_dp/<<interface name>>/xsks_map"
 
+When ``dp_path`` is not given, the PMD builds a default from the interface name
+and one of two base directories:
+
+#. ``afxdp_dp/<<interface name>>/`` in the EAL runtime directory
+   returned by ``rte_eal_get_runtime_dir()``, when an entry is found there.
+   That is ``/var/run/dpdk/rte`` for a process running as root
+   with the default ``--file-prefix``;
+   see :doc:`../prog_guide/multi_proc_support` for the other cases.
+#. ``/tmp/afxdp_dp/<<interface name>>/`` otherwise,
+   where the `AF_XDP Device Plugin for Kubernetes`_ mounts it.
+
+The file within that directory is ``afxdp.sock`` for ``use_cni``
+and ``xsks_map`` for ``use_pinned_map``.
+Use of the second location is only maintained for compatibility
+and therefore is logged at notice level.
+The interface name component keeps the endpoints distinct
+when several interfaces are mounted in a single pod.
+
+.. note::
+
+   A pinned map lives on a bpffs mount,
+   so bind mount it into the runtime directory to use the first location.
+
 Limitations
 -----------
 
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 3041d3cca39..cf3b70fbef6 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -83,7 +83,9 @@ RTE_LOG_REGISTER_DEFAULT(af_xdp_logtype, NOTICE);
 
 #define ETH_AF_XDP_MP_KEY "afxdp_mp_send_fds"
 
-#define DP_BASE_PATH			"/tmp/afxdp_dp"
+/* Directory holding the per interface device plugin endpoints. */
+#define DP_DIR_NAME			"afxdp_dp"
+#define DP_LEGACY_BASE_PATH		"/tmp/" DP_DIR_NAME
 #define DP_UDS_SOCK             "afxdp.sock"
 #define DP_XSK_MAP				"xsks_map"
 #define MAX_LONG_OPT_SZ			64
@@ -2380,6 +2382,47 @@ afxdp_mp_send_fds(const struct rte_mp_msg *request, const void *peer)
 	return 0;
 }
 
+/*
+ * Build the default device plugin path for an interface.
+ *
+ * Unix domain sockets and pinned maps are runtime state, so the EAL runtime
+ * directory is preferred: it is per user and per file prefix, and both of its
+ * levels are created with mode 0700. The AF_XDP Device Plugin for Kubernetes
+ * still creates and mounts these endpoints below DP_LEGACY_BASE_PATH, so that
+ * location is used when the runtime directory holds no usable entry.
+ *
+ * The interface name is always part of the path: it keeps the endpoints of
+ * several interfaces distinct when more than one is mounted in a single pod.
+ *
+ * "size" is the longest path the caller can use, which may be shorter than the
+ * destination buffer. A runtime directory candidate that does not fit is
+ * skipped rather than rejected, so the shorter legacy path stays reachable.
+ */
+static int
+get_dflt_dp_path(char *dp_path, size_t size, const char *if_name,
+		 const char *entry)
+{
+	int ret;
+
+	ret = snprintf(dp_path, size, "%s/%s/%s/%s", rte_eal_get_runtime_dir(),
+		       DP_DIR_NAME, if_name, entry);
+	if (ret >= 0 && (size_t)ret < size && access(dp_path, F_OK) == 0)
+		return 0;
+
+	ret = snprintf(dp_path, size, "%s/%s/%s", DP_LEGACY_BASE_PATH, if_name,
+		       entry);
+	if (ret < 0 || (size_t)ret >= size) {
+		AF_XDP_LOG_LINE(ERR, "Device plugin path for %s is too long", if_name);
+		return -ENAMETOOLONG;
+	}
+
+	AF_XDP_LOG_LINE(NOTICE,
+		"No usable '%s' entry for %s below '%s', falling back to '%s'",
+		entry, if_name, rte_eal_get_runtime_dir(), DP_LEGACY_BASE_PATH);
+
+	return 0;
+}
+
 static int
 rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 {
@@ -2442,6 +2485,11 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 		return -EINVAL;
 	}
 
+	if (strlen(if_name) == 0) {
+		AF_XDP_LOG_LINE(ERR, "Network interface must be specified");
+		return -EINVAL;
+	}
+
 	if (use_cni && use_pinned_map) {
 		AF_XDP_LOG_LINE(ERR, "When '%s' parameter is used, '%s' parameter is not valid",
 			ETH_AF_XDP_USE_CNI_ARG, ETH_AF_XDP_USE_PINNED_MAP_ARG);
@@ -2463,13 +2511,20 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 	}
 
 	if (use_cni && !strnlen(dp_path, PATH_MAX)) {
-		snprintf(dp_path, sizeof(dp_path), "%s/%s/%s", DP_BASE_PATH, if_name, DP_UDS_SOCK);
+		/* The UDS path is bounded by sun_path, not by PATH_MAX. */
+		ret = get_dflt_dp_path(dp_path,
+				RTE_SIZEOF_FIELD(struct sockaddr_un, sun_path),
+				if_name, DP_UDS_SOCK);
+		if (ret < 0)
+			return ret;
 		AF_XDP_LOG_LINE(INFO, "'%s' parameter not provided, setting value to '%s'",
 			ETH_AF_XDP_DP_PATH_ARG, dp_path);
 	}
 
 	if (use_pinned_map && !strnlen(dp_path, PATH_MAX)) {
-		snprintf(dp_path, sizeof(dp_path), "%s/%s/%s", DP_BASE_PATH, if_name, DP_XSK_MAP);
+		ret = get_dflt_dp_path(dp_path, sizeof(dp_path), if_name, DP_XSK_MAP);
+		if (ret < 0)
+			return ret;
 		AF_XDP_LOG_LINE(INFO, "'%s' parameter not provided, setting value to '%s'",
 			ETH_AF_XDP_DP_PATH_ARG, dp_path);
 	}
@@ -2481,9 +2536,15 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 		return -EINVAL;
 	}
 
-	if (strlen(if_name) == 0) {
-		AF_XDP_LOG_LINE(ERR, "Network interface must be specified");
-		return -EINVAL;
+	/*
+	 * The socket address is copied into sun_path which is much shorter than
+	 * PATH_MAX, reject an oversized path instead of silently truncating it.
+	 */
+	if (use_cni && strnlen(dp_path, PATH_MAX) >=
+		       RTE_SIZEOF_FIELD(struct sockaddr_un, sun_path)) {
+		AF_XDP_LOG_LINE(ERR, "'%s' value '%s' is too long for a unix socket address",
+				ETH_AF_XDP_DP_PATH_ARG, dp_path);
+		return -ENAMETOOLONG;
 	}
 
 	/* get numa node id from net sysfs */
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-10-27 11:43:54.389569590 +0000
+++ 0016-net-af_xdp-fix-default-device-plugin-path.patch	2026-10-27 11:43:53.506059201 +0000
@@ -1 +1 @@
-From d881d7623f358dda896b6ea8aea8d9d175ed88be Mon Sep 17 00:00:00 2001
+From ab3925c64aa835e02278f16c77581145137a7cd7 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d881d7623f358dda896b6ea8aea8d9d175ed88be ]
+
@@ -47 +48,0 @@
-Cc: stable at dpdk.org
@@ -51,5 +52,4 @@
- doc/guides/howto/af_xdp_dp.rst         | 31 +++++++++--
- doc/guides/nics/af_xdp.rst             | 32 +++++++++--
- doc/guides/rel_notes/release_26_11.rst |  6 +++
- drivers/net/af_xdp/rte_eth_af_xdp.c    | 73 +++++++++++++++++++++++---
- 4 files changed, 128 insertions(+), 14 deletions(-)
+ doc/guides/howto/af_xdp_dp.rst      | 31 ++++++++++--
+ doc/guides/nics/af_xdp.rst          | 32 +++++++++++--
+ drivers/net/af_xdp/rte_eth_af_xdp.c | 73 ++++++++++++++++++++++++++---
+ 3 files changed, 122 insertions(+), 14 deletions(-)
@@ -58 +58 @@
-index 8cab23975b..b6c3fb14a7 100644
+index 9da68e0bfa2..5cbc005d225 100644
@@ -102 +102 @@
-@@ -338,4 +359,6 @@ Run dpdk-testpmd with the AF_XDP Device Plugin + CNI
+@@ -339,4 +360,6 @@ Run dpdk-testpmd with the AF_XDP Device Plugin + CNI
@@ -111 +111 @@
-index c455b4c066..934e10dedd 100644
+index 8bd17f04aed..57dc3b69186 100644
@@ -161,17 +160,0 @@
-diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
-index 4b3e5d995c..089f8093f5 100644
---- a/doc/guides/rel_notes/release_26_11.rst
-+++ b/doc/guides/rel_notes/release_26_11.rst
-@@ -55,6 +55,12 @@ New Features
-      Also, make sure to start the actual text at the margin.
-      =======================================================
- 
-+* **Updated AF_XDP driver.**
-+
-+  * Changed the default device plugin endpoint path used when
-+    ``use_cni`` or ``use_pinned_map`` is set without ``dp_path``.
-+    See :doc:`../nics/af_xdp` for more details.
-+
- 
- Removed Items
- -------------
@@ -179 +162 @@
-index 2cdb533276..54bd095c92 100644
+index 3041d3cca39..cf3b70fbef6 100644
@@ -193 +176 @@
-@@ -2459,6 +2461,47 @@ afxdp_mp_send_fds(const struct rte_mp_msg *request, const void *peer)
+@@ -2380,6 +2382,47 @@ afxdp_mp_send_fds(const struct rte_mp_msg *request, const void *peer)
@@ -241 +224 @@
-@@ -2522,6 +2565,11 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
+@@ -2442,6 +2485,11 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
@@ -253 +236 @@
-@@ -2543,13 +2591,20 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
+@@ -2463,13 +2511,20 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
@@ -276 +259 @@
-@@ -2561,9 +2616,15 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
+@@ -2481,9 +2536,15 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)


More information about the stable mailing list