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 5EDDAA00C4; Mon, 14 Nov 2022 15:07:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09FD240150; Mon, 14 Nov 2022 15:07:53 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2074.outbound.protection.outlook.com [40.107.244.74]) by mails.dpdk.org (Postfix) with ESMTP id 3C3564014F for ; Mon, 14 Nov 2022 15:07:51 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hPkZdGNruCwfnH7hjAeQj3VZkh+sdeRDcQ5vTl68iRUk3tqdvgxRRgCQln44YhdKq5PJQfp2aTGgFMTG0YK8JXSPd2yRFEr9neAS76s1iG1IVrQZHb/XcRcAHHVENqfXRoFbG0wWeZVBUpQORMvzhNzhgu/d3PDavDbp2Hhw4mG1+DPv66xYWFTuhDgwGP/8WyC3waNy+dZNj+xPChteZ3WkZPOht2ZD0FVdnE3MPRywylK//LwYg2xAnhlqmzU8KZAemWPeocM5ARl69T+jCVOKbi0Yg53YycyFfPpVLLDN2qG5qjEAJKn1POkz3+Q0to+PVLa2a2fzF0Ly/l6ASg== 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=hk/icA3tg2yxASdFK8hCZAue45GknNsL8dMk68KkmKA=; b=NVd1t2t8BWGYPXIYYPLt4Y9Y3AttfvkdVmkHM+2baVNL+d73Ob/ESTNXnXF4K929hYqvFZE0tS6TpLZ4oj33MrKme1FaTRxmbAQFaGaoBtRCvzrfkkMJtExkA9pzrDcNOJefoQmbVE0mugOGV/HBqlggCA1JtWibsSFp1LtgTj8QiVTPw0AvwBBy6djRP61uz+x0rtEh2bijO9R9Sseta42JmnkQjuvVVC5ZnMjh5cZU+qcimqcwKhq+JiNHK9QEPbe5HjPd1COl8G1a6awV1eg+uQATwcOte1rTvVC8LMPvqdVriPt1vV0HdiYBwzWmcXshK/Ok5/9w4L1ZCzUTMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hk/icA3tg2yxASdFK8hCZAue45GknNsL8dMk68KkmKA=; b=DX6Jjc5MmgJ6+zPLmhfBMSyQQGboLh4GzCRz2iWe67RJiK4ksbi4/ODFeoHyOIR7D9XlumwRHvzxtMZO7fw9o5poamduFQdWj8M65/kkkwuGUrLINe1vmRoGp/B6WsKKXdoU5rCw28i4vU/ZMY+5PRG4m0QH69Pe9izmyPJyrwM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by IA1PR12MB6161.namprd12.prod.outlook.com (2603:10b6:208:3eb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.17; Mon, 14 Nov 2022 14:07:46 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::b482:d5bd:c7d0:3842]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::b482:d5bd:c7d0:3842%9]) with mapi id 15.20.5813.017; Mon, 14 Nov 2022 14:07:46 +0000 Message-ID: <2f11dfbb-fa91-6fcc-c88b-8723e6d55753@amd.com> Date: Mon, 14 Nov 2022 14:07:38 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2 3/3] ethdev: document special cases of port start and stop Content-Language: en-US To: Dariusz Sosnowski , Aman Singh , Yuying Zhang , Thomas Monjalon , Andrew Rybchenko Cc: dev@dpdk.org References: <20221109190639.886457-1-dsosnowski@nvidia.com> <20221109190639.886457-4-dsosnowski@nvidia.com> From: Ferruh Yigit In-Reply-To: <20221109190639.886457-4-dsosnowski@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LNXP265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::36) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|IA1PR12MB6161:EE_ X-MS-Office365-Filtering-Correlation-Id: 03710513-9b04-4a9c-001b-08dac64999cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AGQrw+vTHG0JlHzuIjWCaumOiT1kxq0OQfJWw4n53ODIX6xkuvjeHJ6gEaxhUf54M1dR68GTYTi7SAvsdWQ3zCGyW7Mj7mCTnVrcOdAu9xZRDPHTuzfOmFsJ4qubjQWmOga3AzmLYR9MAvQIRt1md4OEtrOlbLFMREi2ulHxdX4NWIc26O51y5ylL1qXUCSKn+OoH2zUZ6H97gS9uH4oSsW0h73qhScAJhCYJWj+nDnIxRqyzKjmK69XYPfvSBcsWBlC0xZ1pMLc/cITSHZuaKM3YpFPH//lq6447W67nZj/VGoWY5EOfLOeHaAYrndmvRwulc2fHGmODs3R4TQIZzCNvbVHbHLdwehNLHOAK9fpzdfTK4dLY+VTBTA6lTolesSy8eAnrmZ9Pk937eR3ltnOMtLXjtIBGp4nXavjnYl0gBtodHWXlc3NxKQ324pcET1w222lbqBdf+QTOBECwG9ayEytuNzbhmezU/QkZJFwrKMi3J7ii5RXaYHPxgvWf5BhJR2jD5QraBpcmrBk58LEtzbXoRqNMxrjHST6aW37bciUL2a5OBaTW73OR1Z8K4qYKaJGCX2OFyIha2Ocj+ZVzfpOpVJxoXlh9mXQYVzg8yCrQ9gS4XJeYQlsaVD6UfjGJwPHujfDC8c6y+5LvNKsOOHhP+6iE7xdOWkEcT8Eaelk99PcogroxPnNPA2UibGMF8C4KVHViWmpUK3nU1k6gRv88LVvlB/v5ycFhjgqxoHlY8dcj6XVH1XnV+JG2OO4CIqD0mWv7OcmSGGp68cRnA3vVQeZhI+LKLoQE6M= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(346002)(366004)(396003)(376002)(136003)(39860400002)(451199015)(6512007)(2906002)(66476007)(8676002)(66946007)(66556008)(53546011)(4326008)(26005)(316002)(186003)(44832011)(6506007)(41300700001)(2616005)(36756003)(8936002)(31696002)(5660300002)(86362001)(38100700002)(83380400001)(6666004)(478600001)(6486002)(31686004)(110136005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RVdKZ3RaamY1N0NEamo1TU1zU2VpVWRpd0tvOUFIZ3dGRUhTSHhhMW5QT3c4?= =?utf-8?B?M2k3SVRHNHdqbUFsQmkyRmJBL3RiZVduQWVEcTJFTm0yY3B1N2p2enF1TXY5?= =?utf-8?B?RjVVd0U1T0lVMWZsbVJqVm12eDJjY2p4Q2tVaGlZbW5EU1JDYWVrbG9JUERh?= =?utf-8?B?aXdJSHppczljWUVoeDZWdCtCWkI3Y3ZSejJ5R0RiaTgrczVwT3B2UDAvK3pT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4U2FGUmZLeWxJMy9uRk1lZ2s1VFV3NDFBRVJ6Zk85?= =?utf-8?B?MXR0QTBxNmxJSXFHeVh4cUQ3Z3MxeHJDVTJhSkpvalhOMnRmaXZma2tVWnFP?= =?utf-8?Q?nF8RCbhbtNRFZNRsVJ1+fEK75?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03710513-9b04-4a9c-001b-08dac64999cd X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2022 14:07:46.1146 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kAhS3/mCxgSUiUZcbosWbZ0xXUUJqCWFPYRhhfdM5yZ8EkYK32IkxjY17piev7Gj X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6161 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 On 11/9/2022 7:06 PM, Dariusz Sosnowski wrote: > 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. > EAGAIN and EBUSY has kind of standard meaning, I am not sure if it is good idea to change this meaning to a specific "dependency to other port" use case. Why not keep common generic meanings of the error codes? > 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; If the stop() failed, isn't the current status should be STARTED independent from the error type? > + 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);