[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230327142202.3754446-2-o.rempel@pengutronix.de>
Date: Mon, 27 Mar 2023 16:21:55 +0200
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: Wei Fang <wei.fang@....com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>
Cc: Oleksij Rempel <o.rempel@...gutronix.de>, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Shenwei Wang <shenwei.wang@....com>,
Clark Wang <xiaoning.wang@....com>,
NXP Linux Team <linux-imx@....com>,
Amit Cohen <amcohen@...dia.com>, Gal Pressman <gal@...dia.com>,
Alexandru Tachici <alexandru.tachici@...log.com>,
Piergiorgio Beruto <piergiorgio.beruto@...il.com>,
Willem de Bruijn <willemb@...gle.com>,
Vladimir Oltean <vladimir.oltean@....com>
Subject: [PATCH net-next v2 1/8] net: phy: Add driver-specific get/set_eee support for non-standard PHYs
Not all PHYs are implemented fully according to the IEEE 802.3
specification and cannot be handled by the generic
phy_ethtool_get/set_eee() functions. To address this, this commit adds
driver-specific get/set_eee support, enabling better handling of such
PHYs. This is particularly important for handling PHYs with SmartEEE
support, which requires specialized management.
Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
---
drivers/net/phy/phy.c | 10 ++++++++--
include/linux/phy.h | 5 +++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0c0df38cd1ab..103484c24437 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1568,7 +1568,10 @@ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data)
return -EIO;
mutex_lock(&phydev->lock);
- ret = genphy_c45_ethtool_get_eee(phydev, data);
+ if (phydev->drv->get_eee)
+ ret = phydev->drv->get_eee(phydev, data);
+ else
+ ret = genphy_c45_ethtool_get_eee(phydev, data);
mutex_unlock(&phydev->lock);
return ret;
@@ -1590,7 +1593,10 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
return -EIO;
mutex_lock(&phydev->lock);
- ret = genphy_c45_ethtool_set_eee(phydev, data);
+ if (phydev->drv->set_eee)
+ ret = phydev->drv->set_eee(phydev, data);
+ else
+ ret = genphy_c45_ethtool_set_eee(phydev, data);
mutex_unlock(&phydev->lock);
return ret;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index fefd5091bc24..07cebf110aa6 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1056,6 +1056,11 @@ struct phy_driver {
/** @get_plca_status: Return the current PLCA status info */
int (*get_plca_status)(struct phy_device *dev,
struct phy_plca_status *plca_st);
+
+ /** @get_eee: Return the current EEE configuration */
+ int (*get_eee)(struct phy_device *phydev, struct ethtool_eee *e);
+ /** @set_eee: Set the EEE configuration */
+ int (*set_eee)(struct phy_device *phydev, struct ethtool_eee *e);
};
#define to_phy_driver(d) container_of(to_mdio_common_driver(d), \
struct phy_driver, mdiodrv)
--
2.30.2
Powered by blists - more mailing lists