From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v1 08/13] app/testpmd: add show device command
Date: Thu, 30 Aug 2018 15:41:59 +0200 [thread overview]
Message-ID: <92b192aa67cec3d4b41680fa05e72a138b9cc92d.1535633784.git.gaetan.rivet@6wind.com> (raw)
In-Reply-To: <cover.1535633783.git.gaetan.rivet@6wind.com>
A new interactive command is offered:
show device <device description>
This commands lists all rte_device element matching the device
description. e.g.:
show device bus=pci
show device bus=vdev
show device bus=vdev/class=eth
show device bus=vdev,driver=net_ring/class=eth
show device bus=vdev/class=eth,name=net_ring0
These devices may not be otherwise useful, some buses will spawn devices
to keep track of their assets without having a driver to use them.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/cmdline.c | 54 +++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 24 +++++++++
2 files changed, 78 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 589121d69..a7c0e622a 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -228,6 +228,9 @@ static void cmd_help_long_parsed(void *parsed_result,
"show port tm node stats (port_id) (node_id) (clear)\n"
" Display the port TM node stats.\n\n"
+ "show device (device_string)\n"
+ " Display devices matching the device string.\n\n"
+
);
}
@@ -7117,6 +7120,56 @@ cmdline_parse_inst_t cmd_showportall = {
},
};
+/* *** SHOW DEVICE INFO *** */
+struct cmd_showdevice_result {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t device;
+ cmdline_fixed_string_t filter;
+};
+
+static void
+cmd_showdevice_dump_device(const struct rte_device *dev)
+{
+ const struct rte_driver *drv = dev->driver;
+
+ printf("0x%p: %s:%s\n", (const void *)dev, dev->name,
+ drv ? drv->name : "<nil>");
+}
+
+static void cmd_showdevice_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_showdevice_result *res = parsed_result;
+ struct rte_dev_iterator it;
+ const struct rte_device *dev;
+
+ RTE_DEV_FOREACH(dev, res->filter, &it)
+ cmd_showdevice_dump_device(dev);
+}
+
+cmdline_parse_token_string_t cmd_showdevice_show =
+ TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result,
+ show, "show");
+cmdline_parse_token_string_t cmd_showdevice_device =
+ TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result,
+ device, "device");
+cmdline_parse_token_string_t cmd_showdevice_filter =
+ TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result,
+ filter, NULL);
+
+cmdline_parse_inst_t cmd_showdevice = {
+ .f = cmd_showdevice_parsed,
+ .data = NULL,
+ .help_str = "show device <device string>",
+ .tokens = {
+ (void *)&cmd_showdevice_show,
+ (void *)&cmd_showdevice_device,
+ (void *)&cmd_showdevice_filter,
+ NULL,
+ },
+};
+
/* *** SHOW PORT INFO *** */
struct cmd_showport_result {
cmdline_fixed_string_t show;
@@ -17610,6 +17663,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_help_long,
(cmdline_parse_inst_t *)&cmd_quit,
(cmdline_parse_inst_t *)&cmd_load_from_file,
+ (cmdline_parse_inst_t *)&cmd_showdevice,
(cmdline_parse_inst_t *)&cmd_showport,
(cmdline_parse_inst_t *)&cmd_showqueue,
(cmdline_parse_inst_t *)&cmd_showportall,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index dde205a2b..417072cce 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2663,6 +2663,30 @@ set the traffic management default hierarchy on the port::
testpmd> set port tm hierarchy default (port_id)
+Device functions
+----------------
+
+Show devices
+~~~~~~~~~~~~
+
+Display any registered devices::
+
+ testpmd> show device <device_string>
+
+where:
+
+* ``device_string``: Device description string, of the format
+
+ layer[/layer[/layer]]
+
+ where one layer is in the form
+
+ layer_key=layer_name[,key1=value1[,...]]
+
+ Valid layer keys are ``bus`` and ``class``.
+ Their respective values is defined by registered ``bus`` and ``class``
+ drivers.
+
Filter Functions
----------------
--
2.18.0
next prev parent reply other threads:[~2018-08-30 13:42 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 13:41 [dpdk-dev] [PATCH v1 00/13] Implement new devargs framework Gaetan Rivet
2018-08-30 13:41 ` [dpdk-dev] [PATCH v1 01/13] bus/pci: implement device iteration and comparison Gaetan Rivet
2018-08-30 13:41 ` [dpdk-dev] [PATCH v1 02/13] bus/pci: add device matching field id Gaetan Rivet
2018-08-30 13:41 ` [dpdk-dev] [PATCH v1 03/13] bus/vdev: implement device iteration Gaetan Rivet
2018-08-30 13:41 ` [dpdk-dev] [PATCH v1 04/13] bus/vdev: add device matching field driver Gaetan Rivet
2018-08-30 13:41 ` [dpdk-dev] [PATCH v1 05/13] ethdev: add private generic device iterator Gaetan Rivet
2018-08-31 10:09 ` Andrew Rybchenko
2018-08-31 10:22 ` Gaëtan Rivet
2018-08-30 13:41 ` [dpdk-dev] [PATCH v1 06/13] ethdev: register ether layer as a class Gaetan Rivet
2018-08-31 10:09 ` Andrew Rybchenko
2018-08-30 13:41 ` [dpdk-dev] [PATCH v1 07/13] ethdev: add device matching field name Gaetan Rivet
2018-08-31 10:10 ` Andrew Rybchenko
2018-08-30 13:41 ` Gaetan Rivet [this message]
2018-08-30 13:42 ` [dpdk-dev] [PATCH v1 09/13] bus/pci: pre-process declarative PCI devargs Gaetan Rivet
2018-08-30 13:42 ` [dpdk-dev] [PATCH v1 10/13] bus/vdev: pre-process declarative vdev devargs Gaetan Rivet
2018-08-30 13:42 ` [dpdk-dev] [PATCH v1 11/13] bus/pci: process declarative PCI devargs Gaetan Rivet
2018-08-30 16:15 ` Stephen Hemminger
2018-08-30 16:37 ` Gaëtan Rivet
2018-08-30 13:42 ` [dpdk-dev] [PATCH v1 12/13] ethdev: process declarative eth devargs Gaetan Rivet
2018-08-31 10:10 ` Andrew Rybchenko
2018-08-31 12:16 ` Gaëtan Rivet
2018-08-30 13:42 ` [dpdk-dev] [PATCH v1 13/13] eal: add generic dev parameter Gaetan Rivet
2018-08-30 15:42 ` [dpdk-dev] [PATCH v1 00/13] Implement new devargs framework Stephen Hemminger
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 " Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 01/13] bus/pci: implement device iteration and comparison Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 02/13] bus/pci: add device matching field id Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 03/13] bus/vdev: implement device iteration Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 04/13] bus/vdev: add device matching field driver Gaetan Rivet
2018-09-20 16:11 ` Thomas Monjalon
2018-09-21 11:53 ` Gaëtan Rivet
2018-09-21 12:55 ` Thomas Monjalon
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 05/13] ethdev: add private generic device iterator Gaetan Rivet
2018-09-20 10:02 ` Andrew Rybchenko
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 06/13] ethdev: register ether layer as a class Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 07/13] ethdev: add device matching field name Gaetan Rivet
2018-09-20 16:17 ` Thomas Monjalon
2018-09-21 12:16 ` Gaëtan Rivet
2018-09-21 13:06 ` Thomas Monjalon
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 08/13] app/testpmd: add show device command Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 09/13] bus/pci: pre-process declarative PCI devargs Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 10/13] bus/vdev: pre-process declarative vdev devargs Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 11/13] bus/pci: process declarative PCI devargs Gaetan Rivet
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 12/13] ethdev: process declarative eth devargs Gaetan Rivet
2018-09-20 10:11 ` Andrew Rybchenko
2018-09-19 16:03 ` [dpdk-dev] [PATCH v2 13/13] eal: add generic dev parameter Gaetan Rivet
2018-10-03 12:31 ` [dpdk-dev] [PATCH v2 00/13] Implement new devargs framework Thomas Monjalon
2020-02-19 5:43 ` Pavan Nikhilesh Bhagavatula
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=92b192aa67cec3d4b41680fa05e72a138b9cc92d.1535633784.git.gaetan.rivet@6wind.com \
--to=gaetan.rivet@6wind.com \
--cc=dev@dpdk.org \
/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).