* [PATCH 1/2] net/pcap: fix Rx timestamp in secondary process
@ 2026-11-14 18:57 Stephen Hemminger
2026-11-14 18:57 ` [PATCH 2/2] net/pcap: handle > 64K packets in capture file Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2026-11-14 18:57 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, stable
The offset and flag of the Rx timestamp dynamic field are the same
in all processes, but the driver keeps them in static variables
which are only set in dev_configure. A secondary process does not
configure the port, so its copy of the offset is still -1 while the
shared device data says the offload is enabled. The Rx burst then
stores the timestamp over buf_addr of the mbuf.
Move the offset and flag into the device private data, which is
shared with secondary processes.
Bugzilla ID: 2128
Fixes: 32fd14bf07f8 ("net/pcap: support nanosecond timestamp precision")
Cc: stable@dpdk.org
Reported-by: Anthropic OSS Scanner (ANT-2026-80N5ICNL)
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/pcap/pcap_ethdev.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index 1e114e0008..b89f4a0c2e 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -60,9 +60,6 @@ static struct timespec start_time;
static uint64_t start_cycles;
static uint64_t hz;
-static uint64_t timestamp_rx_dynflag;
-static int timestamp_dynfield_offset = -1;
-
struct queue_stat {
volatile unsigned long pkts;
volatile unsigned long bytes;
@@ -122,6 +119,8 @@ struct pmd_internals {
bool rx_scatter;
bool timestamp_offloading;
bool lsc_active;
+ int timestamp_dynfield_offset;
+ uint64_t timestamp_rx_dynflag;
};
struct pmd_process_private {
@@ -268,6 +267,7 @@ eth_pcap_rx_infinite(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
{
int i;
struct pcap_rx_queue *pcap_q = queue;
+ struct pmd_internals *internals = rte_eth_devices[pcap_q->port_id].data->dev_private;
uint32_t rx_bytes = 0;
if (unlikely(nb_pkts == 0))
@@ -296,9 +296,9 @@ eth_pcap_rx_infinite(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
struct timespec ts;
timespec_get(&ts, TIME_UTC);
- *RTE_MBUF_DYNFIELD(bufs[i], timestamp_dynfield_offset,
+ *RTE_MBUF_DYNFIELD(bufs[i], internals->timestamp_dynfield_offset,
rte_mbuf_timestamp_t *) = rte_timespec_to_ns(&ts);
- bufs[i]->ol_flags |= timestamp_rx_dynflag;
+ bufs[i]->ol_flags |= internals->timestamp_rx_dynflag;
}
rx_bytes += bufs[i]->data_len;
@@ -420,10 +420,10 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
uint64_t ns = (uint64_t)header->ts.tv_sec * NSEC_PER_SEC
+ header->ts.tv_usec;
- *RTE_MBUF_DYNFIELD(mbuf, timestamp_dynfield_offset,
+ *RTE_MBUF_DYNFIELD(mbuf, internals->timestamp_dynfield_offset,
rte_mbuf_timestamp_t *) = ns;
- mbuf->ol_flags |= timestamp_rx_dynflag;
+ mbuf->ol_flags |= internals->timestamp_rx_dynflag;
}
mbuf->port = pcap_q->port_id;
@@ -1027,9 +1027,9 @@ eth_dev_configure(struct rte_eth_dev *dev)
internals->rx_scatter = !!(rxmode->offloads & RTE_ETH_RX_OFFLOAD_SCATTER);
internals->timestamp_offloading = !!(rxmode->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP);
- if (internals->timestamp_offloading && timestamp_rx_dynflag == 0) {
- int ret = rte_mbuf_dyn_rx_timestamp_register(×tamp_dynfield_offset,
- ×tamp_rx_dynflag);
+ if (internals->timestamp_offloading && internals->timestamp_rx_dynflag == 0) {
+ int ret = rte_mbuf_dyn_rx_timestamp_register(&internals->timestamp_dynfield_offset,
+ &internals->timestamp_rx_dynflag);
if (ret != 0) {
PMD_LOG(ERR, "Failed to register Rx timestamp field/flag");
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] net/pcap: handle > 64K packets in capture file
2026-11-14 18:57 [PATCH 1/2] net/pcap: fix Rx timestamp in secondary process Stephen Hemminger
@ 2026-11-14 18:57 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-11-14 18:57 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, stable, Sergio Gonzalez Monroy, John McNamara,
Tero Aho
If a pcap file given to the pcap PMD had a super jumbo frame
there would be a silent truncation and also the driver was not
checking for excessive number of mbuf segments.
Bugzilla ID: 2129
Fixes: 6db141c91e1f ("pcap: support jumbo frames")
Cc: stable@dpdk.org
Reported-by: Anthropic OSS scanner (ANT-2026-VD4V3KPV)
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/pcap/pcap_ethdev.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index b89f4a0c2e..fb18f0932b 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -226,7 +226,7 @@ queue_missed_stat_get(struct rte_eth_dev *dev, unsigned int qid)
static int
eth_pcap_rx_jumbo(struct rte_mempool *mb_pool, struct rte_mbuf *mbuf,
- const u_char *data, uint16_t data_len)
+ const u_char *data, uint32_t data_len)
{
/* Copy the first segment. */
uint16_t len = rte_pktmbuf_tailroom(mbuf);
@@ -237,9 +237,12 @@ eth_pcap_rx_jumbo(struct rte_mempool *mb_pool, struct rte_mbuf *mbuf,
data += len;
while (data_len > 0) {
+ /* Avoid excessively long chain */
+ if (mbuf->nb_segs + 1 > RTE_MBUF_MAX_NB_SEGS)
+ return -1;
+
/* Allocate next mbuf and point to that. */
m->next = rte_pktmbuf_alloc(mb_pool);
-
if (unlikely(!m->next))
return -1;
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-14 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14 18:57 [PATCH 1/2] net/pcap: fix Rx timestamp in secondary process Stephen Hemminger
2026-11-14 18:57 ` [PATCH 2/2] net/pcap: handle > 64K packets in capture file Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox