All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: fix interactive mode with no ports
@ 2022-11-09 16:54 Gregory Etelson
  2022-11-09 17:09 ` [PATCH v2] " Gregory Etelson
  0 siblings, 1 reply; 9+ messages in thread
From: Gregory Etelson @ 2022-11-09 16:54 UTC (permalink / raw)
  To: dev
  Cc: getelson, matan, rasland, Aman Singh, Yuying Zhang, Ferruh Yigit,
	Stephen Hemminger

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")
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/testpmd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7381dfd9e5..8517f376db 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4433,8 +4433,11 @@ 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)
+			goto eal_out;
+	}
 
 	/* set all ports to promiscuous mode by default */
 	RTE_ETH_FOREACH_DEV(port_id) {
@@ -4526,6 +4529,7 @@ main(int argc, char** argv)
 			return 1;
 	}
 
+eal_out:
 	ret = rte_eal_cleanup();
 	if (ret != 0)
 		rte_exit(EXIT_FAILURE,
-- 
2.34.1


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

* [PATCH v2] app/testpmd: fix interactive mode with no ports
  2022-11-09 16:54 [PATCH] app/testpmd: fix interactive mode with no ports Gregory Etelson
@ 2022-11-09 17:09 ` Gregory Etelson
  2022-11-16  4:23   ` Singh, Aman Deep
                     ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Gregory Etelson @ 2022-11-09 17:09 UTC (permalink / raw)
  To: dev
  Cc: getelson, matan, rasland, stephen, stable, Aman Singh,
	Yuying Zhang, Ferruh Yigit

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
---
 app/test-pmd/testpmd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7381dfd9e5..8517f376db 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4433,8 +4433,11 @@ 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)
+			goto eal_out;
+	}
 
 	/* set all ports to promiscuous mode by default */
 	RTE_ETH_FOREACH_DEV(port_id) {
@@ -4526,6 +4529,7 @@ main(int argc, char** argv)
 			return 1;
 	}
 
+eal_out:
 	ret = rte_eal_cleanup();
 	if (ret != 0)
 		rte_exit(EXIT_FAILURE,
-- 
2.34.1


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

* Re: [PATCH v2] app/testpmd: fix interactive mode with no ports
  2022-11-09 17:09 ` [PATCH v2] " Gregory Etelson
@ 2022-11-16  4:23   ` Singh, Aman Deep
  2023-01-19 15:09     ` Ferruh Yigit
  2023-01-19 17:16   ` [PATCH v3] " Gregory Etelson
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Singh, Aman Deep @ 2022-11-16  4:23 UTC (permalink / raw)
  To: Gregory Etelson, dev
  Cc: matan, rasland, stephen, stable, Yuying Zhang, Ferruh Yigit

Hi Gregory,

Thanks for the patch.

On 11/9/2022 10:39 PM, Gregory Etelson wrote:
> 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.

I tested testpmd in interactive mode with no ports.
It did get into command line-

$./dpdk-testpmd -n 4 -c 0x1f -- -i
testpmd: No probed ethernet devices
Interactive-mode selected
testpmd: create a new mbuf pool <mb_pool_0>: n=179456, size=2176, socket=0
testpmd: preferred mempool ops selected: ring_mp_mc
Done
testpmd>

>
> 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
> ---
>   app/test-pmd/testpmd.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 7381dfd9e5..8517f376db 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -4433,8 +4433,11 @@ main(int argc, char** argv)
>   		}
>   	}
>   
> -	if (!no_device_start && start_port(RTE_PORT_ALL) != 0)

With no ports, start_port returns 0 so it doesn't exits.

> -		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)
> +			goto eal_out;
> +	}
>   
>   	/* set all ports to promiscuous mode by default */
>   	RTE_ETH_FOREACH_DEV(port_id) {
> @@ -4526,6 +4529,7 @@ main(int argc, char** argv)
>   			return 1;
>   	}
>   
> +eal_out:
>   	ret = rte_eal_cleanup();
>   	if (ret != 0)
>   		rte_exit(EXIT_FAILURE,


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

* Re: [PATCH v2] app/testpmd: fix interactive mode with no ports
  2022-11-16  4:23   ` Singh, Aman Deep
@ 2023-01-19 15:09     ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2023-01-19 15:09 UTC (permalink / raw)
  To: Singh, Aman Deep, Gregory Etelson, dev
  Cc: matan, rasland, stephen, stable, Yuying Zhang

On 11/16/2022 4:23 AM, Singh, Aman Deep wrote:
> Hi Gregory,
> 
> Thanks for the patch.
> 
> On 11/9/2022 10:39 PM, Gregory Etelson wrote:
>> 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.
> 
> I tested testpmd in interactive mode with no ports.
> It did get into command line-
> 
> $./dpdk-testpmd -n 4 -c 0x1f -- -i
> testpmd: No probed ethernet devices
> Interactive-mode selected
> testpmd: create a new mbuf pool <mb_pool_0>: n=179456, size=2176, socket=0
> testpmd: preferred mempool ops selected: ring_mp_mc
> Done
> testpmd>
> 
>>
>> 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
>> ---
>>   app/test-pmd/testpmd.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
>> index 7381dfd9e5..8517f376db 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -4433,8 +4433,11 @@ main(int argc, char** argv)
>>           }
>>       }
>>   -    if (!no_device_start && start_port(RTE_PORT_ALL) != 0)
> 
> With no ports, start_port returns 0 so it doesn't exits.
> 

Hi Aman,

I think patch is for the case port exists and 'start_port()' failed, in
that case testpmd exits.

With patch, testpmd only continues after 'start_port()' failure only if
interactive mode is selected, that also looks good to me.


Gregory,

Only for non interactive case if 'start_port()' fails, application exit
value changed to 'EXIT_SUCCESS', which is not quite right, can you
please fix it?

>> -        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)
>> +            goto eal_out;
>> +    }
>>         /* set all ports to promiscuous mode by default */
>>       RTE_ETH_FOREACH_DEV(port_id) {
>> @@ -4526,6 +4529,7 @@ main(int argc, char** argv)
>>               return 1;
>>       }
>>   +eal_out:
>>       ret = rte_eal_cleanup();
>>       if (ret != 0)
>>           rte_exit(EXIT_FAILURE,
> 


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

* [PATCH v3] app/testpmd: fix interactive mode with no ports
  2022-11-09 17:09 ` [PATCH v2] " Gregory Etelson
  2022-11-16  4:23   ` Singh, Aman Deep
@ 2023-01-19 17:16   ` Gregory Etelson
  2023-01-19 17:23   ` Gregory Etelson
  2023-01-19 17:45   ` [PATCH v4] " Gregory Etelson
  3 siblings, 0 replies; 9+ messages in thread
From: Gregory Etelson @ 2023-01-19 17:16 UTC (permalink / raw)
  To: dev; +Cc: getelson, stephen, stable, Aman Singh, Yuying Zhang, Ferruh Yigit

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(-)

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) {
-- 
2.34.1


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

* [PATCH v3] app/testpmd: fix interactive mode with no ports
  2022-11-09 17:09 ` [PATCH v2] " Gregory Etelson
  2022-11-16  4:23   ` Singh, Aman Deep
  2023-01-19 17:16   ` [PATCH v3] " Gregory Etelson
@ 2023-01-19 17:23   ` Gregory Etelson
  2023-01-19 17:28     ` Stephen Hemminger
  2023-01-19 17:45   ` [PATCH v4] " Gregory Etelson
  3 siblings, 1 reply; 9+ messages in thread
From: Gregory Etelson @ 2023-01-19 17:23 UTC (permalink / raw)
  To: dev; +Cc: getelson, stephen, stable, Aman Singh, Yuying Zhang, Ferruh Yigit

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(-)

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) {
-- 
2.34.1


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

* Re: [PATCH v3] app/testpmd: fix interactive mode with no ports
  2023-01-19 17:23   ` Gregory Etelson
@ 2023-01-19 17:28     ` Stephen Hemminger
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2023-01-19 17:28 UTC (permalink / raw)
  To: Gregory Etelson; +Cc: dev, stable, Aman Singh, Yuying Zhang, Ferruh Yigit

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.

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

* [PATCH v4] app/testpmd: fix interactive mode with no ports
  2022-11-09 17:09 ` [PATCH v2] " Gregory Etelson
                     ` (2 preceding siblings ...)
  2023-01-19 17:23   ` Gregory Etelson
@ 2023-01-19 17:45   ` Gregory Etelson
  2023-01-27 23:04     ` Ferruh Yigit
  3 siblings, 1 reply; 9+ messages in thread
From: Gregory Etelson @ 2023-01-19 17:45 UTC (permalink / raw)
  To: dev; +Cc: getelson, stephen, stable, Aman Singh, Yuying Zhang, Ferruh Yigit

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.
v4: Update patch.
---
 app/test-pmd/testpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 134d79a555..e366f81a0f 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) {
+		if (!interactive) {
+			rte_eal_cleanup();
+			rte_exit(EXIT_FAILURE, "Start ports failed\n");
+		}
+		fprintf(stderr, "Start ports failed\n");
+	}
 
 	/* set all ports to promiscuous mode by default */
 	RTE_ETH_FOREACH_DEV(port_id) {
-- 
2.34.1


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

* Re: [PATCH v4] app/testpmd: fix interactive mode with no ports
  2023-01-19 17:45   ` [PATCH v4] " Gregory Etelson
@ 2023-01-27 23:04     ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2023-01-27 23:04 UTC (permalink / raw)
  To: Gregory Etelson, dev; +Cc: stephen, stable, Aman Singh, Yuying Zhang

On 1/19/2023 5:45 PM, Gregory Etelson wrote:
> 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>

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>

Applied to dpdk-next-net/main, thanks.

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

end of thread, other threads:[~2023-01-27 23:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 16:54 [PATCH] app/testpmd: fix interactive mode with no ports Gregory Etelson
2022-11-09 17:09 ` [PATCH v2] " Gregory Etelson
2022-11-16  4:23   ` Singh, Aman Deep
2023-01-19 15:09     ` Ferruh Yigit
2023-01-19 17:16   ` [PATCH v3] " Gregory Etelson
2023-01-19 17:23   ` Gregory Etelson
2023-01-19 17:28     ` Stephen Hemminger
2023-01-19 17:45   ` [PATCH v4] " Gregory Etelson
2023-01-27 23:04     ` Ferruh Yigit

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.