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 6229643C3B; Thu, 29 Feb 2024 17:58:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1E8F402E0; Thu, 29 Feb 2024 17:58:17 +0100 (CET) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id CC4D14025C for ; Thu, 29 Feb 2024 17:58:16 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id C93862119E; Thu, 29 Feb 2024 17:58:14 +0100 (CET) Content-class: urn:content-classes:message Subject: RE: [PATCH v2] ethdev: add Linux ethtool link mode conversion MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Thu, 29 Feb 2024 17:58:13 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F28A@smartserver.smartshare.dk> X-MimeOLE: Produced By Microsoft Exchange V6.5 In-Reply-To: <20240229084517.510acd7f@hermes.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v2] ethdev: add Linux ethtool link mode conversion Thread-Index: AdprLre5eSHc80dxS1ayYZsMlLX7uQAAYxNw References: <20240229123653.1379466-1-thomas@monjalon.net> <20240229154343.1752555-1-thomas@monjalon.net> <20240229084517.510acd7f@hermes.local> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Stephen Hemminger" , "Thomas Monjalon" Cc: , "Ferruh Yigit" , "Andrew Rybchenko" 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 > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Thursday, 29 February 2024 17.45 >=20 > On Thu, 29 Feb 2024 16:42:56 +0100 > Thomas Monjalon wrote: >=20 > > +/* Link modes sorted with index as defined in ethtool. > > + * Values are speed in Mbps with LSB indicating duplex. > > + * > > + * The ethtool bits definition should not change as it is a kernel > API. > > + * Using raw numbers directly avoids checking API availability > > + * and allows to compile with new bits included even on an old > kernel. > > + * > > + * The array below is built from bit definitions with this shell > command: > > + * sed -rn 's;.*(ETHTOOL_LINK_MODE_)([0-9]+)([0-9a-zA-Z_]*).*=3D > *([0-9]*).*;'\ > > + * '[\4] =3D \2, /\* \1\2\3 *\/;p' > /usr/include/linux/ethtool.h | > > + * awk '/_Half_/{$3=3D$3+1","}1' > > + */ > > +static uint32_t link_modes[] =3D { >=20 > Make it const please. >=20 > You could add meson rule to generate it and then use non-numeric tags. However you do it, make sure it cross builds. The kernel/ethtool on the = target system may differ from the one on the build system.