From patchwork Mon Sep 18 03:40:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Yang X-Patchwork-Id: 28812 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A5D8225A1; Mon, 18 Sep 2017 05:41:12 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 1CBCD1E34 for ; Mon, 18 Sep 2017 05:41:11 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 81B631529; Sun, 17 Sep 2017 20:41:10 -0700 (PDT) Received: from phil-VirtualBox.shanghai.arm.com (unknown [10.169.107.165]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0EE773F483; Sun, 17 Sep 2017 20:41:09 -0700 (PDT) From: Phil Yang To: dev@dpdk.org Cc: nd@arm.com Date: Mon, 18 Sep 2017 11:40:58 +0800 Message-Id: <1505706058-1841-1-git-send-email-phil.yang@arm.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] app/testpmd: fix stats period can't quit normally in container 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" While running testpmd in container with stats-period option, it can't quit normally after received SIGINT. Signed-off-by: Phil Yang --- app/test-pmd/testpmd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e097ee0..d94c63b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -183,6 +183,7 @@ uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */ uint32_t param_total_num_mbufs = 0; /**< number of mbufs in all pools - if * specified on command-line. */ uint16_t stats_period; /**< Period to show statistics (disabled by default) */ +uint8_t f_quit; /* Receive LSC INTERRUPTION to stop show statistics periodically */ /* * Configuration of packet segments used by the "txonly" processing engine. */ @@ -2285,6 +2286,8 @@ init_port(void) static void force_quit(void) { + f_quit = 1; + pmd_test_exit(); prompt_exit(); } @@ -2441,10 +2444,13 @@ main(int argc, char** argv) uint64_t prev_time = 0, cur_time, diff_time = 0; uint64_t timer_period; + /* Receive LSC interrupt to stop showing statistics period */ + f_quit = 0; + /* Convert to number of cycles */ timer_period = stats_period * rte_get_timer_hz(); - while (1) { + while (!f_quit) { cur_time = rte_get_timer_cycles(); diff_time += cur_time - prev_time;