DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: block xstats for hidden ports
Date: Fri,  1 Nov 2019 13:12:55 -0700	[thread overview]
Message-ID: <20191101201255.4853-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20191101201255.4853-1-stephen@networkplumber.org>

All the other testpmd commands block access to devices that
are owned. Looks like xstat got overlooked.

Fixes: bfd5051b43b5 ("app/testpmd: new command to get extended statistics")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test-pmd/config.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index efe2812a85ef..ad926d573b81 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -238,6 +238,10 @@ nic_xstats_display(portid_t port_id)
 	int cnt_xstats, idx_xstat;
 	struct rte_eth_xstat_name *xstats_names;
 
+	if (port_id_is_invalid(port_id, ENABLED_WARN)) {
+		print_valid_ports();
+		return;
+	}
 	printf("###### NIC extended statistics for port %-2d\n", port_id);
 	if (!rte_eth_dev_is_valid_port(port_id)) {
 		printf("Error: Invalid port number %i\n", port_id);
@@ -295,6 +299,10 @@ nic_xstats_clear(portid_t port_id)
 {
 	int ret;
 
+	if (port_id_is_invalid(port_id, ENABLED_WARN)) {
+		print_valid_ports();
+		return;
+	}
 	ret = rte_eth_xstats_reset(port_id);
 	if (ret != 0) {
 		printf("%s: Error: failed to reset xstats (port %u): %s",
-- 
2.20.1


  reply	other threads:[~2019-11-01 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01 20:12 [dpdk-dev] [PATCH 0/2] xstats related patches Stephen Hemminger
2019-11-01 20:12 ` Stephen Hemminger [this message]
2019-11-04 11:25   ` [dpdk-dev] [PATCH 1/2] app/testpmd: block xstats for hidden ports Iremonger, Bernard
2019-11-01 20:12 ` [dpdk-dev] [PATCH 2/2] failsafe: implement xstats Stephen Hemminger
2019-11-08 18:13   ` Ferruh Yigit
2019-11-08 18:26 ` [dpdk-dev] [PATCH 0/2] xstats related patches 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=20191101201255.4853-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --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).