DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matan Azrad <matan@mellanox.com>
To: Jingjing Wu <jingjing.wu@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] app/testpmd: extend event printing
Date: Thu, 30 Nov 2017 07:51:23 +0000	[thread overview]
Message-ID: <1512028283-18903-1-git-send-email-matan@mellanox.com> (raw)

There are new Ethernet device events - NEW and DESTROY, and new option
to register all ports by one call.

Adjust application to aforementioned changes.

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 app/test-pmd/parameters.c             |  4 ++++
 app/test-pmd/testpmd.c                | 30 ++++++++++++++++--------------
 doc/guides/testpmd_app_ug/run_app.rst |  4 ++--
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 84e7a63..796d1a5 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -546,6 +546,10 @@
 		mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC;
 	else if (!strcmp(optarg, "intr_rmv"))
 		mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV;
+	else if (!strcmp(optarg, "dev_probed"))
+		mask = UINT32_C(1) << RTE_ETH_EVENT_NEW;
+	else if (!strcmp(optarg, "dev_released"))
+		mask = UINT32_C(1) << RTE_ETH_EVENT_DESTROY;
 	else if (!strcmp(optarg, "all"))
 		mask = ~UINT32_C(0);
 	else {
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c3ab448..26576eb 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1568,20 +1568,6 @@ static int eth_event_callback(portid_t port_id,
 			}
 		}
 
-		for (event_type = RTE_ETH_EVENT_UNKNOWN;
-		     event_type < RTE_ETH_EVENT_MAX;
-		     event_type++) {
-			diag = rte_eth_dev_callback_register(pi,
-							event_type,
-							eth_event_callback,
-							NULL);
-			if (diag) {
-				printf("Failed to setup even callback for event %d\n",
-					event_type);
-				return -1;
-			}
-		}
-
 		/* start port */
 		if (rte_eth_dev_start(pi) < 0) {
 			printf("Fail to start port %d\n", pi);
@@ -1608,6 +1594,20 @@ static int eth_event_callback(portid_t port_id,
 		need_check_link_status = 1;
 	}
 
+	for (event_type = RTE_ETH_EVENT_UNKNOWN;
+	     event_type < RTE_ETH_EVENT_MAX;
+	     event_type++) {
+		diag = rte_eth_dev_callback_register(RTE_ETH_ALL,
+						event_type,
+						eth_event_callback,
+						NULL);
+		if (diag) {
+			printf("Failed to setup even callback for event %d\n",
+				event_type);
+			return -1;
+		}
+	}
+
 	if (need_check_link_status == 1 && !no_link_check)
 		check_all_ports_link_status(RTE_PORT_ALL);
 	else if (need_check_link_status == 0)
@@ -1930,6 +1930,8 @@ struct pmd_test_command {
 		[RTE_ETH_EVENT_VF_MBOX] = "VF Mbox",
 		[RTE_ETH_EVENT_MACSEC] = "MACsec",
 		[RTE_ETH_EVENT_INTR_RMV] = "device removal",
+		[RTE_ETH_EVENT_NEW] = "device probed",
+		[RTE_ETH_EVENT_DESTROY] = "device released",
 		[RTE_ETH_EVENT_MAX] = NULL,
 	};
 
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 4c0d2ce..377b076 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -492,12 +492,12 @@ The commandline options are:
 
     Set the logical core N to perform bitrate calculation.
 
-*   ``--print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>``
+*   ``--print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|dev_probed|dev_released|all>``
 
     Enable printing the occurrence of the designated event. Using all will
     enable all of them.
 
-*   ``--mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|all>``
+*   ``--mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|dev_probed|dev_released|all>``
 
     Disable printing the occurrence of the designated event. Using all will
     disable all of them.
-- 
1.8.3.1

             reply	other threads:[~2017-11-30  7:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30  7:51 Matan Azrad [this message]
2017-12-29 13:28 ` 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=1512028283-18903-1-git-send-email-matan@mellanox.com \
    --to=matan@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.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).