From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D9534844F; Wed, 19 Nov 2025 13:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763558971; cv=none; b=L5nN9rySMVVLcESJtEJsXPmIw+gv/0mMEETSbi9jnzfoOu3ntRDDcTYkWqcFT1H99r+ECJ3COjl+yAdcU8kG1zMMJcx/Szj63+Q3woh1JEN43e1y8nhu6C7TJWfrtqygHTa9PzfDadBLLNe4ple0bnQxsVUXvRY45vBEuOZynLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763558971; c=relaxed/simple; bh=qw70Gd/8aPnigjGd4TFxyj7CW7WiK8MjE5NahwJDp/4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SvTp7A64oEr2zekaofAoh+Tq48NqeNak9z1ycfp8KUdDxB2PfOVux0Im0TArZ3z/U8IfZmwZxHxjrwvmSTRVjxdlLmGR58Lb6xd70wMfKbN+CZvrNzWz9ADvV3Dg83NabFIlWxHpp/75nKcs5S2mSnW4xJYo7hATxDHDELs9Q4A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Pe1Fcnas; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Pe1Fcnas" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id C0CFC4E4179C; Wed, 19 Nov 2025 13:29:21 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9307F60699; Wed, 19 Nov 2025 13:29:21 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 239FB10371A57; Wed, 19 Nov 2025 14:29:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1763558960; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=QCeVgdlyRn3to5o8svSAQCYCIaAyOrCinIsywtbsnqc=; b=Pe1FcnasPMVjycj+4K0o7Bt+G5cxX2nnbT/fjuTU12uOoD4C3dTkyrWYHDi4XbjOerISVJ GiBRvYSi1g+DJiRpzTmUx46bAYXMDyGPbCQO2SLSqf0G1FD5Ot/to08c5dMt4qwhoVjffU 37zIfMQw1phSkaC1c/UNsBu4sEVa6I96q563Ij2ZArqeBPQaaRxRQn/qFGDgK9b1CakKZw +QkZhMbpKEb0PxoTkvEClXSlBk4+/4wVOW+TfgWXpgzfxptQVhNs/R9RCcqX2Xcr/leEzs eAupQQBmU4B84dRKUW9STIjPPYVKbLbTmcmWdRne8rlSpmzA3wUjDBd4WnJktw== Message-ID: <57aa6516-ae7d-4d8d-9ae4-70bd6557547f@bootlin.com> Date: Wed, 19 Nov 2025 14:29:09 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v16 02/15] net: ethtool: Introduce ETHTOOL_LINK_MEDIUM_* values To: Jakub Kicinski Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?UTF-8?Q?K=C3=B6ry_Maincent?= , =?UTF-8?Q?Marek_Beh=C3=BAn?= , Oleksij Rempel , =?UTF-8?Q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org, Antoine Tenart , devicetree@vger.kernel.org, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Romain Gantois , Daniel Golle , Dimitri Fedrau References: <20251113081418.180557-1-maxime.chevallier@bootlin.com> <20251113081418.180557-3-maxime.chevallier@bootlin.com> <20251118191517.1a369dad@kernel.org> From: Maxime Chevallier Content-Language: en-US In-Reply-To: <20251118191517.1a369dad@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 Hi Jakub, On 19/11/2025 04:15, Jakub Kicinski wrote: > On Thu, 13 Nov 2025 09:14:04 +0100 Maxime Chevallier wrote: >> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h >> index c2d8b4ec62eb..ad2b5ed9522b 100644 >> --- a/include/linux/ethtool.h >> +++ b/include/linux/ethtool.h >> @@ -216,13 +216,26 @@ static inline u8 *ethtool_rxfh_context_key(struct ethtool_rxfh_context *ctx) >> void ethtool_rxfh_context_lost(struct net_device *dev, u32 context_id); >> >> struct link_mode_info { >> - int speed; >> - u8 lanes; >> - u8 duplex; >> + int speed; >> + u8 lanes; >> + u8 min_pairs; >> + u8 pairs; >> + u8 duplex; >> + u16 mediums; >> }; >> >> extern const struct link_mode_info link_mode_params[]; >> >> +extern const char ethtool_link_medium_names[][ETH_GSTRING_LEN]; >> + >> +static inline const char *phy_mediums(enum ethtool_link_medium medium) >> +{ >> + if (medium >= __ETHTOOL_LINK_MEDIUM_LAST) >> + return "unknown"; >> + >> + return ethtool_link_medium_names[medium]; >> +} > > Will this function be called by a lot of drivers? Would be great to > find a more suitable place for it, ethtool.h is included by thousands > of objects :( I expect this to be mostly used by the current DT parsing code, as well as a few print statements in the core. So indeed let's move this somewhere more specific. > >> /* declare a link mode bitmap */ >> #define __ETHTOOL_DECLARE_LINK_MODE_MASK(name) \ >> DECLARE_BITMAP(name, __ETHTOOL_LINK_MODE_MASK_NBITS) >> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h >> index 8bd5ea5469d9..6ed235053aed 100644 >> --- a/include/uapi/linux/ethtool.h >> +++ b/include/uapi/linux/ethtool.h >> @@ -2587,4 +2587,24 @@ enum phy_upstream { >> PHY_UPSTREAM_PHY, >> }; >> >> +enum ethtool_link_medium { >> + ETHTOOL_LINK_MEDIUM_BASET = 0, >> + ETHTOOL_LINK_MEDIUM_BASEK, >> + ETHTOOL_LINK_MEDIUM_BASES, >> + ETHTOOL_LINK_MEDIUM_BASEC, >> + ETHTOOL_LINK_MEDIUM_BASEL, >> + ETHTOOL_LINK_MEDIUM_BASED, >> + ETHTOOL_LINK_MEDIUM_BASEE, >> + ETHTOOL_LINK_MEDIUM_BASEF, >> + ETHTOOL_LINK_MEDIUM_BASEV, >> + ETHTOOL_LINK_MEDIUM_BASEMLD, >> + ETHTOOL_LINK_MEDIUM_NONE, >> + >> + __ETHTOOL_LINK_MEDIUM_LAST, >> +}; > > Why is this in uAPI? I'd have expected it to either exist in the YAML > spec if there's a new uAPI that needs it, or in kernel headers. > Let's move it out for now to be safe, we can always move it in. I originally planned to report that in linkmodes et.al. but changed my mind, let me move that out as well. > >> +#define ETHTOOL_MEDIUM_FIBER_BITS (BIT(ETHTOOL_LINK_MEDIUM_BASES) | \ >> + BIT(ETHTOOL_LINK_MEDIUM_BASEL) | \ >> + BIT(ETHTOOL_LINK_MEDIUM_BASEF)) > > Ditto. Thanks for taking a look, Maxime