From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 3110A4241A
	for <public@inbox.dpdk.org>; Thu, 19 Jan 2023 18:46:26 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 283D141101;
	Thu, 19 Jan 2023 18:46:26 +0100 (CET)
Received: from NAM11-DM6-obe.outbound.protection.outlook.com
 (mail-dm6nam11on2060.outbound.protection.outlook.com [40.107.223.60])
 by mails.dpdk.org (Postfix) with ESMTP id 334D8400D5;
 Thu, 19 Jan 2023 18:46:24 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Uh0q0t6ZGX/HuYGXF0CcCs/OhYxcU7jfKbLlZutoYZGDjU1yfYtFNY9T9IK/l8qNlz0Zp39ef1W7Jn8Z1zNE9FCuAa+sk6iOlaWsSwLO7fJC0soONBDhIp+kUg7XKhsxCkvigFhnm7oXQfgt7YvjEvxWJat3tpNQQw/8gOfYPDc+N+eaXTkvzxtLGIQYbrM4JJjJgUhRHpuTX8YMoevBLkVyIcOadS7mSJjsJdRY8bzC8ghYs4EMqpgd+2exi0LNwL3+gIc0Rt9zIt58SG2v737VAmY3b7YblckIQiTkzPx8CmYEu+mz8VLe7f/lX6v0D1shZkjSjVDv5oD8mB9zSA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=7PQRest19+9Ds85PPMZBuF6KNde1pB4pWfP1zkIydbk=;
 b=HxqdtoQdniSe4mR/kfm7iVCcTRgH9auHej6mMWe6XhrU3z3mi9IqGUTYS+9idfLX3gJJpdcEQQ0DCHlWf8FEWrZfrW9iq3d7m2UEzzRNogEZLYNQRj76aUesLifDr560AdAdB+ehky3s8p2lWPiWa5ngElSwZhA65QLLj1MjbDQqTPIWJTu05hI+jUo9shyhIVWUZ0Pt76ovxK+A+pISQ9GyuoZ049Pa1eGxwgmqyI1fKBfFpUuyFhJPk/bS4bybsDkvl1reDNHkGdNupfVia/tphjcB7N0JtVmTJZFgxnnrQRz+ZkpBchQMw1SXox6rfJ28yZbvI71aFybZpCKPng==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com;
 dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;
 dkim=none (message not signed); arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=7PQRest19+9Ds85PPMZBuF6KNde1pB4pWfP1zkIydbk=;
 b=T4GVm3rl0NeEaAP6sURyDjG7Dde2KHtxe1AN5kG8Wvs3K65dnK+M4FGKvU/zaLEB6P3WvTk7r4T6QWeQhMLMpJI6K4GRnjTcCXZYyXCsFTlwxpsmQfTeIq7ARxiyY5ZGewgZsZbv1UWIlk2EWTQYUEKdHutaJJJ93zdUlBe8YbokumW0jaI77eT171HYHNcuB3QeaM8VQ0QRkpwtjAYaxRf8melnUel8tlU2oykOgTxDj68fvbln35+97s+/RdbwWtBtDw3a391v0ArQrCnKpqrKEjqZgDruQyORvnkaKZRweJtJS+YqtnMm+GkJ1ZqIlvtWrZRkeuFWX+GoPUGcsw==
Received: from MW4PR03CA0085.namprd03.prod.outlook.com (2603:10b6:303:b6::30)
 by CH3PR12MB8356.namprd12.prod.outlook.com (2603:10b6:610:130::8)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Thu, 19 Jan
 2023 17:46:22 +0000
Received: from CO1NAM11FT017.eop-nam11.prod.protection.outlook.com
 (2603:10b6:303:b6:cafe::4e) by MW4PR03CA0085.outlook.office365.com
 (2603:10b6:303:b6::30) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.26 via Frontend
 Transport; Thu, 19 Jan 2023 17:46:22 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160)
 smtp.mailfrom=nvidia.com;
 dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=nvidia.com;
Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates
 216.228.117.160 as permitted sender) receiver=protection.outlook.com;
 client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C
Received: from mail.nvidia.com (216.228.117.160) by
 CO1NAM11FT017.mail.protection.outlook.com (10.13.175.108) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.6023.16 via Frontend Transport; Thu, 19 Jan 2023 17:46:22 +0000
Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com
 (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 19 Jan
 2023 09:46:15 -0800
Received: from nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com
 (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 19 Jan
 2023 09:46:13 -0800
From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
CC: <getelson@nvidia.com>, <stephen@networkplumber.org>, <stable@dpdk.org>,
 Aman Singh <aman.deep.singh@intel.com>, Yuying Zhang
 <yuying.zhang@intel.com>, Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [PATCH v4] app/testpmd: fix interactive mode with no ports
Date: Thu, 19 Jan 2023 19:45:59 +0200
Message-ID: <20230119174559.16120-1-getelson@nvidia.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20221109170918.2887-1-getelson@nvidia.com>
References: <20221109170918.2887-1-getelson@nvidia.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [10.126.231.37]
X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To
 rnnvmail201.nvidia.com (10.129.68.8)
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: CO1NAM11FT017:EE_|CH3PR12MB8356:EE_
X-MS-Office365-Filtering-Correlation-Id: 6ae53db1-1d08-446b-80c5-08dafa45140d
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: ryalOOydiQVUxYFgJ1oTW9jCw6WCIPYoq18N4A9SqbgKqg0hhGmY9AO9UPee+YjRhB/sJrVniHNGVfHOwjxmMhv+8e23ShUlneyv1+p5eUyp1BJOwGx3Ez7po/akXMTvSpLn8ngIAO2hFC3zAAi5LCuhgkDpSiCoCz+vayfZ1myoWxqqDeL0bd83owq8KmhSpJkXQ8hhnMfKJHSWguHPPQuwLN5yp+JA3iWQGXMpCrO3/7SEo4IIYLL2acytnWrDz6kdodrLLUYTUesjMG6cIh67HJyEOluy2GaxFb8DeMaZM7lZeNq4mNuxAHEU6qQysIFT2xDNlr1sRRTPsPLljMnRrf7vsWtOtQeVtmSeXqGBaQG1oWZW6Qr2AO29TF5OFez+LrQit6ncYILEtSsxv5gSX5kvo0g27r+PKQA2viq43AwfrVdJ3ml3zd8X37NqRTflc2FJTTGrEQYjgA09rPy4j3m7rleOx73ipWKVK07Fb3NK92l8CHCcVF8alD3pU5jrKcqeDh4PZmLRTavbDrliIRQ0N2q0gRu9kMlsdR0WVFHZ+jzOPSEV9T+2YUWnPbxyMQWc6f2Zt/BFQTKKCTdDLZO43Fd9hqzIIR1GhzlY+G6GFIvSgLPgLy6HWwSwL4WeUajuTsj7AwEaSjlehfpz5zQUI5AHOTo3S16kLgVniCh1vna0TbLM/m0s/OP4gWNhGKKbmVI7g7RpKoLOyw==
X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE;
 SFS:(13230022)(4636009)(346002)(39860400002)(136003)(396003)(376002)(451199015)(46966006)(40470700004)(36840700001)(2616005)(6916009)(55016003)(70586007)(426003)(6286002)(86362001)(41300700001)(16526019)(70206006)(186003)(8676002)(4326008)(36756003)(82310400005)(26005)(47076005)(82740400003)(83380400001)(5660300002)(36860700001)(2906002)(336012)(8936002)(1076003)(54906003)(6666004)(478600001)(316002)(40480700001)(7696005)(356005)(7636003)(40460700003);
 DIR:OUT; SFP:1101; 
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 17:46:22.1525 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 6ae53db1-1d08-446b-80c5-08dafa45140d
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160];
 Helo=[mail.nvidia.com]
X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT017.eop-nam11.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8356
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

Testpmd terminated unconditionally if it failed to start all ports.

The patch allows testpmd to get into the command line,
if the interactive mode was requested.

Fixes: 6937d2103e22 ("app/testpmd: add option to not start device")

Cc: stephen@networkplumber.org
Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
v2: Add Cc.
v3: Update patch.
v4: Update patch.
---
 app/test-pmd/testpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 134d79a555..e366f81a0f 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4483,8 +4483,13 @@ main(int argc, char** argv)
 		}
 	}
 
-	if (!no_device_start && start_port(RTE_PORT_ALL) != 0)
-		rte_exit(EXIT_FAILURE, "Start ports failed\n");
+	if (!no_device_start && start_port(RTE_PORT_ALL) != 0) {
+		if (!interactive) {
+			rte_eal_cleanup();
+			rte_exit(EXIT_FAILURE, "Start ports failed\n");
+		}
+		fprintf(stderr, "Start ports failed\n");
+	}
 
 	/* set all ports to promiscuous mode by default */
 	RTE_ETH_FOREACH_DEV(port_id) {
-- 
2.34.1