From: Daniel Thompson <daniel@riscstar.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Alexander Duyck <alexanderduyck@fb.com>,
Alex Elder <elder@riscstar.com>,
hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] net: pcs: xpcs: select operating mode for 10G-baseR capable PCS
Date: Tue, 20 Oct 2026 18:02:04 +0100 [thread overview]
Message-ID: <ateejER1HFGxjQpG@aspen.lan> (raw)
In-Reply-To: <atZJBaHU2QQGwcnG@aspen.lan>
On Mon, Oct 19, 2026 at 05:44:53PM +0100, Daniel Thompson wrote:
> On Sun, Oct 18, 2026 at 05:48:39PM +0200, Andrew Lunn wrote:
> > > default value after a reset prevents <=1G modes from working (I think
> > > automatic switch over between 1G and 2.5G also liked this to a reserved
> > > value but I don't fully recall right now).
> > >
> > > On that basis the best bit pattern to use one that isn't implemented by
> > > whatever XPCS we happen to be running on. One simple approach might be
> > > keep using 40GBASE-R but to check PCS Status 2 to ensure we fail in a
> > > non-silent manner on hypothesized future XPCS hardware:
> > >
> > > if (mdio_stat2 & MDIO_PCS_STAT2_10GBR) {
> > > if (mdio_stat2 & MDIO_PCS_STAT2_40GBR) {
> > > dev_err(dev, "40GBASE-R is *not* a reserved "
> > > value on this XPCS");
> > > return -ENOTSUP;
> > > }
> >
> > Maybe. But we need to ensure it does not cause regressions for fbnic,
> > which might actually support this speed.
>
> I will sketch out an idea based on explicitly checking both my
> assumptions hold by checking PCS Status 2 and PCS Control 2 after
> a soft reset. Thus if you never reset then the code will never
> deploy. Likewise we don't need to rely on my guess that all XPCS
> implementations will reset PCS_TYPE_SEL to 0.
>
> I will also, given everything I've had to share by e-mail,
> improve the commenting a lot!
Patches will follow in due course but in case anyone is curious in the
mean time, that sketched out idea becomes the following. I had to read
the TRM very closely but we can avoid using the obviously weird 40GBR
value (the key information that allowed this version to write a better
value to PCS Control 2 turned out to be a missing bit pattern in a very
narrow column that I must have read tens of times without noticing).
Anyhow, pcs_type_sel_quirk is true if and only if my assumptions hold
(explicit test after a soft reset that 10GBR is supported and that
PCS_TYPE_SEL is 0 after reset). This hugely drops the risk of
regression:
+ /*
+ * XPCS (at least in some implementations) is a little odd in it's
+ * handling of PCS CTRL2:PCS_TYPE_SEL. Instead of PCS CTRL1:SPEED
+ * SELECTION controlling how PCS_TYPE_SEL is interpreted it is the other
+ * way around: the speed selection is only honored when PCS TYPE SEL has
+ * specific values.
+ *
+ * This is a particular issue on XPCS implementations that implement
+ * 10GBASE-R because that will be the reset value for PCS_TYPE_SEL. That
+ * means that at reset, the system does not honor speed selection by
+ * default. This forces us to recognize an XPCS with this property and
+ * update PCS_TYPE_SEL accordingly.
+ */
+ if (xpcs->pcs_type_sel_quirk) {
+ switch (interface) {
+ case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_1000BASEX:
+ case PHY_INTERFACE_MODE_2500BASEX:
+ /* Really means 10GBX unless speed sel says otherwise */
+ mdio_ctrl2 = MDIO_PCS_CTRL2_10GBX;
+ break;
+ default:
+ /* Restore the reset value for unmatched cases */
+ mdio_ctrl2 = MDIO_PCS_CTRL2_10GBR;
+ break;
+ }
+
+ ret = xpcs_write(xpcs, MDIO_MMD_PCS, MDIO_CTRL2, mdio_ctrl2);
+ if (ret < 0)
+ return ret;
+ }
The code still doesn't entirely spark joy but I think at this point I
can blame the hardware!
Daniel.
next prev parent reply other threads:[~2026-10-20 17:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 22:30 [PATCH net-next 0/2] net: pcs: xpcs: fix operating mode selection Alex Elder
2026-10-14 22:30 ` [PATCH net-next 1/2] net: pcs: xpcs: re-order xpcs_pre_config() to update after the reset Alex Elder
2026-10-18 13:00 ` netdev-bot+sashiko
2026-10-20 8:38 ` Daniel Thompson
2026-10-14 22:30 ` [PATCH net-next 2/2] net: pcs: xpcs: select operating mode for 10G-baseR capable PCS Alex Elder
2026-10-15 21:09 ` Andrew Lunn
2026-10-16 14:30 ` Daniel Thompson
2026-10-18 15:48 ` Andrew Lunn
2026-10-19 16:44 ` Daniel Thompson
2026-10-20 0:08 ` Andrew Lunn
2026-10-20 17:02 ` Daniel Thompson [this message]
2026-10-18 13:00 ` netdev-bot+sashiko
2026-10-15 20:34 ` [PATCH net-next 0/2] net: pcs: xpcs: fix operating mode selection Andrew Lunn
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=ateejER1HFGxjQpG@aspen.lan \
--to=daniel@riscstar.com \
--cc=alexanderduyck@fb.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=elder@riscstar.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--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
all inboxes | Powered by JetHome®