patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Isaac Boukris <iboukris@gmail.com>, dpdk stable <stable@dpdk.org>
Subject: patch 'app/dumpcap: allow multiple invocations' has been queued to stable release 21.11.6
Date: Thu,  7 Dec 2023 11:21:01 +0000	[thread overview]
Message-ID: <20231207112116.769502-9-ktraynor@redhat.com> (raw)
In-Reply-To: <20231207112116.769502-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to stable release 21.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/12/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/952d7028792c77ad14e64bb596fb005c48f274ee

Thanks.

Kevin

---
From 952d7028792c77ad14e64bb596fb005c48f274ee Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri, 17 Nov 2023 08:35:56 -0800
Subject: [PATCH] app/dumpcap: allow multiple invocations

[ upstream commit e0235c0e4d40a6d93dfef8b1316e03c32f2f8b43 ]

If dumpcap is run twice with each instance pointing a different
interface, it would fail because of overlap in ring a pool names.
Fix by putting process id in the name.

It is still not allowed to do multiple invocations on the same
interface because only one callback is allowed and only one copy
of mbuf is done. Dumpcap will fail with error in this case:

   pdump_prepare_client_request(): client request for pdump enable/disable failed
   EAL: Error - exiting with code: 1
     Cause: Packet dump enable on 0:net_null0 failed File exists

Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application")

Reported-by: Isaac Boukris <iboukris@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/dumpcap/main.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 4a76cc3d05..74dd72b3ac 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -45,5 +45,4 @@
 #include <pcap/bpf.h>
 
-#define RING_NAME "capture-ring"
 #define MONITOR_INTERVAL  (500 * 1000)
 #define MBUF_POOL_CACHE_SIZE 32
@@ -540,4 +539,5 @@ static struct rte_ring *create_ring(void)
 {
 	struct rte_ring *ring;
+	char ring_name[RTE_RING_NAMESIZE];
 	size_t size, log2;
 
@@ -553,12 +553,14 @@ static struct rte_ring *create_ring(void)
 	}
 
-	ring = rte_ring_lookup(RING_NAME);
-	if (ring == NULL) {
-		ring = rte_ring_create(RING_NAME, ring_size,
-					rte_socket_id(), 0);
-		if (ring == NULL)
-			rte_exit(EXIT_FAILURE, "Could not create ring :%s\n",
-				 rte_strerror(rte_errno));
-	}
+	/* Want one ring per invocation of program */
+	snprintf(ring_name, sizeof(ring_name),
+		 "dumpcap-%d", getpid());
+
+	ring = rte_ring_create(ring_name, ring_size,
+			       rte_socket_id(), 0);
+	if (ring == NULL)
+		rte_exit(EXIT_FAILURE, "Could not create ring :%s\n",
+			 rte_strerror(rte_errno));
+
 	return ring;
 }
@@ -566,11 +568,9 @@ static struct rte_ring *create_ring(void)
 static struct rte_mempool *create_mempool(void)
 {
-	static const char pool_name[] = "capture_mbufs";
+	char pool_name[RTE_MEMPOOL_NAMESIZE];
 	size_t num_mbufs = 2 * ring_size;
 	struct rte_mempool *mp;
 
-	mp = rte_mempool_lookup(pool_name);
-	if (mp)
-		return mp;
+	snprintf(pool_name, sizeof(pool_name), "capture_%d", getpid());
 
 	mp = rte_pktmbuf_pool_create_by_ops(pool_name, num_mbufs,
-- 
2.43.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-12-07 11:18:59.837862786 +0000
+++ 0009-app-dumpcap-allow-multiple-invocations.patch	2023-12-07 11:18:59.620873903 +0000
@@ -1 +1 @@
-From e0235c0e4d40a6d93dfef8b1316e03c32f2f8b43 Mon Sep 17 00:00:00 2001
+From 952d7028792c77ad14e64bb596fb005c48f274ee Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e0235c0e4d40a6d93dfef8b1316e03c32f2f8b43 ]
+
@@ -19 +20,0 @@
-Cc: stable@dpdk.org
@@ -24,2 +25,2 @@
- app/dumpcap/main.c | 28 ++++++++++++++--------------
- 1 file changed, 14 insertions(+), 14 deletions(-)
+ app/dumpcap/main.c | 26 +++++++++++++-------------
+ 1 file changed, 13 insertions(+), 13 deletions(-)
@@ -28 +29 @@
-index 4f581bd341..d05dddac00 100644
+index 4a76cc3d05..74dd72b3ac 100644
@@ -37 +38 @@
-@@ -648,4 +647,5 @@ static struct rte_ring *create_ring(void)
+@@ -540,4 +539,5 @@ static struct rte_ring *create_ring(void)
@@ -43 +44 @@
-@@ -661,12 +661,14 @@ static struct rte_ring *create_ring(void)
+@@ -553,12 +553,14 @@ static struct rte_ring *create_ring(void)
@@ -66 +67,2 @@
-@@ -675,12 +677,10 @@ static struct rte_mempool *create_mempool(void)
+@@ -566,11 +568,9 @@ static struct rte_ring *create_ring(void)
+ static struct rte_mempool *create_mempool(void)
@@ -68 +69,0 @@
- 	const struct interface *intf;
@@ -73 +73,0 @@
- 	uint32_t data_size = 128;
@@ -80,8 +80 @@
- 	/* Common pool so size mbuf for biggest snap length */
-@@ -827,5 +827,5 @@ static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp)
- 				"Packet dump enable on %u:%s failed %s\n",
- 				intf->port, intf->name,
--				rte_strerror(-ret));
-+				rte_strerror(rte_errno));
- 		}
- 
+ 	mp = rte_pktmbuf_pool_create_by_ops(pool_name, num_mbufs,


  parent reply	other threads:[~2023-12-07 11:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 11:20 patch 'net/txgbe: fix out of bound access' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: fix hns3 build option about max queue number' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: update features in hns3 guide' " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: fix RSS flow description " Kevin Traynor
2023-12-07 11:20 ` patch 'doc: update versions recommendations for i40e and ice' " Kevin Traynor
2023-12-07 11:20 ` patch 'examples/ipsec-secgw: fix partial overflow' " Kevin Traynor
2023-12-07 11:20 ` patch 'eal/windows: fix build with recent MinGW' " Kevin Traynor
2023-12-07 11:21 ` patch 'pdump: fix error number on IPC response' " Kevin Traynor
2023-12-07 11:21 ` Kevin Traynor [this message]
2023-12-07 11:21 ` patch 'examples/ethtool: fix pause configuration' " Kevin Traynor
2023-12-07 11:21 ` patch 'test/hash: fix creation error log' " Kevin Traynor
2023-12-07 11:21 ` patch 'app/pipeline: add sigint handler' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: remove restriction on ixgbe vector support' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: fix some ordered lists' " Kevin Traynor
2023-12-07 11:21 ` patch 'doc: remove number of commands in vDPA guide' " Kevin Traynor
2023-12-07 11:21 ` patch 'mempool: fix get function documentation' " Kevin Traynor
2023-12-07 11:21 ` patch 'mempool: clarify enqueue/dequeue ops " Kevin Traynor
2023-12-07 11:21 ` patch 'ethdev: fix ESP packet type description' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix ignored reset event' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix reset event status' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/hns3: fix VF reset handler interruption' " Kevin Traynor
2023-12-07 11:21 ` patch 'net/af_xdp: make compatible with libbpf 0.8.0' " Kevin Traynor
2023-12-07 14:16   ` Kevin Traynor
2023-12-11 12:44     ` Loftus, Ciara
2023-12-11 15:27       ` Kevin Traynor

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=20231207112116.769502-9-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=iboukris@gmail.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;
as well as URLs for NNTP newsgroup(s).