From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4E760A0093; Mon, 14 Nov 2022 19:21:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 41AF142D2F; Mon, 14 Nov 2022 19:21:28 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) by mails.dpdk.org (Postfix) with ESMTP id 0C9A642D24 for ; Mon, 14 Nov 2022 19:21:26 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QQlyagqSbjvkeLnAKRSuaUcBx+g8zyh5c71apVgGZA2FP1DtgTd9lJWq3YWzAsIs8iDIU3bfIu5nJORD20jE9rD6OKgvej+bjvooFYL9ELT640DFrt2wj/B5znh/s8Gvq2MovJi4KWJi0Wc4ikL5Efek7r0Ya0T4QHOaMRHf82EwyKS0Q0RNA/O1NYb6o64YJE3uLL8TbvBmqJDxJx9EQfQciexTrMOvR80IydltsVeOW8c3F7uV9tB+AOapxa0rJR6nw25Qqysna0CLjEAQeZWOKSqRHGnGZWC1/UkyH3t9v4xnc3TtkFeGOxVLGYuk6/7d2e5d5I7GbLSV01wG2A== 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=/7ZlqtQJKEODbPENZe0MdhiRW6isK2SjPKnTnz9s0Vc=; b=ahuXCjUT/ceZCbJiI5DLgR3M0tq4PcSwQOyQob31cJsIA6s9KHSDlO9+FxZdv2RW+CaGXf0NdhlquF6920lXR8UPa16W0hm+c/ffYiuKP8Nnl7FIb7i3GDh9grw9sELIVFLiZS1rRDUb5sVOY8TM506R7TSTFu85TlKF7O54RRWG/+4KsK8u9b+C6EQoqPmzXuk1k88PFd5I5Hypga9E284Tipg3o3ON7BP/A/UTsX2DQUVXYRBPdqtBV+uZOaC/6UTU93rf6zA7rjplJNVzlQM8aoCSIudJCsRjBzvOGs7HnFhdDdTY+te8h6ie4dzSG4+VNlsTksKjRVab5EWtIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=intel.com 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=/7ZlqtQJKEODbPENZe0MdhiRW6isK2SjPKnTnz9s0Vc=; b=iiWrke1BVg8RVUSDfxdwIdvNVN15ZgD8KP2yFWmJacdUn5CK14J1er5Pg0ui4qf+10gq9oUyWafnqDD/ganEdFt4D274Gc+RY8ATTq6Unzkkn3q9wBCS5DcWSNUU8j1y/GtSRON3hyzAPBoK8OoR5SvQok9Wn1/e0wgJlG0p7Cd1lZ5lCiGeHqdnM/SPiOFMn+BQEIaj0S1egFM0PRY2o+3j4Ri4Jc3beHoOusiH4GnixxWSJk/r0Y790fDcfJJTV63zQ/QKAhhizmKlFEBP91LlG/OC2mRmTT9zbsQ5dX+jvsf5Z80/b3RqEQ4dYRLTuv5254K/2qEE6kYSaEDc2Q== Received: from BN0PR02CA0046.namprd02.prod.outlook.com (2603:10b6:408:e5::21) by BL1PR12MB5191.namprd12.prod.outlook.com (2603:10b6:208:318::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.25; Mon, 14 Nov 2022 18:21:24 +0000 Received: from BN8NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e5:cafe::60) by BN0PR02CA0046.outlook.office365.com (2603:10b6:408:e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.17 via Frontend Transport; Mon, 14 Nov 2022 18:21:24 +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 BN8NAM11FT017.mail.protection.outlook.com (10.13.177.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.12 via Frontend Transport; Mon, 14 Nov 2022 18:21:23 +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; Mon, 14 Nov 2022 10:21:06 -0800 Received: from nvidia.com (10.126.230.35) 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; Mon, 14 Nov 2022 10:21:04 -0800 From: Dariusz Sosnowski To: Aman Singh , Yuying Zhang , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: Subject: [PATCH v3 3/3] ethdev: document special cases of port start and stop Date: Mon, 14 Nov 2022 18:19:56 +0000 Message-ID: <20221114181956.1052159-4-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221114181956.1052159-1-dsosnowski@nvidia.com> References: <20221114181956.1052159-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT017:EE_|BL1PR12MB5191:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b725cea-10b0-4949-b988-08dac66d099c X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d6xRU9PxXU5wiJJK8AT3elH6srm787KmhzbAcC+gMtSL/HBONFfAkbjEyC7Kzmgw78RqYD7mQ898MgxyANIHOkC9oX+Yfi8NnqWo46rUt/bM2019X11rZR5eYpnYHTodSKKthGtpNi7AzqP4idcYXrhNjoGW3FeGusA+yG6c7yTEA2seMYiMm9O+RKmTARo/UEqYzHRSERqNXWJOoWGW/kAF80uXLMk6vLFWkC4O8dG7Cqdg/s5MKUa6I1I8alqYcgLdJdTjR0fRv9enRS8lLo/IOGWI2JXCN35ULB1nP7fBZR7Mh0MCrsDKj51bqrUNm5ttzZv8M1IEOmtctL22NDimPkvLVFkPZNglo/yl42N5QET4lS0NuVuQYa3ozhJmCMrNRpQJ8lSCLv87s9WaQA2L+6sgtB19X9hTU+r7Aa34BATM6Lx90oftTI7ULgxdHIpHvPiOSqhbPPpvBo9bF7H4H/bVz89sLyAzb6flqu/RK/6m6XFbkEndqTQCu/Kw3qQtrXlqwyOXuiNYVITNgLy0KSNmKlewGK+kqJBmrLn0bNTgwHnDdA7Eo4UXBo2hfssc7EoTS+ujLe7kvGLp9hsDkGz0d8aoK83p48VYfcG5+HWoqUWtccGvOXx6677n7NAqZFHrl0CEW8Sn07L1vRUDzdyoWNYUGUGjIZStch5Nz0+orRkvJ92L7JPyywZVMaSr3dXFF+6liDYh08Vnvrl2x6+XodRS57qNkMeidqk1UvcjOQ5nh4iMSuqBJ4PEgA4L8bpB1Ao6nPyqWGHytw== 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)(39860400002)(376002)(136003)(396003)(346002)(451199015)(36840700001)(46966006)(40470700004)(83380400001)(2906002)(8676002)(70586007)(4326008)(8936002)(5660300002)(55016003)(110136005)(478600001)(41300700001)(356005)(7636003)(70206006)(316002)(16526019)(36860700001)(6666004)(82740400003)(336012)(40480700001)(26005)(426003)(40460700003)(6286002)(2616005)(1076003)(86362001)(7696005)(82310400005)(186003)(47076005)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2022 18:21:23.9160 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b725cea-10b0-4949-b988-08dac66d099c 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: BN8NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5191 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch clarifies the handling of following cases in the ethdev API docs: - If rte_eth_dev_start() returns (-EAGAIN) for some port, it cannot be started right now and start operation must be retried. - If rte_eth_dev_stop() returns (-EBUSY) for some port, it cannot be stopped in the current state. When stopping the port in testpmd fails, port's state is switched back to STARTED to allow users to manually retry stopping the port. No additional changes in testpmd are required to handle failures to start the port. If rte_eth_dev_start() fails, port's state is switched to STOPPED and users are allowed to retry the operation. Signed-off-by: Dariusz Sosnowski --- app/test-pmd/testpmd.c | 8 +++++++- lib/ethdev/rte_ethdev.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4e25f77c6a..a0b4ede48b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3182,6 +3182,7 @@ stop_port(portid_t pid) int need_check_link_status = 0; portid_t peer_pl[RTE_MAX_ETHPORTS]; int peer_pi; + int ret; if (port_id_is_invalid(pid, ENABLED_WARN)) return; @@ -3231,9 +3232,14 @@ stop_port(portid_t pid) if (port->flow_list) port_flow_flush(pi); - if (eth_dev_stop_mp(pi) != 0) + ret = eth_dev_stop_mp(pi); + if (ret != 0) { RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n", pi); + /* Allow to retry stopping the port. */ + port->port_status = RTE_PORT_STARTED; + continue; + } if (port->port_status == RTE_PORT_HANDLING) port->port_status = RTE_PORT_STOPPED; diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 13fe73d5a3..c129ca1eaf 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -2705,6 +2705,7 @@ int rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id); * The port identifier of the Ethernet device. * @return * - 0: Success, Ethernet device started. + * - -EAGAIN: If start operation must be retried. * - <0: Error code of the driver device start function. */ int rte_eth_dev_start(uint16_t port_id); @@ -2717,6 +2718,7 @@ int rte_eth_dev_start(uint16_t port_id); * The port identifier of the Ethernet device. * @return * - 0: Success, Ethernet device stopped. + * - -EBUSY: If stopping the port is not allowed in current state. * - <0: Error code of the driver device stop function. */ int rte_eth_dev_stop(uint16_t port_id); -- 2.25.1