Devicetree
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: Selvamani.Rajagopal@onsemi.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, parthiban.veerasooran@microchip.com,
	horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org,
	rdunlap@infradead.org, richardcochran@gmail.com, andrew@lunn.ch,
	hkallweit1@gmail.com, linux@armlinux.org.uk, edumazet@kernel.org,
	piergiorgio.beruto@gmail.com, willemb@google.com,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	jerry.ray@microchip.com, ciprian.regus@analog.com
Subject: Re: [PATCH net-next v13 15/15] net: ethernet: onsemi: s2500: Add driver support for S2500
Date: Thu, 03 Dec 2026 17:46:35 +0000	[thread overview]
Message-ID: <179631999583.3146.12032673410320909910@kernel.org> (raw)
In-Reply-To: <20261202-s2500-mac-phy-support-v13-15-a2908fad2693@onsemi.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] A failed live MAC address change can leave unicast receive
  permanently broken.
- [Low] The commit message says `imply NET_SELFTESTS` was added "so that
  users would be able to disable self-test and still compile".

--

net: ethernet: onsemi: s2500: Add driver support for S2500

This adds a driver for the onsemi S2500 10BASE-T1S MAC-PHY, built on the
OPEN Alliance TC6 framework. It covers PTP, ethtool statistics and
register dumps, and unicast and multicast address filtering. It also
adds self-test support through net_selftest.

> diff --git a/drivers/net/ethernet/onsemi/s2500/Kconfig b/drivers/net/ethernet/onsemi/s2500/Kconfig
> new file mode 100644
> index 0000000000000..4bd28dc560e64
> --- /dev/null
> +++ b/drivers/net/ethernet/onsemi/s2500/Kconfig
> @@ -0,0 +1,20 @@

[ ... ]

> +config S2500_MACPHY
> +	tristate "S2500 support"
> +	depends on SPI
> +	depends on PTP_1588_CLOCK_OPTIONAL
> +	imply NET_SELFTESTS

[Severity: Low]
The commit message says:

  Support self-test. Also Add imply NET_SELFTESTS in Kconfig
  so that users would be able to disable self-test and still
  compile.

Is that accurate? NET_SELFTESTS in net/Kconfig has no prompt:

config NET_SELFTESTS
	def_tristate PHYLIB
	depends on PHYLIB && INET

S2500_MACPHY selects OA_TC6, and OA_TC6 selects PHYLIB, so PHYLIB is
always at least as high as S2500_MACPHY. For a symbol with no prompt,
the implied value is combined with the default, and the default is
already PHYLIB. So this line doesn't change the value of NET_SELFTESTS,
and users can't turn self-tests off on their own.

Building with NET_SELFTESTS=n (for example with INET=n) works because of
the stubs in include/net/selftests.h, not because of the imply.

The guard in s2500_get_sset_count() also looks unnecessary, because the
stub net_selftest_get_count() already returns 0:

	case ETH_SS_TEST:
		if (!IS_ENABLED(CONFIG_NET_SELFTESTS))
			return -EOPNOTSUPP;
		return net_selftest_get_count();

Could the commit message be updated to say what the imply actually does?

> diff --git a/drivers/net/ethernet/onsemi/s2500/s2500_main.c b/drivers/net/ethernet/onsemi/s2500/s2500_main.c
> new file mode 100644
> index 0000000000000..88e0aec94bdbe
> --- /dev/null
> +++ b/drivers/net/ethernet/onsemi/s2500/s2500_main.c
> @@ -0,0 +1,504 @@

[ ... ]

> +/* Writes MAC address to macphy registers */
> +static int s2500_write_filter(struct s2500_info *priv, int slot,
> +			      const u8 *mac)
> +{
> +	u8 mms = OA_TC6_MAC_MMS1;
> +	u32 val;
> +	int ret;
> +
> +	ret = oa_tc6_write_register_mms(priv->tc6, mms,
> +					S2500_REG_MAC_ADDRMASKL(slot),
> +					0xffffffff);
> +	if (ret)
> +		return ret;

[ ... ]

> +	val = S2500_MAC_ADDRFILT_ENABLE | get_unaligned_be16(mac);
> +
> +	return oa_tc6_write_register_mms(priv->tc6, mms,
> +					 S2500_REG_MAC_ADDRFILTH(slot), val);
> +}
> +
> +static int s2500_set_mac_filter(struct net_device *ndev, const u8 *mac)
> +{
> +	struct s2500_info *priv = netdev_priv(ndev);
> +	int ret;
> +
> +	/* Disable slot 0 before programming its address. */
> +	ret = oa_tc6_write_register_mms(priv->tc6, OA_TC6_MAC_MMS1,
> +					S2500_REG_MAC_ADDRFILTH(0), 0);
> +	if (ret)
> +		return ret;
> +
> +	return s2500_write_filter(priv, 0, mac);
> +}

[ ... ]

> +static int s2500_set_mac_address(struct net_device *ndev, void *p)
> +{
> +	struct sockaddr *addr = p;
> +	int ret;
> +
> +	ret = eth_prepare_mac_addr_change(ndev, p);
> +	if (ret)
> +		return ret;
> +
> +	ret = s2500_set_mac_filter(ndev, addr->sa_data);
> +	if (ret)
> +		return ret;

[Severity: Medium]
What happens to unicast receive if one of the writes in
s2500_write_filter() fails here?

IFF_LIVE_ADDR_CHANGE is set, so this can run while the interface is up
with RXEN and ADRF set. s2500_set_mac_filter() first writes
ADDRFILTH(0) = 0. s2500_write_filter() then makes four separate control
writes and sets S2500_MAC_ADDRFILT_ENABLE only in the last one.

Any of those writes can fail. Examples are -EPROTO from
oa_tc6_check_ctrl_write_reply() when the echo does not match, or an SPI
transfer error.

On that path s2500_set_mac_address() returns the error without
reprogramming slot 0 with the old ndev->dev_addr. Slot 0 stays disabled
while ADRF is still set. Wouldn't the MAC-PHY then drop every unicast
frame for this node, while dev_addr still holds the old address?

Nothing else seems to reprogram slot 0 afterwards.
s2500_set_rx_mode() only touches promiscuous mode and multicast slots
1-3, and s2500_open() does not call s2500_init(). The problem would
therefore survive a down/up cycle until a later MAC change succeeds or
the driver is re-probed.

Would it make sense to write ndev->dev_addr back into slot 0 when this
fails?

> +
> +	eth_commit_mac_addr_change(ndev, p);
> +	return 0;
> +}

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-s2500-mac-phy-support-v13-0-a2908fad2693%40onsemi.com

      reply	other threads:[~2026-12-03 17:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 17:37 [PATCH net-next v13 00/15] Support for onsemi's S2500 10BASE-T1S MAC-PHY Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 01/15] dt-bindings: net: add onsemi's S2500 Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 02/15] Documentation: networking: Add timestamp related APIs to OA TC6 framework Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 03/15] net: ethernet: oa_tc6: Move oa_tc6.c to its own directory Selvamani Rajagopal via B4 Relay
2026-12-03 17:46   ` netdev-bot+sashiko
2026-12-02 17:37 ` [PATCH net-next v13 04/15] net: ethernet: oa_tc6: Move constant definitions to header file Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 05/15] net: ethernet: microchip: lan865x: Depends on PTP_1588_CLOCK_OPTIONAL Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 06/15] net: ethernet: adi: adin1140: " Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 07/15] net: ethernet: oa_tc6: Support for hardware timestamp Selvamani Rajagopal via B4 Relay
2026-12-03 17:41   ` sashiko-bot
2026-12-03 17:46   ` netdev-bot+sashiko
2026-12-02 17:37 ` [PATCH net-next v13 08/15] net: ethernet: oa_tc6: Drop frames if footer has FD bit set Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 09/15] net: ethernet: oa_tc6: Support for vendor specific MMS Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 10/15] net: ethernet: oa_tc6: APIs to customize CONFIG0 settings Selvamani Rajagopal via B4 Relay
2026-12-03 17:46   ` netdev-bot+sashiko
2026-12-02 17:37 ` [PATCH net-next v13 11/15] net: phy: ncn26000: Enable enhanced noise immunity Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 12/15] net: phy: Add helper to modify only the PHY loopback bit Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 13/15] net: phy: ncn26000: Support for onsemi's S2500 internal phy Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 14/15] net: phy: dp83867: Use genphy_loopback_no_speed() Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 15/15] net: ethernet: onsemi: s2500: Add driver support for S2500 Selvamani Rajagopal via B4 Relay
2026-12-03 17:46   ` netdev-bot+sashiko [this message]

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=179631999583.3146.12032673410320909910@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Selvamani.Rajagopal@onsemi.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=ciprian.regus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=jerry.ray@microchip.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=piergiorgio.beruto@gmail.com \
    --cc=rdunlap@infradead.org \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=willemb@google.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