public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>, dev@dpdk.org
Cc: stable@dpdk.org,
	"luca.boccassi@gmail.com" <luca.boccassi@gmail.com>,
	Shani Peretz <shperetz@nvidia.com>
Subject: Re: [PATCH v3 4/5] pcapng: handle packets copied before file open
Date: Thu, 19 Mar 2026 10:34:18 +0000	[thread overview]
Message-ID: <28deabb2-361e-4379-9db2-42e94eb352c8@redhat.com> (raw)
In-Reply-To: <20260228175601.585102-5-stephen@networkplumber.org>

On 2/28/26 5:35 PM, Stephen Hemminger wrote:
> Either through misuse of the API, or races it might happen
> that rte_pcapng_copy() is called before rte_pcapng_fdopen().
> 
> Simplest solution to handle this is to modify the logic for
> TSC to nanosecond epoch conversion to handle the case where
> the difference is negative.
> 
> Bugzilla ID: 1291
> Fixes: 166591931b72 ("pcapng: modify timestamp calculation")
> Cc: stable@dpdk.org
> 

Hi Stephen,

Fixes tag goes back to 23.11 but the fix modifies a function added in
26.03 commit below, which doesn't apply cleanly either.

So will just drop from LTS. Otherwise we'll need custom backports and
there's quite a lot of churn.

thanks,
Kevin.

commit 4fc65615b274701070c67f8c424d93aef8bf7483
Author: Stephen Hemminger <stephen@networkplumber.org>
Date:   Mon Feb 16 13:38:03 2026 -0800

    pcapng: improve performance of timestamping


> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/pcapng/rte_pcapng.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
> index b93af418aa..b5d1026891 100644
> --- a/lib/pcapng/rte_pcapng.c
> +++ b/lib/pcapng/rte_pcapng.c
> @@ -157,11 +157,15 @@ tsc_to_ns_epoch(const struct tsc_clock *clk, uint64_t tsc)
>  {
>  	uint64_t delta, ns;
>  
> +	if (unlikely(tsc < clk->tsc_base)) {
> +		delta = clk->tsc_base - tsc;
> +		ns = (delta >> clk->shift) * NSEC_PER_SEC;
> +		return clk->ns_base - rte_reciprocal_divide_u64(ns, &clk->tsc_hz_inv);
> +	}
> +
>  	delta = tsc - clk->tsc_base;
>  	ns = (delta >> clk->shift) * NSEC_PER_SEC;
> -	ns = rte_reciprocal_divide_u64(ns, &clk->tsc_hz_inv);
> -
> -	return clk->ns_base + ns;
> +	return clk->ns_base + rte_reciprocal_divide_u64(ns, &clk->tsc_hz_inv);
>  }
>  
>  /* length of option including padding */



  reply	other threads:[~2026-03-19 10:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 18:41 [PATCH 0/2] pcapng: bug fixes Stephen Hemminger
2026-02-20 18:41 ` [PATCH 1/2] test: fix pcapng test to work on Windows Stephen Hemminger
2026-02-20 18:41 ` [PATCH 2/2] pcapng: handle packets copied before file open Stephen Hemminger
2026-02-24 15:25 ` [PATCH v2 0/4] pcapng: fix test and copy before open Stephen Hemminger
2026-02-24 15:25   ` [PATCH v2 1/4] test: fix pcapng test to work on Windows Stephen Hemminger
2026-02-24 15:25   ` [PATCH v2 2/4] pcapng: handle packets copied before file open Stephen Hemminger
2026-02-24 15:25   ` [PATCH v2 3/4] test: add pcapng test for copy before open Stephen Hemminger
2026-02-24 15:25   ` [PATCH v2 4/4] test: use fixed time length for write packet test Stephen Hemminger
2026-02-25 22:57 ` [PATCH v3 0/4] pcapng: enhancements and test fix Stephen Hemminger
2026-02-25 22:57   ` [PATCH v3 1/4] test: fix pcapng test to work on Windows Stephen Hemminger
2026-02-25 22:57   ` [PATCH v3 2/4] test: use fixed time length for write packet test Stephen Hemminger
2026-02-25 22:57   ` [PATCH v3 3/4] pcapng: handle packets copied before file open Stephen Hemminger
2026-02-25 22:57   ` [PATCH v3 4/4] test: add pcapng test for copy before open Stephen Hemminger
2026-02-28 17:34 ` [PATCH v3 0/5] pcapng: fixes for Windows and timestamps Stephen Hemminger
2026-02-28 17:35   ` [PATCH v3 1/5] test: fix pcapng test to work on Windows Stephen Hemminger
2026-02-28 17:35   ` [PATCH v3 2/5] test: use fixed time length for write packet test Stephen Hemminger
2026-02-28 17:35   ` [PATCH v3 3/5] test: better logging for pcapng test Stephen Hemminger
2026-02-28 17:35   ` [PATCH v3 4/5] pcapng: handle packets copied before file open Stephen Hemminger
2026-03-19 10:34     ` Kevin Traynor [this message]
2026-03-31 18:07       ` Stephen Hemminger
2026-02-28 17:35   ` [PATCH v3 5/5] test: add pcapng test for copy before open Stephen Hemminger
2026-03-17 10:38   ` [PATCH v3 0/5] pcapng: fixes for Windows and timestamps Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28deabb2-361e-4379-9db2-42e94eb352c8@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=dev@dpdk.org \
    --cc=luca.boccassi@gmail.com \
    --cc=shperetz@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox