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 BB27AA09FF; Thu, 24 Dec 2020 04:58:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD4AEC9C2; Thu, 24 Dec 2020 04:58:05 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 2E78CC9C0; Thu, 24 Dec 2020 04:58:02 +0100 (CET) IronPort-SDR: FSFozEcsl2Rvqh0crvHgP0VCYrc4JkDobv57B+jYvWGq6g4qdypgHujgVhnTiKrUd/QqUiIzlD ueDgtUpqkp0A== X-IronPort-AV: E=McAfee;i="6000,8403,9844"; a="237663675" X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="237663675" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 19:58:00 -0800 IronPort-SDR: eO1/I6jUiPnNnUS6g1SqCgc6XcZehcZbJ8SI/MJkeCy4+dREsq8Outps84bjYU67CaEPrmw94F 4TxQhp/HqvWw== X-IronPort-AV: E=Sophos;i="5.78,444,1599548400"; d="scan'208";a="374230856" Received: from unknown (HELO localhost.localdomain) ([10.240.183.93]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2020 19:57:58 -0800 From: dapengx.yu@intel.com To: wenzhuo.lu@intel.com, beilei.xing@intel.com, bernard.iremonger@intel.com Cc: dev@dpdk.org, YU DAPENG , stable@dpdk.org Date: Thu, 24 Dec 2020 11:57:48 +0800 Message-Id: <20201224035748.67012-1-dapengx.yu@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] app/testpmd: avoid exit without resource release 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" From: YU DAPENG In interactive mode, if testpmd exit by calling rte_exit without cmdline resource release, terminal will not echo keyboard input. So add code to just show error message, but not exit testpmd when unexpected happens on starting packet forwarding in interactive mode. User can type "quit" to exit testpmd later. Fixes: 5a8fb55c48ab ("app/testpmd: support unidirectional configuration") Cc: stable@dpdk.org Signed-off-by: YU DAPENG --- app/test-pmd/testpmd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 33fc0fddf..0071c7235 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2194,10 +2194,18 @@ start_packet_forwarding(int with_tx_first) if ((strcmp(cur_fwd_eng->fwd_mode_name, "rxonly") != 0 && strcmp(cur_fwd_eng->fwd_mode_name, "txonly") != 0) && - (!nb_rxq || !nb_txq)) + (!nb_rxq || !nb_txq)) { +#ifdef RTE_LIB_CMDLINE + if (interactive == 1) { + printf("Either rxq or txq are 0, cannot use %s fwd mode\n", + cur_fwd_eng->fwd_mode_name); + return; + } +#endif rte_exit(EXIT_FAILURE, "Either rxq or txq are 0, cannot use %s fwd mode\n", cur_fwd_eng->fwd_mode_name); + } if (all_ports_started() == 0) { printf("Not all ports were started\n"); -- 2.27.0