[dpdk-dev] [PATCH v4] app/pdump: add pudmp exits with primary support.

Suanming.Mou mousuanming at huawei.com
Tue Apr 30 05:39:08 CEST 2019


When primary app exits, the residual running pdump will stop the
primary app to restart. Add pdump exits with primary support.

Suggested-by: Varghese, Vipin <vipin.varghese at intel.com>
Suggested-by: Burakov, Anatoly <anatoly.burakov at intel.com>
Signed-off-by: Suanming.Mou <mousuanming at huawei.com>
---
 app/pdump/main.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 3d20854..c3413da 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -26,6 +26,7 @@
 #include <rte_ring.h>
 #include <rte_string_fns.h>
 #include <rte_pdump.h>
+#include <rte_alarm.h>
 
 #define CMD_LINE_OPT_PDUMP "pdump"
 #define CMD_LINE_OPT_PDUMP_NUM 256
@@ -65,6 +66,7 @@
 #define SIZE 256
 #define BURST_SIZE 32
 #define NUM_VDEVS 2
+#define MONITOR_INTERVAL (500 * 1000)
 
 /* true if x is a power of 2 */
 #define POWEROF2(x) ((((x)-1) & (x)) == 0)
@@ -864,12 +866,26 @@ struct parse_val {
 	return 0;
 }
 
+static void monitor_primary(void *arg __rte_unused)
+{
+	if (quit_signal)
+		return;
+
+	if (rte_eal_primary_proc_alive(NULL))
+		rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL);
+	else
+		quit_signal = 1;
+}
+
 static inline void
 dump_packets(void)
 {
 	int i;
 	uint32_t lcore_id = 0;
 
+	/* Once primary exits, so will pdump. */
+	rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL);
+
 	if (!multiple_core_capture) {
 		printf(" core (%u), capture for (%d) tuples\n",
 				rte_lcore_id(), num_tuples);
-- 
1.8.3.4



More information about the dev mailing list