lkml.org 
[lkml]   [2023]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH net-next v5 10/23] net: phy: add driver specific get/set_eee support
    Date
    Not all PHYs can be handled by generic phy_ethtool_get/set_eee()
    functions. So, add driver specific get/set_eee support.

    Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
    ---
    drivers/net/phy/phy.c | 6 ++++++
    include/linux/phy.h | 5 +++++
    2 files changed, 11 insertions(+)

    diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
    index 2f1041a7211e..c42df62df302 100644
    --- a/drivers/net/phy/phy.c
    +++ b/drivers/net/phy/phy.c
    @@ -1520,6 +1520,9 @@ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data)
    if (!phydev->drv)
    return -EIO;

    + if (phydev->drv->get_eee)
    + return phydev->drv->get_eee(phydev, data);
    +
    return genphy_c45_ethtool_get_eee(phydev, data);
    }
    EXPORT_SYMBOL(phy_ethtool_get_eee);
    @@ -1536,6 +1539,9 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
    if (!phydev->drv)
    return -EIO;

    + if (phydev->drv->set_eee)
    + return phydev->drv->set_eee(phydev, data);
    +
    return genphy_c45_ethtool_set_eee(phydev, data);
    }
    EXPORT_SYMBOL(phy_ethtool_set_eee);
    diff --git a/include/linux/phy.h b/include/linux/phy.h
    index ef0e3212f68e..b14ca4b06607 100644
    --- a/include/linux/phy.h
    +++ b/include/linux/phy.h
    @@ -1051,6 +1051,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
    \
     
     \ /
      Last update: 2023-03-27 00:11    [W:4.043 / U:0.204 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site