All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] app/pdump: make dpdk-pdump can run multiple simultaneously
@ 2023-05-06  8:52 Chaoyong He
  2023-05-06 15:47 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Chaoyong He @ 2023-05-06  8:52 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Peng Zhang, Chaoyong He

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] app/pdump: make dpdk-pdump can run multiple simultaneously
  2023-05-06  8:52 [PATCH] app/pdump: make dpdk-pdump can run multiple simultaneously Chaoyong He
@ 2023-05-06 15:47 ` Stephen Hemminger
  2023-05-08  2:52   ` Nole Zhang
  2023-05-08  3:17   ` Chaoyong He
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Hemminger @ 2023-05-06 15:47 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, niklas.soderlund, Peng Zhang

On Sat,  6 May 2023 16:52:06 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> 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>

FYI - app/dumpcap does support multiple ports already.
Why not use that?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] app/pdump: make dpdk-pdump can run multiple simultaneously
  2023-05-06 15:47 ` Stephen Hemminger
@ 2023-05-08  2:52   ` Nole Zhang
  2023-05-08  3:17   ` Chaoyong He
  1 sibling, 0 replies; 4+ messages in thread
From: Nole Zhang @ 2023-05-08  2:52 UTC (permalink / raw)
  To: Stephen Hemminger, Chaoyong He; +Cc: dev, oss-drivers, Niklas Soderlund



> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Saturday, May 6, 2023 11:48 PM
> To: Chaoyong He <chaoyong.he@corigine.com>
> Cc: dev@dpdk.org; oss-drivers <oss-drivers@corigine.com>; Niklas
> Soderlund <niklas.soderlund@corigine.com>; Nole Zhang
> <peng.zhang@nephogine.com>
> Subject: Re: [PATCH] app/pdump: make dpdk-pdump can run multiple
> simultaneously
> 
> On Sat,  6 May 2023 16:52:06 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > 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>
> 
> FYI - app/dumpcap does support multiple ports already.
> Why not use that?
Yes, you are right, I will abandon this patch, thanks for your reply


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] app/pdump: make dpdk-pdump can run multiple simultaneously
  2023-05-06 15:47 ` Stephen Hemminger
  2023-05-08  2:52   ` Nole Zhang
@ 2023-05-08  3:17   ` Chaoyong He
  1 sibling, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2023-05-08  3:17 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, oss-drivers, Niklas Soderlund, Nole Zhang



> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Saturday, May 6, 2023 11:48 PM
> To: Chaoyong He <chaoyong.he@corigine.com>
> Cc: dev@dpdk.org; oss-drivers <oss-drivers@corigine.com>; Niklas Soderlund
> <niklas.soderlund@corigine.com>; Nole Zhang
> <peng.zhang@nephogine.com>
> Subject: Re: [PATCH] app/pdump: make dpdk-pdump can run multiple
> simultaneously
> 
> On Sat,  6 May 2023 16:52:06 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > 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>
> 
> FYI - app/dumpcap does support multiple ports already.
> Why not use that?

Yes, you are right.
I will abandon this patch, thanks for your reply.

Should I change the state of this patch into 'Not Applicable' or other?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-08  7:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-06  8:52 [PATCH] app/pdump: make dpdk-pdump can run multiple simultaneously Chaoyong He
2023-05-06 15:47 ` Stephen Hemminger
2023-05-08  2:52   ` Nole Zhang
2023-05-08  3:17   ` Chaoyong He

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.