Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alex Elder" <elder@riscstar.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH net-next v2 05/14] net: pcs: pcs-xpcs: select operating mode for 10G-baseR capable PCS
Date: Sat, 06 Jun 2026 01:01:20 +0000	[thread overview]
Message-ID: <20260606010121.580DF1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260605010022.968612-6-elder@riscstar.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] False detection of 10Gbase-R capability on 1G-only devices lacking MMD 3 (PCS) due to unhandled `0xffff` MDIO read response.
--

commit 8962f48f9cb6674f919016e2d22817c0d0ed132d
Author: Daniel Thompson <daniel@riscstar.com>

net: pcs: pcs-xpcs: select operating mode for 10G-baseR capable PCS

This commit adds generic logic to change the operating mode on XPCS
devices that support 10Gbase-R when the default mode is inappropriate.
It sets PCS_TYPE_SEL to a reserved value to fix an issue where modal
switching is otherwise suppressed.

> diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
> index 76c04372b5b50..e58103ae8dadd 100644
> --- a/drivers/net/pcs/pcs-xpcs.c
> +++ b/drivers/net/pcs/pcs-xpcs.c
> @@ -705,10 +705,49 @@ static void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
>  static int xpcs_switch_interface_mode(struct dw_xpcs *xpcs,
>  				      phy_interface_t interface)
>  {
> +	int mdio_stat2, ret;
> +
>  	/* Wangxun provides a full alternative implementation to handle quirks */
>  	if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID)
>  		return txgbe_xpcs_switch_mode(xpcs, interface);
>  
> +	mdio_stat2 = xpcs_read(xpcs, MDIO_MMD_PCS, MDIO_STAT2);
> +	if (mdio_stat2 < 0)
> +		return mdio_stat2;
> +
> +	/*
> +	 * If this XPCS supports 10Gbase-R then that will be the default
> +	 * operating mode. There are several interface modes where this default
> +	 * is unhelpful. Change the operating mode for interfaces were we know
> +	 * the default is wrong, and restore the default otherwise.
> +	 */
> +	if (mdio_stat2 & MDIO_PCS_STAT2_10GBR) {

[Severity: Medium]
Will this falsely detect 10GBASE-R support on 1G-only devices?

If a device lacks the PCS MMD (MMD 3), the MDIO bus read in xpcs_read()
naturally returns 0xffff due to floating bus pull-ups. Because 0xffff is
greater than 0, it bypasses the mdio_stat2 < 0 error check above.

Since 0xffff & MDIO_PCS_STAT2_10GBR (0x0001) evaluates to true, the driver
will falsely identify the device as 10GBASE-R capable and perform unintended
writes to MDIO_CTRL2 in the unpopulated MMD 3. Does this check need to
account for 0xffff responses?

> +		switch (interface) {
> +		case PHY_INTERFACE_MODE_SGMII:

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260605010022.968612-1-elder@riscstar.com?part=5

  reply	other threads:[~2026-06-06  1:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05  1:00 [PATCH net-next v2 00/14] net: enable TC956x support Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 01/14] dt-bindings: net: qca,qca808x: Add regulator properties Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 02/14] net: phy: qcom: qca808x: Add regulator management Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 03/14] net: pcs: pcs-xpcs-regmap: support XPCS memory-mapped MDIO bus via regmap Alex Elder
2026-06-05 15:35   ` Maxime Chevallier
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 04/14] net: pcs: xpcs: re-order xpcs_pre_config() to update after the reset Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 05/14] net: pcs: pcs-xpcs: select operating mode for 10G-baseR capable PCS Alex Elder
2026-06-06  1:01   ` sashiko-bot [this message]
2026-06-05  1:00 ` [PATCH net-next v2 06/14] net: stmmac: dma: create a separate dma_device pointer Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 07/14] net: stmmac: dwxgmac2: Add multi MSI interrupt mode Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 08/14] net: stmmac: dwxgmac2: Add XGMAC 3.01a support Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 09/14] net: stmmac: dwxgmac2: export symbols for XGMAC 3.01a DMA Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 10/14] dt-bindings: net: toshiba,tc9654-dwmac: add TC9564 Ethernet bridge Alex Elder
2026-06-05  2:40   ` Rob Herring (Arm)
2026-06-05 12:24     ` Alex Elder
2026-06-05 14:40   ` Rob Herring
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 11/14] misc: tc956x_pci: add TC956x/QPS615 support Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 12/14] gpio: tc956x: " Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 13/14] net: stmmac: " Alex Elder
2026-06-05 14:47   ` Rob Herring
2026-06-05 16:05   ` Maxime Chevallier
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 14/14] arm64: dts: qcom: qcs6490-rb3gen2: enable TC9564 with a single QCA8081 phy Alex Elder
2026-06-06  1:01   ` sashiko-bot

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=20260606010121.580DF1F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=elder@riscstar.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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