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 5F86643BCD; Fri, 1 Mar 2024 11:27:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 40D2842F53; Fri, 1 Mar 2024 11:27:14 +0100 (CET) Received: from wfhigh4-smtp.messagingengine.com (wfhigh4-smtp.messagingengine.com [64.147.123.155]) by mails.dpdk.org (Postfix) with ESMTP id C9A82400D5 for ; Fri, 1 Mar 2024 11:27:12 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id 4511F18000A6; Fri, 1 Mar 2024 05:27:09 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 01 Mar 2024 05:27:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1709288828; x=1709375228; bh=yLKIQWlfiW6y/Lm4+nr0JhHSg73M5uHpwc2mXs3cER4=; b= FjhrSAD5fGwG2x8IM2ekqGzVBTi+ciipQYBpWzwat79o8aKgp2Wp+cfSvxZSyOyO DtvRfPiSbkduIjGgy2DeY8WaJNHeXob/h6P1BxVT9Qf1hjZ+XqY3YV3zZb+Wr0zo Ui67WxHcQf3CCzcOKy4sGNxb95Hu5aDGXTj50v4Dg4h2JoonjrlJWmb0ldMfv2mZ OJaGqadS8QJEqaenNr/oqv+EI8Hp18tOsPFs0worNcDUcElyFqPeh4oQ0PyDOnRr Eo3ukiaNPl8zh6xGT0z2hXzFSXYGZY5WRuZ4qnlcRI7smG32ACTQk7U10TZTyeju QPnB5tuL4mzLQyY3tYtgPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709288828; x= 1709375228; bh=yLKIQWlfiW6y/Lm4+nr0JhHSg73M5uHpwc2mXs3cER4=; b=I dWbdABWksDLnUcDNqEWoxvQJj+g6eav2b94a9pw1m8zMArTSCrHstFFYZAB8lEYW Y0k1fxmqGqbyTw9CJfgwhU5rXA3PK87X/HABCNayZHCKemBamuc7RLRxDfwUftVg ZRv/lS5971zgb9uCSSf4E8otG77BjPXO5/n6c83tymZgX3fEwXKlJSy+prk6feHd hGND0iBsy3jxYUv4QN5A5JnCvvXgrA9j+o30fJ9ek12w2ofGmHhlUcKfHcALW9NU ISSEF417yHOabD/+4au9YX2fAyhnJGkbtdQkPwrs1tbng9UBsS+LpYhcAvVp/gPW KUmkbBc+yYp+x4evarxSg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrhedugdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkfgjfhgggfgtsehtqhertddttddunecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepfefhjeeluedvvedtuddtuedtvefhieejtefhffeujefhteduudev tdektdeikeffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 1 Mar 2024 05:27:07 -0500 (EST) From: Thomas Monjalon To: Morten =?ISO-8859-1?Q?Br=F8rup?= , Stephen Hemminger Cc: dev@dpdk.org, Ferruh Yigit , Andrew Rybchenko Subject: Re: [PATCH v2] ethdev: add Linux ethtool link mode conversion Date: Fri, 01 Mar 2024 11:27:05 +0100 Message-ID: <1911014.eGJsNajkDb@thomas> In-Reply-To: <20240229093818.642e6f48@hermes.local> References: <20240229123653.1379466-1-thomas@monjalon.net> <98CBD80474FA8B44BF855DF32C47DC35E9F28A@smartserver.smartshare.dk> <20240229093818.642e6f48@hermes.local> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" 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 29/02/2024 18:38, Stephen Hemminger: > On Thu, 29 Feb 2024 17:58:13 +0100 > Morten Br=F8rup wrote: >=20 > > > 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= =20 > > > API. =20 > > > > + * Using raw numbers directly avoids checking API availability > > > > + * and allows to compile with new bits included even on an old =20 > > > kernel. =20 > > > > + * > > > > + * The array below is built from bit definitions with this shell = =20 > > > command: =20 > > > > + * sed -rn 's;.*(ETHTOOL_LINK_MODE_)([0-9]+)([0-9a-zA-Z_]*).*=3D= =20 > > > *([0-9]*).*;'\ =20 > > > > + * '[\4] =3D \2, /\* \1\2\3 *\/;p' =20 > > > /usr/include/linux/ethtool.h | =20 > > > > + * awk '/_Half_/{$3=3D$3+1","}1' > > > > + */ > > > > +static uint32_t link_modes[] =3D { =20 > > >=20 > > > Make it const please. Yes > > > You could add meson rule to generate it and then use non-numeric tags= =2E =20 > >=20 > > 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. > >=20 >=20 > If the build system is older, the speed table will be smaller. And the co= de should just print "Unknown" > If the build system is newer, then the table will be larger than kernel e= ver returns which is Ok. There is no benefit in having a smaller table. That's why I prefer using numeric indices with the best coverage possible.