[dpdk-dev,2/2] app/testpmd: fix invalid port detach

Message ID 1517321620-14198-2-git-send-email-matan@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Matan Azrad Jan. 30, 2018, 2:13 p.m. UTC
  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(+)
  

Comments

Thomas Monjalon Jan. 31, 2018, 8:36 p.m. UTC | #1
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
  

Patch

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,