From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 8BAECA0679 for ; Sun, 28 Apr 2019 04:56:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 733541B49B; Sun, 28 Apr 2019 04:56:12 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 917AC4C93 for ; Sun, 28 Apr 2019 04:56:10 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 43EFDBB1E5979D7C5A1A for ; Sun, 28 Apr 2019 10:56:08 +0800 (CST) Received: from huawei.com (10.175.100.202) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Sun, 28 Apr 2019 10:56:04 +0800 From: Suanming.Mou To: CC: , Date: Sun, 28 Apr 2019 04:58:26 +0000 Message-ID: <1556427506-49150-1-git-send-email-mousuanming@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1556210141-43153-1-git-send-email-mousuanming@huawei.com> References: <1556210141-43153-1-git-send-email-mousuanming@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [10.175.100.202] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2] app/pdump: add exit_with_primary option support. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190428045826.R4HcLlAwZ3H0nMDwM7RALbW00kbaFIjRXla0YUzwRLY@z> When primary app exits, the residual running pdump will stop the primary app to restart. Add an exit_with_primary option to make pdump exit with primary. Suggested-by: Varghese, Vipin Suggested-by: Burakov, Anatoly Signed-off-by: Suanming.Mou --- app/pdump/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/pdump/main.c b/app/pdump/main.c index 3d20854..3909f15 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -26,11 +26,14 @@ #include #include #include +#include #define CMD_LINE_OPT_PDUMP "pdump" #define CMD_LINE_OPT_PDUMP_NUM 256 #define CMD_LINE_OPT_MULTI "multi" #define CMD_LINE_OPT_MULTI_NUM 257 +#define CMD_LINE_OPT_EXIT_WP "exit_with_primary" +#define CMD_LINE_OPT_EXIT_WP_NUM 258 #define PDUMP_PORT_ARG "port" #define PDUMP_PCI_ARG "device_id" #define PDUMP_QUEUE_ARG "queue" @@ -65,6 +68,7 @@ #define SIZE 256 #define BURST_SIZE 32 #define NUM_VDEVS 2 +#define MONITOR_INTERVEL (500 * 1000) /* true if x is a power of 2 */ #define POWEROF2(x) ((((x)-1) & (x)) == 0) @@ -143,12 +147,14 @@ struct parse_val { static struct rte_eth_conf port_conf_default; static volatile uint8_t quit_signal; static uint8_t multiple_core_capture; +static uint8_t exit_with_primary; /**< display usage */ static void pdump_usage(const char *prgname) { printf("usage: %s [EAL options]" + " --["CMD_LINE_OPT_EXIT_WP"]" " --["CMD_LINE_OPT_MULTI"]\n" " --"CMD_LINE_OPT_PDUMP" " "'(port= | device_id=)," @@ -383,6 +389,7 @@ struct parse_val { static struct option long_option[] = { {CMD_LINE_OPT_PDUMP, 1, 0, CMD_LINE_OPT_PDUMP_NUM}, {CMD_LINE_OPT_MULTI, 0, 0, CMD_LINE_OPT_MULTI_NUM}, + {CMD_LINE_OPT_EXIT_WP, 0, 0, CMD_LINE_OPT_EXIT_WP_NUM}, {NULL, 0, 0, 0} }; @@ -403,6 +410,9 @@ struct parse_val { case CMD_LINE_OPT_MULTI_NUM: multiple_core_capture = 1; break; + case CMD_LINE_OPT_EXIT_WP_NUM: + exit_with_primary = 1; + break; default: pdump_usage(prgname); return -1; @@ -864,12 +874,28 @@ 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_INTERVEL, monitor_primary, NULL); + else + quit_signal = 1; + + return; +} + static inline void dump_packets(void) { int i; uint32_t lcore_id = 0; + if (exit_with_primary) + rte_eal_alarm_set(MONITOR_INTERVEL, monitor_primary, NULL); + if (!multiple_core_capture) { printf(" core (%u), capture for (%d) tuples\n", rte_lcore_id(), num_tuples); -- 1.8.3.4