Article View: linux.kernel.netdev
Article #26537Re: [PATCH net-next v13 15/15] net: ethernet: onsemi: s2500: Add driver support for S2500
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 17:46
Date: Thu, 03 Dec 2026 17:46
167 lines
13702 bytes
13702 bytes
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
Technical Details
Message-ID:
<179631999583.3146.12032673410320909910@kernel.org>Path:
mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376802-linux-kernel-netdev=dewy.ruReferences:
<20261202-s2500-mac-phy-support-v13-15-a2908fad2693@onsemi.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376802-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179631999583.3146.12032673410320909910@kernel.org> References: <20261202-s2500-mac-phy-support-v13-15-a2908fad2693@onsemi.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2557748"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:wxUiVKDSAk9dh6DjKa4Zz3c3lcg= sha256:wb2nwRqvmczyjpx6/BWI+aTgxoJvRtE3APRk/linYZM= sha1:vgdYmq1f9ZE2VGw+2hyf8Nr5YY0= sha256:0wzzJimaiAWd2DmPiVdAh2PboKp+HMoQ5fiihIv8RxI= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id BEB461179FB; Thu, 3 Dec 2026 20:47:00 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.74 X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A4IPSiFrQ0Ir; Thu, 3 Dec 2026 20:46:57 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376802-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 9D9391179F7; Thu, 3 Dec 2026 20:46:49 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 6FD462602F; Thu, 3 Dec 2026 17:46:45 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796319998; b=vIATpOdMHmNInlQPs51Gm8ku8XthIDw+wcQPMo2Q0LaqQkZtojjbXHhfPj0dvSgPRiqq ekc0Shw1zfsN3X7Vm+705saTBZbKbD/zml8g0fr4sbiUT0hny39y9JxTBMeWuCDAnZ3b9 5/EuH1veo1djjXjCAG21v25aNcZwnXgIwtkhdQvHP3fYYlv0Psi2wzgBns+pQOu0VS6UJ 6VBnU7XIhMR5MrM3TJ5OGkGZaFUaPxE22IZJYUEIHg6sWCLmDMxJFVm9qVM7PpvU8uSBu Xn1mwUNo56D6XDsSZ0ihYmFN687mwejWWiq8O5vfDaeYTXOTZBL7CKdzPW9NcNhw3pw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796319998; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=f1SF2yvqRwAdRRkxh2r6Z2FGaS1Fc0AzCSCd+rLMPk4=; b=2mrkgVg9VqWzEW34gP1M9hYgUzsceErSU4N2YEtBwx/V+oy9e8z3hMUkiWqR/MPKXz+R xGe0y9Lsij5fSe/QwD/RnPS8glc7nYcnGMb7uqOfKisP+7zDinN8YsVN6I3xx9XxULojk fUDmdI50Kip6uGvAbeFX8Fw5vzJ+9FiP8urL3Y6+v2a3Aoor2SUISD44ibBK+ZeiGpTys YjjsSHZM7JTJ7pwZMFJ04D85UEyfFDb8ctouQFos/lxNKugeJzimDZD2xPoySkkWnX3TM d+kU1nbI4tbRfHU3mrglHQqvSKFvO4FLBtyAu5PJ72NJO5iinZi4ykG/eJe0KT7r5Ow== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L3ulT2w8; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4DE0606A6A8; Thu, 3 Dec 2026 17:46:38 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L3ulT2w8 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796319998; b=odQUo98AgKtNKHfNq2VxsUg8srCiSmDAii4XqqgDp52nhcbAlUuUsmkzBSGY3MTP2KfJ JQqryp2L4c5v2emFi9HSOysEGhggsdUpnKCgTOMh0qwDY15qIcG8GN0OeTl2fMKes95qn RQAMewrXxa16atUEfk84QsdgIgIhyE6CgZF1PBufa1jzfmm1cfmvNhM0Xal+07+0ds8kx DXzZr+XZO438CohRmEd5ZRKUT6ugVV9WnWrax9UC8uRfE93PXrufiJ0sSSAPBd3QeayTH DiqpQZG+By5O1WqXJt45KkSaZZTvc9GTpGitNpR/7H9wdl/hBjGx0pbrKmzLwxUba+g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796319998; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=f1SF2yvqRwAdRRkxh2r6Z2FGaS1Fc0AzCSCd+rLMPk4=; b=ikiDaa+RAcRfzl53DtBw6cBIdBjIdVyY4Q5laqt4VkmUink28R1oUunDCtUrT5jQVp7g pcXXPBRY8XRVlByAzVMZEyKGu0Ii84U23GhEjfE7nWq//9WA+u7ApoyttyMIqS6bRHvLs y9ivZYAlbuQMf+HS8xBKVp1WPUCtmCHPSqNksu6rcs1LBaQnZdn0PsfvtiE2L6vdLRrJZ wFP3SkwD7uTQ1mz9vz1C7W8wQ1g6n6Jn1omiggOLrmsZShOmulXMgZmOqmnNcSKoKPvPM DVvsIRLUNv3YU/pWbWufMK8BCVzkVFy12Wz92JvNxjoqyafNDIGQoq+swZGzR/5esug== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L3ulT2w8; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E75A7606A683; Thu, 3 Dec 2026 17:46:37 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E04A1F0092A; Thu, 3 Dec 2026 17:46:36 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796319997; bh=f1SF2yvqRwAdRRkxh2r6Z2FGaS1Fc0AzCSCd+rLMPk4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=L3ulT2w8W4IjE8HN07QjOol1wEqJPGTL1qncO1WR0aJ9fcH2GD8P2Ej+JilChxeNM QgBHtezVCGfmvmIhv9Qs5hLnrgxbF329PScdxdo5aANSPQYzr+wVJYwuFE9qHE4KDv LgiYiB+CSYZejUpemD+j5idfyaRXsXEiQ4iMGmII6NryNq0AS2n+IzQBpwH9xDfk+I R3P5MuHOii+7CMPWdp/mFMRFFZ7cata6HbvwoQ84VSwtEOW+3nWkyBBd4ksxsN0KQf NeHmVgsW0ZE8siZzNc6VHVhzW8icmQu+UI4lqcG2PGLlBqGo+RYArQ4meaxiyGzUdx c1dEoUFsjt+Qg== X-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 X-In-Reply-To: <20261202-s2500-mac-phy-support-v13-15-a2908fad2693@onsemi.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list