All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] app/testpmd: fix port validation
@ 2018-01-30 14:13 Matan Azrad
  2018-01-30 14:13 ` [PATCH 2/2] app/testpmd: fix invalid port detach Matan Azrad
  0 siblings, 1 reply; 3+ messages in thread
From: Matan Azrad @ 2018-01-30 14:13 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: dev, stable

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] app/testpmd: fix invalid port detach
  2018-01-30 14:13 [PATCH 1/2] app/testpmd: fix port validation Matan Azrad
@ 2018-01-30 14:13 ` Matan Azrad
  2018-01-31 20:36   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Matan Azrad @ 2018-01-30 14:13 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: dev

Using registration to all ports includes also the ports which should not
be used by the application.

It is nice to print each port event by testpmd but in case of RMV
event, testpmd tries to detach the port and this case is problematic
when the port should not be used by the application.

Check the port validation before detach API calling.

Fixes: 4fb82244b394 ("app/testpmd: extend event printing")

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

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc8cca..71b03d5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2026,6 +2026,9 @@ struct pmd_test_command {
 		fflush(stdout);
 	}
 
+	if (port_id_is_invalid(port_id, DISABLED_WARN))
+		return 0;
+
 	switch (type) {
 	case RTE_ETH_EVENT_INTR_RMV:
 		if (rte_eal_alarm_set(100000,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] app/testpmd: fix invalid port detach
  2018-01-30 14:13 ` [PATCH 2/2] app/testpmd: fix invalid port detach Matan Azrad
@ 2018-01-31 20:36   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-01-31 20:36 UTC (permalink / raw)
  To: Matan Azrad; +Cc: dev, Wenzhuo Lu

30/01/2018 15:13, Matan Azrad:
> Using registration to all ports includes also the ports which should not
> be used by the application.
> 
> It is nice to print each port event by testpmd but in case of RMV
> event, testpmd tries to detach the port and this case is problematic
> when the port should not be used by the application.
> 
> Check the port validation before detach API calling.
> 
> Fixes: 4fb82244b394 ("app/testpmd: extend event printing")
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>

Series applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-31 20:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30 14:13 [PATCH 1/2] app/testpmd: fix port validation Matan Azrad
2018-01-30 14:13 ` [PATCH 2/2] app/testpmd: fix invalid port detach Matan Azrad
2018-01-31 20:36   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.