From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Wei Fang <wei.fang@nxp.com>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: Arun.Ramadoss@microchip.com, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v6 5/9] net: phy: add genphy_c45_ethtool_get/set_eee() support
Date: Wed, 8 Feb 2023 14:08:30 +0100 [thread overview]
Message-ID: <20230208130830.GA19895@pengutronix.de> (raw)
In-Reply-To: <20230208103211.2521836-6-o.rempel@pengutronix.de>
On Wed, Feb 08, 2023 at 11:32:07AM +0100, Oleksij Rempel wrote:
> Add replacement for phy_ethtool_get/set_eee() functions.
>
> Current phy_ethtool_get/set_eee() implementation is great and it is
> possible to make it even better:
> - this functionality is for devices implementing parts of IEEE 802.3
> specification beyond Clause 22. The better place for this code is
> phy-c45.c
> - currently it is able to do read/write operations on PHYs with
> different abilities to not existing registers. It is better to
> use stored supported_eee abilities to avoid false read/write
> operations.
> - the eee_active detection will provide wrong results on not supported
> link modes. It is better to validate speed/duplex properties against
> supported EEE link modes.
> - it is able to support only limited amount of link modes. We have more
> EEE link modes...
>
> By refactoring this code I address most of this point except of the last
> one. Adding additional EEE link modes will need more work.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> +/**
> + * genphy_c45_eee_is_active - get EEE supported and status
> + * @phydev: target phy_device struct
> + * @data: ethtool_eee data
I forgot to update this comment.
> + *
> + * 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))i
and linkmode_empty() can be replaced with linkmode_intersects()
I'll wait if more comments will come and make a new version tomorrow.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2023-02-08 13:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 10:32 [PATCH net-next v6 0/9] net: add EEE support for KSZ9477 and AR8035 with i.MX6 Oleksij Rempel
2023-02-08 10:32 ` [PATCH net-next v6 1/9] net: dsa: microchip: enable EEE support Oleksij Rempel
2023-02-09 4:07 ` Arun.Ramadoss
2023-02-09 5:48 ` Oleksij Rempel
2023-02-09 8:06 ` Arun.Ramadoss
2023-02-08 10:32 ` [PATCH net-next v6 2/9] net: phy: add genphy_c45_read_eee_abilities() function Oleksij Rempel
2023-02-08 10:32 ` [PATCH net-next v6 3/9] net: phy: micrel: add ksz9477_get_features() Oleksij Rempel
2023-02-08 10:32 ` [PATCH net-next v6 4/9] net: phy: export phy_check_valid() function Oleksij Rempel
2023-02-08 10:32 ` [PATCH net-next v6 5/9] net: phy: add genphy_c45_ethtool_get/set_eee() support Oleksij Rempel
2023-02-08 13:08 ` Oleksij Rempel [this message]
2023-02-08 10:32 ` [PATCH net-next v6 6/9] net: phy: c22: migrate to genphy_c45_write_eee_adv() Oleksij Rempel
2023-02-08 10:32 ` [PATCH net-next v6 7/9] net: phy: c45: " Oleksij Rempel
2023-02-08 10:32 ` [PATCH net-next v6 8/9] net: phy: migrate phy_init_eee() to genphy_c45_eee_is_active() Oleksij Rempel
2023-02-08 10:32 ` [PATCH net-next v6 9/9] net: phy: start using genphy_c45_ethtool_get/set_eee() Oleksij Rempel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230208130830.GA19895@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=Arun.Ramadoss@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
--cc=wei.fang@nxp.com \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).