[dpdk-dev] [PATCH] app/testpmd: fix testpmd exit using ctrl+d

Iremonger, Bernard bernard.iremonger at intel.com
Tue Jul 24 11:25:14 CEST 2018


Hi Jasvider,

> -----Original Message-----
> From: Singh, Jasvinder
> Sent: Monday, July 23, 2018 11:44 AM
> To: dev at dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger at intel.com>; Pattan, Reshma
> <reshma.pattan at intel.com>
> Subject: [PATCH] app/testpmd: fix testpmd exit using ctrl+d
> 
> Fix testpmd app exit by pressing ctrl+d, End-of-Transmission character (EOT)
> on the empty command line.
> 
> Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> 
> Reported-by: Mordechay Haimovsky <motih at mellanox.com>
> Signed-off-by: Jasvinder Singh <jasvinder.singh at intel.com>
> ---
>  app/test-pmd/cmdline.c       | 10 ++++++----
>  lib/librte_cmdline/cmdline.c |  2 +-
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 5885289..edaf0e6 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -17581,12 +17581,14 @@ 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 == RDLINE_RES_EOF) {
> +			if (status == RDLINE_RES_EOF)
> +				pmd_test_exit();
> +
>  			cmdline_stdin_exit(testpmd_cl);
>  			rte_exit(0, "\n");
> -		}
> +		} else if (status < 0)
> +			rte_panic("CLI poll error (%" PRId32 ")\n", status);
> 
>  #if defined RTE_LIBRTE_PMD_SOFTNIC
> 
> diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c index
> 591b78b..47b0f6a 100644
> --- a/lib/librte_cmdline/cmdline.c
> +++ b/lib/librte_cmdline/cmdline.c
> @@ -187,7 +187,7 @@ cmdline_in(struct cmdline *cl, const char *buf, int
> size)
>  			rdline_newline(&cl->rdl, cl->prompt);
>  		}
>  		else if (ret == RDLINE_RES_EOF)
> -			return -1;
> +			return RDLINE_RES_EOF;
>  		else if (ret == RDLINE_RES_EXITED)
>  			return -1;
>  	}
> --
> 2.9.3
The check-git-log script is showing the following error:

./devtools/check-git-log.sh -1
Line too long:
        Fix testpmd app exit by pressing ctrl+d, End-of-Transmission character (EOT)

Regards,

Bernard.



More information about the dev mailing list