DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
	Peng Zhang <peng.zhang@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH] app/pdump: make dpdk-pdump can run multiple simultaneously
Date: Sat,  6 May 2023 16:52:06 +0800	[thread overview]
Message-ID: <20230506085206.475810-1-chaoyong.he@corigine.com> (raw)

From: Peng Zhang <peng.zhang@corigine.com>

The pdump doesn't support start the multiple separate process for different
queues or ports to monitor the packets, because it apply the same name for
memory space. This commit will use the device_id, port and queue to name
the memory space and it will support this function.

Adjust the value of RTE_MEMZONE_NAMESIZE to adapt the name length.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 app/pdump/main.c              | 37 +++++++++++++++++++++++------------
 lib/eal/include/rte_memzone.h |  2 +-
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index c6cf9d9c87..d5d73b57f5 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -42,15 +42,15 @@
 #define PDUMP_MSIZE_ARG "mbuf-size"
 #define PDUMP_NUM_MBUFS_ARG "total-num-mbufs"
 
-#define VDEV_NAME_FMT "net_pcap_%s_%d"
+#define VDEV_NAME_FMT "net_pcap_%s_%s_p%d_q%d_%d"
 #define VDEV_PCAP_ARGS_FMT "tx_pcap=%s"
 #define VDEV_IFACE_ARGS_FMT "tx_iface=%s"
 #define TX_STREAM_SIZE 64
 
-#define MP_NAME "pdump_pool_%d"
+#define MP_NAME "pdump_pool_%s_p%d_q%d_%d"
 
-#define RX_RING "rx_ring_%d"
-#define TX_RING "tx_ring_%d"
+#define RX_RING "rx_ring_%s_p%d_q%d_%d"
+#define TX_RING "tx_ring_%s_p%d_q%d_%d"
 
 #define RX_STR "rx"
 #define TX_STR "tx"
@@ -633,11 +633,14 @@ create_mp_ring_vdev(void)
 	char vdev_name[SIZE];
 	char vdev_args[SIZE];
 	char ring_name[SIZE];
+	const char *device_name;
 	char mempool_name[SIZE];
 
 	for (i = 0; i < num_tuples; i++) {
 		pt = &pdump_t[i];
-		snprintf(mempool_name, SIZE, MP_NAME, i);
+		device_name = pt->device_id != NULL ?  pt->device_id : "dev";
+		snprintf(mempool_name, SIZE, MP_NAME, device_name, pt->port,
+			  pt->queue, i);
 		mbuf_pool = rte_mempool_lookup(mempool_name);
 		if (mbuf_pool == NULL) {
 			/* create mempool */
@@ -658,7 +661,8 @@ create_mp_ring_vdev(void)
 		if (pt->dir == RTE_PDUMP_FLAG_RXTX) {
 			/* if captured packets has to send to the same vdev */
 			/* create rx_ring */
-			snprintf(ring_name, SIZE, RX_RING, i);
+			snprintf(ring_name, SIZE, RX_RING, device_name,
+				 pt->port, pt->queue, i);
 			pt->rx_ring = rte_ring_create(ring_name, pt->ring_size,
 					rte_socket_id(), 0);
 			if (pt->rx_ring == NULL) {
@@ -669,7 +673,8 @@ create_mp_ring_vdev(void)
 			}
 
 			/* create tx_ring */
-			snprintf(ring_name, SIZE, TX_RING, i);
+			snprintf(ring_name, SIZE, TX_RING, device_name,
+				 pt->port, pt->queue, i);
 			pt->tx_ring = rte_ring_create(ring_name, pt->ring_size,
 					rte_socket_id(), 0);
 			if (pt->tx_ring == NULL) {
@@ -681,7 +686,8 @@ create_mp_ring_vdev(void)
 
 			/* create vdevs */
 			snprintf(vdev_name, sizeof(vdev_name),
-				 VDEV_NAME_FMT, RX_STR, i);
+				 VDEV_NAME_FMT, RX_STR, device_name,
+				 pt->port, pt->queue, i);
 			(pt->rx_vdev_stream_type == IFACE) ?
 			snprintf(vdev_args, sizeof(vdev_args),
 				 VDEV_IFACE_ARGS_FMT, pt->rx_dev) :
@@ -711,7 +717,8 @@ create_mp_ring_vdev(void)
 				pt->tx_vdev_id = portid;
 			else {
 				snprintf(vdev_name, sizeof(vdev_name),
-					 VDEV_NAME_FMT, TX_STR, i);
+					 VDEV_NAME_FMT, TX_STR, device_name,
+					 pt->port, pt->queue, i);
 				(pt->rx_vdev_stream_type == IFACE) ?
 				snprintf(vdev_args, sizeof(vdev_args),
 					 VDEV_IFACE_ARGS_FMT, pt->tx_dev) :
@@ -741,7 +748,8 @@ create_mp_ring_vdev(void)
 		} else if (pt->dir == RTE_PDUMP_FLAG_RX) {
 
 			/* create rx_ring */
-			snprintf(ring_name, SIZE, RX_RING, i);
+			snprintf(ring_name, SIZE, RX_RING, device_name,
+				 pt->port, pt->queue, i);
 			pt->rx_ring = rte_ring_create(ring_name, pt->ring_size,
 					rte_socket_id(), 0);
 			if (pt->rx_ring == NULL) {
@@ -751,7 +759,8 @@ create_mp_ring_vdev(void)
 			}
 
 			snprintf(vdev_name, sizeof(vdev_name),
-				 VDEV_NAME_FMT, RX_STR, i);
+				 VDEV_NAME_FMT, RX_STR, device_name,
+				 pt->port, pt->queue, i);
 			(pt->rx_vdev_stream_type == IFACE) ?
 			snprintf(vdev_args, sizeof(vdev_args),
 				 VDEV_IFACE_ARGS_FMT, pt->rx_dev) :
@@ -778,7 +787,8 @@ create_mp_ring_vdev(void)
 		} else if (pt->dir == RTE_PDUMP_FLAG_TX) {
 
 			/* create tx_ring */
-			snprintf(ring_name, SIZE, TX_RING, i);
+			snprintf(ring_name, SIZE, TX_RING, device_name,
+				 pt->port, pt->queue, i);
 			pt->tx_ring = rte_ring_create(ring_name, pt->ring_size,
 					rte_socket_id(), 0);
 			if (pt->tx_ring == NULL) {
@@ -788,7 +798,8 @@ create_mp_ring_vdev(void)
 			}
 
 			snprintf(vdev_name, sizeof(vdev_name),
-				 VDEV_NAME_FMT, TX_STR, i);
+				 VDEV_NAME_FMT, TX_STR, device_name,
+				 pt->port, pt->queue, i);
 			(pt->tx_vdev_stream_type == IFACE) ?
 			snprintf(vdev_args, sizeof(vdev_args),
 				 VDEV_IFACE_ARGS_FMT, pt->tx_dev) :
diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h
index 5302caa437..b8c7a86517 100644
--- a/lib/eal/include/rte_memzone.h
+++ b/lib/eal/include/rte_memzone.h
@@ -47,7 +47,7 @@ extern "C" {
  */
 struct rte_memzone {
 
-#define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
+#define RTE_MEMZONE_NAMESIZE 64       /**< Maximum length of memory zone name.*/
 	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
 
 	rte_iova_t iova;                  /**< Start IO address. */
-- 
2.39.1


             reply	other threads:[~2023-05-06  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06  8:52 Chaoyong He [this message]
2023-05-06 15:47 ` Stephen Hemminger
2023-05-08  2:52   ` Nole Zhang
2023-05-08  3:17   ` Chaoyong He

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=20230506085206.475810-1-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    /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).