[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da3509e4602e28a1cc0d14cfce72db68808f5947.camel@microchip.com>
Date: Mon, 6 Feb 2023 14:54:13 +0000
From: <Arun.Ramadoss@...rochip.com>
To: <olteanv@...il.com>, <UNGLinuxDriver@...rochip.com>,
<vivien.didelot@...il.com>, <andrew@...n.ch>,
<f.fainelli@...il.com>, <kuba@...nel.org>, <wei.fang@....com>,
<edumazet@...gle.com>, <pabeni@...hat.com>,
<o.rempel@...gutronix.de>, <Woojung.Huh@...rochip.com>,
<davem@...emloft.net>, <hkallweit1@...il.com>
CC: <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<intel-wired-lan@...ts.osuosl.org>, <kernel@...gutronix.de>
Subject: Re: [PATCH net-next v5 05/23] net: phy: add
genphy_c45_ethtool_get/set_eee() support
Hi Oleksij,
On Mon, 2023-02-06 at 14:50 +0100, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
>
> ---
> drivers/net/phy/phy-c45.c | 235
> ++++++++++++++++++++++++++++++++++++++
> include/linux/mdio.h | 58 ++++++++++
> include/linux/phy.h | 7 ++
> include/uapi/linux/mdio.h | 8 ++
> 4 files changed, 308 insertions(+)
>
> diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
> index 3ae642d3ae14..38361df1e669 100644
> --- a/drivers/net/phy/phy-c45.c
> +++ b/drivers/net/phy/phy-c45.c
> @@ -661,6 +661,129 @@ int genphy_c45_read_mdix(struct phy_device
> *phydev)
> }
> EXPORT_SYMBOL_GPL(genphy_c45_read_mdix);
>
>
> /**
> * genphy_c45_read_eee_cap1 - read supported EEE link modes from
> register 3.20
> * @phydev: target phy_device struct
> @@ -1194,6 +1317,118 @@ int genphy_c45_plca_get_status(struct
> phy_device *phydev,
> }
> EXPORT_SYMBOL_GPL(genphy_c45_plca_get_status);
>
> +/**
> + * genphy_c45_eee_is_active - get EEE supported and status
> + * @phydev: target phy_device struct
> + * @data: ethtool_eee data
Does the comment need to update based on the function parameter.
> + *
> + * Description: it reports the possible state of EEE functionality.
> + */
> +int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned
> long *adv,
> + unsigned long *lp, bool *is_enabled)
> +{
> + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_adv) = {};
> + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_lp) = {};
> + __ETHTOOL_DECLARE_LINK_MODE_MASK(common);
> + bool eee_enabled, eee_active;
> + int ret;
> +
> + ret = genphy_c45_read_eee_adv(phydev, tmp_adv);
> + if (ret)
> + return ret;
> +
> + ret = genphy_c45_read_eee_lpa(phydev, tmp_lp);
> + if (ret)
> + return ret;
> +
> + eee_enabled = !linkmode_empty(tmp_adv);
> + linkmode_and(common, tmp_adv, tmp_lp);
> + if (eee_enabled && !linkmode_empty(common))
> + eee_active = phy_check_valid(phydev->speed, phydev-
> >duplex,
> + common);
> + else
> + eee_active = false;
> +
> + if (adv)
> + linkmode_copy(adv, tmp_adv);
> + if (lp)
> + linkmode_copy(lp, tmp_lp);
> + if (is_enabled)
> + *is_enabled = eee_enabled;
> +
> + return eee_active;
> +}
> +EXPORT_SYMBOL(genphy_c45_eee_is_active);
> +
>
>
> --
> 2.30.2
>
Powered by blists - more mailing lists