From: sashiko-bot@kernel.org
To: "Selvamani Rajagopal via B4 Relay"
<devnull+Selvamani.Rajagopal.onsemi.com@kernel.org>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v6 11/15] net: phy: ncn26000: Support for loopback
Date: Tue, 30 Jun 2026 17:24:02 +0000 [thread overview]
Message-ID: <20260630172403.3EE571F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260629-s2500-mac-phy-support-v6-11-18ce79500371@onsemi.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] The config_aneg callback unconditionally overwrites the MII_BMCR register, silently clearing previously set bits such as loopback.
- [Medium] The interrupt handler incorrectly uses a register address macro as a bitmask to check for link status changes.
--
commit 80f0753c539b77ecac87c47e5aa0620f69037283
Author: Selvamani Rajagopal <Selvamani.Rajagopal@onsemi.com>
net: phy: ncn26000: Support for loopback
Adding loopback support for S2500 internal PHY to help running
loopback test through ethtool. This sets genphy_loopback_fixed_speed
as the set_loopback callback.
> diff --git a/drivers/net/phy/ncn26000.c b/drivers/net/phy/ncn26000.c
> index c3a34b2c524d5..afafa81dc22b8 100644
> --- a/drivers/net/phy/ncn26000.c
> +++ b/drivers/net/phy/ncn26000.c
> @@ -178,6 +178,7 @@ static struct phy_driver ncn26000_driver[] = {
> .config_aneg = ncn26000_config_aneg,
> .read_status = ncn26000_read_status,
> .handle_interrupt = ncn26000_handle_interrupt,
[Severity: Medium]
This is a pre-existing issue, but does the interrupt handler use the wrong
mask to check for link status changes?
ncn26000_handle_interrupt() checks the interrupt status using the register
address macro (17 / 0x11) instead of the proper bitmask:
drivers/net/phy/ncn26000.c:ncn26000_handle_interrupt() {
...
ret = phy_read(phydev, NCN26000_REG_IRQ_STATUS);
// check only link status changes
if (ret < 0 || (ret & NCN26000_REG_IRQ_STATUS) == 0)
return IRQ_NONE;
...
}
Because NCN26000_REG_IRQ_STATUS is 17 (which has bit 0 set), it coincidentally
matches NCN26000_IRQ_LINKST_BIT (BIT(0)). However, it will also incorrectly
match other interrupts like bit 4 (NCN26000_IRQ_PLCAREC_BIT).
Should this be using NCN26000_IRQ_LINKST_BIT instead?
> + .set_loopback = genphy_loopback_fixed_speed,
[Severity: High]
This isn't a bug introduced by this patch, but will configuring loopback
here be silently broken by ncn26000_config_aneg()?
When a user configures loopback via ethtool, it sets BMCR_LOOPBACK in MII_BMCR.
However, if the PHY state machine later triggers a re-configuration,
ncn26000_config_aneg() unconditionally overwrites MII_BMCR:
drivers/net/phy/ncn26000.c:ncn26000_config_aneg() {
...
// bring up the link
return phy_write(phydev, MII_BMCR, NCN26000_BCMR_LINK_CTRL_BIT);
}
Will this wipe out the loopback bit and cause the hardware state to be lost
while the software state machine assumes loopback is still active?
> .set_plca_cfg = ncn26000_c45_plca_set_cfg,
> .get_plca_cfg = genphy_c45_plca_get_cfg,
> .get_plca_status = genphy_c45_plca_get_status,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260629-s2500-mac-phy-support-v6-0-18ce79500371@onsemi.com?part=11
next prev parent reply other threads:[~2026-06-30 17:24 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 17:23 [PATCH net-next v6 00/15] Support for onsemi's S2500 10Base-T1S MAC-PHY Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 01/15] net: phy: Helper to read and write through C45 without lock Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 02/15] net: phy: Helper to modify PHY loopback mode only Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 03/15] net: ethernet: oa_tc6: Move oa_tc6.c to its own directory Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-30 17:24 ` sashiko-bot
2026-06-29 17:23 ` [PATCH net-next v6 04/15] net: phy: microchip_t1s: Use generic APIs for C45 read and write Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 05/15] net: ethernet: oa_tc6: Move constant definitions to header file Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 06/15] net: ethernet: oa_tc6: Support for hardware timestamp Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-30 17:24 ` sashiko-bot
2026-07-01 19:33 ` Jerry.Ray
2026-07-01 21:59 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 07/15] net: ethernet: oa_tc6: Support for vendor specific MMS Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 08/15] net: ethernet: oa_tc6: read, write interface with MMS option Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 09/15] net: phy: ncn26000: Support for onsemi's S2500 internal phy Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 10/15] net: phy: ncn26000: Enable enhanced noise immunity Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 11/15] net: phy: ncn26000: Support for loopback Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-30 17:24 ` sashiko-bot [this message]
2026-06-29 17:23 ` [PATCH net-next v6 12/15] onsemi: s2500: Add driver support for TS2500 MAC-PHY Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-30 17:08 ` Uwe Kleine-König
2026-06-30 17:36 ` Selvamani Rajagopal
2026-06-30 17:24 ` sashiko-bot
2026-07-02 19:29 ` Julian Braha
2026-07-02 21:23 ` Selvamani Rajagopal
2026-06-29 17:23 ` [PATCH net-next v6 13/15] onsemi: s2500: Added selftest support to onsemi's S2500 driver Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-30 17:24 ` sashiko-bot
2026-06-29 17:23 ` [PATCH net-next v6 14/15] dt-bindings: net: add onsemi's S2500 Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
2026-06-30 6:29 ` Krzysztof Kozlowski
2026-06-30 15:09 ` Selvamani Rajagopal
2026-06-30 17:24 ` sashiko-bot
2026-06-29 17:23 ` [PATCH net-next v6 15/15] Documentation: networking: Add timestamp related APIs to OA TC6 framework Selvamani Rajagopal via B4 Relay
2026-06-29 17:23 ` Selvamani Rajagopal
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=20260630172403.3EE571F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+Selvamani.Rajagopal.onsemi.com@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.