patch 'app/testpmd: fix early exit from signal' has been queued to stable release 20.11.10

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Nov 8 20:25:07 CET 2023


Hi,

FYI, your patch has been queued to stable release 20.11.10

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/10/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/14d0084034451375f62e3ae03de173fbdcdbd19c

Thanks.

Luca Boccassi

---
>From 14d0084034451375f62e3ae03de173fbdcdbd19c Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Thu, 26 Oct 2023 10:11:33 -0700
Subject: [PATCH] app/testpmd: fix early exit from signal

[ upstream commit a996cd04aeeaeca88e6313174101a1229349fb47 ]

Other signals may occur causing read to get interrupted.
Loop until quit flag is set by signal, a character is entered,
or end of file. This fixes bug where testpmd would exit early
because of signal used by TAP device.

Bugzilla ID: 1305
Fixes: 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>
Reviewed-by: David Marchand <david.marchand at redhat.com>
---
 app/test-pmd/testpmd.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 568b9f7390..4fa8284a0e 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -10,7 +10,6 @@
 #include <time.h>
 #include <fcntl.h>
 #include <sys/mman.h>
-#include <sys/select.h>
 #include <sys/types.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -4059,25 +4058,17 @@ main(int argc, char** argv)
 			}
 		} else {
 			char c;
-			fd_set fds;
 
 			printf("Press enter to exit\n");
-
-			FD_ZERO(&fds);
-			FD_SET(0, &fds);
-
-			/* wait for signal or enter */
-			ret = select(1, &fds, NULL, NULL, NULL);
-			if (ret < 0 && errno != EINTR)
-				rte_exit(EXIT_FAILURE,
-					 "Select failed: %s\n",
-					 strerror(errno));
-
-			/* if got enter then consume it */
-			if (ret == 1 && read(0, &c, 1) < 0)
-				rte_exit(EXIT_FAILURE,
-					 "Read failed: %s\n",
+			while (f_quit == 0) {
+				/* end-of-file or any character exits loop */
+				if (read(0, &c, 1) >= 0)
+					break;
+				if (errno == EINTR)
+					continue;
+				rte_exit(EXIT_FAILURE, "Read failed: %s\n",
 					 strerror(errno));
+			}
 		}
 	}
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-11-08 19:23:52.388614698 +0000
+++ 0009-app-testpmd-fix-early-exit-from-signal.patch	2023-11-08 19:23:51.745395713 +0000
@@ -1 +1 @@
-From a996cd04aeeaeca88e6313174101a1229349fb47 Mon Sep 17 00:00:00 2001
+From 14d0084034451375f62e3ae03de173fbdcdbd19c Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit a996cd04aeeaeca88e6313174101a1229349fb47 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -23 +24 @@
-index 595b77748c..9e4e99e53b 100644
+index 568b9f7390..4fa8284a0e 100644
@@ -26 +27,2 @@
-@@ -11,7 +11,6 @@
+@@ -10,7 +10,6 @@
+ #include <time.h>
@@ -28 +29,0 @@
- #ifndef RTE_EXEC_ENV_WINDOWS
@@ -31 +31,0 @@
- #endif
@@ -34 +34,2 @@
-@@ -4743,25 +4742,17 @@ main(int argc, char** argv)
+ #include <stdbool.h>
+@@ -4059,25 +4058,17 @@ main(int argc, char** argv)


More information about the stable mailing list