Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: kyle.switch@motor-comm.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, andrew@lunn.ch,
	hkallweit1@gmail.com, linux@armlinux.org.uk,
	Frank.Sae@motor-comm.com, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	ming.xu@motor-comm.com, xiaolin.xu@motor-comm.com,
	jianmin.wang@motor-comm.com
Subject: Re: [PATCH net-next v29 RESEND 2/3] net: phy: Add support for Template Control register for PMA
Date: Thu, 03 Dec 2026 11:49:23 +0000	[thread overview]
Message-ID: <179629856356.3146.7532277250694179813@kernel.org> (raw)
In-Reply-To: <20261202105259.3767612-3-kyle.switch@motor-comm.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit subject ("net: phy: Add support for Template Control
  register for PMA") and body ("10GBASE-T PMA Template Test Mode…
- [Low] genphy_c45_pma_test_mode() in drivers/net/phy/phy-c45.c is
  documented to select "Normal or one of Test Mode 1..7", but it only…

--

net: phy: Add support for Template Control register for PMA

This commit adds a genphy_c45_pma_test_mode() helper and uAPI defines for
the 10GBASE-T PMA test mode register (1.132). The helper selects Normal or
Test Mode 1..7 by programming bits 15:13 of that register.

> net: phy: Add support for Template Control register for PMA
>
> Add support for the 10GBASE-T PMA Template Test Mode register
> field, which allows selecting one of eight test modes (Normal and
> TestMode1..TestMode7) used for PHY validation.

[Severity: Low]
This isn't a bug, but is "Template" the right name for this register?

IEEE 802.3 calls register 1.132 the 10GBASE-T test mode register. The code
in this patch uses the same name:

#define MDIO_PMA_10GBT_TESTMODE 132 /* Test mode control */

The kernel-doc for genphy_c45_pma_test_mode() also says "configure the
10GBASE-T PMA test mode register".

Could the subject and body use the test mode name instead?

> diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
> index 828af4c4e9d4c..0136727767ace 100644
> --- a/drivers/net/phy/phy-c45.c
> +++ b/drivers/net/phy/phy-c45.c
> @@ -1444,6 +1444,26 @@ int genphy_c45_fast_retrain(struct phy_device *phydev, bool enable)
>  }
>  EXPORT_SYMBOL_GPL(genphy_c45_fast_retrain);
>  
> +/**
> + * genphy_c45_pma_test_mode - configure the 10GBASE-T PMA test mode register
> + * @phydev: target phy_device struct
> + * @test_mode: test mode to select, one of MDIO_PMA_10GBT_TESTMODE_*
> + *
> + * Set the 10GBASE-T PMA test mode to Normal or one of Test Mode 1..7.
> + *
> + * Return: 0 on success, or a negative error code on failure (e.g. register
> + * read/write error).
> + */
> +int genphy_c45_pma_test_mode(struct phy_device *phydev, u16 test_mode)
> +{
> +	if (test_mode & ~MDIO_PMA_10GBT_TESTMODE_MASK)
> +		return -EOPNOTSUPP;
> +
> +	return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TESTMODE,
> +			      MDIO_PMA_10GBT_TESTMODE_MASK, test_mode);

[Severity: Low]
The kernel-doc says this selects "Normal or one of Test Mode 1..7". The
helper only writes bits 15:13 of register 1.132, because
MDIO_PMA_10GBT_TESTMODE_MASK is 0xE000.

In IEEE 802.3, bits 1.132.12:10 are the transmitter test frequencies field.
That field picks the dual-tone pair sent in Test Mode 4. Several of its
encodings are reserved, including 000.

What happens when a caller passes MDIO_PMA_10GBT_TESTMODE_4? The
read-modify-write keeps whatever is already in bits 12:10. Frequency bits
cannot be passed in either, because the check above rejects them:

	if (test_mode & ~MDIO_PMA_10GBT_TESTMODE_MASK)
		return -EOPNOTSUPP;

The PHY would then send whatever tone pair the stale bits select. That
could be a reserved encoding, depending on the PHY's reset value.

The uAPI header also defines MDIO_PMA_10GBT_TESTMODE_4 but nothing for
bits 12:10.

The only caller in this series is the YT8824 code in
drivers/net/phy/motorcomm.c, added by "net: phy: Add driver for Motorcomm
Quad 2.5GbE phy". It only uses MDIO_PMA_10GBT_TESTMODE_1 and
MDIO_PMA_10GBT_TESTMODE_NORMAL, so nothing in the tree triggers this today.

Could the kernel-doc say that Test Mode 4 needs the frequency field
programmed separately? Alternatively, could the header gain defines for
bits 12:10, with a way to pass them through this exported helper?

> +}
> +EXPORT_SYMBOL_GPL(genphy_c45_pma_test_mode);
> +

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202105259.3767612-1-kyle.switch%40motor-comm.com

  reply	other threads:[~2026-12-03 11:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 10:52 [PATCH net-next v29 RESEND 0/3] net: phy: Add driver for Motorcomm Quad 2.5GbE phy Kyle Switch
2026-12-02 10:52 ` [PATCH net-next v29 RESEND 1/3] dt-bindings: net: Document Motorcomm YT8824 PHY package Kyle Switch
2026-12-03 11:49   ` netdev-bot+sashiko
2026-12-02 10:52 ` [PATCH net-next v29 RESEND 2/3] net: phy: Add support for Template Control register for PMA Kyle Switch
2026-12-03 11:49   ` netdev-bot+sashiko [this message]
2026-12-02 10:52 ` [PATCH net-next v29 RESEND 3/3] net: phy: Add driver for Motorcomm Quad 2.5GbE phy Kyle Switch
2026-12-03 11:49   ` netdev-bot+sashiko

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=179629856356.3146.7532277250694179813@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Frank.Sae@motor-comm.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=jianmin.wang@motor-comm.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kyle.switch@motor-comm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=ming.xu@motor-comm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=xiaolin.xu@motor-comm.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