[v3] app/testpmd: fix interactive mode with no ports

Message ID 20230119172312.15418-1-getelson@nvidia.com (mailing list archive)
State Not Applicable, archived
Headers
Series [v3] app/testpmd: fix interactive mode with no ports |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS

Commit Message

Gregory Etelson Jan. 19, 2023, 5:23 p.m. UTC
  Testpmd terminated unconditionally if it failed to start all ports.

The patch allows testpmd to get into the command line,
if the interactive mode was requested.

Fixes: 6937d2103e22 ("app/testpmd: add option to not start device")

Cc: stephen@networkplumber.org
Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
v2: Add Cc.
v3: Update patch.
---
 app/test-pmd/testpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger Jan. 19, 2023, 5:28 p.m. UTC | #1
On Thu, 19 Jan 2023 19:23:12 +0200
Gregory Etelson <getelson@nvidia.com> wrote:

> +	if (!no_device_start && start_port(RTE_PORT_ALL) != 0) {
> +		fprintf(stderr, "Start ports failed\n");
> +		if (!interactive) {
> +			rte_eal_cleanup();
> +			rte_exit(EXIT_FAILURE, "Start ports failed\n");
> +		}
> +	}

Ok, but you are printing message twice now.
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 134d79a555..3d336a4d3e 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4483,8 +4483,13 @@  main(int argc, char** argv)
 		}
 	}
 
-	if (!no_device_start && start_port(RTE_PORT_ALL) != 0)
-		rte_exit(EXIT_FAILURE, "Start ports failed\n");
+	if (!no_device_start && start_port(RTE_PORT_ALL) != 0) {
+		fprintf(stderr, "Start ports failed\n");
+		if (!interactive) {
+			rte_eal_cleanup();
+			rte_exit(EXIT_FAILURE, "Start ports failed\n");
+		}
+	}
 
 	/* set all ports to promiscuous mode by default */
 	RTE_ETH_FOREACH_DEV(port_id) {