From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48EA5A0613 for ; Tue, 24 Sep 2019 07:38:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 64AE6378E; Tue, 24 Sep 2019 07:38:10 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 951CE2B96; Tue, 24 Sep 2019 07:38:08 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 22:38:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,542,1559545200"; d="scan'208";a="203293878" Received: from intel.sh.intel.com ([10.239.255.149]) by fmsmga001.fm.intel.com with ESMTP; 23 Sep 2019 22:38:06 -0700 From: Wang ShougangX To: dev@dpdk.org Cc: qiming.yang@intel.com, bernard.iremonger@intel.com, ferruh.yigit@intel.com, Wang ShougangX , stable@dpdk.org Date: Tue, 24 Sep 2019 04:49:03 +0000 Message-Id: <20190924044903.59156-1-shougangx.wang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190920031333.16859-1-shougangx.wang@intel.com> References: <20190920031333.16859-1-shougangx.wang@intel.com> Subject: [dpdk-dev] [PATCH v3] app/testpmd: fix Segment fault when start fwd 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" This patch fixed the reset function to avoid crash when user don't call port stop, port reset functions as sequence. Fixes: 97f1e19679 ("app/testpmd: add port reset command") Cc: stable@dpdk.org Signed-off-by: Wang ShougangX --- app/test-pmd/cmdline.c | 3 +++ app/test-pmd/testpmd.c | 6 ++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 56783aa13..9d0c3db5e 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -758,6 +758,9 @@ static void cmd_help_long_parsed(void *parsed_result, "port close (port_id|all)\n" " Close all ports or port_id.\n\n" + "port reset (port_id|all)\n" + " Reset all ports or port_id.\n\n" + "port attach (ident)\n" " Attach physical or virtual dev by pci address or virtual device name\n\n" diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e8e2a39b6..9b7a1521a 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2344,6 +2344,12 @@ reset_port(portid_t pid) if (port_id_is_invalid(pid, ENABLED_WARN)) return; + if ((pid == (portid_t)RTE_PORT_ALL && !all_ports_stopped()) || + (pid != (portid_t)RTE_PORT_ALL && !port_is_stopped(pid))) { + printf("Can not reset port(s), please stop port(s) first.\n"); + return; + } + printf("Resetting ports...\n"); RTE_ETH_FOREACH_DEV(pi) { diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 313e0707e..b1a14cc4e 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2041,6 +2041,15 @@ Close all ports or a specific port:: testpmd> port close (port_id|all) +port reset +~~~~~~~~~~ + +Reset all ports or a specific port:: + + testpmd> port reset (port_id|all) + +User should stop port(s) before resetting and (re-)start after reset. + port config - queue ring size ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.17.1