Thread (26 messages) 26 messages, 5 authors, 2019-02-01

Re: [PATCH net-next 05/10] net: phy: introduce a phy_driver macsec helper

From: Andrew Lunn <andrew@lunn.ch>
Date: 2019-01-23 17:08:22
Also in: lkml

+int phy_macsec(struct phy_device *phydev, struct netdev_macsec *macsec)
+{
+	int ret = -EOPNOTSUPP;
+
+	if (!phydev->drv)
+		return -EIO;
+
+	mutex_lock(&phydev->lock);
+
+	if (phydev->drv->macsec)
+		ret = phydev->drv->macsec(phydev, macsec);
+
+	mutex_unlock(&phydev->lock);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(phy_macsec);
+
quoted hunk ↗ jump to hunk
@@ -630,6 +634,10 @@ struct phy_driver {
 			    struct ethtool_tunable *tuna,
 			    const void *data);
 	int (*set_loopback)(struct phy_device *dev, bool enable);
+
+#ifdef CONFIG_MACSEC
+	int (*macsec)(struct phy_device *dev, struct netdev_macsec *macsec);
+#endif
Hi Antoine

So the member only exists if CONFIG_MACSEC is defined. So i think you
need similar protection in phy_macsec() or you are going to try to
access a member which sometimes does not exist.

       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