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 9D09F43BEB; Fri, 1 Mar 2024 16:08:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7066B42830; Fri, 1 Mar 2024 16:08:23 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) by mails.dpdk.org (Postfix) with ESMTP id 1494D427D8 for ; Fri, 1 Mar 2024 16:08:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NbShL+YVoaHy4ZNFxtpPYf8FyzFnJNHRyL801280WhSF4cPMSIgZThB/ceA5VbbIc0eWmtXgpdVa0MavIlTS6/tQ63B1fxBc4LAGWvTXUX7q63qIkXPoKSs8nd7FEDB58CSHs+UOxJqwA/sAD9zeWUZaHCyEyQmlPynuxvPRh0+xeaA6Hgth5W/lLVIGvuCxSfVrcaXRvmNeSQIbVzINf8NsHkg2FY2xWSa+0tuvpjlsIDF/YL4e2jNI7NomPMlcnFBjVEmjVF+1Wd5eghDOLgBC6fu+FtnHZ1cxags1rM8X31zhcxIntnkpeLfotYAqdIYsV7SXc0Ek6h0axya70g== 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=C/C2Yo2jvbjdanaNnnExzSiMXfvq2KNz3W87hDp0Ez4=; b=R2hMsbFgC3dbtTckG9ofhk8kxqfddNPmU3lvCt7TpOjVbluszQmOZXUuhfUOh5FBGI4NiqmJMEwYpvggrr41tXMu40/FrBermMKqfKcNipa1BuVBKO6KYy/aRLlmQv5XgfwApgFXaFUBBAsC+1l46P2GLq1H6JT471nbO72w6mekj7a7guk3J64vzIk7WGx7oPgFGk3dee5hUYqiFlqZMBQfNEw7aWyY1H3LHNMbHBmS0tGs3eEhKDpeAwcEHvvUXJzXOKOLcbnuSGwAHrcJHmmCv7IZEdMaC0cQcSaxNh5579CiVlrGnrJ4zE3oFKQo8Vd2r0BQlWZ37zKJ5me1PQ== 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=C/C2Yo2jvbjdanaNnnExzSiMXfvq2KNz3W87hDp0Ez4=; b=szj6oXWR2/f9KvEMuWqZPZLFHknygQ/YpggBe5WL+wOF+BQbfAy4zRLusy5ijjupEZKX65tf4TPehPA2EcnYPrHRDngmSR7FrrqErFarPnoAKlkP/98pt8MSr3V7TOzGw1Miv88JL7upcPhp5a/RtaMLDcsINtV347ylwMUH2wA= 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 MW4PR12MB7357.namprd12.prod.outlook.com (2603:10b6:303:219::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Fri, 1 Mar 2024 15:08:18 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3ec7:6339:1c14:c529]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3ec7:6339:1c14:c529%5]) with mapi id 15.20.7316.039; Fri, 1 Mar 2024 15:08:18 +0000 Message-ID: <14dcf7c4-2e9d-459e-b701-5f26ab4174a1@amd.com> Date: Fri, 1 Mar 2024 15:08:14 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] ethdev: add Linux ethtool link mode conversion Content-Language: en-US To: Thomas Monjalon Cc: dev@dpdk.org, Andrew Rybchenko References: <20240229123653.1379466-1-thomas@monjalon.net> <20240229154343.1752555-1-thomas@monjalon.net> <14dc648a-dc45-4308-b096-cd1a189a2e80@amd.com> <3271586.N7aMVyhfb1@thomas> From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iARRCiQ N3AmBIxZ/A7UXBKLaOyZ+/i3sE6Wb53nrO4i8+0K2Qwyh6LjTeiJAIjYKN43ppxz3DaI+QwQ vI+uyHr4Gg0Da9EPPz/YyKauSeOZCfCB5gIfICO0j6x0SCl8uQ2nLpjxcZkf0gjcwUzP3h+S 3x6NfDji9YEij0zczW/dcSpGgZ6vsFpPrtnP9ZXy6J53yp0kJtOJoOlkEFFdU2yCZnCDseum CoudmGLZVvS0/DzHDJejq+3kK3FDGktZBOxZIIpal+nFqS7lVgOZc4+huVv3jyhzoAUOEyXA XK5j6o7g8STUY+z33QNnHpdLvecMwuzmvqy0jR54yAbZ64mB9QARAQABzSNGZXJydWggWWln aXQgPGZlcnJ1aC55aWdpdEBhbWQuY29tPsLBlwQTAQgAQQIbAwULCQgHAgYVCgkICwIEFgID AQIeAQIXgAIZARYh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ZUMTzME5PFCXJIZ83qkZQ795MTe2YScp9dIV7fsS5tpDwIs7BZNVM1l3NAdK+DLHqNxKuyO 8Zk= In-Reply-To: <3271586.N7aMVyhfb1@thomas> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0655.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:316::9) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|MW4PR12MB7357:EE_ X-MS-Office365-Filtering-Correlation-Id: a7cff5be-cd9e-48fc-ce9a-08dc3a016d67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2SwdPPHxhH8XEVchqa8cJrgyWLICDui76rHzuw5w/qmBJQqG9fo1ONlP9m9dNz6az0V9hiZ3XLHoGGrK/Qy3OcedGZYScztLEpq780m17prN/1yQ/Mit3LTZPSbsphc3yRGKvOmK6rwGooLMYkN3WdfYNKkfuQ4ddyEmKNAr/3+KqQNs47DYsBMrdiyUyxvUqX3gfPcsQaSHPsodohcCuPxQQvgqXfMDfRDzJ73RfyFSFSf3eWNetCCVxbRbWG1GZwXWnRBAsGB9MGux4aqhiscTBNHswfYFb4p9L19J5wK/Fq6GT1P3+GMg+Vh2Qlvf1LIUQtBa9+Bv3z514lrd9FZAHOIl0zUciT6CICHHM1yyzsVgAgTkgu8Jg1kIMWrgAjEEb6Jvxi8rbUivSDQKXz+1t/ELR/nS1cLVXbLxlKfIF4AcLPGXUW/KX8YiWWRXxtjNsecaT8ZabkKsY85SyJeCs8m1sNLq6C7WpWN3piLesyqzZv5d3pf3YvgFlDYgrGJBM7YqIAPMJH2csvScUIzJ9v1+Xh+3oSInOKDSb/+xPJ4J43GV95H217g2g3dWaOvP9UmB8z/Q6xXl6NDY1okDUjjo0yLilqCOpMqLgn8sKZUH2Eptxj1pF9bu8JKVEqhoOzUPoXvPUaXfdDhNzw== 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:(13230031); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OEFPZGR5cENIS3NLQXZ6OG1ueUIwTStVYkw0VE9pTkFwNnpZdHROYVRpQnJD?= =?utf-8?B?YnVNZlZiRVBJWFpxT3UxVWg5VTJvdHdQOU9seVRnNEI1QjJ2MkxsaFF0QjNa?= =?utf-8?B?bjIwNGNQVVV6WEcwWm10aUF6b0hCTWgrTW1DNWZkbndsUk5MUjJIbWxoTnE0?= =?utf-8?B?YUtDTjQ1UXRuY05kaktrYWNSamk0LzM4OWlUYkhHL2cxR2QrNklaNUpBWkZF?= =?utf-8?B?dFdobEZEUmNZa2wyWktkMzhFZlBBb1VVVktRSU9NYk9LVzZXY2FzTTRrS29F?= =?utf-8?B?V2pHOEk2U3pXNnZGM3JxT0NUWWc4SUZJVXNuQWpidnZlemlpQzRwcnB1elNB?= =?utf-8?B?QmRlNW5iZlBtc0dxbzVkZDJXY0FDUkhKVVJ5anpyd3hKOTVNRzBhbzBPbVhp?= =?utf-8?B?Y2h4VHAvdGFXSkJLaDhLYUZxbWNsMkhuYThMeHZUS0xvb2RMa1NyRVBFaHM5?= =?utf-8?B?cnhmcHkyeE01eTR4VE5OaVFmY0ZQaHVRWkdHcEdNZWl0eWRWL3dJemZaRUZk?= =?utf-8?B?dXdOeFF4eXdGZnZnNFdvRUhmdXhQdFN1OGdXMFFMZTYyUzBOWVBldXRCVGJq?= =?utf-8?B?ZHlvL0VZckJqTm1Db3JZQ2pYQThKS2x0TC9RUytpTXhTS0pQNkNOR0EvUzR2?= =?utf-8?B?dXF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r?= =?utf-8?B?Q2ZUTko5VVgyZFRpL3VjSTJuUUplYWlmMlkyVzFuVW5HQ3pvMGdYK0M4eFp5?= =?utf-8?B?MlROcEozN0RUMTZITHNYbUZQRkRnYUk2QStIS21WcmNPZEZwUFdpcXdBU1ZC?= =?utf-8?B?d2sxWmRwMjdVZGNYUDExVy93YWY0enpVeitMMy93NFB2VVpkN0g4bGJCcDhJ?= =?utf-8?B?dVkycGxaUkVmMUJpM1Fqc3RLZ2lVdFhGaWY3YTlKLzRaclR6R3RxWUl3b0Ny?= =?utf-8?B?TE5TQTJoc0R5S21wUm9sQ1VEeEN5RlZsTlFzbTB2Qm5XUkZQVzF0blVNMHl2?= =?utf-8?B?a0V5bnJreXVIT1F5d1BkOGZadkhCNDZnOTI3eDRQZDVmUWluRTd0SG1EbkN5?= =?utf-8?B?UUhsMXdXdVdYRCthLzhTVWJ6U2psekNIR09ldnhmcUZybjZ6NEQyWkVtRVhj?= =?utf-8?B?WitkVTJGNmtnQXdXdWpSZW5nd2hvVzRsL3hqd29qZEVGaVZjZFZndTBqWUww?= =?utf-8?B?MFZnQlVaSy9rNmo2VVhkcVM1eDdhQVZINGJwTkx3WHFrdTNFQzQ3K053c25R?= =?utf-8?Q?FuPo4zfPkN8o1zgw44ChsyUVc?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7cff5be-cd9e-48fc-ce9a-08dc3a016d67 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2024 15:08:18.6423 (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: 5T1x9Qn0eVlGFZJn9+q+laWXUaj5lgzQ8wDT4jyoUq1evUthZuX0HHIWd/V81UUE X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7357 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 3/1/2024 1:37 PM, Thomas Monjalon wrote: > 01/03/2024 14:12, Ferruh Yigit: >> On 2/29/2024 3:42 PM, Thomas Monjalon wrote: >>> Speed capabilities of a NIC may be discovered through its Linux >>> kernel driver. It is especially useful for bifurcated drivers, >>> so they don't have to duplicate the same logic in the DPDK driver. >>> >>> Parsing ethtool speed capabilities is made easy thanks to >>> the functions added in ethdev for internal usage only. >>> Of course these functions work only on Linux, >>> so they are not compiled in other environments. >>> >>> In order to ease parsing, the ethtool macro names are parsed >>> externally in a shell command which generates a C array >>> included in this patch. >>> It also avoids to depend on a kernel version. >>> This C array should be updated in future to get latest ethtool bits. >>> Note it is easier to update this array than adding new cases >>> in a parsing code. >>> >>> The types in the functions are following the ethtool type: >>> uint32_t for bitmaps, and int8_t for the number of 32-bitmaps. >>> >>> Signed-off-by: Thomas Monjalon >>> --- >>> >>> A follow-up patch will be sent to use these functions in mlx5. >>> I suspect mana could use this parsing as well. >>> >> >> Is the usecase driver get link info via ibverbs and convert it to DPDK >> link info? > > The use case is to get capabilities from the kernel driver via ethtool ioctl. > Sure, as it is adding kernel ethtool conversion, DPDK driver will get link from kernel driver, thanks for clarification. >> How complex or duplicated effort to get link info directly via DPDK >> functions? > > This is done by the driver. > This is how mlx5 driver is getting speed capabilities. > >> Because this approach is can be applied to only limited devices in DPDK >> and solving an issue DPDK already has a solution, does it worth to the >> code it adds? > > It is going to replace code in mlx5 driver. > I could add this code in mlx5 driver, > but it could help other drivers in future like mana. > Why replace, is there anything to fix in the DPDK link get code? >>> + speed = link_modes[bit]; >>> + if (speed == 0) >>> + return RTE_ETH_LINK_SPEED_AUTONEG; >>> + RTE_BUILD_BUG_ON(RTE_ETH_LINK_SPEED_AUTONEG != 0); >>> >> >> I think for above two checks, we can't really get the speed from >> provided ethtool enum, and intention is to return something ineffective, >> intention is not really return AUTONEG, right? If so why not directly >> return 0? > > Yes it could return 0 directly, but the namespace of the returned value > is RTE_ETH_LINK_SPEED_. > Also it is semantically correct: if no other capability found, > there is no other choice than autoneg. > >>> + >>> + /* duplex is LSB */ >>> + duplex = (speed & 1) ? >>> + RTE_ETH_LINK_HALF_DUPLEX : >>> + RTE_ETH_LINK_FULL_DUPLEX; >>> + speed &= RTE_GENMASK32(31, 1); >> >> As trying to zero the LSB, following also work, >> >> speed &= ~UINT32_C(1) > > Indeed, this is what RTE_GENMASK32 is doing. > But I think using RTE_GENMASK32 better convey the intent. > > [...] >>> + for (word = 0; word < nwords; word++) { >>> + for (bit = 0; bit < 32; bit++) { >> >> May be (sizeof(bitmap) * CHAR_BIT) instead of hardcoded 32, although not >> sure if it is required. > > Anyway we are using RTE_BIT32 below, so we must know it is 32 bits. > >>> + if ((bitmap[word] & RTE_BIT32(bit)) == 0) >>> + continue; >>> + ethdev_bitmap |= rte_eth_link_speed_ethtool(word * 32 + bit); > > [...] >>> --- a/lib/ethdev/meson.build >>> +++ b/lib/ethdev/meson.build >>> +if is_linux >>> + driver_sdk_headers += files( >>> + 'ethdev_linux_ethtool.h', >>> + ) >>> + sources += files( >>> + 'ethdev_linux_ethtool.c', >>> + ) >>> +endif >> >> Should meson check if 'linux/ethtool.h' exists, for anycase? > > It is an old API header file. Why would not be there? > Just to be cautious, but I just recognized this dependency already exists in some drivers, and they don't check for the header. It seems it is OK to not check the header. > If we make it conditional here, we'll need to make it conditional in the caller. > >