[Bug 1180] TestPMD shell get stuck

Stephen Hemminger stephen at networkplumber.org
Mon Mar 13 00:01:52 CET 2023


On Sun, 12 Mar 2023 17:09:12 +0000
bugzilla at dpdk.org wrote:

> https://bugs.dpdk.org/show_bug.cgi?id=1180
> 
>             Bug ID: 1180
>            Summary: TestPMD shell get stuck
>            Product: DPDK
>            Version: unspecified
>           Hardware: x86
>                 OS: Windows
>             Status: UNCONFIRMED
>           Severity: major
>           Priority: Normal
>          Component: testpmd
>           Assignee: dev at dpdk.org
>           Reporter: pdamouny at nvidia.com
>   Target Milestone: ---
> 
> from the commit 0fd1386c30c3ad9365d7fdd2829bf7cb2e1b9dff
> 
> when entering testpmd with interactive mode 
> while writing the shell get stuck and cant enter or CTRL C
> 

Try this patch, it works on Linux. Sorry, don't have time or setup to run DPDK on Windows.
I am totally volunteer on the project now.

From f3410ed290c2f2b1981be289a121089366edcb4c Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Sun, 12 Mar 2023 15:58:14 -0700
Subject: [PATCH] testpmd: make sure ctrl-c causes SIGINT

The setting in terminal handling for both Unix style and
Windows was not ensuring that Ctrl-C character would
cause interrupt.

Fixes: 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal")
Bugzilla ID: 1180
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/cmdline/cmdline_os_unix.c    | 3 ++-
 lib/cmdline/cmdline_os_windows.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline/cmdline_os_unix.c b/lib/cmdline/cmdline_os_unix.c
index 64a945a34fb3..755a6141546d 100644
--- a/lib/cmdline/cmdline_os_unix.c
+++ b/lib/cmdline/cmdline_os_unix.c
@@ -16,7 +16,8 @@ terminal_adjust(struct cmdline *cl)
 	tcgetattr(0, &cl->oldterm);
 
 	memcpy(&term, &cl->oldterm, sizeof(term));
-	term.c_lflag &= ~(ICANON | ECHO | ISIG);
+	term.c_lflag &= ~(ICANON | ECHO);
+	term.c_lflag |= ISIG;
 	tcsetattr(0, TCSANOW, &term);
 
 	setbuf(stdin, NULL);
diff --git a/lib/cmdline/cmdline_os_windows.c b/lib/cmdline/cmdline_os_windows.c
index 73ed9ba290b8..be11409029a2 100644
--- a/lib/cmdline/cmdline_os_windows.c
+++ b/lib/cmdline/cmdline_os_windows.c
@@ -32,10 +32,10 @@ terminal_adjust(struct cmdline *cl)
 		mode &= ~(
 			ENABLE_LINE_INPUT |      /* no line buffering */
 			ENABLE_ECHO_INPUT |      /* no echo */
-			ENABLE_PROCESSED_INPUT | /* pass Ctrl+C to program */
 			ENABLE_MOUSE_INPUT |     /* no mouse events */
 			ENABLE_WINDOW_INPUT);    /* no window resize events */
-		mode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
+		mode |= ENABLE_VIRTUAL_TERMINAL_INPUT |
+			ENABLE_PROCESSED_INPUT; /* Ctrl C processed by the system */
 		SetConsoleMode(handle, mode);
 	}
 
-- 
2.39.2




More information about the dev mailing list