Thread (18 messages) 18 messages, 4 authors, 2022-08-27

Re: [PATCH net-next v2 6/7] ethtool: add interface to interact with Ethernet Power Equipment

flat view

From: Jakub Kicinski <kuba@kernel.org>
Date: 2022-08-25 18:08:06
Also in: linux-devicetree, linux-doc, lkml

On Thu, 25 Aug 2022 15:02:10 +0200 Oleksij Rempel wrote:
quoted hunk ↗ jump to hunk
+void ethtool_set_ethtool_pse_ops(const struct ethtool_pse_ops *ops)
+{
+	rtnl_lock();
+	ethtool_pse_ops = ops;
+	rtnl_unlock();
+}
+EXPORT_SYMBOL_GPL(ethtool_set_ethtool_pse_ops);
Do we really need the loose linking on the PSE ops?
It's not a lot of code, and the pcdev->ops should be 
enough to decouple drivers, it seems.
quoted hunk ↗ jump to hunk
+static int pse_set_pse_config(struct net_device *dev,
+			      struct netlink_ext_ack *extack,
+			      struct nlattr **tb)
+{
+	struct phy_device *phydev = dev->phydev;
+	struct pse_control_config config = {};
+	const struct ethtool_pse_ops *ops;
+	int ret;
+
+	if (!tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL])
+		return 0;
If SET has no useful attrs the usual response is -EINVAL.
quoted hunk ↗ jump to hunk
+	ops = ethtool_pse_ops;
+	if (!ops || !ops->set_config)
+		return -EOPNOTSUPP;
+
+	config.admin_cotrol = nla_get_u8(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]);
+
+	if (!phydev)
+		return -EOPNOTSUPP;
+
+	// todo resolve phydev dependecy
My lack of phydev understanding and laziness are likely the cause,
but I haven't found an explanation for this todo. What is it about?
quoted hunk ↗ jump to hunk
+	if (!phydev->psec)
+		ret = -EOPNOTSUPP;
+	else
+		ret = ops->set_config(phydev->psec, extack, &config);
+
+	return ret;
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help