DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matan Azrad <matan@mellanox.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: fix port validation
Date: Tue, 30 Jan 2018 14:13:39 +0000	[thread overview]
Message-ID: <1517321620-14198-1-git-send-email-matan@mellanox.com> (raw)

rte_eth_dev_is_valid_port() API validates each valid port from ethdev
point of view and may validate ports which should not be used by the
application.

Testpmd should use only the ports available through the
RTE_ETH_FOREACH_DEV iterator.

Replace rte_eth_dev_is_valid_port() usage by RTE_ETH_FOREACH_DEV
iterator usage for testpmd ports validation.

Fixes: 7d89b2610353 ("app/testpmd: use ethdev iterator to list devices")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 app/test-pmd/config.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 957b820..8c920a2 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -756,11 +756,14 @@ struct rss_type_info {
 int
 port_id_is_invalid(portid_t port_id, enum print_warning warning)
 {
+	uint16_t pid;
+
 	if (port_id == (portid_t)RTE_PORT_ALL)
 		return 0;
 
-	if (rte_eth_dev_is_valid_port(port_id))
-		return 0;
+	RTE_ETH_FOREACH_DEV(pid)
+		if (port_id == pid)
+			return 0;
 
 	if (warning == ENABLED_WARN)
 		printf("Invalid port %d\n", port_id);
-- 
1.8.3.1

             reply	other threads:[~2018-01-30 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 14:13 Matan Azrad [this message]
2018-01-30 14:13 ` [dpdk-dev] [PATCH 2/2] app/testpmd: fix invalid port detach Matan Azrad
2018-01-31 20:36   ` 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=1517321620-14198-1-git-send-email-matan@mellanox.com \
    --to=matan@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@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).