DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/pdump: enhance to support multi-core capture
@ 2019-03-28  6:00 Vipin Varghese
  2019-03-28  6:00 ` Vipin Varghese
  2019-03-28 14:57 ` [dpdk-dev] [PATCH v2] " Vipin Varghese
  0 siblings, 2 replies; 64+ messages in thread
From: Vipin Varghese @ 2019-03-28  6:00 UTC (permalink / raw)
  To: dev, marko.kovacevic, reshma.pattan
  Cc: keith.wiles, john.mcnamara, stephen1.byrne, amit.tamboli,
	sanjay.padubidri, amool.patel, Vipin Varghese

Enhance pdump application, to allow user to run on multiple cores.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---
 app/pdump/main.c           | 73 ++++++++++++++++++++++++++++++++------
 doc/guides/tools/pdump.rst |  5 +++
 2 files changed, 67 insertions(+), 11 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index ccf2a1d2f..110fd59d9 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -62,6 +62,7 @@
 #define SIZE 256
 #define BURST_SIZE 32
 #define NUM_VDEVS 2
+#define COREMASK_SIZE 32
 
 /* true if x is a power of 2 */
 #define POWEROF2(x) ((((x)-1) & (x)) == 0)
@@ -144,7 +145,7 @@ static volatile uint8_t quit_signal;
 static void
 pdump_usage(const char *prgname)
 {
-	printf("usage: %s [EAL options] -- --pdump "
+	printf("usage: %s [EAL options] -- [-c=<coremask in HEX>] --pdump "
 			"'(port=<port id> | device_id=<pci id or vdev name>),"
 			"(queue=<queue_id>),"
 			"(rx-dev=<iface or pcap file> |"
@@ -415,6 +416,7 @@ print_pdump_stats(void)
 	for (i = 0; i < num_tuples; i++) {
 		printf("##### PDUMP DEBUG STATS #####\n");
 		pt = &pdump_t[i];
+		printf(" == DPDK interface (%d) ==\n", i);
 		printf(" -packets dequeued:			%"PRIu64"\n",
 							pt->stats.dequeue_pkts);
 		printf(" -packets transmitted to vdev:		%"PRIu64"\n",
@@ -834,22 +836,62 @@ enable_pdump(void)
 	}
 }
 
+static inline void
+pdump_packets(struct pdump_tuples *pt)
+{
+	if (pt->dir & RTE_PDUMP_FLAG_RX)
+		pdump_rxtx(pt->rx_ring, pt->rx_vdev_id, &pt->stats);
+	if (pt->dir & RTE_PDUMP_FLAG_TX)
+		pdump_rxtx(pt->tx_ring, pt->tx_vdev_id, &pt->stats);
+}
+
+static int
+dump_packets_core(void *arg)
+{
+	struct pdump_tuples *pt = (struct pdump_tuples *) arg;
+
+	while (!quit_signal)
+		pdump_packets(pt);
+
+	return 0;
+}
+
 static inline void
 dump_packets(void)
 {
 	int i;
-	struct pdump_tuples *pt;
+	uint32_t lcore_id = 0;
+
+	lcore_id = rte_get_next_lcore(lcore_id, 0, 1);
+
+	if (rte_lcore_count() == 1) {
+		while (!quit_signal) {
+			for (i = 0; i < num_tuples; i++) {
+				struct pdump_tuples *pt = &pdump_t[i];
+				pdump_packets(pt);
+			}
+		}
+	} else {
+		printf(" Tuples (%u) lcores (%u)\n",
+			num_tuples, rte_lcore_count());
+
+		if ((uint32_t)num_tuples >= rte_lcore_count()) {
+			printf("Insufficent Cores\n");
+			return;
+		}
 
-	while (!quit_signal) {
 		for (i = 0; i < num_tuples; i++) {
-			pt = &pdump_t[i];
-			if (pt->dir & RTE_PDUMP_FLAG_RX)
-				pdump_rxtx(pt->rx_ring, pt->rx_vdev_id,
-					&pt->stats);
-			if (pt->dir & RTE_PDUMP_FLAG_TX)
-				pdump_rxtx(pt->tx_ring, pt->tx_vdev_id,
-					&pt->stats);
+			/* use remote launch for n interfaces */
+			rte_eal_remote_launch(dump_packets_core,
+				&pdump_t[i], lcore_id);
+			lcore_id = rte_get_next_lcore(lcore_id, 0, 1);
+
+			if (rte_eal_wait_lcore(lcore_id) < 0)
+				rte_exit(EXIT_FAILURE, "failed to wait\n");
 		}
+
+		while (!quit_signal)
+			;
 	}
 }
 
@@ -860,7 +902,7 @@ main(int argc, char **argv)
 	int ret;
 	int i;
 
-	char c_flag[] = "-c1";
+	char c_flag[COREMASK_SIZE] = "-c1";
 	char n_flag[] = "-n4";
 	char mp_flag[] = "--proc-type=secondary";
 	char *argp[argc + 3];
@@ -868,6 +910,15 @@ main(int argc, char **argv)
 	/* catch ctrl-c so we can print on exit */
 	signal(SIGINT, signal_handler);
 
+	for (i = 0; i < argc; i++) {
+		if (strstr(argv[i], "-c")) {
+			snprintf(c_flag, RTE_DIM(c_flag), "-c %s", argv[i+1]);
+			strlcpy(argv[i], "", 2);
+			strlcpy(argv[i + 1], "", 2);
+			break;
+		}
+	}
+
 	argp[0] = argv[0];
 	argp[1] = c_flag;
 	argp[2] = n_flag;
diff --git a/doc/guides/tools/pdump.rst b/doc/guides/tools/pdump.rst
index 7c2b73e72..c7be6d0c7 100644
--- a/doc/guides/tools/pdump.rst
+++ b/doc/guides/tools/pdump.rst
@@ -35,6 +35,7 @@ The tool has a number of command line options:
 .. code-block:: console
 
    ./build/app/dpdk-pdump --
+                          [-c <core-mask in HEX>]
                           --pdump '(port=<port id> | device_id=<pci id or vdev name>),
                                    (queue=<queue_id>),
                                    (rx-dev=<iface or pcap file> |
@@ -43,6 +44,9 @@ The tool has a number of command line options:
                                    [mbuf-size=<mbuf data size>],
                                    [total-num-mbufs=<number of mbufs>]'
 
+The ``-c`` command line option is optional and HEX representation of core-mask
+allows to run capture for each ``--pdump`` to run on lcore.
+
 The ``--pdump`` command line option is mandatory and it takes various sub arguments which are described in
 below section.
 
@@ -113,3 +117,4 @@ Example
 .. code-block:: console
 
    $ sudo ./build/app/dpdk-pdump -- --pdump 'port=0,queue=*,rx-dev=/tmp/rx.pcap'
+   $ sudo ./build/app/dpdk-pdump -- -c 0x700 --pdump 'port=0,queue=*,rx-dev=/tmp/rx.pcap' --pdump 'port=1,queue=*,tx-dev=/tmp/tx.pcap'
-- 
2.17.1

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

end of thread, other threads:[~2019-04-22 19:49 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-28  6:00 [dpdk-dev] [PATCH] app/pdump: enhance to support multi-core capture Vipin Varghese
2019-03-28  6:00 ` Vipin Varghese
2019-03-28 14:57 ` [dpdk-dev] [PATCH v2] " Vipin Varghese
2019-03-28 14:57   ` Vipin Varghese
2019-03-28 15:04   ` [dpdk-dev] [PATCH v3] " Vipin Varghese
2019-03-28 15:04     ` Vipin Varghese
2019-03-28 15:34     ` Wiles, Keith
2019-03-28 15:34       ` Wiles, Keith
2019-03-29 10:08     ` Pattan, Reshma
2019-03-29 10:08       ` Pattan, Reshma
2019-03-29 10:22       ` Varghese, Vipin
2019-03-29 10:22         ` Varghese, Vipin
2019-03-29 10:52         ` Pattan, Reshma
2019-03-29 10:52           ` Pattan, Reshma
2019-03-29 17:03         ` Ferruh Yigit
2019-03-29 17:03           ` Ferruh Yigit
2019-04-01  4:05           ` Varghese, Vipin
2019-04-01  4:05             ` Varghese, Vipin
2019-04-02  4:33     ` [dpdk-dev] [PATCH v4 0/2] app/pdump: enhance to support unique cores Vipin Varghese
2019-04-02  4:33       ` Vipin Varghese
2019-04-02  4:33       ` [dpdk-dev] [PATCH v4 1/2] app/pdump: remove core restriction Vipin Varghese
2019-04-02  4:33         ` Vipin Varghese
2019-04-02  4:33       ` [dpdk-dev] [PATCH v4 2/2] app/pdump: enhance to support multi-core capture Vipin Varghese
2019-04-02  4:33         ` Vipin Varghese
2019-04-02  7:05         ` David Marchand
2019-04-02  7:05           ` David Marchand
2019-04-02  8:06           ` Varghese, Vipin
2019-04-02  8:06             ` Varghese, Vipin
2019-04-02  9:18         ` [dpdk-dev] [PATCH v5 0/2] app/pdump: enhance to support unique cores Vipin Varghese
2019-04-02  9:18           ` Vipin Varghese
2019-04-02  9:18           ` [dpdk-dev] [PATCH v5 1/2] app/pdump: remove core restriction Vipin Varghese
2019-04-02  9:18             ` Vipin Varghese
2019-04-02  9:18           ` [dpdk-dev] [PATCH v5 2/2] app/pdump: enhance to support multi-core capture Vipin Varghese
2019-04-02  9:18             ` Vipin Varghese
2019-04-02 10:01             ` David Marchand
2019-04-02 10:01               ` David Marchand
2019-04-02 15:30               ` Varghese, Vipin
2019-04-02 15:30                 ` Varghese, Vipin
2019-04-04  7:39                 ` David Marchand
2019-04-04  7:39                   ` David Marchand
2019-04-02 16:13             ` Pattan, Reshma
2019-04-02 16:13               ` Pattan, Reshma
2019-04-03  3:53               ` Varghese, Vipin
2019-04-03  3:53                 ` Varghese, Vipin
2019-04-05 17:10                 ` Pattan, Reshma
2019-04-05 17:10                   ` Pattan, Reshma
2019-04-08  3:03                   ` Varghese, Vipin
2019-04-08  3:03                     ` Varghese, Vipin
2019-04-04  8:55             ` [dpdk-dev] [PATCH v6 0/2] app/pdump: enhance to support unique cores Vipin Varghese
2019-04-04  8:55               ` Vipin Varghese
2019-04-04  8:55               ` [dpdk-dev] [PATCH v6 1/2] app/pdump: remove core restriction Vipin Varghese
2019-04-04  8:55                 ` Vipin Varghese
2019-04-09  9:04                 ` Pattan, Reshma
2019-04-09  9:04                   ` Pattan, Reshma
2019-04-04  8:55               ` [dpdk-dev] [PATCH v6 2/2] app/pdump: enhance to support multi-core capture Vipin Varghese
2019-04-04  8:55                 ` Vipin Varghese
2019-04-05 17:09                 ` Pattan, Reshma
2019-04-05 17:09                   ` Pattan, Reshma
2019-04-08  3:01                   ` Varghese, Vipin
2019-04-08  3:01                     ` Varghese, Vipin
2019-04-09  9:05                 ` Pattan, Reshma
2019-04-09  9:05                   ` Pattan, Reshma
2019-04-22 19:49               ` [dpdk-dev] [PATCH v6 0/2] app/pdump: enhance to support unique cores Thomas Monjalon
2019-04-22 19:49                 ` Thomas Monjalon

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