[PATCH 1/2] net: ethtool: Add link mode for 25Gbps long-range fiber

Josua Mayer posted 2 patches 3 weeks ago
[PATCH 1/2] net: ethtool: Add link mode for 25Gbps long-range fiber
Posted by Josua Mayer 3 weeks ago
ethtool.h header already has a link-mode bit for short-range (SR) fiber.
but missing the long-range (LR) variant.

Define link-mode bit for 25Gbps long-range fiber (25000baseLR_Full).

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 drivers/net/phy/phy-core.c   | 2 +-
 include/uapi/linux/ethtool.h | 1 +
 net/ethtool/common.c         | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 3badf6e84554..cccd1316e145 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -18,7 +18,7 @@
  */
 const char *phy_speed_to_str(int speed)
 {
-	BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 125,
+	BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 126,
 		"Enum ethtool_link_mode_bit_indices and phylib are out of sync. "
 		"If a speed or mode has been added please update phy_speed_to_str "
 		"and the PHY settings array.\n");
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index ce9aeb65a8e1..51929f3e00d9 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -2094,6 +2094,7 @@ enum ethtool_link_mode_bit_indices {
 	ETHTOOL_LINK_MODE_1600000baseKR8_Full_BIT	 = 122,
 	ETHTOOL_LINK_MODE_1600000baseDR8_Full_BIT	 = 123,
 	ETHTOOL_LINK_MODE_1600000baseDR8_2_Full_BIT	 = 124,
+	ETHTOOL_LINK_MODE_25000baseLR_Full_BIT		 = 125,
 
 	/* must be last entry */
 	__ETHTOOL_LINK_MODE_MASK_NBITS
diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 4036561b078b..0010debce4e6 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -237,6 +237,7 @@ const char link_mode_names[][ETH_GSTRING_LEN] = {
 	__DEFINE_LINK_MODE_NAME(1600000, KR8, Full),
 	__DEFINE_LINK_MODE_NAME(1600000, DR8, Full),
 	__DEFINE_LINK_MODE_NAME(1600000, DR8_2, Full),
+	__DEFINE_LINK_MODE_NAME(25000, LR, Full),
 };
 static_assert(ARRAY_SIZE(link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);
 
@@ -464,6 +465,7 @@ const struct link_mode_info link_mode_params[] = {
 	__DEFINE_LINK_MODE_PARAMS(1600000, KR8, Full, K),
 	__DEFINE_LINK_MODE_PARAMS(1600000, DR8, Full, D),
 	__DEFINE_LINK_MODE_PARAMS(1600000, DR8_2, Full, D),
+	__DEFINE_LINK_MODE_PARAMS(25000, LR, Full, L),
 };
 static_assert(ARRAY_SIZE(link_mode_params) == __ETHTOOL_LINK_MODE_MASK_NBITS);
 EXPORT_SYMBOL_GPL(link_mode_params);

-- 
2.43.0