[v2] app/testpmd: fix testpmd exit for ctrl+d

Message ID 1532441847-7492-1-git-send-email-reshma.pattan@intel.com (mailing list archive)
State Superseded, archived
Headers
Series [v2] app/testpmd: fix testpmd exit for ctrl+d |

Checks

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

Commit Message

Pattan, Reshma July 24, 2018, 2:17 p.m. UTC
  Testpmd should be existed gracefully when ctrl+d is typed.
This behaviour is not handled properly, fix this by calling
pmd_test_exit() instead of rte_panic.

Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")

Reported-by: Mordechay Haimovsky <motih@mellanox.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
v2: removed changes done to lib/librte_cmdline/cmdline.c
reworded commit message and heading.
---
 app/test-pmd/cmdline.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Pattan, Reshma July 24, 2018, 2:46 p.m. UTC | #1
+ CC: Olivier and Mordechay Haimovsky. 

> -----Original Message-----
> From: Pattan, Reshma
> Sent: Tuesday, July 24, 2018 3:17 PM
> To: dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>;
> thomas@monjalon.net; Singh, Jasvinder <jasvinder.singh@intel.com>;
> Pattan, Reshma <reshma.pattan@intel.com>
> Subject: [PATCH v2] app/testpmd: fix testpmd exit for ctrl+d
> 
> Testpmd should be existed gracefully when ctrl+d is typed.
> This behaviour is not handled properly, fix this by calling
> pmd_test_exit() instead of rte_panic.
> 
> Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> 
> Reported-by: Mordechay Haimovsky <motih@mellanox.com>
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
> v2: removed changes done to lib/librte_cmdline/cmdline.c reworded commit
> message and heading.
> ---
>  app/test-pmd/cmdline.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 588528928..406008d73 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -17581,9 +17581,9 @@ prompt(void)
> 
>  	for (;;) {
>  		status = cmdline_poll(testpmd_cl);
> -		if (status < 0)
> -			rte_panic("CLI poll error (%" PRId32 ")\n", status);
> -		else if (status == RDLINE_EXITED) {
> +		if (status == RDLINE_EXITED || status == -1) {
> +			if (status == -1)
> +				pmd_test_exit();
>  			cmdline_stdin_exit(testpmd_cl);
>  			rte_exit(0, "\n");
>  		}
> --
> 2.14.4
  
Pattan, Reshma July 24, 2018, 3:31 p.m. UTC | #2
Hi ,

Can you check if v2 version is working ? And it would be great if you add Tested-by: if test passes.

Else, please let me know the steps to reproduce the issue.

Thanks,
Reshma
  
Iremonger, Bernard July 24, 2018, 3:31 p.m. UTC | #3
Hi Reshma,

> -----Original Message-----
> From: Pattan, Reshma
> Sent: Tuesday, July 24, 2018 3:47 PM
> To: dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>;
> thomas@monjalon.net; Singh, Jasvinder <jasvinder.singh@intel.com>;
> olivier.matz@6wind.com; Mordechay Haimovsky <motih@mellanox.com>
> Subject: RE: [PATCH v2] app/testpmd: fix testpmd exit for ctrl+d
> 
> + CC: Olivier and Mordechay Haimovsky.
> 
> > -----Original Message-----
> > From: Pattan, Reshma
> > Sent: Tuesday, July 24, 2018 3:17 PM
> > To: dev@dpdk.org
> > Cc: Iremonger, Bernard <bernard.iremonger@intel.com>;
> > thomas@monjalon.net; Singh, Jasvinder <jasvinder.singh@intel.com>;
> > Pattan, Reshma <reshma.pattan@intel.com>
> > Subject: [PATCH v2] app/testpmd: fix testpmd exit for ctrl+d
> >
> > Testpmd should be existed gracefully when ctrl+d is typed.

Typo in commit message:
"should be existed" should be "should exit"

> > This behaviour is not handled properly, fix this by calling
> > pmd_test_exit() instead of rte_panic.
> >
> > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> >
> > Reported-by: Mordechay Haimovsky <motih@mellanox.com>
> > Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> > Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> > ---
> > v2: removed changes done to lib/librte_cmdline/cmdline.c reworded
> > commit message and heading.
> > ---
> >  app/test-pmd/cmdline.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 588528928..406008d73 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -17581,9 +17581,9 @@ prompt(void)
> >
> >  	for (;;) {
> >  		status = cmdline_poll(testpmd_cl);
> > -		if (status < 0)
> > -			rte_panic("CLI poll error (%" PRId32 ")\n", status);
> > -		else if (status == RDLINE_EXITED) {
> > +		if (status == RDLINE_EXITED || status == -1) {
> > +			if (status == -1)
> > +				pmd_test_exit();
> >  			cmdline_stdin_exit(testpmd_cl);
> >  			rte_exit(0, "\n");
> >  		}
> > --
> > 2.14.4

Regards,

Bernard.
  
Thomas Monjalon July 26, 2018, 2:14 p.m. UTC | #4
24/07/2018 16:46, Pattan, Reshma:
> + CC: Olivier and Mordechay Haimovsky. 
> 
> > Testpmd should be existed gracefully when ctrl+d is typed.
> > This behaviour is not handled properly, fix this by calling
> > pmd_test_exit() instead of rte_panic.
> > 
> > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> > 
> > Reported-by: Mordechay Haimovsky <motih@mellanox.com>
> > Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> > Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> > ---
> > v2: removed changes done to lib/librte_cmdline/cmdline.c reworded commit
> > message and heading.

The partial revert from Moti is preferred.
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 588528928..406008d73 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -17581,9 +17581,9 @@  prompt(void)
 
 	for (;;) {
 		status = cmdline_poll(testpmd_cl);
-		if (status < 0)
-			rte_panic("CLI poll error (%" PRId32 ")\n", status);
-		else if (status == RDLINE_EXITED) {
+		if (status == RDLINE_EXITED || status == -1) {
+			if (status == -1)
+				pmd_test_exit();
 			cmdline_stdin_exit(testpmd_cl);
 			rte_exit(0, "\n");
 		}