From patchwork Wed Jan 22 17:42:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13947614 X-Patchwork-Delegate: kuba@kernel.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 0D9782153D5; Wed, 22 Jan 2025 17:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567784; cv=none; b=GTcKKCWQT+hNgQXTfX+84XJhFvXZnD7es4qSwDvEJpzZ3THSqLPH3uLijjZzoekS8Xq+pt+qYBbmSpA7TTrZ40dFrWfxRHSir86R8QB7fSjT1mtSDA+KA0+ma8xcctCZP2PWxwSxBXems8HsNOavrKJCKc0MRWh+TzLP+e1WboU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737567784; c=relaxed/simple; bh=U4GXsXjHNH8qWojj6vgU11Z4qIln4YJMD5I3RtgX87w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UPUAtKtaVjnV6JkyOn8wnk2rdMewoSB5JpxnT2ct65jeJRWCuEK1DAj3U1ibqqMvyJa+8IULJcqOHanlcy5lU1DEyvySkyQZbtW44vojlIFBy5iGtsdH9Oqn9qlkdvTrLIYnFXVT3zA+hBshr26o0uH/PybHmbiRrWSYYgHK9qE= 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=Rwg+zLXv; arc=none smtp.client-ip=217.70.183.201 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="Rwg+zLXv" Received: by mail.gandi.net (Postfix) with ESMTPSA id 142431BF20C; Wed, 22 Jan 2025 17:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1737567780; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lxBwRO45We+7ObzCCa7M0xSrioxzIdEM4qqA8w0iUl0=; b=Rwg+zLXvMErlE6LKk10vYUNupen0rNgW0JnrK+BiWNK7GV9o+3G1D9seOVy3JkgBgOYxpa /e6QaVo1/BCVVNgYUg8MAZXjA+pMXWCT2tTLjGqp3NnFrSie4jYi3BGgrFLI3D5U/bKuz/ oNhVviuNpBouYhXcxUtSCn9JtcQmYXY4xC8tx2D3UROs+h5HlnjBKGP6Kyx8FmaQZHAs2B P77ajSo5ogd1PN89uDVjEiSKI/6hnAy1re2DlokD+FnvhLS0kpACiurwqAA5a/R2NMPIxF IR1yTEQWGYsXKmGaiw9yuGToN2AFZj6qFQkhaJdBNGBKKWA2lym85QqaiFMTWA== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , 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?= =?utf-8?q?_Beh=C3=BAn?= , Oleksij Rempel , =?utf-8?q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org, Antoine Tenart , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH net-next RFC v2 3/6] net: ethtool: Export the link_mode_params definitions Date: Wed, 22 Jan 2025 18:42:48 +0100 Message-ID: <20250122174252.82730-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250122174252.82730-1-maxime.chevallier@bootlin.com> References: <20250122174252.82730-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC link_mode_params contains a lookup table of all 802.3 link modes that are currently supported with structured data about each mode's speed, duplex, number of lanes and mediums. As a preparation for a port representation, export that table for the rest of the net stack to use. Signed-off-by: Maxime Chevallier --- RFC V2: No changes include/linux/ethtool.h | 10 ++++++++++ net/ethtool/common.c | 1 + net/ethtool/common.h | 9 --------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 62b5a9d7efd5..519a90ce24d3 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -258,6 +258,16 @@ static inline const char *phy_mediums(enum ethtool_link_medium medium) } } +struct link_mode_info { + int speed; + u8 min_lanes; + u8 lanes; + u8 duplex; + enum ethtool_link_medium medium; +}; + +extern const struct link_mode_info link_mode_params[]; + /* declare a link mode bitmap */ #define __ETHTOOL_DECLARE_LINK_MODE_MASK(name) \ DECLARE_BITMAP(name, __ETHTOOL_LINK_MODE_MASK_NBITS) diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 487731945224..43b6135c8f0a 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -392,6 +392,7 @@ const struct link_mode_info link_mode_params[] = { __DEFINE_LINK_MODE_PARAMS(10, T1BRR, Full, T), }; static_assert(ARRAY_SIZE(link_mode_params) == __ETHTOOL_LINK_MODE_MASK_NBITS); +EXPORT_SYMBOL_GPL(link_mode_params); const char netif_msg_class_names[][ETH_GSTRING_LEN] = { [NETIF_MSG_DRV_BIT] = "drv", diff --git a/net/ethtool/common.h b/net/ethtool/common.h index b25011a05fea..ee250a5c5364 100644 --- a/net/ethtool/common.h +++ b/net/ethtool/common.h @@ -14,14 +14,6 @@ #define __SOF_TIMESTAMPING_CNT (const_ilog2(SOF_TIMESTAMPING_LAST) + 1) -struct link_mode_info { - int speed; - u8 min_lanes; - u8 lanes; - u8 duplex; - enum ethtool_link_medium medium; -}; - struct genl_info; struct hwtstamp_provider_desc; @@ -34,7 +26,6 @@ tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN]; extern const char phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN]; extern const char link_mode_names[][ETH_GSTRING_LEN]; -extern const struct link_mode_info link_mode_params[]; extern const char netif_msg_class_names[][ETH_GSTRING_LEN]; extern const char wol_mode_names[][ETH_GSTRING_LEN]; extern const char sof_timestamping_names[][ETH_GSTRING_LEN];