From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: "Marek Behún" <kabel@kernel.org>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next] net: phy: extend genphy_c45_read_eee_abilities() to read capability 2 register
Date: Wed, 3 Jan 2024 10:29:54 +0000 [thread overview]
Message-ID: <ZZU3Ijo2TCIHJvJh@shell.armlinux.org.uk> (raw)
In-Reply-To: <20231220161258.17541-1-kabel@kernel.org>
On Wed, Dec 20, 2023 at 05:12:58PM +0100, Marek Behún wrote:
> +/**
> + * genphy_c45_read_eee_cap2 - read supported EEE link modes from register 3.21
> + * @phydev: target phy_device struct
> + */
> +static int genphy_c45_read_eee_cap2(struct phy_device *phydev)
> +{
> + int val;
> +
> + /* IEEE 802.3-2018 45.2.3.11 EEE control and capability 2
> + * (Register 3.21)
> + */
> + val = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE2);
> + if (val < 0)
> + return val;
> +
> + /* The 802.3 2018 standard says the top 6 bits are reserved and should
> + * read as 0.
> + * If MDIO_PCS_EEE_ABLE2 is 0xffff assume EEE is not supported.
> + */
> + if (val == 0xffff)
> + return 0;
802.3 also says that unimplemented registers should read as zeros.
Reserved bits should read as 0, but reserved typically means (as we've
seen several times) that bits get used in the future. Do you have a
good reason why this check is necessary?
> +
> + mii_eee_cap2_mod_linkmode_t(phydev->supported_eee, val);
> +
> + /* Some buggy devices may indicate EEE link modes in MDIO_PCS_EEE_ABLE2
> + * which they don't support as indicated by BMSR, ESTATUS etc.
> + */
> + linkmode_and(phydev->supported_eee, phydev->supported_eee,
> + phydev->supported);
I wonder whether we should just do that as a general thing after
reading all the abilities in phy_probe() rather than burying it in
various capability reading functions?
Apart from those two, I don't see any other issues with the patch.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
prev parent reply other threads:[~2024-01-03 10:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-20 16:12 [PATCH net-next] net: phy: extend genphy_c45_read_eee_abilities() to read capability 2 register Marek Behún
2024-01-02 23:50 ` Jakub Kicinski
2024-01-03 10:29 ` Russell King (Oracle) [this message]
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=ZZU3Ijo2TCIHJvJh@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kabel@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).