From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Sean Anderson <sean.anderson@linux.dev>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org,
Christian Marangi <ansuelsmth@gmail.com>,
upstream@airoha.com, Heiner Kallweit <hkallweit1@gmail.com>,
Michal Simek <michal.simek@amd.com>,
Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>,
Robert Hancock <robert.hancock@calian.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC net-next PATCH 07/13] net: pcs: Add Xilinx PCS driver
Date: Thu, 3 Apr 2025 21:27:13 +0100 [thread overview]
Message-ID: <Z-7vIbvtjIGS5hzr@shell.armlinux.org.uk> (raw)
In-Reply-To: <20250403181907.1947517-8-sean.anderson@linux.dev>
On Thu, Apr 03, 2025 at 02:19:01PM -0400, Sean Anderson wrote:
> +static int xilinx_pcs_validate(struct phylink_pcs *pcs,
> + unsigned long *supported,
> + const struct phylink_link_state *state)
> +{
> + __ETHTOOL_DECLARE_LINK_MODE_MASK(xilinx_supported) = { 0 };
> +
> + phylink_set_port_modes(xilinx_supported);
> + phylink_set(xilinx_supported, Autoneg);
> + phylink_set(xilinx_supported, Pause);
> + phylink_set(xilinx_supported, Asym_Pause);
> + switch (state->interface) {
> + case PHY_INTERFACE_MODE_SGMII:
> + /* Half duplex not supported */
> + phylink_set(xilinx_supported, 10baseT_Full);
> + phylink_set(xilinx_supported, 100baseT_Full);
> + phylink_set(xilinx_supported, 1000baseT_Full);
> + break;
> + case PHY_INTERFACE_MODE_1000BASEX:
> + phylink_set(xilinx_supported, 1000baseX_Full);
> + break;
> + case PHY_INTERFACE_MODE_2500BASEX:
> + phylink_set(xilinx_supported, 2500baseX_Full);
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + linkmode_and(supported, supported, xilinx_supported);
> + return 0;
You can not assume that an interface mode implies any particular media.
For example, you can not assume that just because you have SGMII, that
the only supported media is BaseT. This has been a fundamental principle
in phylink's validation since day one.
Phylink documentation for the pcs_validate() callback states:
* Validate the interface mode, and advertising's autoneg bit, removing any
* media ethtool link modes that would not be supportable from the supported
* mask. Phylink will propagate the changes to the advertising mask. See the
* &struct phylink_mac_ops validate() method.
and if we look at the MAC ops validate (before it was removed):
- * Clear bits in the @supported and @state->advertising masks that
- * are not supportable by the MAC.
- *
- * Note that the PHY may be able to transform from one connection
- * technology to another, so, eg, don't clear 1000BaseX just
- * because the MAC is unable to BaseX mode. This is more about
- * clearing unsupported speeds and duplex settings. The port modes
- * should not be cleared; phylink_set_port_modes() will help with this.
PHYs can and do take SGMII and provide both BaseT and BaseX or BaseR
connections. A PCS that is not directly media facing can not dictate
the link modes.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2025-04-03 20:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 18:18 [RFC net-next PATCH 00/13] Add PCS core support Sean Anderson
2025-04-03 18:19 ` [RFC net-next PATCH 07/13] net: pcs: Add Xilinx PCS driver Sean Anderson
2025-04-03 20:27 ` Russell King (Oracle) [this message]
2025-04-03 20:51 ` Sean Anderson
2025-04-03 18:19 ` [RFC net-next PATCH 08/13] net: axienet: Convert to use PCS subsystem Sean Anderson
2025-04-03 18:28 ` [RFC net-next PATCH 12/13] arm64: dts: Add compatible strings for Lynx PCSs Sean Anderson
2025-04-07 16:27 ` [RFC net-next PATCH 00/13] Add PCS core support Kory Maincent
2025-04-07 16:33 ` Sean Anderson
2025-04-07 16:46 ` Christian Marangi (Ansuel)
2025-04-07 17:00 ` Sean Anderson
2025-04-07 17:21 ` Christian Marangi (Ansuel)
2025-04-07 17:25 ` Daniel Golle
2025-04-07 17:40 ` Sean Anderson
2025-04-08 15:17 ` Sean Anderson
2025-04-07 18:06 ` Sean Anderson
2025-04-07 16:51 ` Kory Maincent
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=Z-7vIbvtjIGS5hzr@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew+netdev@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=radhey.shyam.pandey@amd.com \
--cc=robert.hancock@calian.com \
--cc=sean.anderson@linux.dev \
--cc=upstream@airoha.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).