lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20190123155638.13852-6-antoine.tenart@bootlin.com> Date: Wed, 23 Jan 2019 16:56:33 +0100 From: Antoine Tenart <antoine.tenart@...tlin.com> To: davem@...emloft.net, sd@...asysnail.net, andrew@...n.ch, f.fainelli@...il.com, hkallweit1@...il.com Cc: Antoine Tenart <antoine.tenart@...tlin.com>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com, alexandre.belloni@...tlin.com, quentin.schulz@...tlin.com, allan.nielsen@...rochip.com Subject: [PATCH net-next 05/10] net: phy: introduce a phy_driver macsec helper This patch introduces a phy_driver MACsec helper to allow PHYs to implement a MACsec offloading solution. The phy_driver MACsec helper is called through a wrapper, phy_macsec, to perform this call while holding the phydev lock. Signed-off-by: Antoine Tenart <antoine.tenart@...tlin.com> --- drivers/net/phy/phy.c | 17 +++++++++++++++++ include/linux/phy.h | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 631ed33fe9d9..6b37bb845ce9 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1095,6 +1095,23 @@ int phy_get_eee_err(struct phy_device *phydev) } EXPORT_SYMBOL(phy_get_eee_err); +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); + /** * phy_ethtool_get_eee - get EEE supported and status * @phydev: target phy_device struct diff --git a/include/linux/phy.h b/include/linux/phy.h index 1f3873a2ff29..21839f352e7c 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -27,6 +27,10 @@ #include <linux/workqueue.h> #include <linux/mod_devicetable.h> +#ifdef CONFIG_MACSEC +#include <net/macsec.h> +#endif + #include <linux/atomic.h> #define PHY_DEFAULT_FEATURES (SUPPORTED_Autoneg | \ @@ -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 }; #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv) @@ -1072,6 +1080,7 @@ int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask); int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable); int phy_get_eee_err(struct phy_device *phydev); +int phy_macsec(struct phy_device *phydev, struct netdev_macsec *macsec); int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data); int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); -- 2.20.1
Powered by blists - more mailing lists