From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
stable@dpdk.org, Reshma Pattan <reshma.pattan@intel.com>
Subject: [PATCH 1/4] app/dumpcap: fix packet count overshoot
Date: Tue, 17 Nov 2026 08:06:19 -0800 [thread overview]
Message-ID: <20261117160727.388470-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20261117160727.388470-1-stephen@networkplumber.org>
When a packet count was given with -c or -a packets:NUM,
the capture could write up to a whole burst (32) of extra
packets because the count was only checked after each burst.
Limit the burst to the number of packets still wanted.
Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/dumpcap/main.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 46a6cb251e..c4790988e5 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -945,12 +945,15 @@ pcap_write_packets(pcap_dumper_t *dumper,
static int process_ring(dumpcap_out_t out, struct rte_ring *r)
{
struct rte_mbuf *pkts[BURST_SIZE];
- unsigned int avail, n;
+ unsigned int avail, n, burst = BURST_SIZE;
static unsigned int empty_count;
ssize_t written;
- n = rte_ring_sc_dequeue_burst(r, (void **) pkts, BURST_SIZE,
- &avail);
+ /* don't capture more than the requested number of packets */
+ if (stop.packets != 0 && stop.packets - packets_received < burst)
+ burst = stop.packets - packets_received;
+
+ n = rte_ring_sc_dequeue_burst(r, (void **) pkts, burst, &avail);
if (n == 0) {
/* don't consume endless amounts of cpu if idle */
if (empty_count < SLEEP_THRESHOLD)
--
2.53.0
next prev parent reply other threads:[~2026-11-17 16:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 16:06 [PATCH 0/4] app/dumpcap: assorted fixes Stephen Hemminger
2026-11-17 16:06 ` Stephen Hemminger [this message]
2026-11-17 16:06 ` [PATCH 2/4] app/dumpcap: fix capture duration Stephen Hemminger
2026-11-17 16:06 ` [PATCH 3/4] app/dumpcap: fix pcap timestamps Stephen Hemminger
2026-11-17 16:06 ` [PATCH 4/4] app/dumpcap: do not use rte_exit before EAL init Stephen Hemminger
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=20261117160727.388470-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=reshma.pattan@intel.com \
--cc=stable@dpdk.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