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

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

From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2025-11-19 13:30:44
Also in: linux-arm-kernel, linux-arm-msm, linux-devicetree, lkml


On 19/11/2025 04:15, Jakub Kicinski wrote:
On Thu, 13 Nov 2025 09:14:05 +0100 Maxime Chevallier wrote:
quoted
--- 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?
hmpf indeed... thanks for spotting this
quoted
 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()
No problem :)

Thanks !

Maxime
quoted
+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