Thread (25 messages) 25 messages, 3 authors, 2023-11-23

Re: [RFC PATCH net-next v2 05/10] net: ethtool: Allow passing a phy index for some commands

From: Andrew Lunn <andrew@lunn.ch>
Date: 2023-11-21 01:08:44
Also in: linux-arm-kernel, lkml

+	if (dev) {
+		if (tb[ETHTOOL_A_HEADER_PHY_INDEX]) {
+			u32 phy_index = nla_get_u32(tb[ETHTOOL_A_HEADER_PHY_INDEX]);
+
+			phydev = link_topo_get_phy(&dev->link_topo, phy_index);
struct phy_device *link_topo_get_phy(struct link_topology *lt, int phyindex)

We have u32 vs int here for phyindex. It would be good to have the
same type everywhere.

+			if (!phydev) {
+				NL_SET_ERR_MSG_ATTR(extack, header, "no phy matches phy index");
+				return -EINVAL;
+			}
+		} else {
+			/* If we need a PHY but no phy index is specified, fallback
+			 * to dev->phydev
+			 */
+			phydev = dev->phydev;
+		}
+	}
+
+	req_info->phydev = phydev;
Don't forget to update Documentation/networking/ethtool-netlink.rst.

      Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help