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 9BD17A034C; Wed, 9 Nov 2022 17:32:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3BC8442D16; Wed, 9 Nov 2022 17:32:21 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id A382B41133 for ; Wed, 9 Nov 2022 17:32:19 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dTBe25Lq0eg8R3j+6tP+qxsafz/jtGyLn3/aeCYfDlOOl9lkGhCMrAMzyTZ/VeC/rhD0thrVrnPNVpHmnnVZ1DZki9Y/psM6o6j5vFZNYLF6B/vqIx7r/ru5jfzGO6TAMKQyKMWjLg3qKS7HKji4oWP7i6hd2Vfvc5jyK5/m2lEUvocM9dPyQsa2WQMd9n4slugnBHmp5UE0w4yb4k8IonksVysHX6ayLufSbpIMXj2BA6kbkg1gLqvMfrIOa7JaVek4HAzAnagvfNs92PfrQ9U6kPzi310lX9bIgu+/kbA8lsk8F5pfinIXwQv6FPjCQ8qSgv5yGsonWL9FThX+Dw== 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=neuzJKaEJp265Vcw3m+2Ahs8GmlNbbXabMPowGQj+Uk=; b=RE+5+kw1UTMfR7ekzybO4Z6qdSNrmVjHu9KKnPoVhH3CIwV6BB2+O73G97SK4P6exdqgK6h4yK0r0B4nQ/Em4z6l3+EafEw9s2Q+AJSmnh6AAIrwJVgA3/O3BPGAvZRXSZRPn1EnCGalrChTUrns7BNEQohKXSMzHVZeMXa9LNSjoUEIq5fTt8bw34j2aEvITESmZfEBQDsgoUDU2zfM87pJQobFo7f4zg6WbzDco4oPYSkC9R3VahEnfAyLep+uTCIDn5u4ojBrPd5In6NiYaQXnwQ0M7jlwqUuIG/hRFATCKqX9N5pyPvf/k+si0URV8tB8as9dd7IQKa7bjSczg== 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=neuzJKaEJp265Vcw3m+2Ahs8GmlNbbXabMPowGQj+Uk=; b=oSu+Pgvj/HxcgGOzvX5D6DUS7ly2ruR9D2DqNZIred3tTLAW0P3PldaIOyFZZ5+42dJuwhecE7DaCfvo+4uuTmD/fy7djeNXggNTiaPD6hNnW4j7szv7DKshFl4IlCWngAnCQXl+OwdjeGAUmKb2ESYxykTfNQtKGPmDbWfKWK0fvSzlkjKzdBbkz0vsJrFTOdEMNODMy9ktDzIYwEzSJqKLIt2fXxvzBwcFKCCWBja3HTWTWBcfu9UDdK7AxeRscYtfg0rjgmCJIWKs2mXqesJwiZFDEkbIfn1+iKFgjhe6MRSlk30xei5w08XKMAgeBiTC9L1szbvqmYqrwA0Nmw== Received: from DS7PR03CA0007.namprd03.prod.outlook.com (2603:10b6:5:3b8::12) by SA0PR12MB4576.namprd12.prod.outlook.com (2603:10b6:806:93::13) 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 16:32:17 +0000 Received: from DM6NAM11FT085.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::29) by DS7PR03CA0007.outlook.office365.com (2603:10b6:5:3b8::12) 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 16:32:17 +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 DM6NAM11FT085.mail.protection.outlook.com (10.13.172.236) 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 16:32:17 +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 08:32: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; Wed, 9 Nov 2022 08:32:05 -0800 From: Dariusz Sosnowski To: Aman Singh , Yuying Zhang , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: Subject: [PATCH 3/3] ethdev: document special cases of port start and stop Date: Wed, 9 Nov 2022 16:31:15 +0000 Message-ID: <20221109163115.868939-4-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221109163115.868939-1-dsosnowski@nvidia.com> References: <20221109163115.868939-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: 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: DM6NAM11FT085:EE_|SA0PR12MB4576:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cd16175-af55-4200-df77-08dac26ff781 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: LnxCKrpg64ANbqrOehmLEzH39+PtW7ERWwnu+1zBCyKIQqx6f+Xsnzwb34cAYV0NXgETPel6wRewpzw5ch/rYbmTppkYJ/9AkERPjnM1o1G4FozKHEdIzSDk9cQLxFJppiVSsnQFRTHQwS73EYwTgOP8E95G0D/VW3eM5cZ+HmVUSovXjawEZG5NRsrtqy5Qy4QuX4vHFl5+2EqSxkqCEkxugwZ93/d+yH9/2V/ERbvcZ8KtH/YB2wd6JLzkksDr+Q0HwyWqSbh6YMXo7YFhLDEq3bXS0wZPgE3qPG2GiUKXIDauVZDAjazOLWMjfGkQkp6jDzK+HSa12dQ4w22HTfGUUOA3HgTA2eIg8Q/OMfsaAXqbiliWmNh+Nk6Rcz3kLtFeQ+HH42M051+94WrBnAmyFztKAePM9BNj0TgDS3f42a3UATpZtHPXS6hk3dblOLneH7btknV4oeixGlTb24NisUPZeOEpsYhyLTpkZK4jQuc6Mig/MbQGX3EVNzlqc1XP0T4rejmx0O8ZTxdTDU7HrbNQPaRPzTZDi6PncFnF/tRVAf2cWuolhleV9G7yAvQ752XFqYLmeMVkgozCVduyVMY0TMJDh0IrEfSxumXTMSG3z8PwRGcNRryL/OPYwhe5UI3iLHFcF+sUTV4NfE2bToVrZjaH81iiLvL/+k3PUhStHapCi7LaM4Y1lpJIU90rmtOhgi9qH4iqggyMe3VN5zLzpJJ8gJbkEvpWApLxCI6TIsOJ30y6HVcbCKMKm0+7IuE9c63bKlYq+gpgeg== 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)(39860400002)(396003)(136003)(376002)(451199015)(36840700001)(40470700004)(46966006)(7696005)(41300700001)(110136005)(8676002)(6666004)(4326008)(70586007)(70206006)(5660300002)(316002)(8936002)(6286002)(2906002)(26005)(478600001)(426003)(1076003)(7636003)(356005)(82740400003)(83380400001)(2616005)(16526019)(186003)(336012)(82310400005)(36860700001)(36756003)(40480700001)(55016003)(86362001)(40460700003)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2022 16:32:17.4426 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9cd16175-af55-4200-df77-08dac26ff781 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: DM6NAM11FT085.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4576 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 7381dfd9e5..c9252031e8 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3158,6 +3158,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; @@ -3207,9 +3208,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