🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22504

Re: [PATCH net-next RESEND v4 3/4] microchip: lan865x: enable PHY interrupt via virtual IRQ

#22504
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 13:05
182 lines
14586 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 (1) · 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] Setting OA_TC6_PHY_INT moves the LAN865X PHY from polling to
  interrupt mode.
- [Low] Tagging and backport problem.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but
  lan865x_remove() calls cancel_work_sync(&priv->multicast_work) before…

--

microchip: lan865x: enable PHY interrupt via virtual IRQ

This patch makes lan865x_probe() pass the OA_TC6_PHY_INT quirk flag to
oa_tc6_init(), which turns on the oa_tc6 virtual IRQ for the internal
PHY. phylib then runs in interrupt mode. As a result, CDEN follows PLCA
transitions through lan86xx_config_intr() and lan86xx_handle_interrupt()
instead of the polling-based resync.

> CDEN is synchronized to the live PLCA status when lan86xx_config_intr()
> runs during phy_enable_interrupts(), then tracked on each subsequent
> PLCA transition via lan86xx_handle_interrupt(). This PHY interrupt path
> is critical for keeping CDEN correct across PLCA transitions.
>
> Fixes: 78341049fbcd ("net: phy: microchip_t1s: configure collision detection based on PLCA mode")

[Severity: Low]

Can this patch be backported on its own? It uses OA_TC6_PHY_INT, but at
the baseline include/linux/oa_tc6.h only defines OA_TC6_BROKEN_PHY. The
new flag comes from the prerequisite "net: ethernet: oa_tc6: deliver the
PHY interrupt to phylib", together with the irq_chip, irq_domain and
phy_irq_work code.

That prerequisite has no Fixes: tag and no "Cc: stable # dependency"
annotation. It only says "Prerequisite for ..." in prose.

78341049fbcd is from October 2024 and is in current stable branches.
Stable tooling that picks Fixes: tagged commits could take this patch
without its dependency. lan865x_probe() would then fail to build with
OA_TC6_PHY_INT undeclared.

Would it make sense to either tag the prerequisite as a stable dependency
or drop the Fixes: tag here?

Is the "critical" wording accurate? The earlier commit "net: phy:
microchip_t1s: fix collision detection on PLCA status change" already
added a polling resync for the LAN865X Rev.B entry:

drivers/net/phy/microchip_t1s.c:lan86xx_read_status() {
    ...
	/* When no PHY interrupt is available, phylib polls read_status().
	 * Use the PLCA status from that poll to resync CDEN.
	 */
	mutex_lock(&priv->cden_lock);
	ret = lan86xx_update_cden(phydev);
    ...
}

So this patch seems to cut the resync delay from about one phylib poll
interval down to interrupt latency. It does not appear to close a
correctness hole by itself. Could the wording be toned down?

> diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c
> index d7e5dfc22396f..bd670c1c5d472 100644
> --- a/drivers/net/ethernet/microchip/lan865x/lan865x.c
> +++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c

[ ... ]

> @@ -348,7 +349,8 @@ static int lan865x_probe(struct spi_device *spi)
>  
>  	netdev->netdev_ops = &lan865x_netdev_ops;
>  
> -	priv->tc6 = oa_tc6_init(spi, netdev, NULL);
> +	tc6_quirks.quirk_flags = OA_TC6_PHY_INT;
> +	priv->tc6 = oa_tc6_init(spi, netdev, &tc6_quirks);

[Severity: Medium]

With OA_TC6_PHY_INT set, phydev->irq becomes valid and phy_polling_mode()
returns false. The periodic CDEN resync in lan86xx_read_status() then
stops. From that point, does CDEN depend on every PHY interrupt getting
through the oa_tc6 virtual IRQ path?

Two error branches in that path are not recovered. The first is in
oa_tc6_phy_irq_work():

drivers/net/ethernet/oa_tc6.c:oa_tc6_phy_irq_work() {
    ...
	handle_nested_irq(tc6->phy_virq);

	ret = oa_tc6_phy_irq_unmask_hw(tc6);
	if (ret)
		dev_err(&tc6->spi->dev, "Failed to unmask PHY interrupt: %d\n",
			ret);
}

The INT_MASK0 read or write here can fail, for example with an SPI
transfer error or -EPROTO from oa_tc6_check_ctrl_read_reply() or
oa_tc6_check_ctrl_write_reply(). PHYINTM then stays set in hardware while
the phy_irq_masked shadow says unmasked.

The second is in oa_tc6_process_extended_status():

drivers/net/ethernet/oa_tc6.c:oa_tc6_process_extended_status() {
    ...
	if (tc6->phy_virq && FIELD_GET(OA_TC6_STATUS0_PHY_INT, value)) {
		ret = oa_tc6_phy_irq_mask_hw(tc6);
		if (ret)
			dev_err(&tc6->spi->dev,
				"Failed to mask PHY interrupt: %d\n", ret);
		else
			schedule_work(&tc6->phy_irq_work);
	}
    ...
}

oa_tc6_phy_irq_mask_hw() can report an error even though its write
reached the device. In that case the worker that would unmask is never
scheduled.

In both cases, unmask_hw only runs again after a PHYINT is delivered.
bus_sync_unlock only runs on genirq enable, disable or request.

Would PSTC interrupts then stop for good, with phylib no longer polling?
lan86xx_update_cden() would not run again until the driver is rebound.

Before this patch, a transient SPI control error only delayed the resync
until the next poll.

>  	if (IS_ERR(priv->tc6)) {
>  		ret = PTR_ERR(priv->tc6);
>  		goto free_netdev;

[Severity: High]

This isn't a bug introduced by this patch, but there is a problem in the
same driver. lan865x_remove() cancels the multicast work before it
unregisters the netdev:

drivers/net/ethernet/microchip/lan865x/lan865x.c:lan865x_remove() {
	...
	cancel_work_sync(&priv->multicast_work);
	unregister_netdev(priv->netdev);
	oa_tc6_exit(priv->tc6);
	free_netdev(priv->netdev);
}

At that point the netdev is still registered and may still be IFF_UP.
lan865x uses the legacy rx-mode path, so __dev_set_rx_mode() calls
ndo_set_rx_mode() synchronously:

__dev_set_rx_mode()
    lan865x_set_multicast_list()
        schedule_work(&priv->multicast_work);

Can a concurrent multicast join or promisc change re-queue the work in
the window between cancel_work_sync() and unregister_netdev() clearing
IFF_UP?

Nothing cancels the work a second time. oa_tc6_exit() frees tc6 and
free_netdev() frees priv. lan865x_multicast_work_handler() would then
dereference priv->netdev and priv->tc6 in freed memory.

remove() runs under device_lock rather than rtnl, so nothing serialises
the two paths. Would moving cancel_work_sync() after unregister_netdev()
close this window?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124124930.485323-1-parthiban.veerasooran%40microchip.com
Technical Details
Message-ID: <179561192833.3135.495365531706227788@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.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-371322-linux-kernel-netdev=dewy.ru
References: <20261124124930.485323-4-parthiban.veerasooran@microchip.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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-371322-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next RESEND v4 3/4] microchip: lan865x: enable PHY
 interrupt via virtual IRQ
Date: Wed, 25 Nov 2026 13:05:28 +0000
Organization: Usenet Network
Message-ID: <179561192833.3135.495365531706227788@kernel.org>
References: <20261124124930.485323-4-parthiban.veerasooran@microchip.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="210425"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:WQyGA6nYrQvAog/+BmM8zRpaE7w= sha256:2b7MQQTKLxutOfXMZHDnk2Z3ge9c70EWvsgg3noinOI=
	sha1:mg3MjuDMkVBJpbstD58Y8SMa9Qk= sha256:v/ZdMvx5/frUd8BPvfsHFQklGjb60mrS9bNWAz3yPhY=
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 69619125E6A; Wed, 25 Nov 2026 16:05:48 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, 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 Qte1fgFZ_QLr;
	Wed, 25 Nov 2026 16:05:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-371322-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 79C93125E69; Wed, 25 Nov 2026 16:05:31 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 2A401605357; Wed, 25 Nov 2026 13:05:31 +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=1795611930;
	b=phq5R7UunAH4FRTNebXXzbObcDf2zbgi73GrDU3I1iT2EkfRC9WIQddjLr/DO1GmHYOR
	 pcmaEimK6DO8kdIa6ZWiL6DXR+zfoa5ffvL3/oLr4b8zzDS2AC4CEg1Zt8nykNTFPXlFa
	 nv+QKK7Bv2zKikjCKmIin4kJPF49DWInPKdxUg7vJvkhdcWZHlYq3vN+3t4fV8geKADPM
	 X+3zWmjJzKuMntQx73S4k+Ndn52cYRkaK5Iv9EaeoiquaHikOeG2Eo3WcAlHrVXEF+Egp
	 dw/VQutUrlyS8s9AMms/Yqp9KPAs9DY/E7d5KwszxKFpQGPvRnnkkEXwi2dnvY7smKQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795611930;
	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=8+bHJOXJl3+c5blsq+R9XDMbPhumxE5ufEoErrnoD1g=;
	b=m9OEd3Hwf1BMDGETu/yDV7/WqKcMUyEo0NR3DCqU8a2mxTXMp1sqTKm9dcoJREvqB677
	 ZwqO3L4kVbt/sOFfNNuCca+M4BGcr07yC8Mm1LcTxUpmK4UNCKT9BU1NNlrznvPXH7jq4
	 njwR4seuaKOqWtwvQWPU/F7rlUxveY0Rs03ggtwih+1r7KN7fLfu+B1kIwyV3md3zpmER
	 EBnvBBdidV65AuJZmNI7DveG7M/6dadwJDfn+ehtefYB+K6B1scus468igz1US/35091F
	 jTUNOzl1YECeh2LmzBNrdNs69z96w5VyAkj+7H3aakO+ihD8m9NYoO7qL+frHgQQeNg==
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=NZTFFOvt;
	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 593B5606A32C;
	Wed, 25 Nov 2026 13:05:30 +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=NZTFFOvt
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=1795611929;
	b=IfOZrX7TYZsSZSwZ4HaeiExvkPqXOLuW2d7WeZ2vhZJFV6q0ZKPcmsER5dWv4OBliSM1
	 RmadI36IY9WWElj/w5xe86tJjrjuE0P3Pf9vmkK+D/zolMaqg42DYWziTusWwZfMxUimw
	 mZuwvlZ2WcSip5OP/O7XNhbKlLiYk+aIfOmCc/HYcSNTBvrpOt1LWPe8IwuZ0+QUehI0r
	 1AoNTY+kR+6EFWOB1haGCb8h7OqQeU8rxZ09vKi02KayBhRCFLh1dL/eDaUXfbGSkO5P4
	 hmCmMNt4HOx/f5JCz06QhxLABlZgc3NF8E91MKJlGis7xIj4o9mbEHy+NwaqMf+6C9A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795611929;
	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=8+bHJOXJl3+c5blsq+R9XDMbPhumxE5ufEoErrnoD1g=;
	b=dRGwlfCKzCcTUkvyMdsk25vuPAt7t02EgQgaF25CFhB9TzZETct4Mll7sOC/3HDHimZO
	 21m0k+9M43A2FoCiObCO1LzYaFdYDqBr1v3sXoRE6fK3DaYjStRbUdHPu30i7//eb/PSO
	 Ylg1fVEefutt0Cbk6cXekDj5CMDcMmrgjrkeL8J4F7Ryhl5UEjpu32H/B4GrfqM4fi+8O
	 DFom2ZKzgb7IJTfy9QnDTBkAmEpqSyo0A4N7qgIZZ9KzOpYwwl3x4eI9jzqHYRnMcjMTs
	 NA9YKBy6t9peiQiapGZ6NtwP5ZRDJyWIhtimD2DfUhiBDTEsGOIl/zXH8y6xjg/yPtg==
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=NZTFFOvt;
	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 7C0C4606A32D
	for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 13:05:29 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B630A1F000D1;
	Wed, 25 Nov 2026 13:05:28 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795611929;
	bh=8+bHJOXJl3+c5blsq+R9XDMbPhumxE5ufEoErrnoD1g=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=NZTFFOvtqkxBldu6ewMp4QviLHe/lG47UbDj6Vkg0uADARknRcMH/hQsM3aRlYQRO
	 aJxvsgntxhCruGlAwTYSTWFNAATzKsss9be7f7boXOO4LZ3BlARnS//GDG0tf8G++H
	 SAzt9mg+t/VlYjYSXJ3qYYG+RLoPogVuMzCNLMdjyRSogDf+d7q6YpTEY0Cxz86QHh
	 0Xva2TBTJrOzPApM+SkKUviPkuB6JTrZLSKBswbVg68lVWsj3h1npUa6E+hEEN755W
	 mGxNt2nSou+24zLTmrEPBzCHjcBOsLk/Q5DGs+scaBCp37Kd+W76mfk9MmNJ/PHZyK
	 UNmgrO6QQ5Qdg==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, hkallweit1@gmail.com,
 linux@armlinux.org.uk, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com
X-In-Reply-To: <20261124124930.485323-4-parthiban.veerasooran@microchip.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