DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, Matan Azrad <matan@mellanox.com>
Subject: [dpdk-dev] [PATCH v3 5/5] app/testpmd: extend event printing
Date: Fri, 29 Dec 2017 14:36:58 +0100	[thread overview]
Message-ID: <20171229133658.31258-6-thomas@monjalon.net> (raw)
In-Reply-To: <20171229133658.31258-1-thomas@monjalon.net>

From: Matan Azrad <matan@mellanox.com>

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>
---
v3: no change
---
 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 84e7a63ef..796d1a5b6 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -546,6 +546,10 @@ parse_event_printing_config(const char *optarg, int enable)
 		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 c3ab44849..26576eb76 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1568,20 +1568,6 @@ start_port(portid_t pid)
 			}
 		}
 
-		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 @@ start_port(portid_t pid)
 		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 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
 		[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 4c0d2cede..377b07651 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.
-- 
2.15.1

  parent reply	other threads:[~2017-12-29 13:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 22:13 [dpdk-dev] [PATCH] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-22  3:17 ` Ferruh Yigit
2017-12-22  8:39   ` Thomas Monjalon
2017-12-29 13:12 ` [dpdk-dev] [PATCH v2 0/3] ethdev port notifications Thomas Monjalon
2017-12-29 13:12   ` [dpdk-dev] [PATCH v2 1/3] ethdev: allow event registration for all ports Thomas Monjalon
2017-12-29 13:12   ` [dpdk-dev] [PATCH v2 2/3] ethdev: free detached port by the dedicated function Thomas Monjalon
2017-12-29 13:12   ` [dpdk-dev] [PATCH v2 3/3] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-29 13:36 ` [dpdk-dev] [PATCH v3 0/5] ethdev port notifications Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 1/5] ethdev: remove useless parameter in callback process Thomas Monjalon
2018-01-02 11:35     ` Iremonger, Bernard
2018-01-02 12:21       ` Neil Horman
2018-01-03  8:17         ` Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 2/5] ethdev: allow event registration for all ports Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 3/5] ethdev: free detached port by the dedicated function Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 4/5] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-29 13:36   ` Thomas Monjalon [this message]
2018-01-04 16:01 ` [dpdk-dev] [PATCH v4 0/5] ethdev port notifications Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 1/5] ethdev: remove useless parameter in callback process Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 2/5] ethdev: allow event registration for all ports Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 3/5] ethdev: free detached port by the dedicated function Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 4/5] ethdev: add notifications for probing and removal Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 5/5] app/testpmd: extend event printing Thomas Monjalon
2018-01-04 16:03     ` Thomas Monjalon
2018-01-10 21:02     ` Ferruh Yigit
2018-01-10 21:19   ` [dpdk-dev] [PATCH v4 0/5] ethdev port notifications Ferruh Yigit

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=20171229133658.31258-6-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@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 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).