DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/6] crypto/uadk: use timing-safe digest comparison
From: Stephen Hemminger @ 2026-06-29 18:59 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, stable, Siraj Luthfi Ananda, Zongyu Wu,
	Zhangfei Gao
In-Reply-To: <20260629190027.2071745-1-stephen@networkplumber.org>

Digest verification used memcmp() to compare the computed and
expected MAC. memcmp() returns as soon as the first differing byte
is found, so its run time depends on how many leading bytes match.
An attacker submitting forged digests can use that timing signal to
recover the correct value one byte at a time.

Use rte_memeq_timingsafe(), whose run time depends only on the
length, for the verify comparison.

Bugzilla ID: 1773
Fixes: aba5b230ca04 ("crypto/uadk: use async mode")
Cc: stable@dpdk.org

Reported-by: Siraj Luthfi Ananda <sirajluthfi@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/crypto/uadk/uadk_crypto_pmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/uadk/uadk_crypto_pmd.c b/drivers/crypto/uadk/uadk_crypto_pmd.c
index 3c4e83e56f..221ad546da 100644
--- a/drivers/crypto/uadk/uadk_crypto_pmd.c
+++ b/drivers/crypto/uadk/uadk_crypto_pmd.c
@@ -1111,8 +1111,8 @@ uadk_crypto_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 		if (sess->auth.operation == RTE_CRYPTO_AUTH_OP_VERIFY) {
 			uint8_t *dst = qp->temp_digest[i % BURST_MAX];
 
-			if (memcmp(dst, op->sym->auth.digest.data,
-				   sess->auth.digest_length) != 0)
+			if (!rte_memeq_timingsafe(dst, op->sym->auth.digest.data,
+						  sess->auth.digest_length))
 				op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
 		}
 
-- 
2.53.0


^ permalink raw reply related

* [PATCH v2 1/6] eal: take experimental flag off of rte_memeq_timingsafe
From: Stephen Hemminger @ 2026-06-29 18:59 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Anatoly Burakov
In-Reply-To: <20260629190027.2071745-1-stephen@networkplumber.org>

This function is needed in other places, and don't want to
have to propagate allow_experimental_api into those drivers.
It is stable enough and inline so no ABI exposure.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 doc/guides/rel_notes/release_26_07.rst | 4 ++++
 lib/eal/include/rte_memory.h           | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/guides/rel_notes/release_26_07.rst b/doc/guides/rel_notes/release_26_07.rst
index 4ca0a9ac77..ec227fd90d 100644
--- a/doc/guides/rel_notes/release_26_07.rst
+++ b/doc/guides/rel_notes/release_26_07.rst
@@ -241,6 +241,10 @@ API Changes
   - ``rte_pmd_mlx5_enable_steering``
   - ``rte_pmd_mlx5_disable_steering``
 
+* **eal: promoted timing-safe memory comparison from experimental to stable.**
+
+  The inline function ``rte_memeq_timingsafe()`` is no longer marked experimental.
+
 
 ABI Changes
 -----------
diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h
index b6e97ad695..940770f1eb 100644
--- a/lib/eal/include/rte_memory.h
+++ b/lib/eal/include/rte_memory.h
@@ -747,9 +747,6 @@ void
 rte_memzero_explicit(void *dst, size_t sz);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Timing-safe memory equality comparison.
  *
  * This function compares two memory regions in constant time,
@@ -770,7 +767,6 @@ rte_memzero_explicit(void *dst, size_t sz);
  * @return
  *   true if the memory regions are identical, false if they differ.
  */
-__rte_experimental
 static inline bool
 rte_memeq_timingsafe(const void *a, const void *b, size_t n)
 {
-- 
2.53.0


^ permalink raw reply related

* Re: [PATCH] net/af_xdp: add Rx metadata and dynamic timestamping support
From: Stephen Hemminger @ 2026-06-29 17:38 UTC (permalink / raw)
  To: Mark Blasko
  Cc: dev, Ciara Loftus, Maryam Tahhan, Joshua Washington,
	Jasper Tran O'Leary
In-Reply-To: <CANULgnK9-P5dQtTPayiFD7PLor=1qV=7du-AtRuWGPd4F5SmAQ@mail.gmail.com>

On Sun, 28 Jun 2026 17:50:03 -0700
Mark Blasko <blasko@google.com> wrote:

> In AF_PACKET, the PMD reads the timestamp from socket ring headers
> because the kernel stack processes the packet and allocates a socket
> buffer. Since the kernel stack and socket buffer allocation are bypassed
> in AF_XDP, UMEM frames are given directly to the PMD, which
> means the kernel never generates these socket headers. Also, it
> looks like the TAP PMD doesn't support RX timestamps.
> 
> Since the location of metadata in the UMEM headroom is determined
> by the XDP program, the current driver implementation is coupled to
> a specific XDP program layout. As an alternative, we could just
> plumb the entire metadata headroom to the DPDK application and let
> the application parse it based on whatever XDP program is in use.
> That would couple the application and the XDP program, but would
> at least decouple the driver and the XDP program.


Sorry if I was not clear enough before.
The DPDK PMD provides an abstraction to applications to avoid exposing
as many details as possible. Whenever possible a PMD should follow
precedent and implement functions in a manner similar to other drivers.

The method of expressing received timestamps was never well described
in DPDK documentation. The convention is:
  - A dynamic field in mbuf is used for the timestamp.
  - All drivers using timestamp should register the same field
    using rte_mbuf_dyn_rx_timestamp_register.
  - The mbuf field is filled inside the rx_burst processing.
  - The timestamp dynamic field is a 64 bit unsigned number rolling
    clock value.
  - A PMD providing timestamp, must also define a readclock ethdev dev ops
    so that application can compute the number of ticks in timestamp per
    time interval.
  - A PMD providing timestamp must advertise that in offload flags.
  - Timestamp should only be inserted if the Rx timestamp offload flag
    is set during configuration.

When I read this was a little confused about meta data in mbuf.
Would have been clearer with a simple helper:

static inline void
af_xdp_rx_timestamp(struct rte_mbuf *m)
{
	const struct af_xdp_rx_metadata *meta
		= rte_pktmbuf_mtod_offset(m, struct af_xdp_rx_metadata, -(int)sizeof(*meta));

	*RTE_MBUF_DYNFIELD(m, timestamp_dynfield_offset, uint64_t *) = meta->rx_timestamp;
	m->ol_flags |= timestamp_dynflag;
}

If you are going to do Rx timestamp then a simple readclock ethdev op
is also needed to tell the application what the units are.

But there are bigger issues with this patch:
1. The patch assumes metadata is always present in XDP receive but device
used by XDP may not implement it. There is no capability checking.
The DPDK PMD ends up advertising RTE_ETH_RX_OFFLOAD_TIMESTAMP
unconditionally even if underling kernel device doesn't do it.

2. The format of metadata is not a documented contract between kernel
device implementing XDP and the DPDK.

3. The XDP documentation says you need to check for metadata
in each frame.

4. There are no head bounds checks; must check that there is
packet headroom is configured with enough space for metadata.

I am sure AI will find several more things but need fixing
before ready to merge.


^ permalink raw reply

* Re: [PATCH v6 1/1] pcapng: add user-supplied timestamp support
From: Stephen Hemminger @ 2026-06-29 16:50 UTC (permalink / raw)
  To: Dawid Wesierski; +Cc: dev, marek.kasiewicz, thomas, mb
In-Reply-To: <20260629093942.983145-1-dawid.wesierski@intel.com>

On Mon, 29 Jun 2026 05:37:33 -0400
Dawid Wesierski <dawid.wesierski@intel.com> wrote:

> Add a timestamp parameter to rte_pcapng_copy() so that callers with a
> hardware PTP or pre-captured timestamp can inject an exact epoch-ns value
> directly into the packet record.
> 
> Timestamp handling:
>  - ts != 0: caller-supplied nanoseconds since the Unix epoch, stored as-is.
>  - ts == 0: TSC captured at copy time with bit 63 set as a sentinel.
>    rte_pcapng_write_packets() detects the sentinel and converts the TSC to
>    epoch ns using the file's calibrated clock.  The TSC will not reach
>    bit 63 for centuries, and epoch-ns values stay below bit 63 until 2554,
>    so the bit is safe to use as a disambiguation flag.
> 
> Adding the parameter changes the ABI, so rte_pcapng_copy() is versioned.
> 
> rte_pcapng_tsc_to_ns() is added as a new experimental helper.  It exposes the
> same calibrated, drift-compensated, divide-free TSC-to-epoch-ns conversion
> used internally by rte_pcapng_write_packets(), allows callers to convert
> a TSC captured at packet arrival time before passing it to rte_pcapng_copy().
> 
> Signed-off-by: Marek Kasiewicz <marek.kasiewicz@intel.com>
> Signed-off-by: Dawid Wesierski <dawid.wesierski@intel.com>
> ---

Looks good, I would like to make some follow on patches to replace
the tsc_to_ns routines with something in EAL since it is generally useful
to get time in nanoseconds.

^ permalink raw reply

* Re: [PATCH 1/2] net/e1000: fix igc RSS redirection table
From: Bruce Richardson @ 2026-06-29 15:50 UTC (permalink / raw)
  To: Shuzo Ichiyoshi; +Cc: dev, stable
In-Reply-To: <akKNdk8s7O17S9m1@bricha3-mobl1.ger.corp.intel.com>

On Mon, Jun 29, 2026 at 04:21:26PM +0100, Bruce Richardson wrote:
> On Mon, Jun 29, 2026 at 01:51:13PM +0900, Shuzo Ichiyoshi wrote:
> > The IGC RETA register stores four 8-bit queue indexes.
> > igc_rss_configure() and igc_add_rss_filter() used a fresh
> > uninitialized union for each table entry and wrote the register only
> > every fourth entry. As a result, three bytes of each RETA register
> > came from stack garbage.
> > 
> > Build the register a word at a time and initialize all four queue
> > indexes before writing it.
> > 
> > Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
> > Fixes: 746664d546fb ("net/igc: support flow API")
> > Cc: stable@dpdk.org
> > Signed-off-by: Shuzo Ichiyoshi <deadcafe.beef@gmail.com>
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 
Series applied to dpdk-next-net-intel.
Thanks,
/Bruce

^ permalink raw reply

* Re: [PATCH 2/2] net/e1000: fix igc Tx descriptor ring wrap
From: Bruce Richardson @ 2026-06-29 15:27 UTC (permalink / raw)
  To: Song, Yoong Siang
  Cc: Shuzo Ichiyoshi, Zage, David, dev@dpdk.org, stable@dpdk.org
In-Reply-To: <IA3PR11MB92549B10D6A67B13D8AE092FD8E82@IA3PR11MB9254.namprd11.prod.outlook.com>

On Mon, Jun 29, 2026 at 06:59:37AM +0100, Song, Yoong Siang wrote:
> On Monday, June 29, 2026 12:51 PM, Shuzo Ichiyoshi <deadcafe.beef@gmail.com> wrote:
> >igc_xmit_pkts() reserves two extra descriptors for launch time.
> >It indexed sw_ring[tx_last + 2] without wrapping the descriptor
> >index first.
> >
> >If tx_last is one of the last two descriptors in the ring, this
> >reads past the software ring. Wrap the index before looking up
> >last_id.
> >
> >Fixes: 2e79349dcd07 ("net/e1000: fix igc launch time calculation")
> >Cc: stable@dpdk.org
> >Signed-off-by: Shuzo Ichiyoshi <deadcafe.beef@gmail.com>
> 
> Reviewed-by: Song Yoong Siang <yoong.siang.song@intel.com>
> 
> Thanks for the fix.
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply

* Re: [PATCH 1/2] net/e1000: fix igc RSS redirection table
From: Bruce Richardson @ 2026-06-29 15:21 UTC (permalink / raw)
  To: Shuzo Ichiyoshi; +Cc: dev, stable
In-Reply-To: <20260629045511.473850-1-deadcafe.beef@gmail.com>

On Mon, Jun 29, 2026 at 01:51:13PM +0900, Shuzo Ichiyoshi wrote:
> The IGC RETA register stores four 8-bit queue indexes.
> igc_rss_configure() and igc_add_rss_filter() used a fresh
> uninitialized union for each table entry and wrote the register only
> every fourth entry. As a result, three bytes of each RETA register
> came from stack garbage.
> 
> Build the register a word at a time and initialize all four queue
> indexes before writing it.
> 
> Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
> Fixes: 746664d546fb ("net/igc: support flow API")
> Cc: stable@dpdk.org
> Signed-off-by: Shuzo Ichiyoshi <deadcafe.beef@gmail.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>


^ permalink raw reply

* Tested the v3 series on Intel E810-C (Columbiaville) hardware.
From: Dawid Wesierski @ 2026-06-29 15:33 UTC (permalink / raw)
  To: dev; +Cc: dawid.wesierski, marek.kasiewicz, stephen, bruce.richardson
In-Reply-To: <20260618144442.312844-8-dawid.wesierski@intel.com>

app/testpmd: The 'create pinned-rxpool' command successfully creates 
   pinned external-buffer mempools for buffer-split segments.
 net/ice: The 'rl_burst_size' devarg correctly configures the scheduler 
   burst size, verified via debug traces.
net/iavf: The 'no_runtime_queue_setup' devarg successfully disables
   the advertisement of runtime queue setup capabilities.
net/iavf: Verified max ring descriptors increased to 8160.

Tested-by: Dawid Wesierski <dawid.wesierski@intel.com>
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.


^ permalink raw reply

* Re: [EXTERNAL] [v3] crypto/qat: require IPsec MB for HMAC precomputes
From: Thomas Monjalon @ 2026-06-29 14:36 UTC (permalink / raw)
  To: gakhil@marvell.com, Emma Finn, Kai Ji; +Cc: dev@dpdk.org
In-Reply-To: <CO6PR18MB4484479022C9D2E2AEF13363D8ED2@CO6PR18MB4484.namprd18.prod.outlook.com>

>> IPsec MB library (v1.4.0+) is now required for HMAC precomputes as
>> OpenSSL 3.0 removed SHA*_Transform APIs. OpenSSL remains optional
>> for DOCSIS BPI cipher fallback via EVP API.
>> 
>> On x86: IPsec MB required, OpenSSL optional (DOCSIS fallback)
>> On ARM: IPsec MB required, OpenSSL required (DOCSIS support)
>> 
>> Signed-off-by: Emma Finn <emma.finn@intel.com>
>> ---
>> v2:
>> * Fix resource leak in ossl_legacy_provider_load()
>> * Added release note
>> v3:
>> * Removed checks for openssl <= 3.0
>> ---
> Applied to dpdk-next-crypto

It does not compile on Arm:
drivers/crypto/qat/qat_sym_session.h:156:9: error: unknown type name 'IMB_MGR'

^ permalink raw reply

* [PATCH v3] build: drop dependency on libbsd
From: Bruce Richardson @ 2026-06-29 14:29 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, Bruce Richardson
In-Reply-To: <20260624113550.821516-1-bruce.richardson@intel.com>

Glibc added the strlcpy and strlcat functions to version 2.38, released
in 2023, meaning they are natively available in modern linux distros. At
this point, the value of having the libbsd provided versions of these
functions is reduced, so let's simplify the code options here by
providing just two options for strlcpy rather than three:

1. native implementation for BSD and recent Linux
2. DPDK-specific fallbacks using snprintf

Since the strlcpy and strlcat functions are the only two items used from
libbsd, we can then drop completely any DPDK dependency on libbsd.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
v3:
* removed additional references to libbsd in scripts and docs
* corrected detection of strlcpy by adding _GNU_SOURCE to detection
  check, which matches DPDK build.
* added extra macro check in fallback header, to handle case where
  strlcpy is available for DPDK build, but not for app builds, e.g.
  where strict c11 compliance is required.

v2:
* Took the work further than v1, dropping libbsd dependency entirely.
  Now DPDK just supports native strlcpy or it's own fallback version.
---
 .github/workflows/build.yml       |  2 --
 app/test/test_string_fns.c        |  4 ++--
 buildtools/pkg-config/meson.build |  3 +--
 config/meson.build                |  7 +++----
 devtools/process-iwyu.py          | 10 +++++-----
 doc/guides/howto/af_xdp_dp.rst    |  1 -
 lib/eal/include/rte_string_fns.h  | 22 ++++++----------------
 lib/eal/meson.build               |  4 +---
 lib/telemetry/telemetry.c         |  2 --
 lib/telemetry/telemetry_data.c    |  1 -
 lib/telemetry/telemetry_legacy.c  |  2 --
 11 files changed, 18 insertions(+), 40 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f0ef39d34f..a2a88ecb10 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -58,7 +58,6 @@ jobs:
       build_deps: |
         ccache \
         libarchive-dev \
-        libbsd-dev \
         libbpf-dev \
         libfdt-dev \
         libibverbs-dev \
@@ -254,7 +253,6 @@ jobs:
         jansson-devel \
         libarchive-devel \
         libatomic \
-        libbsd-devel \
         libbpf-devel \
         libfdt-devel \
         libpcap-devel \
diff --git a/app/test/test_string_fns.c b/app/test/test_string_fns.c
index 697cb7ed15..213a9312ea 100644
--- a/app/test/test_string_fns.c
+++ b/app/test/test_string_fns.c
@@ -134,7 +134,7 @@ static int
 test_rte_strlcat(void)
 {
 	/* only run actual unit tests if we have system-provided strlcat */
-#if defined(__BSD_VISIBLE) || defined(RTE_USE_LIBBSD)
+#ifdef RTE_HAS_STRLCPY
 #define BUF_LEN 32
 	const char dst[BUF_LEN] = "Test string";
 	const char src[] = " appended";
@@ -168,7 +168,7 @@ test_rte_strlcat(void)
 	}
 	LOG("Checked %zu combinations\n", i);
 #undef BUF_LEN
-#endif /* defined(__BSD_VISIBLE) || defined(RTE_USE_LIBBSD) */
+#endif /* RTE_HAS_STRLCPY */
 
 	return 0;
 }
diff --git a/buildtools/pkg-config/meson.build b/buildtools/pkg-config/meson.build
index b36add17e3..a0a265ad92 100644
--- a/buildtools/pkg-config/meson.build
+++ b/buildtools/pkg-config/meson.build
@@ -47,8 +47,7 @@ pkg.generate(name: 'DPDK', # main DPDK pkgconfig file
         description: '''The Data Plane Development Kit (DPDK).
 Note that CFLAGS might contain an -march flag higher than typical baseline.
 This is required for a number of static inline functions in the public headers.''',
-        requires: ['libdpdk-libs', libbsd], # may need libbsd for string funcs
-                      # if libbsd is not enabled, then this is blank
+        requires: ['libdpdk-libs'],
         libraries_private: ['-Wl,--whole-archive'] +
             dpdk_drivers + dpdk_static_libraries +
             ['-Wl,--no-whole-archive'] + platform_flags
diff --git a/config/meson.build b/config/meson.build
index d7f5e55c18..344f68822b 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -266,10 +266,9 @@ if libarchive.found()
     dpdk_conf.set('RTE_HAS_LIBARCHIVE', 1)
 endif
 
-# check for libbsd
-libbsd = dependency('libbsd', required: false, method: 'pkg-config')
-if libbsd.found()
-    dpdk_conf.set('RTE_USE_LIBBSD', 1)
+# check for strlcpy/strlcat in native libc, otherwise use DPDK fallback
+if cc.has_function('strlcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
+    dpdk_conf.set('RTE_HAS_STRLCPY', 1)
 endif
 
 jansson_dep = dependency('jansson', required: false, method: 'pkg-config')
diff --git a/devtools/process-iwyu.py b/devtools/process-iwyu.py
index 08a63b962b..0f9fc5837d 100755
--- a/devtools/process-iwyu.py
+++ b/devtools/process-iwyu.py
@@ -60,9 +60,9 @@ def get_build_config(builddir, condition):
         return [ln for ln in f.readlines() if condition(ln)]
 
 
-def uses_libbsd(builddir):
-    "return whether the build uses libbsd or not"
-    return bool(get_build_config(builddir, lambda ln: 'RTE_USE_LIBBSD' in ln))
+def uses_native_strlcpy(builddir):
+    "return whether the build uses fallback strlcpy or libc native one"
+    return bool(get_build_config(builddir, lambda ln: 'RTE_HAS_STRLCPY' in ln))
 
 
 def process(args):
@@ -74,9 +74,9 @@ def process(args):
     print("Warning: The results of this script may include false positives which are required for different systems",
           file=sys.stderr)
 
-    keep_str_fns = uses_libbsd(build_dir)  # check for libbsd
+    keep_str_fns = uses_native_strlcpy(build_dir)  # check for strlcpy fallback in use
     if keep_str_fns:
-        print("Warning: libbsd is present, build will fail to detect incorrect removal of rte_string_fns.h",
+        print("Warning: strlcpy is present, build will fail to detect incorrect removal of rte_string_fns.h",
               file=sys.stderr)
     # turn on werror
     run_meson(['configure', build_dir, '-Dwerror=true'])
diff --git a/doc/guides/howto/af_xdp_dp.rst b/doc/guides/howto/af_xdp_dp.rst
index b3681af2f7..e565b9b08d 100644
--- a/doc/guides/howto/af_xdp_dp.rst
+++ b/doc/guides/howto/af_xdp_dp.rst
@@ -147,7 +147,6 @@ Build a DPDK container image (using Docker)
 
       # Setup container to build DPDK applications
       RUN dnf -y upgrade && dnf -y install \
-          libbsd-devel \
           numactl-libs \
           libbpf-devel \
           libbpf \
diff --git a/lib/eal/include/rte_string_fns.h b/lib/eal/include/rte_string_fns.h
index 3713c94acb..b3b5bdf275 100644
--- a/lib/eal/include/rte_string_fns.h
+++ b/lib/eal/include/rte_string_fns.h
@@ -55,7 +55,7 @@ rte_strsplit(char *string, int stringlen,
 /**
  * @internal
  * DPDK-specific version of strlcpy for systems without
- * libc or libbsd copies of the function
+ * a native libc copy of the function
  */
 static inline size_t
 rte_strlcpy(char *dst, const char *src, size_t size)
@@ -66,7 +66,7 @@ rte_strlcpy(char *dst, const char *src, size_t size)
 /**
  * @internal
  * DPDK-specific version of strlcat for systems without
- * libc or libbsd copies of the function
+ * a native libc copy of the function
  */
 static inline size_t
 rte_strlcat(char *dst, const char *src, size_t size)
@@ -81,24 +81,14 @@ rte_strlcat(char *dst, const char *src, size_t size)
 }
 #endif
 
-/* pull in a strlcpy function */
-#ifdef RTE_EXEC_ENV_FREEBSD
-#ifndef __BSD_VISIBLE /* non-standard functions are hidden */
+/* provide strlcpy/strlcat aliases where not natively available */
+#if !defined(RTE_HAS_STRLCPY) || \
+	(defined(RTE_EXEC_ENV_FREEBSD) && !defined(__BSD_VISIBLE)) || \
+	(defined(__GLIBC__) && !defined(__USE_MISC))
 #define strlcpy(dst, src, size) rte_strlcpy(dst, src, size)
 #define strlcat(dst, src, size) rte_strlcat(dst, src, size)
 #endif
 
-#else /* non-BSD platforms */
-#ifdef RTE_USE_LIBBSD
-#include <bsd/string.h>
-
-#else /* no BSD header files, create own */
-#define strlcpy(dst, src, size) rte_strlcpy(dst, src, size)
-#define strlcat(dst, src, size) rte_strlcat(dst, src, size)
-
-#endif /* RTE_USE_LIBBSD */
-#endif /* FREEBSD */
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/eal/meson.build b/lib/eal/meson.build
index f9fcee24ee..092f5c5261 100644
--- a/lib/eal/meson.build
+++ b/lib/eal/meson.build
@@ -18,9 +18,7 @@ deps += ['argparse', 'kvargs']
 if not is_windows
     deps += ['telemetry']
 endif
-if dpdk_conf.has('RTE_USE_LIBBSD')
-    ext_deps += libbsd
-endif
+
 if dpdk_conf.has('RTE_HAS_LIBARCHIVE')
     ext_deps += libarchive
 endif
diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index e591c1e283..f863445798 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -13,8 +13,6 @@
 #include <sys/stat.h>
 #endif /* !RTE_EXEC_ENV_WINDOWS */
 
-/* we won't link against libbsd, so just always use DPDKs-specific strlcpy */
-#undef RTE_USE_LIBBSD
 #include <eal_export.h>
 #include <rte_string_fns.h>
 #include <rte_common.h>
diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c
index 0a006559ab..08bdc4ea36 100644
--- a/lib/telemetry/telemetry_data.c
+++ b/lib/telemetry/telemetry_data.c
@@ -7,7 +7,6 @@
 #include <stdlib.h>
 #include <inttypes.h>
 
-#undef RTE_USE_LIBBSD
 #include <stdbool.h>
 
 #include <eal_export.h>
diff --git a/lib/telemetry/telemetry_legacy.c b/lib/telemetry/telemetry_legacy.c
index 1d73282ba8..af497a594a 100644
--- a/lib/telemetry/telemetry_legacy.c
+++ b/lib/telemetry/telemetry_legacy.c
@@ -10,8 +10,6 @@
 #include <pthread.h>
 #endif /* !RTE_EXEC_ENV_WINDOWS */
 
-/* we won't link against libbsd, so just always use DPDKs-specific strlcpy */
-#undef RTE_USE_LIBBSD
 #include <eal_export.h>
 #include <rte_string_fns.h>
 #include <rte_common.h>
-- 
2.53.0


^ permalink raw reply related

* [PATCH] net/bonding: fix the log MAC address restore failure
From: Evgeny Sokolov @ 2026-06-29 13:58 UTC (permalink / raw)
  To: Thomas Monjalon, Chas Williams, Min Hu (Connor), Declan Doherty
  Cc: dev, stable, chas3, Evgeny Sokolov

Log an error when rte_eth_dev_default_mac_addr_set() fails while
restoring the default MAC address of a member device removed from a
bonding device.
This improves visibility of failures without changing the existing
behavior.

Fixes: aa7791ba8de0 ("net/bonding: fix setting slave MAC addresses")
Cc: chas3@att.com

Signed-off-by: Evgeny Sokolov <Evgeny.Sokolov@infotecs.ru>
Cc: stable@dpdk.org
---
 .mailmap                               | 1 +
 drivers/net/bonding/rte_eth_bond_api.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/.mailmap b/.mailmap
index 8e1153ce58..ddbaaf744f 100644
--- a/.mailmap
+++ b/.mailmap
@@ -461,6 +461,7 @@ Evan Swanson <evan.swanson@intel.com>
 Evgeny Efimov <evgeny.efimov@intel.com>
 Evgeny Im <evgeny.im@oktetlabs.com>
 Evgeny Schemeilin <evgenys@amazon.com>
+Evgeny Sokolov <Evgeny.Sokolov@infotecs.ru>
 Fabio Pricoco <fabio.pricoco@intel.com>
 Fady Bader <fady@mellanox.com>
 Faicker Mo <faicker.mo@ucloud.cn>
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 9e5df67c18..da2b538b3c 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -706,8 +706,12 @@ __eth_bond_member_remove_lock_free(uint16_t bonding_port_id,
 			&rte_eth_devices[bonding_port_id].data->port_id);
 
 	/* Restore original MAC address of member device */
-	rte_eth_dev_default_mac_addr_set(member_port_id,
-			&internals->members[member_idx].persisted_mac_addr);
+	if (rte_eth_dev_default_mac_addr_set(member_port_id,
+			&internals->members[member_idx].persisted_mac_addr)) {
+		RTE_BOND_LOG(ERR,
+				"Failed to restore MAC address on member port %u",
+				member_port_id);
+	}
 
 	/* remove additional MAC addresses from the member */
 	member_remove_mac_addresses(bonding_eth_dev, member_port_id);
-- 
2.47.3


^ permalink raw reply related

* Re: [PATCH v2 0/6] net/dpaa2: NAPI-style Rx queue interrupts
From: Maxime Leroy @ 2026-06-29 13:13 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev
In-Reply-To: <c1b545ca-6761-412e-b3a6-44389778edc2@oss.nxp.com>

Hi Hemant,

On Sun, Jun 21, 2026 at 6:33 AM Hemant Agrawal
<hemant.agrawal@oss.nxp.com> wrote:
>
> Hi Maxime,
>
> On 16-06-2026 15:57, Maxime Leroy wrote:
> > This series lets a dpaa2 worker sleep on a queue's data-availability
> > notification instead of busy-polling, exposed through the generic
> > rte_eth_dev_rx_intr_* API (NAPI-style: poll while frames keep coming,
> > arm the interrupt and sleep when the queue runs dry).
> >
>      We need to try out few things on it.  I am afraid that it will take
> some time and our review for this patch will be late.
>

Thanks for the update. No problem, please take the time you need.

I am also preparing a v2 using CDAN only for notifications, while
keeping packets on the regular volatile-dequeue path.
This should improve PPS compared to v1, but I still need more time for
validation and performance testing before sending it.

I will also send the VLAN strip cleanup separately soon.

Regards,
Maxime

^ permalink raw reply

* [PATCH] usertools/dpdk-devbind: improve query performance on BSD
From: Bruce Richardson @ 2026-06-29 12:59 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

The time taken on FreeBSD to run the status command from dpdk-devbind
was exceptionally long. When run on a real system with lots of
devices, the original code took over 80 seconds in some cases to produce
the output of "dpdk-devbind.py -s". (Time on BSD VMs is quicker as they
tend not to have so many hardware devices, which is why this may not
have been noticed before.)

Rework the processing to avoid doing so many subprocess calls to
pciconf; use one call to get info on all devices rather than an
individual call per-device. On the same HW as before, it now takes a
fraction of a second, rather than >80 seconds.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 usertools/dpdk-devbind.py | 111 ++++++++++++++++++++++++++++----------
 1 file changed, 84 insertions(+), 27 deletions(-)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 93f2383dff..e72f238aba 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -111,6 +111,9 @@
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
 devices = {}
+# for bsd, cache of all devices with ifconfig info merged in. populated once on first call.
+devices_cache = None
+
 # list of supported DPDK drivers
 dpdk_drivers = ["igb_uio", "vfio-pci", "uio_pci_generic"] if is_linux else ["nic_uio"]
 # list of currently loaded kernel modules
@@ -220,7 +223,10 @@ def get_pci_device_details(dev_id, probe_lspci):
 def clear_data():
     '''This function clears any old data'''
     global devices
+    global devices_cache
     devices = {}
+    if is_bsd:
+        devices_cache = None
 
 
 def get_basic_devinfo_linux(devices_type):
@@ -253,38 +259,89 @@ def get_basic_devinfo_linux(devices_type):
             dev[name.rstrip(":")] = value_list[len(value_list) - 1] \
                 .rstrip("]").lstrip("[")
 
+def init_devices_cache_bsd():
+    '''Initialize the devices cache by parsing pciconf -lv and ifconfig -a once.
+    Returns a list of device dictionaries with ifconfig data merged in.'''
+    global devices_cache
+
+    if devices_cache is not None:
+        return devices_cache
+
+    # Get all PCI device info in one call
+    pciconf_output = subprocess.check_output(["pciconf", "-lv"]).decode("utf8")
+    # Get all network interface info in one call
+    ifconfig_output = subprocess.check_output(["ifconfig", "-a"]).decode("utf8").splitlines()
+
+    devices_cache = []
+    current_dev = None
+
+    # Parse pciconf -lv output
+    for line in pciconf_output.splitlines():
+        # Main device line: none0@pci0:0:0:0: class=0x088000 rev=0x04 hdr=0x00 vendor=0x8086 device=0x09a2
+        if line and '@pci' in line:
+            # Save previous device if any
+            if current_dev:
+                devices_cache.append(current_dev)
+
+            # Parse slot/address from first part
+            name_addr, fields = line.split(maxsplit=1)
+            devname, addr = name_addr.split('@')
+            # Remove trailing colon from address
+            addr = addr.rstrip(':')
+
+            current_dev = {}
+            current_dev["Slot"] = addr
+            current_dev["Slot_str"] = addr
+
+            # Extract driver base name from device name (e.g., "nic_uio2" -> "nic_uio", "ixl0" -> "ixl")
+            # Device name format is like: "nic_uio2", "ioat0", "em0", "ixl1", "none0", etc.
+            current_dev["Driver_str"] = devname.rstrip('0123456789')
+
+            # Parse class/vendor/device from rest of line
+            fields_list = fields.split()
+            for field in fields_list:
+                if '=' in field:
+                    name, value = field.split("=")
+                    name = name.title()
+                    if name.startswith("Sub"):
+                        name = "S" + name[3:].title()
+                    # For class code, extract only first 2 hex digits (class part)
+                    if name == "Class" and value.startswith("0x") and len(value) > 4:
+                        current_dev[name + "_str"] = value
+                        current_dev[name] = value[2:4]  # Extract just class code (e.g., "02" from "0x020000")
+                    else:
+                        current_dev[name + "_str"] = value
+                        current_dev[name] = value[2:] if value.startswith("0x") else value
+
+            # Check if this is a network device and attach interface info
+            if "Class" in current_dev:
+                class_code = current_dev.get("Class", "")
+                if class_code == "02":  # Network controller
+                    iflines = [ln for ln in ifconfig_output if ln.startswith(f"{devname}:")]
+                    if iflines:
+                        current_dev["Interface"] = devname
+
+        # Device description line: device = 'Intel 82576 Gigabit Network Connection'
+        elif current_dev and "device" in line.lower() and "=" in line:
+            current_dev["Device_str"] = line.split("=")[1].strip().strip("'")
+
+    # Add the last device
+    if current_dev:
+        devices_cache.append(current_dev)
+
+    return devices_cache
 
 def get_basic_devinfo_bsd(devices_type):
+    '''Filter the pre-cached device list by device type and populate devices dict.'''
     global devices
 
-    dev_lines = subprocess.check_output(["pciconf", "-l"]).decode("utf8").splitlines()
-    netifs = subprocess.check_output(["ifconfig", "-a"]).decode("utf8").splitlines()
-    for dev_line in dev_lines:
-        dev = {}
-        name_addr, fields = dev_line.split(maxsplit=1)
-        devname, addr = name_addr.split('@')
-        dev["Slot"] = addr
-        dev["Slot_str"] = addr
-        dev["Driver_str"] = devname[:-1]
-        if devices_type == network_devices:
-            iflines = [ln for ln in netifs if ln.startswith(f"{devname}:")]
-            if iflines:
-                dev["Interface"] = devname
-        fields = fields.split()
-        for field in fields:
-            name, value = field.split("=")
-            name = name.title()
-            if name.startswith("Sub"):
-                name = "S" + name[3:].title()
-            dev[name + "_str"] = value
-            dev[name] = value[2:] if value.startswith("0x") else value
-        # explicitly query the device name string
-        devdetails = subprocess.check_output(["pciconf", "-lv", addr]).decode("utf8")
-        for devline in devdetails.splitlines():
-            if devline.lstrip().startswith("device") and "=" in devline:
-                dev["Device_str"] = devline.split("=")[1].strip().strip("'")
+    # Initialize cache on first call (subsequent calls return cached data)
+    all_devices = init_devices_cache_bsd()
+
+    # Filter by device type and add to devices dict
+    for dev in all_devices:
         if device_type_match(dev, devices_type):
-            devices[addr] = dict(dev)
+            devices[dev["Slot"]] = dict(dev)
 
 
 def get_device_details(devices_type):
-- 
2.53.0


^ permalink raw reply related

* Re: [PATCH v2] build: drop dependency on libbsd
From: David Marchand @ 2026-06-29 11:55 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Thomas Monjalon, Stephen Hemminger
In-Reply-To: <akJcdJ9beQ560Opd@bricha3-mobl1.ger.corp.intel.com>

On Mon, 29 Jun 2026 at 13:52, Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Mon, Jun 29, 2026 at 01:30:32PM +0200, David Marchand wrote:
> > On Thu, 25 Jun 2026 at 15:08, Bruce Richardson
> > <bruce.richardson@intel.com> wrote:
> > >
> > > Glibc added the strlcpy and strlcat functions to version 2.38, released
> > > in 2023, meaning they are natively available in modern linux distros. At
> > > this point, the value of having the libbsd provided versions of these
> > > functions is reduced, so let's simplify the code options here by
> > > providing just two options for strlcpy rather than three:
> > >
> > > 1. native implementation for BSD and recent Linux
> > > 2. DPDK-specific fallbacks using snprintf
> > >
> > > Since the strlcpy and strlcat functions are the only two items used from
> > > libbsd, we can then drop completely any DPDK dependency on libbsd.
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > >
> > > ---
> > > V2:
> > > * took the work further than v1, dropping libbsd dependency entirely.
> > >   Now DPDK just supports native strlcpy or it's own fallback version.
> >
> > We still have some references:
> >
> > $ git grep -i libbsd
> > .github/workflows/build.yml:        libbsd-dev \
> > .github/workflows/build.yml:        libbsd-devel \
> > devtools/process-iwyu.py:def uses_libbsd(builddir):
> > devtools/process-iwyu.py:    "return whether the build uses libbsd or not"
> > devtools/process-iwyu.py:    return bool(get_build_config(builddir,
> > lambda ln: 'RTE_USE_LIBBSD' in ln))
> > devtools/process-iwyu.py:    keep_str_fns = uses_libbsd(build_dir)  #
> > check for libbsd
> > devtools/process-iwyu.py:        print("Warning: libbsd is present,
> > build will fail to detect incorrect removal of rte_string_fns.h",
> > doc/guides/howto/af_xdp_dp.rst:          libbsd-devel \
> >
>
> Sure, will respin and try and clean these up a bit. I assume from the
> detailed feedback that there is no issue with the high-level approach here?

Consumers of dpdk may have been relying on the libbsd dependency (and
RTE_USE_LIBBSD config...) but I think we should proceed with this
removal.

https://xkcd.com/1172/


-- 
David Marchand


^ permalink raw reply

* Re: [PATCH v2] build: drop dependency on libbsd
From: Bruce Richardson @ 2026-06-29 11:52 UTC (permalink / raw)
  To: David Marchand; +Cc: dev
In-Reply-To: <CAJFAV8yP-Mp75so4qoKqOHUzbgWqBi-e8JDLY6yZDpjhodU-tA@mail.gmail.com>

On Mon, Jun 29, 2026 at 01:30:32PM +0200, David Marchand wrote:
> On Thu, 25 Jun 2026 at 15:08, Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > Glibc added the strlcpy and strlcat functions to version 2.38, released
> > in 2023, meaning they are natively available in modern linux distros. At
> > this point, the value of having the libbsd provided versions of these
> > functions is reduced, so let's simplify the code options here by
> > providing just two options for strlcpy rather than three:
> >
> > 1. native implementation for BSD and recent Linux
> > 2. DPDK-specific fallbacks using snprintf
> >
> > Since the strlcpy and strlcat functions are the only two items used from
> > libbsd, we can then drop completely any DPDK dependency on libbsd.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >
> > ---
> > V2:
> > * took the work further than v1, dropping libbsd dependency entirely.
> >   Now DPDK just supports native strlcpy or it's own fallback version.
> 
> We still have some references:
> 
> $ git grep -i libbsd
> .github/workflows/build.yml:        libbsd-dev \
> .github/workflows/build.yml:        libbsd-devel \
> devtools/process-iwyu.py:def uses_libbsd(builddir):
> devtools/process-iwyu.py:    "return whether the build uses libbsd or not"
> devtools/process-iwyu.py:    return bool(get_build_config(builddir,
> lambda ln: 'RTE_USE_LIBBSD' in ln))
> devtools/process-iwyu.py:    keep_str_fns = uses_libbsd(build_dir)  #
> check for libbsd
> devtools/process-iwyu.py:        print("Warning: libbsd is present,
> build will fail to detect incorrect removal of rte_string_fns.h",
> doc/guides/howto/af_xdp_dp.rst:          libbsd-devel \
> 

Sure, will respin and try and clean these up a bit. I assume from the
detailed feedback that there is no issue with the high-level approach here?

/Bruce

^ permalink raw reply

* Re: [PATCH v2] build: drop dependency on libbsd
From: David Marchand @ 2026-06-29 11:30 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev
In-Reply-To: <20260625130813.1527333-1-bruce.richardson@intel.com>

On Thu, 25 Jun 2026 at 15:08, Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> Glibc added the strlcpy and strlcat functions to version 2.38, released
> in 2023, meaning they are natively available in modern linux distros. At
> this point, the value of having the libbsd provided versions of these
> functions is reduced, so let's simplify the code options here by
> providing just two options for strlcpy rather than three:
>
> 1. native implementation for BSD and recent Linux
> 2. DPDK-specific fallbacks using snprintf
>
> Since the strlcpy and strlcat functions are the only two items used from
> libbsd, we can then drop completely any DPDK dependency on libbsd.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>
> ---
> V2:
> * took the work further than v1, dropping libbsd dependency entirely.
>   Now DPDK just supports native strlcpy or it's own fallback version.

We still have some references:

$ git grep -i libbsd
.github/workflows/build.yml:        libbsd-dev \
.github/workflows/build.yml:        libbsd-devel \
devtools/process-iwyu.py:def uses_libbsd(builddir):
devtools/process-iwyu.py:    "return whether the build uses libbsd or not"
devtools/process-iwyu.py:    return bool(get_build_config(builddir,
lambda ln: 'RTE_USE_LIBBSD' in ln))
devtools/process-iwyu.py:    keep_str_fns = uses_libbsd(build_dir)  #
check for libbsd
devtools/process-iwyu.py:        print("Warning: libbsd is present,
build will fail to detect incorrect removal of rte_string_fns.h",
doc/guides/howto/af_xdp_dp.rst:          libbsd-devel \


-- 
David Marchand


^ permalink raw reply

* Re: [PATCH 1/1] mldev: fix typos in code documentation
From: David Marchand @ 2026-06-29 11:05 UTC (permalink / raw)
  To: Srikanth Yalavarthi; +Cc: Jerin Jacob, dev, sshankarnara, ptakkar, aprabhu
In-Reply-To: <20260609040513.919215-1-syalavarthi@marvell.com>

On Tue, 9 Jun 2026 at 06:05, Srikanth Yalavarthi
<syalavarthi@marvell.com> wrote:
>
> Fix typos in MLDEV spec and code documentation.
>
> Fixes: d82cac584f84 ("mldev: introduce machine learning device API")
>
> Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply

* Re: [PATCH 1/1] mldev: fix incorrect captions for model_ops
From: David Marchand @ 2026-06-29 11:04 UTC (permalink / raw)
  To: Srikanth Yalavarthi; +Cc: Anup Prabhu, dev, jerinj, sshankarnara, ptakkar
In-Reply-To: <20260609050020.995268-1-syalavarthi@marvell.com>

On Tue, 9 Jun 2026 at 07:01, Srikanth Yalavarthi
<syalavarthi@marvell.com> wrote:
>
> Fixed incorrect captions in images depecting the
> model_ops test flows.
>
> Fixes: f6661e6d9a3a ("app/mldev: validate model operations")
>
> Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply

* Re: [PATCH v2] bus/fslmc: convert queue storage macros to inline functions
From: David Marchand @ 2026-06-29 10:41 UTC (permalink / raw)
  To: Weijun Pan, hemant.agrawal
  Cc: dev, sachin.saxena, jun.yang, stable, stephen, thomas, Weijun Pan
In-Reply-To: <20260628152553.46342-1-wpan3636@gmail.com>

Hello,

Thanks for working on this issue.

On Sun, 28 Jun 2026 at 17:27, Weijun Pan <wpan3636@gmail.com> wrote:
>
> From: Weijun Pan <wpan36@wisc.edu>
>
> The queue storage allocation and free helpers are implemented as macros
> which declare local variables in the caller scope. This can cause shadow
> warnings when -Wshadow is enabled.
>
> Convert them to static inline functions to avoid macro-local variable
> scope issues without changing behavior.
>
> Bugzilla ID: 1744

This bugzilla is about compiling with -Wshadow.

The proposed fix is partial.
As I reported in my previous mail, enabling -Wshadow after the current
patch still shows many build warnings in
drivers/bus/fslmc/qbman/qbman_portal.c.
https://inbox.dpdk.org/dev/CAJFAV8w-VQJb6jM0KgAVP1rJKyUUwiBA6_seOCDwMX47rZmYyA@mail.gmail.com/

Could you work on a complete fix so the bz can be closed?


> Fixes: 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
> Cc: jun.yang@nxp.com
> Cc: stable@dpdk.org

Afaics, nothing is broken in the current code, why do we *need* to
backport the change?


> Signed-off-by: Weijun Pan <wpan36@wisc.edu>


-- 
David Marchand


^ permalink raw reply

* Re: [PATCH v2] eal: return error on devargs truncation in hotplug MP messages
From: David Marchand @ 2026-06-29  9:30 UTC (permalink / raw)
  To: Long Li; +Cc: dev, stable
In-Reply-To: <20260624000531.1562655-1-longli@microsoft.com>

On Wed, 24 Jun 2026 at 02:11, Long Li <longli@microsoft.com> wrote:
>
> The EAL hotplug multi-process messaging uses a fixed-size buffer
> (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments.
> When devargs exceeds this limit, strlcpy silently truncates the
> string. This causes secondary processes to receive incomplete
> devargs during hotplug re-add, leading to failed port
> re-initialization.
>
> For example, a MANA PCI device with 6 mac= arguments:
>
>   mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
>   mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
>   mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06
>
> produces a 131-byte devargs string that gets silently truncated
> to 127 bytes, losing the last MAC address.
>
> Return -E2BIG from rte_dev_probe() when devargs would be truncated,
> instead of silently corrupting data. rte_dev_remove() does not need
> the same check because the length was already validated at probe time.
>
> Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
> Cc: stable@dpdk.org
>
> Signed-off-by: Long Li <longli@microsoft.com>

Applied, thanks for the fix.


-- 
David Marchand


^ permalink raw reply

* Re: [EXTERNAL] Re: [PATCH v2] eal: return error on devargs truncation in hotplug MP messages
From: David Marchand @ 2026-06-29  9:29 UTC (permalink / raw)
  To: Long Li
  Cc: dev@dpdk.org, stable@dpdk.org, Thomas Monjalon, Bruce Richardson,
	Stephen Hemminger, Burakov, Anatoly
In-Reply-To: <SA1PR21MB66834BB21B6AA86BCA50B046CEEB2@SA1PR21MB6683.namprd21.prod.outlook.com>

On Fri, 26 Jun 2026 at 20:20, Long Li <longli@microsoft.com> wrote:
>
> >
> > On Wed, 24 Jun 2026 at 02:11, Long Li <longli@microsoft.com> wrote:
> > >
> > > The EAL hotplug multi-process messaging uses a fixed-size buffer
> > > (EAL_DEV_MP_DEV_ARGS_MAX_LEN, 128 bytes) for device arguments.
> > > When devargs exceeds this limit, strlcpy silently truncates the
> > > string. This causes secondary processes to receive incomplete devargs
> > > during hotplug re-add, leading to failed port re-initialization.
> > >
> > > For example, a MANA PCI device with 6 mac= arguments:
> > >
> > >   mac=AA:BB:CC:DD:EE:01,mac=AA:BB:CC:DD:EE:02,
> > >   mac=AA:BB:CC:DD:EE:03,mac=AA:BB:CC:DD:EE:04,
> > >   mac=AA:BB:CC:DD:EE:05,mac=AA:BB:CC:DD:EE:06
> > >
> > > produces a 131-byte devargs string that gets silently truncated to 127
> > > bytes, losing the last MAC address.
> > >
> > > Return -E2BIG from rte_dev_probe() when devargs would be truncated,
> > > instead of silently corrupting data. rte_dev_remove() does not need
> > > the same check because the length was already validated at probe time.
> > >
> > > Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Long Li <longli@microsoft.com>
> >
> > Re-reading the function, I have one concern about the fix.
> >
> > I agree there is a bug with multiprocess.
> > But this change here also imposes a limit to 128 that was not there before,
> > even if multiprocess is disabled.
> > It may not be a big problem, but we are calling the the multi process
> > machinerie when unneeded (it ends up with a ENOTSUP).
> >
> > I sent a small patch on this topic, could you have a look please?
>
> Thank you. I sent a review comment. This patch looks good.
>
> I'll modify this patch to have the length check inside if (do_mp) block.

I did it directly.

With this adjustment:
Acked-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply

* Re: [PATCH v2] dev: skip multi-process in hotplug
From: David Marchand @ 2026-06-29  9:28 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, longli, Chengwen Feng
In-Reply-To: <20260628140557.1718861-1-david.marchand@redhat.com>

On Sun, 28 Jun 2026 at 16:06, David Marchand <david.marchand@redhat.com> wrote:
>
> If multi-process is disabled (--no-shconf/--in-memory),
> there is no need to build a multi-process message.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply

* [PATCH v6 1/1] pcapng: add user-supplied timestamp support
From: Dawid Wesierski @ 2026-06-29  9:37 UTC (permalink / raw)
  To: dev; +Cc: dawid.wesierski, marek.kasiewicz, thomas, stephen, mb
In-Reply-To: <20260624215858.710217-1-dawid.wesierski@intel.com>

Add a timestamp parameter to rte_pcapng_copy() so that callers with a
hardware PTP or pre-captured timestamp can inject an exact epoch-ns value
directly into the packet record.

Timestamp handling:
 - ts != 0: caller-supplied nanoseconds since the Unix epoch, stored as-is.
 - ts == 0: TSC captured at copy time with bit 63 set as a sentinel.
   rte_pcapng_write_packets() detects the sentinel and converts the TSC to
   epoch ns using the file's calibrated clock.  The TSC will not reach
   bit 63 for centuries, and epoch-ns values stay below bit 63 until 2554,
   so the bit is safe to use as a disambiguation flag.

Adding the parameter changes the ABI, so rte_pcapng_copy() is versioned.

rte_pcapng_tsc_to_ns() is added as a new experimental helper.  It exposes the
same calibrated, drift-compensated, divide-free TSC-to-epoch-ns conversion
used internally by rte_pcapng_write_packets(), allows callers to convert
a TSC captured at packet arrival time before passing it to rte_pcapng_copy().

Signed-off-by: Marek Kasiewicz <marek.kasiewicz@intel.com>
Signed-off-by: Dawid Wesierski <dawid.wesierski@intel.com>
---
 .mailmap                |   2 +
 app/test/test_pcapng.c  | 112 +++++++++++++++++++++++++++++++++++++++-
 lib/graph/graph_pcap.c  |   2 +-
 lib/pcapng/meson.build  |   1 +
 lib/pcapng/rte_pcapng.c |  59 +++++++++++++++++----
 lib/pcapng/rte_pcapng.h |  22 +++++++-
 lib/pdump/rte_pdump.c   |   2 +-
 7 files changed, 185 insertions(+), 15 deletions(-)

diff --git a/.mailmap b/.mailmap
index 4001e5fb0e..a7d97a631e 100644
--- a/.mailmap
+++ b/.mailmap
@@ -366,6 +366,7 @@ David Zeng <zengxhsh@cn.ibm.com>
 Davide Caratti <dcaratti@redhat.com>
 Dawid Gorecki <dgr@semihalf.com>
 Dawid Jurczak <dawid_jurek@vp.pl>
+Dawid Wesierski <dawid.wesierski@intel.com> Wesierski, Dawid <dawid.wesierski@intel.com>
 Dawid Zielinski <dawid.zielinski@intel.com>
 Dawid Łukwiński <dawid.lukwinski@intel.com>
 Daxue Gao <daxuex.gao@intel.com>
@@ -1014,6 +1015,7 @@ Marcin Wilk <marcin.wilk@caviumnetworks.com>
 Marcin Wojtas <mw@semihalf.com>
 Marcin Zapolski <marcinx.a.zapolski@intel.com>
 Marco Varlese <mvarlese@suse.de>
+Marek Kasiewicz <marek.kasiewicz@intel.com>
 Marek Mical <marekx.mical@intel.com>
 Marek Zalfresso-jundzillo <marekx.zalfresso-jundzillo@intel.com>
 Maria Lingemark <maria.lingemark@ericsson.com>
diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c
index 298bcbd31f..1dd2ae6cdd 100644
--- a/app/test/test_pcapng.c
+++ b/app/test/test_pcapng.c
@@ -302,7 +302,7 @@ fill_pcapng_file(rte_pcapng_t *pcapng)
 			mbuf1_resize(&mbfs, rte_rand_max(MAX_DATA_SIZE));
 
 			mc = rte_pcapng_copy(port_id, 0, orig, mp, rte_pktmbuf_pkt_len(orig),
-					     RTE_PCAPNG_DIRECTION_IN, comment);
+					     RTE_PCAPNG_DIRECTION_IN, comment, 0);
 			if (mc == NULL) {
 				printf("Cannot copy packet\n");
 				return -1;
@@ -612,7 +612,7 @@ test_write_before_open(void)
 	for (i = 0; i < (int)count; i++) {
 		clones[i] = rte_pcapng_copy(port_id, 0, &mbfs.mb[0], mp,
 					    rte_pktmbuf_pkt_len(&mbfs.mb[0]),
-					    RTE_PCAPNG_DIRECTION_IN, NULL);
+					    RTE_PCAPNG_DIRECTION_IN, NULL, 0);
 		if (clones[i] == NULL) {
 			fprintf(stderr, "Cannot copy packet before open\n");
 			rte_pktmbuf_free_bulk(clones, i);
@@ -672,6 +672,113 @@ test_write_before_open(void)
 	return -1;
 }
 
+static int
+test_pcapng_timestamp(void)
+{
+	char file_name[PATH_MAX] = "/tmp/pcapng_test_XXXXXX.pcapng";
+	rte_pcapng_t *pcapng = NULL;
+	int ret, tmp_fd;
+	struct dummy_mbuf mbfs;
+	struct rte_mbuf *orig, *mc;
+	uint64_t now_ns, tsc, ns_from_tsc, pcap_ts;
+
+	tmp_fd = mkstemps(file_name, strlen(".pcapng"));
+	if (tmp_fd == -1) {
+		perror("mkstemps() failure");
+		goto fail;
+	}
+
+	pcapng = rte_pcapng_fdopen(tmp_fd, NULL, NULL, "pcapng_ts_test", NULL);
+	if (pcapng == NULL) {
+		printf("rte_pcapng_fdopen failed\n");
+		close(tmp_fd);
+		goto fail;
+	}
+
+	ret = rte_pcapng_add_interface(pcapng, port_id, DLT_EN10MB, NULL, NULL, NULL);
+	if (ret < 0) {
+		printf("can not add port %u\n", port_id);
+		goto fail;
+	}
+
+	/* Test 1: rte_pcapng_tsc_to_ns */
+	tsc = rte_get_tsc_cycles();
+	now_ns = current_timestamp();
+	ns_from_tsc = rte_pcapng_tsc_to_ns(pcapng, tsc);
+
+	/* Check if TSC-derived NS is reasonably close to wall clock NS (within 100ms) */
+	if (ns_from_tsc > now_ns + 100000000 || ns_from_tsc < now_ns - 100000000) {
+		printf("TSC to NS conversion failed: tsc=%"PRIu64
+		       " ns_from_tsc=%"PRIu64" now_ns=%"PRIu64"\n",
+		       tsc, ns_from_tsc, now_ns);
+		goto fail;
+	}
+
+	/* Test 2: rte_pcapng_copy with explicit timestamp */
+	mbuf1_prepare(&mbfs);
+	orig = &mbfs.mb[0];
+	pcap_ts = now_ns + 1000000000; /* 1 second in future to be distinct */
+
+	mc = rte_pcapng_copy(port_id, 0, orig, mp, rte_pktmbuf_pkt_len(orig),
+			     RTE_PCAPNG_DIRECTION_IN, "custom_ts", pcap_ts);
+	if (mc == NULL) {
+		printf("rte_pcapng_copy failed\n");
+		goto fail;
+	}
+
+	/* Write it */
+	ret = rte_pcapng_write_packets(pcapng, &mc, 1);
+	rte_pktmbuf_free(mc);
+	if (ret <= 0) {
+		printf("Write of custom timestamp packet failed\n");
+		goto fail;
+	}
+
+	rte_pcapng_close(pcapng);
+
+	/* Validate the file using libpcap */
+	/* We expect 1 packet with timestamp exactly pcap_ts */
+	{
+		char errbuf[PCAP_ERRBUF_SIZE];
+		pcap_t *pcap;
+		struct pcap_pkthdr h;
+		const u_char *bytes;
+		uint64_t ns;
+
+		pcap = pcap_open_offline_with_tstamp_precision(file_name,
+							       PCAP_TSTAMP_PRECISION_NANO,
+							       errbuf);
+		if (pcap == NULL) {
+			printf("pcap_open_offline failed: %s\n", errbuf);
+			goto fail;
+		}
+
+		bytes = pcap_next(pcap, &h);
+		if (bytes == NULL) {
+			printf("No packets in file\n");
+			pcap_close(pcap);
+			goto fail;
+		}
+
+		ns = (uint64_t)h.ts.tv_sec * NS_PER_S + h.ts.tv_usec;
+		if (ns != pcap_ts) {
+			printf("Timestamp mismatch: expected %"PRIu64" got %"PRIu64"\n",
+			       pcap_ts, ns);
+			pcap_close(pcap);
+			goto fail;
+		}
+		pcap_close(pcap);
+	}
+
+	remove(file_name);
+	return 0;
+
+fail:
+	if (pcapng)
+		rte_pcapng_close(pcapng);
+	return -1;
+}
+
 static void
 test_cleanup(void)
 {
@@ -688,6 +795,7 @@ unit_test_suite test_pcapng_suite  = {
 		TEST_CASE(test_add_interface),
 		TEST_CASE(test_write_packets),
 		TEST_CASE(test_write_before_open),
+		TEST_CASE(test_pcapng_timestamp),
 		TEST_CASES_END()
 	}
 };
diff --git a/lib/graph/graph_pcap.c b/lib/graph/graph_pcap.c
index 78859ec2d4..4d907c78aa 100644
--- a/lib/graph/graph_pcap.c
+++ b/lib/graph/graph_pcap.c
@@ -216,7 +216,7 @@ graph_pcap_dispatch(struct rte_graph *graph,
 		struct rte_mbuf *mc;
 		mbuf = (struct rte_mbuf *)objs[i];
 
-		mc = rte_pcapng_copy(mbuf->port, 0, mbuf, pkt_mp, mbuf->pkt_len, 0, comment);
+		mc = rte_pcapng_copy(mbuf->port, 0, mbuf, pkt_mp, mbuf->pkt_len, 0, comment, 0);
 		if (mc == NULL)
 			break;
 
diff --git a/lib/pcapng/meson.build b/lib/pcapng/meson.build
index 4549925d41..3cfaddbd6e 100644
--- a/lib/pcapng/meson.build
+++ b/lib/pcapng/meson.build
@@ -3,5 +3,6 @@
 
 sources = files('rte_pcapng.c')
 headers = files('rte_pcapng.h')
+use_function_versioning = true
 
 deps += ['ethdev']
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index b5d1026891..b8ebb0c288 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -37,6 +37,9 @@
 /* upper bound for strings in pcapng option data */
 #define PCAPNG_STR_MAX	UINT16_MAX
 
+/* Flag to indicate timestamp is in TSC cycles (bit 63) */
+#define PCAPNG_TSC_FLAG	(1ULL << 63)
+
 /*
  * Converter from TSC values to nanoseconds since Unix epoch.
  * Uses reciprocal multiply to avoid runtime division.
@@ -480,6 +483,13 @@ rte_pcapng_mbuf_size(uint32_t length)
 		+ sizeof(uint32_t);		  /*  length */
 }
 
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pcapng_tsc_to_ns, 26.07)
+uint64_t
+rte_pcapng_tsc_to_ns(const rte_pcapng_t *self, uint64_t tsc)
+{
+	return tsc_to_ns_epoch(&self->clock, tsc);
+}
+
 /* More generalized version rte_vlan_insert() */
 static int
 pcapng_vlan_insert(struct rte_mbuf *m, uint16_t ether_type, uint16_t tci)
@@ -546,19 +556,18 @@ pcapng_vlan_insert(struct rte_mbuf *m, uint16_t ether_type, uint16_t tci)
  */
 
 /* Make a copy of original mbuf with pcapng header and options */
-RTE_EXPORT_SYMBOL(rte_pcapng_copy)
-struct rte_mbuf *
-rte_pcapng_copy(uint16_t port_id, uint32_t queue,
+RTE_DEFAULT_SYMBOL(26, struct rte_mbuf *, rte_pcapng_copy,
+		(uint16_t port_id, uint32_t queue,
 		const struct rte_mbuf *md,
 		struct rte_mempool *mp,
 		uint32_t length,
 		enum rte_pcapng_direction direction,
-		const char *comment)
+		const char *comment,
+		uint64_t timestamp))
 {
 	struct pcapng_enhance_packet_block *epb;
 	uint32_t orig_len, pkt_len, padding, flags;
 	struct pcapng_option *opt;
-	uint64_t timestamp;
 	uint16_t optlen;
 	struct rte_mbuf *mc;
 	bool rss_hash;
@@ -690,8 +699,20 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue,
 	/* Interface index is filled in later during write */
 	mc->port = port_id;
 
-	/* Put timestamp in cycles here - adjust in packet write */
-	timestamp = rte_get_tsc_cycles();
+	/*
+	 * Use caller-provided timestamp.
+	 * If none provided, use current TSC and set flag.
+	 * Timestamps shouldn't naturally have the PCAPNG_TSC_FLAG set for
+	 * centuries, so if it is set, treat it as an error.
+	 */
+	if (timestamp != 0 && (timestamp & PCAPNG_TSC_FLAG)) {
+		rte_errno = EINVAL;
+		goto fail;
+	}
+
+	if (timestamp == 0)
+		timestamp = rte_get_tsc_cycles() | PCAPNG_TSC_FLAG;
+
 	epb->timestamp_hi = timestamp >> 32;
 	epb->timestamp_lo = (uint32_t)timestamp;
 	epb->capture_length = pkt_len;
@@ -707,6 +728,22 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue,
 	return NULL;
 }
 
+/*
+ * Original ABI: no caller-supplied timestamp. Capture the current TSC
+ * (default path) and forward to the timestamped implementation.
+ */
+RTE_VERSION_SYMBOL(25, struct rte_mbuf *, rte_pcapng_copy,
+		(uint16_t port_id, uint32_t queue,
+		const struct rte_mbuf *md,
+		struct rte_mempool *mp,
+		uint32_t length,
+		enum rte_pcapng_direction direction,
+		const char *comment))
+{
+	return rte_pcapng_copy(port_id, queue, md, mp, length, direction,
+			       comment, 0);
+}
+
 /* Write pre-formatted packets to file. */
 RTE_EXPORT_SYMBOL(rte_pcapng_write_packets)
 ssize_t
@@ -743,9 +780,11 @@ rte_pcapng_write_packets(rte_pcapng_t *self,
 		 */
 		cycles = (uint64_t)epb->timestamp_hi << 32;
 		cycles += epb->timestamp_lo;
-		timestamp = tsc_to_ns_epoch(&self->clock, cycles);
-		epb->timestamp_hi = timestamp >> 32;
-		epb->timestamp_lo = (uint32_t)timestamp;
+		if (cycles & PCAPNG_TSC_FLAG) {
+			timestamp = tsc_to_ns_epoch(&self->clock, cycles & ~PCAPNG_TSC_FLAG);
+			epb->timestamp_hi = timestamp >> 32;
+			epb->timestamp_lo = (uint32_t)timestamp;
+		}
 
 		/*
 		 * Handle case of highly fragmented and large burst size
diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h
index d8d328f710..97f83c5a88 100644
--- a/lib/pcapng/rte_pcapng.h
+++ b/lib/pcapng/rte_pcapng.h
@@ -129,6 +129,9 @@ enum rte_pcapng_direction {
  * @param comment
  *   Optional per packet comment.
  *   Truncated to UINT16_MAX characters.
+ * @param timestamp
+ *   Nanoseconds since the Unix epoch. If zero, TSC is captured and
+ *   converted at write time.
  *
  * @return
  *   - The pointer to the new mbuf formatted for pcapng_write
@@ -138,7 +141,24 @@ struct rte_mbuf *
 rte_pcapng_copy(uint16_t port_id, uint32_t queue,
 		const struct rte_mbuf *m, struct rte_mempool *mp,
 		uint32_t length,
-		enum rte_pcapng_direction direction, const char *comment);
+		enum rte_pcapng_direction direction,
+		const char *comment, uint64_t timestamp);
+
+/**
+ * Convert a TSC value to nanoseconds since the Unix epoch.
+ *
+ * Uses the calibrated clock of the capture file.
+ *
+ * @param self
+ *  The handle to the packet capture file
+ * @param tsc
+ *  The TSC value to convert
+ * @return
+ *  Nanoseconds since Unix epoch
+ */
+__rte_experimental
+uint64_t
+rte_pcapng_tsc_to_ns(const rte_pcapng_t *self, uint64_t tsc);
 
 
 /**
diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index ac94efe7ff..a85a95a808 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -176,7 +176,7 @@ pdump_copy_burst(uint16_t port_id, uint16_t queue_id,
 		 */
 		if (cbs->ver == V2)
 			p = rte_pcapng_copy(port_id, queue_id, pkts[i], mp, cbs->snaplen,
-					    direction, NULL);
+					    direction, NULL, 0);
 		else
 			p = rte_pktmbuf_copy(pkts[i], mp, 0, cbs->snaplen);
 
-- 
2.47.3

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.

^ permalink raw reply related

* Re: [PATCH v2] dev: skip multi-process in hotplug
From: David Marchand @ 2026-06-29  8:51 UTC (permalink / raw)
  To: fengchengwen; +Cc: dev, longli
In-Reply-To: <94368ef9-ab61-44b1-b56a-6a1d263230b8@huawei.com>

On Mon, 29 Jun 2026 at 02:42, fengchengwen <fengchengwen@huawei.com> wrote:
>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
>
> Minor suggestion: how about replace "bool do_mp = internal_conf->no_shconf == 0;" to "bool do_mp = !!internal_conf->no_shconf;" or bool do_mp = internal_conf->no_shconf;"
>
> the no_shconf's prototype is "volatile unsigned", most of invokation is some like "if (internal_conf->no_shconf)"

This flag should have been a bool in the first place...

Most of this code is already not compliant with DPDK coding style, I
don't mind updating for consistency.


-- 
David Marchand


^ permalink raw reply

* Re: [PATCH] vhost/crypto: fix segfault
From: Radu Nicolau @ 2026-06-29  8:35 UTC (permalink / raw)
  To: Maxime Coquelin
  Cc: David Marchand, dev, stable, Chenbo Xia, Jay Zhou, Fan Zhang
In-Reply-To: <CAO55csyCW5nms7=nCzLw9PA0kptGrGQgQARZ1HJEGBu_Ws4CFQ@mail.gmail.com>


On 29-Jun-26 9:18 AM, Maxime Coquelin wrote:
> On Fri, Jun 26, 2026 at 10:50 AM Radu Nicolau <radu.nicolau@intel.com> wrote:
>>
>> On 25-Jun-26 1:44 PM, David Marchand wrote:
>>> On Wed, 24 Jun 2026 at 16:21, Radu Nicolau <radu.nicolau@intel.com> wrote:
>>>> Fix potential call with dev->mem uninitialized, one common usecase
>>>> example being running the autotest with more than one device.
>>>>
>>>> Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
>>>> ---
>>>>    lib/vhost/vhost_crypto.c | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
>>>> index 648e2d731b..3679eaca1e 100644
>>>> --- a/lib/vhost/vhost_crypto.c
>>>> +++ b/lib/vhost/vhost_crypto.c
>>>> @@ -1512,6 +1512,10 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
>>>>                   VC_LOG_ERR("Invalid descriptor");
>>>>                   return -1;
>>>>           }
>>>> +       if (unlikely((vc_req->dev->mem) == NULL)) {
>>> (Unneeded extra ())
>>>
>>> It sounds to me that some initialisation failed, or processing happens
>>> without waiting initialisation finished.
>> Indeed calling this function with dev->mem uninitialized is caused by
>> some init/deinit state bug, but I still think we should keep this check
>> in for added safety.
>>
>> I will follow up with a v2 to remove the redundant () and also I will
>> look into fixing the root cause.
> Or maybe this crypto backend is lacking proper protection between
> control and data paths?
> If dev->mem is reset to NULL asynchrously by the control path without
> proper locking, then
> the above fix is not enough. For example, the above check could pass
> and dev->mem be
> reset right after.
100% there is a deeper root cause for this segfault and I'm working to 
find it, but it may take a while. That's why I propose this as a stop 
gap fix, it adds an extra check but of course it doesn't remove the root 
cause.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox