* Re: [PATCH 6/7] pcapng: add user-supplied timestamp support [not found] ` <20260429073111.3712950-7-dawid.wesierski@intel.com> @ 2026-04-30 14:05 ` Stephen Hemminger 2026-04-30 14:06 ` Stephen Hemminger ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Stephen Hemminger @ 2026-04-30 14:05 UTC (permalink / raw) To: Dawid Wesierski Cc: dev, bruce.richardson, anatoly.burakov, vladimir.medvedkin, reshma.pattan, thomas, andrew.rybchenko, marek.kasiewicz On Wed, 29 Apr 2026 03:31:10 -0400 Dawid Wesierski <dawid.wesierski@intel.com> wrote: > From: Marek Kasiewicz <marek.kasiewicz@intel.com> > > Add rte_pcapng_copy_ts() which accepts an optional timestamp parameter > in nanoseconds. When the timestamp is non-zero, it is used directly > instead of reading the TSC. This allows applications to provide > hardware PTP timestamps from the NIC, enabling accurate packet capture > with PTP-domain timing rather than host-local TSC values. > > The existing rte_pcapng_copy() function is preserved as a static inline > wrapper that passes zero for backward compatibility. > > The TSC-to-epoch conversion in the write path is removed since callers > providing hardware timestamps have already performed the conversion. > > > Signed-off-by: Marek Kasiewicz <marek.kasiewicz@intel.com> > Signed-off-by: Dawid Wesierski <dawid.wesierski@intel.com> Rather than having two functions, it would simpler to just use function versioning and add timestamp parameter. There is only one caller in the tree right now. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 6/7] pcapng: add user-supplied timestamp support [not found] ` <20260429073111.3712950-7-dawid.wesierski@intel.com> 2026-04-30 14:05 ` [PATCH 6/7] pcapng: add user-supplied timestamp support Stephen Hemminger @ 2026-04-30 14:06 ` Stephen Hemminger 2026-04-30 14:09 ` Stephen Hemminger 2026-06-08 16:38 ` Stephen Hemminger 3 siblings, 0 replies; 6+ messages in thread From: Stephen Hemminger @ 2026-04-30 14:06 UTC (permalink / raw) To: Dawid Wesierski Cc: dev, bruce.richardson, anatoly.burakov, vladimir.medvedkin, reshma.pattan, thomas, andrew.rybchenko, marek.kasiewicz On Wed, 29 Apr 2026 03:31:10 -0400 Dawid Wesierski <dawid.wesierski@intel.com> wrote: > +static inline 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) > +{ > + return rte_pcapng_copy_ts(port_id, queue, m, mp, length, direction, > + comment, 0); > +} > Turning a function that existed in previous release into a inline breaks ABI compatibility. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 6/7] pcapng: add user-supplied timestamp support [not found] ` <20260429073111.3712950-7-dawid.wesierski@intel.com> 2026-04-30 14:05 ` [PATCH 6/7] pcapng: add user-supplied timestamp support Stephen Hemminger 2026-04-30 14:06 ` Stephen Hemminger @ 2026-04-30 14:09 ` Stephen Hemminger 2026-06-08 16:38 ` Stephen Hemminger 3 siblings, 0 replies; 6+ messages in thread From: Stephen Hemminger @ 2026-04-30 14:09 UTC (permalink / raw) To: Dawid Wesierski Cc: dev, bruce.richardson, anatoly.burakov, vladimir.medvedkin, reshma.pattan, thomas, andrew.rybchenko, marek.kasiewicz On Wed, 29 Apr 2026 03:31:10 -0400 Dawid Wesierski <dawid.wesierski@intel.com> wrote: > From: Marek Kasiewicz <marek.kasiewicz@intel.com> > > Add rte_pcapng_copy_ts() which accepts an optional timestamp parameter > in nanoseconds. When the timestamp is non-zero, it is used directly > instead of reading the TSC. This allows applications to provide > hardware PTP timestamps from the NIC, enabling accurate packet capture > with PTP-domain timing rather than host-local TSC values. Also, the HW timestamp would have to be in ns since Unix Epoch not what HW clock is. That is a hard thing to do... I would rather have the pcapng infrastructure know how to use hardware timestamp dynamic field if present. But the problem is getting the conversion right; it would have to compute offset and resolution per NIC, and NIC's roll over too fast. The problem is hard. Bottom line: needs lots more work ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 6/7] pcapng: add user-supplied timestamp support [not found] ` <20260429073111.3712950-7-dawid.wesierski@intel.com> ` (2 preceding siblings ...) 2026-04-30 14:09 ` Stephen Hemminger @ 2026-06-08 16:38 ` Stephen Hemminger 3 siblings, 0 replies; 6+ messages in thread From: Stephen Hemminger @ 2026-06-08 16:38 UTC (permalink / raw) To: Dawid Wesierski Cc: dev, bruce.richardson, anatoly.burakov, vladimir.medvedkin, reshma.pattan, thomas, andrew.rybchenko, marek.kasiewicz On Wed, 29 Apr 2026 03:31:10 -0400 Dawid Wesierski <dawid.wesierski@intel.com> wrote: > @@ -737,16 +736,6 @@ rte_pcapng_write_packets(rte_pcapng_t *self, > return -1; > } > > - /* > - * When data is captured by pcapng_copy the current TSC is stored. > - * Adjust the value recorded in file to PCAP epoch units. > - */ > - 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; > - > /* > * Handle case of highly fragmented and large burst size > * Note: this assumes that max segments per mbuf < IOV_MAX > diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h NAK You need to keep the correct timestamp correction. PCAPNG specifies times as nanoseconds since 1/1/1970. Any new API needs a test as well. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/7] intel network and pcapng updates @ 2026-06-08 16:40 Dawid Wesierski 2026-06-08 16:40 ` [PATCH 6/7] pcapng: add user-supplied timestamp support Dawid Wesierski 0 siblings, 1 reply; 6+ messages in thread From: Dawid Wesierski @ 2026-06-08 16:40 UTC (permalink / raw) To: dev Cc: thomas, david.marchand, vladimir.medvedkin, bruce.richardson, anatoly.burakov, reshma.pattan, stephen, Wesierski, Dawid From: "Wesierski, Dawid" <dawid.wesierski@intel.com> These patches provide various updates for Intel iavf/ice drivers and pcapng. The changes include: - Hardware limit ring descriptor increases for iavf. - Runtime queue rate limit configuration for iavf. - Scheduler burst size reductions for ice base. - Global PTP timestamping for ice. - Disabling runtime queue setup for iavf. - User-supplied timestamp support in pcapng. - Header split mbuf callback support for ice. Marek Kasiewicz (7): net/iavf: increase max ring descriptors to hardware limit net/iavf: allow runtime queue rate limit configuration net/ice/base: reduce default scheduler burst size net/ice: timestamp all received packets when PTP is enabled net/iavf: disable runtime queue setup capability pcapng: add user-supplied timestamp support net/ice: add header split mbuf callback support drivers/net/intel/common/rx.h | 2 + drivers/net/intel/iavf/iavf_ethdev.c | 3 -- drivers/net/intel/iavf/iavf_rxtx.h | 2 +- drivers/net/intel/iavf/iavf_tm.c | 11 ++-- drivers/net/intel/ice/base/ice_type.h | 2 +- drivers/net/intel/ice/ice_ethdev.c | 1 + drivers/net/intel/ice/ice_rxtx.c | 72 ++++++++++++++++++++++++--- drivers/net/intel/ice/ice_rxtx.h | 2 + lib/ethdev/ethdev_driver.h | 10 ++++ lib/ethdev/rte_ethdev.c | 17 +++++++ lib/ethdev/rte_ethdev.h | 46 +++++++++++++++++ lib/pcapng/rte_pcapng.c | 19 ++----- lib/pcapng/rte_pcapng.h | 41 ++++++++++++++- 13 files changed, 196 insertions(+), 32 deletions(-) -- 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 [flat|nested] 6+ messages in thread
* [PATCH 6/7] pcapng: add user-supplied timestamp support 2026-06-08 16:40 [PATCH 0/7] intel network and pcapng updates Dawid Wesierski @ 2026-06-08 16:40 ` Dawid Wesierski 2026-06-08 17:09 ` Stephen Hemminger 0 siblings, 1 reply; 6+ messages in thread From: Dawid Wesierski @ 2026-06-08 16:40 UTC (permalink / raw) To: dev Cc: thomas, david.marchand, vladimir.medvedkin, bruce.richardson, anatoly.burakov, reshma.pattan, stephen, Marek Kasiewicz, Dawid Wesierski From: Marek Kasiewicz <marek.kasiewicz@intel.com> Add rte_pcapng_copy_ts() which accepts an optional timestamp parameter in nanoseconds. When the timestamp is non-zero, it is used directly instead of reading the TSC. This allows applications to provide hardware PTP timestamps from the NIC, enabling accurate packet capture with PTP-domain timing rather than host-local TSC values. The existing rte_pcapng_copy() function is preserved as a static inline wrapper that passes zero for backward compatibility. The TSC-to-epoch conversion in the write path is removed since callers providing hardware timestamps have already performed the conversion. Signed-off-by: Marek Kasiewicz <marek.kasiewicz@intel.com> Signed-off-by: Dawid Wesierski <dawid.wesierski@intel.com> --- lib/pcapng/rte_pcapng.c | 19 ++++--------------- lib/pcapng/rte_pcapng.h | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c index b5d1026891..96b3aafeb6 100644 --- a/lib/pcapng/rte_pcapng.c +++ b/lib/pcapng/rte_pcapng.c @@ -546,14 +546,14 @@ 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) +RTE_EXPORT_SYMBOL(rte_pcapng_copy_ts) struct rte_mbuf * -rte_pcapng_copy(uint16_t port_id, uint32_t queue, +rte_pcapng_copy_ts(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 ts) { struct pcapng_enhance_packet_block *epb; uint32_t orig_len, pkt_len, padding, flags; @@ -691,7 +691,7 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue, mc->port = port_id; /* Put timestamp in cycles here - adjust in packet write */ - timestamp = rte_get_tsc_cycles(); + timestamp = ts ? ts : rte_get_tsc_cycles(); epb->timestamp_hi = timestamp >> 32; epb->timestamp_lo = (uint32_t)timestamp; epb->capture_length = pkt_len; @@ -720,7 +720,6 @@ rte_pcapng_write_packets(rte_pcapng_t *self, for (i = 0; i < nb_pkts; i++) { struct rte_mbuf *m = pkts[i]; struct pcapng_enhance_packet_block *epb; - uint64_t cycles, timestamp; /* sanity check that is really a pcapng mbuf */ epb = rte_pktmbuf_mtod(m, struct pcapng_enhance_packet_block *); @@ -737,16 +736,6 @@ rte_pcapng_write_packets(rte_pcapng_t *self, return -1; } - /* - * When data is captured by pcapng_copy the current TSC is stored. - * Adjust the value recorded in file to PCAP epoch units. - */ - 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; - /* * Handle case of highly fragmented and large burst size * Note: this assumes that max segments per mbuf < IOV_MAX diff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h index d8d328f710..3d735e4ebe 100644 --- a/lib/pcapng/rte_pcapng.h +++ b/lib/pcapng/rte_pcapng.h @@ -109,7 +109,7 @@ enum rte_pcapng_direction { }; /** - * Format an mbuf for writing to file. + * Format an mbuf with time stamp for writing to file. * * @param port_id * The Ethernet port on which packet was received @@ -129,16 +129,53 @@ enum rte_pcapng_direction { * @param comment * Optional per packet comment. * Truncated to UINT16_MAX characters. + * @param ts + * Optional timestamp in nanoseconds. If zero, the current TSC is used. * * @return * - The pointer to the new mbuf formatted for pcapng_write * - NULL on error such as invalid port or out of memory. */ struct rte_mbuf * +rte_pcapng_copy_ts(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, uint64_t ts); + +/** + * Format an mbuf for writing to file. + * + * @param port_id + * The Ethernet port on which packet was received + * or is going to be transmitted. + * @param queue + * The queue on the Ethernet port where packet was received + * or is going to be transmitted. + * @param mp + * The mempool from which the "clone" mbufs are allocated. + * @param m + * The mbuf to copy + * @param length + * The upper limit on bytes to copy. Passing UINT32_MAX + * means all data (after offset). + * @param direction + * The direction of the packer: receive, transmit or unknown. + * @param comment + * Packet comment. + * + * @return + * - The pointer to the new mbuf formatted for pcapng_write + * - NULL if allocation fails. + */ +static inline 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) +{ + return rte_pcapng_copy_ts(port_id, queue, m, mp, length, direction, + comment, 0); +} /** -- 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 [flat|nested] 6+ messages in thread
* Re: [PATCH 6/7] pcapng: add user-supplied timestamp support 2026-06-08 16:40 ` [PATCH 6/7] pcapng: add user-supplied timestamp support Dawid Wesierski @ 2026-06-08 17:09 ` Stephen Hemminger 0 siblings, 0 replies; 6+ messages in thread From: Stephen Hemminger @ 2026-06-08 17:09 UTC (permalink / raw) To: Dawid Wesierski Cc: dev, thomas, david.marchand, vladimir.medvedkin, bruce.richardson, anatoly.burakov, reshma.pattan, Marek Kasiewicz On Mon, 8 Jun 2026 12:40:58 -0400 Dawid Wesierski <dawid.wesierski@intel.com> wrote: > @@ -737,16 +736,6 @@ rte_pcapng_write_packets(rte_pcapng_t *self, > return -1; > } > > - /* > - * When data is captured by pcapng_copy the current TSC is stored. > - * Adjust the value recorded in file to PCAP epoch units. > - */ > - 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; > - You can't generate valid pcapng timestamps without this. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-08 17:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260429073111.3712950-1-dawid.wesierski@intel.com>
[not found] ` <20260429073111.3712950-7-dawid.wesierski@intel.com>
2026-04-30 14:05 ` [PATCH 6/7] pcapng: add user-supplied timestamp support Stephen Hemminger
2026-04-30 14:06 ` Stephen Hemminger
2026-04-30 14:09 ` Stephen Hemminger
2026-06-08 16:38 ` Stephen Hemminger
2026-06-08 16:40 [PATCH 0/7] intel network and pcapng updates Dawid Wesierski
2026-06-08 16:40 ` [PATCH 6/7] pcapng: add user-supplied timestamp support Dawid Wesierski
2026-06-08 17:09 ` Stephen Hemminger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox