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 EE95BA034C; Wed, 9 Nov 2022 20:08:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3432942D1F; Wed, 9 Nov 2022 20:08:13 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2050.outbound.protection.outlook.com [40.107.95.50]) by mails.dpdk.org (Postfix) with ESMTP id C790842D0D for ; Wed, 9 Nov 2022 20:08:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b2wYcxJmO5+tyQgnfMBK40abSfFq7ttHKLOZY5s4niPUBoCII626kgAA6Y+CrJb1fjm82Wyj1R4gN6HzKXFPLtaoUx82HYzLjWjONN+gxZGUaWM5A4Srl1EdT/HT/C7/ZN/aw4sfgeutKn452T5m4vK6L3IElCUZ7Uvu7SpRH4xl973sicQzcY1peonBYWwqYnTJGYT2v6kbwIT830HXeE1J9fxsVAN3pI1DXR+T05kxt8yl+PrxuIcujzwl2o1zalpZjglkQfWuKnElUFS24G2ZYwVJ2zs/p/cuE/RV43ssB3K7nYDlc58ss+Zr9Jb/BNNDRLuRfpSn7yjM1TJBAw== 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=YUnI7PoivOnrhyCGRI5fSbvJceMXDChzBUKCnu0ajKs=; b=RY5oL+A+lTq0OUR3n53/PJdtLNwSSNBdJcZkhhlwvzCDXR8t/A+7jN3XGyBKOk4+Q6aarDlqzRNpLbbPGjr/8Vaa/wUNrKXYoxCtJpCdWemqH3Rg9413DhiGczlITXFbGuapW18fnNoHYqxGktF/1Og54q6kwWRv/503agEBXAVgVwnNity1behAqWPNqjXhU4FRASfyjCu6+zPgr4mUyJNwr7UCQ68Jaat4kTvq6ME5kTRqeeRfe3ylwWnl5SwVe8H03OLMsOJU+GECuG+rKJrkh/lTSY7FlYYFKfR68CGwezYjrcXG+K1/8EnafDoSC0fGaIORQdRR2+XfEuQ0XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=YUnI7PoivOnrhyCGRI5fSbvJceMXDChzBUKCnu0ajKs=; b=l8mUXlPP/yWufgZowmAxUPymNgsNX9rZGpPfylaA+vLv6HD050v0H3rGRsLwFte5YZ2121dnnKxwEvKJmss++NB/Rv0Vgg62PdMWRbrKRykyyqetvXOMtHQlTihU+KzcNOq3H88xwXTmqGmxwHYXdyjhW88u3bhgvAGflr7TjxmzdpPrl5OP0VNz1MSngi6OS7j/RgiAwKiHOJE0cXNw7IglNVzI9GOv+6J3SbtOApYO9j5/m2pX/mX+FBIiqTRjLaXrnWBm2hAnzwOitBt51mfLjXh93m4XzkwhMALEIAgTVIT7ipexB/Otuwp/HEFl02N324pcsYisWIYlg4OSlQ== Received: from BN9PR03CA0442.namprd03.prod.outlook.com (2603:10b6:408:113::27) by SA0PR12MB7074.namprd12.prod.outlook.com (2603:10b6:806:2d5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Wed, 9 Nov 2022 19:08:09 +0000 Received: from BN8NAM11FT092.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::e5) by BN9PR03CA0442.outlook.office365.com (2603:10b6:408:113::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27 via Frontend Transport; Wed, 9 Nov 2022 19:08:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT092.mail.protection.outlook.com (10.13.176.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.12 via Frontend Transport; Wed, 9 Nov 2022 19:08:08 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 9 Nov 2022 11:07:56 -0800 Received: from nvidia.com (10.126.231.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; Wed, 9 Nov 2022 11:07:54 -0800 From: Dariusz Sosnowski To: Aman Singh , Yuying Zhang , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: Subject: [PATCH v2 3/3] ethdev: document special cases of port start and stop Date: Wed, 9 Nov 2022 19:06:39 +0000 Message-ID: <20221109190639.886457-4-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221109190639.886457-1-dsosnowski@nvidia.com> References: <20221109190639.886457-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT092:EE_|SA0PR12MB7074:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e6a8f2f-d478-4cf0-881a-08dac285bd66 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: VyL6l7VAnLBkQX37p+cvMr9dn1cIC5zvFGl/MCVG3myZ4G15gc5a0TgVAjPY4IFzVePCOb/DuIwMlYBeQdkRA6uZvPy3WbboCbhzHs01BwZWOdsyE+yfAHcdWlbai1cK11T37D+6MzQY5sCgOERqQU+EKsXPIJ2xz1K73ON8vLXlHDj/Nc/sFHNjYDZSW+52FPrTPvJLqEqqHyvwMX9Fea2+oh5eiu1iC60LCe1G/I7ygiOtHEk5jymkhd+2DIvjRAYyzc1/oTXV/Ywb/wEzpecjryzsg8F97kud/f6+Uv8XQueiOHjzz/vJ8GatREmggpcwGDtG+eoCCDy6s1/0sJh/n2buOJOFM65m4lC44vdlxAHXSWI+og9KPl2sQ+B7cmyMLHkbpZ5uUCAuS3qjJi+j8iuQqbPJFmYBIia1zaISy3rYwMg6Uz7hXx0YEQ9uAW0nGw1jkq/VEr3UeLaXqCB2JMmR1cdDFBkPnddCjbkAUigTrxfrlUnREVTB1RaC5SCsu9zmJybTQES3ATNykiB/2hr3gGB3CI4pacImfp72wEz3NuBtrPSIFH3hdKF7fD4nd/5ubNZmidBsk0Vsty+d4WaBzt75JAJ6GXUA0J0v8gjeCGvot/xDxvZUQlp0u4Bfyi6NFYubnFTnFNLZ5004Y77c1HM5uzjvf7vKLO5Mccolgtlz9PzixT9sRBCW2treyYk/93r7OsK/8UZqV46qAC0qZg145dUTpKRHo/uSxCla4OKQcvYH4qeWtaqwT2O8ZXN7W9TKw4pe+tHHmQ== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(346002)(136003)(396003)(376002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(356005)(7636003)(110136005)(316002)(82310400005)(82740400003)(36860700001)(6666004)(40460700003)(478600001)(2906002)(41300700001)(6286002)(36756003)(26005)(70586007)(2616005)(40480700001)(70206006)(55016003)(83380400001)(7696005)(47076005)(426003)(16526019)(1076003)(5660300002)(8676002)(336012)(4326008)(8936002)(186003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2022 19:08:08.8367 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e6a8f2f-d478-4cf0-881a-08dac285bd66 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT092.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7074 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 until other port is started. - If rte_eth_dev_stop() returns (-EBUSY) for some port, it cannot be stopped until other port is stopped. When stopping the port in testpmd fails due to (-EBUSY), 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 failure to start port with (-EAGAIN). 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 | 10 +++++++++- lib/ethdev/rte_ethdev.h | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index aa7ea29f15..5a69e3c77a 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3118,6 +3118,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; @@ -3167,9 +3168,16 @@ 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); + if (ret == -EBUSY) { + /* 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..abf5a24f92 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -2701,10 +2701,14 @@ int rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id); * On success, all basic functions exported by the Ethernet API (link status, * receive/transmit, and so on) can be invoked. * + * If the port depends on another one being started, + * PMDs might return (-EAGAIN) to notify about such requirement. + * * @param port_id * The port identifier of the Ethernet device. * @return * - 0: Success, Ethernet device started. + * - -EAGAIN: If it depends on another port to be started first. * - <0: Error code of the driver device start function. */ int rte_eth_dev_start(uint16_t port_id); @@ -2713,10 +2717,15 @@ int rte_eth_dev_start(uint16_t port_id); * Stop an Ethernet device. The device can be restarted with a call to * rte_eth_dev_start() * + * If the port provides some resources for other ports + * and it cannot be stopped before them, + * PMDs might return (-EBUSY) to notify about such requirement. + * * @param port_id * The port identifier of the Ethernet device. * @return * - 0: Success, Ethernet device stopped. + * - -EBUSY: If it depends on another port to be stopped first. * - <0: Error code of the driver device stop function. */ int rte_eth_dev_stop(uint16_t port_id); -- 2.25.1