Thread (31 messages) 31 messages, 5 authors, 2025-11-19

Re: [PATCH net-next v16 03/15] net: phy: Introduce PHY ports representation

From: Jakub Kicinski <kuba@kernel.org>
Date: 2025-11-19 03:15:28
Also in: linux-arm-kernel, linux-arm-msm, linux-devicetree, lkml

On Thu, 13 Nov 2025 09:14:05 +0100 Maxime Chevallier wrote:
quoted hunk ↗ jump to hunk
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -228,6 +228,10 @@ extern const struct link_mode_info link_mode_params[];
 
 extern const char ethtool_link_medium_names[][ETH_GSTRING_LEN];
 
+#define ETHTOOL_MEDIUM_FIBER_BITS (BIT(ETHTOOL_LINK_MEDIUM_BASES) | \
+				   BIT(ETHTOOL_LINK_MEDIUM_BASEL) | \
+				   BIT(ETHTOOL_LINK_MEDIUM_BASEF))
Hm, I think this is defined in uAPI as well?
quoted hunk ↗ jump to hunk
 static inline const char *phy_mediums(enum ethtool_link_medium medium)
 {
 	if (medium >= __ETHTOOL_LINK_MEDIUM_LAST)
@@ -236,6 +240,22 @@ static inline const char *phy_mediums(enum ethtool_link_medium medium)
 	return ethtool_link_medium_names[medium];
 }
 
+static inline enum ethtool_link_medium ethtool_str_to_medium(const char *str)
+{
+	int i;
+
+	for (i = 0; i < __ETHTOOL_LINK_MEDIUM_LAST; i++)
+		if (!strcmp(phy_mediums(i), str))
+			return i;
+
+	return ETHTOOL_LINK_MEDIUM_NONE;
+}
Same comment about possibly moving this elsewhere as on phy_mediums()
+static inline int ethtool_linkmode_n_pairs(unsigned int mode)
+{
+	return link_mode_params[mode].pairs;
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help