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 EB47243C3F; Thu, 29 Feb 2024 18:38:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BD4C42EA1; Thu, 29 Feb 2024 18:38:23 +0100 (CET) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id A244142DDD for ; Thu, 29 Feb 2024 18:38:22 +0100 (CET) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6e57a3bf411so736260b3a.0 for ; Thu, 29 Feb 2024 09:38:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709228302; x=1709833102; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=olypYQm7CI6++4VLpV6o3uJtkyDklFdOwWUliFicTO4=; b=wb1PW3A6Gu6n9/QcNU6DjLFSxnktVsZv9E1OitciARZuMjwqKfuUIcG4/HMRC8DUIL jm9ZWBnAKohB6X3ILbjSgnQKedYjcQrlJNxrK3PQscinCE4Juwnb1ma6jRxZ6ACHt26T QkbN07cTT0kqeGHbjLbIvrTgLsFNnjbtAqvxQqnBWYHkejJi0ZvqDy7SntdlDzComECj mEBJSYBvVTUKRA98XWUTy8jtkpCVa+5Mc3aq7lOpeoi2HyQgPytpsOUaIQAhizNDThrg IR9zVtfSw75pJRXHzPlLK4luNXABbjt9BsQGyGPUkp489uIsIBfolAN+EET2s6bNJFIC WN3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709228302; x=1709833102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=olypYQm7CI6++4VLpV6o3uJtkyDklFdOwWUliFicTO4=; b=vEXrkl4Wxj8maTWBW5LhrH0oE/ZBEqDbHnni9zsboD/6l0CA3wA9Gjzpxx/ockfgxb +1ogDgeFTmqsVLqzncs2EDx8EDJr1NcMLU9r7ZgvwFkKYpeRW8GtQBXvHkVM4YCz7xXI ozbkdpJg70xIUMphjUp82P9E46KhyhEriVgYtNOppb64st4wiRYsSjkCP8wQcsYyJ7Wf Q04/5NE2q/Eo3FJKuaL/wQ7jRtMweoTwZiyn6fPL2hbqmdECYHfkh5fnsNvpcwlx7sOh WAJ+yMGXrv8XNcowhB2QJar96pE2OhL8gagPAe10LIQQJKelCEPoBz4tHqyGXztA9Yfu gYaA== X-Forwarded-Encrypted: i=1; AJvYcCVfqTZHxSHYK1B6Prpji7Thq/rLcZJ2sEXZ/zo/eFevhBFIUZJs8PbxjQLBI6CJqiLnL9BU8XbZbfD2//k= X-Gm-Message-State: AOJu0YxgeP0AXF+zcyLtDSDq9+Zs7p4r279aW54vwXTlzXinyOwAb12v mm5mfk5Ibt6UXHPypzBoloiTkw8nnHjAB9LvuD2gyPrVlzu9PIkl5EPD+ApVi/Y= X-Google-Smtp-Source: AGHT+IGMo47Ygf4Zo7YoZ4lAxJl1LzPeXJRKFhc93vK5JI5b5WslWw5+wb/ETnZd4HuQociBKqkIPw== X-Received: by 2002:aa7:984b:0:b0:6e2:b25d:a999 with SMTP id n11-20020aa7984b000000b006e2b25da999mr3060394pfq.34.1709228301704; Thu, 29 Feb 2024 09:38:21 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id ei4-20020a056a0080c400b006e57e220ceasm1553017pfb.6.2024.02.29.09.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 09:38:21 -0800 (PST) Date: Thu, 29 Feb 2024 09:38:18 -0800 From: Stephen Hemminger To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Cc: "Thomas Monjalon" , , "Ferruh Yigit" , "Andrew Rybchenko" Subject: Re: [PATCH v2] ethdev: add Linux ethtool link mode conversion Message-ID: <20240229093818.642e6f48@hermes.local> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F28A@smartserver.smartshare.dk> References: <20240229123653.1379466-1-thomas@monjalon.net> <20240229154343.1752555-1-thomas@monjalon.net> <20240229084517.510acd7f@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35E9F28A@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Thu, 29 Feb 2024 17:58:13 +0100 Morten Br=C3=B8rup wrote: > > 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. > >=20 > > You could add meson rule to generate it and then use non-numeric tags. = =20 >=20 > However you do it, make sure it cross builds. The kernel/ethtool on the t= arget system may differ from the one on the build system. >=20 If the build system is older, the speed table will be smaller. And the code= should just print "Unknown" If the build system is newer, then the table will be larger than kernel eve= r returns which is Ok.