All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@mellanox.com>
To: jingjing.wu@intel.com
Cc: thomas@monjalon.net, dev@dpdk.org, shahafs@mellanox.com,
	rasland@mellanox.com, xuemingl@mellanox.com, orika@mellanox.com,
	jerin.jacob@caviumnetworks.com, david.marchand@6wind.com,
	bernard.iremonger@intel.com, ferruh.yigit@intel.com
Subject: [PATCH v6 3/3] app/testpmd: set packet dump based on verbosity level
Date: Wed, 17 Oct 2018 18:22:11 +0300	[thread overview]
Message-ID: <1539789731-18409-3-git-send-email-rasland@mellanox.com> (raw)
In-Reply-To: <1539789731-18409-1-git-send-email-rasland@mellanox.com>

when changing verbosity level it will configure rx/tx callbacks to dump
packets based on the verbosity value as following:
    1- dump only received packets:
       testpmd> set verbose 1
    2- dump only sent packets:
       testpmd> set verbose 2
    3- dump sent and received packets:
       testpmd> set verbose (any number > 2)
    4- disable dump
       testpmd> set verbose 0

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

---
changes in v6:
	add documentation for the packet dump
---
---
 app/test-pmd/config.c                       | 25 +++++++++++++++++++++++++
 app/test-pmd/testpmd.c                      |  4 ++--
 app/test-pmd/testpmd.h                      |  1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  6 +++++-
 4 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 55fec7f..1696623 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -50,6 +50,7 @@
 #endif
 #include <rte_gro.h>
 #include <cmdline_parse_etheraddr.h>
+#include <rte_config.h>
 
 #include "testpmd.h"
 
@@ -2773,11 +2774,35 @@ remove_tx_dump_callbacks(portid_t portid)
 }
 
 void
+configure_rxtx_dump_callbacks(uint16_t verbose)
+{
+	portid_t portid;
+
+#ifndef RTE_ETHDEV_RXTX_CALLBACKS
+		TESTPMD_LOG(ERR, "setting rxtx callbacks is not enabled\n");
+		return;
+#endif
+
+	RTE_ETH_FOREACH_DEV(portid)
+	{
+		if (verbose == 1 || verbose > 2)
+			add_rx_dump_callbacks(portid);
+		else
+			remove_rx_dump_callbacks(portid);
+		if (verbose >= 2)
+			add_tx_dump_callbacks(portid);
+		else
+			remove_tx_dump_callbacks(portid);
+	}
+}
+
+void
 set_verbose_level(uint16_t vb_level)
 {
 	printf("Change verbose level from %u to %u\n",
 	       (unsigned int) verbose_level, (unsigned int) vb_level);
 	verbose_level = vb_level;
+	configure_rxtx_dump_callbacks(verbose_level);
 }
 
 void
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dbbf78..3c42924 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1988,7 +1988,7 @@ start_port(portid_t pid)
 					return -1;
 				}
 			}
-
+			configure_rxtx_dump_callbacks(0);
 			printf("Configuring Port %d (socket %u)\n", pi,
 					port->socket_id);
 			/* configure port */
@@ -2087,7 +2087,7 @@ start_port(portid_t pid)
 				return -1;
 			}
 		}
-
+		configure_rxtx_dump_callbacks(verbose_level);
 		/* start port */
 		if (rte_eth_dev_start(pi) < 0) {
 			printf("Fail to start port %d\n", pi);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c07bee8..3da728c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -777,6 +777,7 @@ void add_rx_dump_callbacks(portid_t portid);
 void remove_rx_dump_callbacks(portid_t portid);
 void add_tx_dump_callbacks(portid_t portid);
 void remove_tx_dump_callbacks(portid_t portid);
+void configure_rxtx_dump_callbacks(uint16_t verbose);
 
 /*
  * Work-around of a compilation error with ICC on invocations of the
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index ca060e1..60855c6 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -449,7 +449,11 @@ Set the debug verbosity level::
 
    testpmd> set verbose (level)
 
-Currently the only available levels are 0 (silent except for error) and 1 (fully verbose).
+Available levels are as following:
+* ``0`` silent except for error.
+* ``1`` fully verbose except for Tx packets.
+* ``2`` fully verbose except for Rx packets.
+* ``> 2`` fully verbose.
 
 set log
 ~~~~~~~
-- 
2.7.4

  parent reply	other threads:[~2018-10-17 15:22 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12  8:06 [PATCH 1/2] app/testpmd: add a generic way for dumping packets Raslan Darawsheh
2018-09-12  8:06 ` [PATCH 2/2] app/testpmd: use the generic function to dump packets Raslan Darawsheh
2018-09-13 16:43   ` David Marchand
2018-09-14  6:35     ` Jerin Jacob
2018-09-17 14:18       ` Raslan Darawsheh
2018-09-24 12:49   ` [PATCH v2 1/3] app/testpmd: move dumping packets to a separate function Raslan Darawsheh
2018-09-24 12:49     ` [PATCH v2 2/3] app/testpmd: add packet dump callback functions Raslan Darawsheh
2018-09-24 12:49     ` [PATCH v2 3/3] app/testpmd: set packet dump based on verbosity level Raslan Darawsheh
2018-10-02 13:35     ` [PATCH v2 1/3] app/testpmd: move dumping packets to a separate function Iremonger, Bernard
2018-10-03 15:11       ` Raslan Darawsheh
2018-10-03 15:16     ` [PATCH v3 " Raslan Darawsheh
2018-10-03 15:16       ` [PATCH v3 2/3] app/testpmd: add packet dump callback functions Raslan Darawsheh
2018-10-03 15:16       ` [PATCH v3 3/3] app/testpmd: set packet dump based on verbosity level Raslan Darawsheh
2018-10-04 14:43       ` [PATCH v3 1/3] app/testpmd: move dumping packets to a separate function Iremonger, Bernard
2018-10-07  7:38         ` Raslan Darawsheh
2018-10-07  7:38     ` [PATCH v4 " Raslan Darawsheh
2018-10-07  7:38       ` [PATCH v4 2/3] app/testpmd: add packet dump callback functions Raslan Darawsheh
2018-10-08 10:03         ` Iremonger, Bernard
2018-10-11 14:58         ` Ferruh Yigit
2018-10-16 10:11           ` Raslan Darawsheh
2018-10-07  7:38       ` [PATCH v4 3/3] app/testpmd: set packet dump based on verbosity level Raslan Darawsheh
2018-10-08 10:04         ` Iremonger, Bernard
2018-10-11 15:00         ` Ferruh Yigit
2018-10-11 15:24           ` Iremonger, Bernard
2018-10-11 15:52             ` Ferruh Yigit
2018-10-11 16:39               ` Iremonger, Bernard
2018-10-17 12:34                 ` Ferruh Yigit
2018-10-08 10:01       ` [PATCH v4 1/3] app/testpmd: move dumping packets to a separate function Iremonger, Bernard
2018-10-11 14:56       ` Ferruh Yigit
2018-10-16 10:10         ` Raslan Darawsheh
2018-10-16 13:11           ` Ferruh Yigit
2018-10-17  7:27       ` [PATCH v5 " Raslan Darawsheh
2018-10-17  7:27         ` [PATCH v5 2/3] app/testpmd: add packet dump callback functions Raslan Darawsheh
2018-10-17  7:27         ` [PATCH v5 3/3] app/testpmd: set packet dump based on verbosity level Raslan Darawsheh
2018-10-17 12:27         ` [PATCH v5 1/3] app/testpmd: move dumping packets to a separate function Ferruh Yigit
2018-10-17 12:59           ` Iremonger, Bernard
2018-10-17 15:22             ` Raslan Darawsheh
2018-10-17 15:22       ` [PATCH v6 " Raslan Darawsheh
2018-10-17 15:22         ` [PATCH v6 2/3] app/testpmd: add packet dump callback functions Raslan Darawsheh
2018-10-17 15:22         ` Raslan Darawsheh [this message]
2018-10-17 16:24           ` [PATCH v6 3/3] app/testpmd: set packet dump based on verbosity level Iremonger, Bernard
2018-10-17 16:33             ` Ferruh Yigit
2018-10-18  8:19               ` Raslan Darawsheh
2018-10-18  8:33                 ` Ferruh Yigit
2018-10-18  8:47                   ` Raslan Darawsheh
2018-10-17 16:22         ` [PATCH v6 1/3] app/testpmd: move dumping packets to a separate function Ferruh Yigit
2018-09-12 15:00 ` [PATCH 1/2] app/testpmd: add a generic way for dumping packets Thomas Monjalon

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=1539789731-18409-3-git-send-email-rasland@mellanox.com \
    --to=rasland@mellanox.com \
    --cc=bernard.iremonger@intel.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=jingjing.wu@intel.com \
    --cc=orika@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    --cc=xuemingl@mellanox.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 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.