๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12507

Re: [PATCH net] net: ethernet: adi: adin1110: mask the RX IRQ of the port being stopped

#12507
From: netdev-bot+sashiko
Date: Sat, 07 Nov 2026 14:34
94 lines
11380 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 0

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).

- [High] The fix is incomplete: the peer port's ndo_open can re-arm the
  RX-ready interrupt of a port that is still down.

--

net: ethernet: adi: adin1110: mask the RX IRQ of the port being stopped

This patch swaps the two RX_RDY bits in adin1110_net_stop(). Each port
now masks its own RX-ready interrupt in IMASK1 when it is stopped, which
matches the bit mapping in adin1110_port_rx_ready().

> diff --git a/drivers/net/ethernet/adi/adin1110.c b/drivers/net/ethernet/adi/adin1110.c
> index 53fac3dc8be62..abdc16089c9e3 100644
> --- a/drivers/net/ethernet/adi/adin1110.c
> +++ b/drivers/net/ethernet/adi/adin1110.c
> @@ -945,7 +945,7 @@ static int adin1110_net_stop(struct net_device *net_dev)
>  	u32 mask;
>  	int ret;
>  
> -	mask = !port_priv->nr ? ADIN2111_RX_RDY_IRQ : ADIN1110_RX_RDY_IRQ;
> +	mask = !port_priv->nr ? ADIN1110_RX_RDY_IRQ : ADIN2111_RX_RDY_IRQ;
>  
>  	/* Disable RX RDY IRQs */
>  	mutex_lock(&priv->lock);

[Severity: High]
Is this fix complete? The peer port's open path looks like it can unmask
this bit again while this port is still down.

adin1110_net_stop() masks the bit with a read-modify-write.
adin1110_net_open() does not. It rebuilds IMASK1 from scratch and
unmasks RX_RDY for both ports:

drivers/net/ethernet/adi/adin1110.c:adin1110_net_open() {
    ...
	val = ADIN1110_TX_RDY_IRQ | ADIN1110_RX_RDY_IRQ | ADIN1110_SPI_ERR_IRQ;
	if (priv->cfg->id == ADIN2111_MAC)
		val |= ADIN2111_RX_RDY_IRQ;

	priv->irq_mask = val;
	ret = adin1110_write_reg(priv, ADIN1110_IMASK1, ~val);
    ...
}

On ADIN2111, take this sequence:

  ip link set eth1 down    -> adin1110_net_stop() masks ADIN2111_RX_RDY_IRQ
  ip link set eth0 down
  ip link set eth0 up      -> adin1110_net_open() clears that mask again

eth1 is still down at this point, but its RX_RDY interrupt is enabled
again. A port that was never opened also gets its RX_RDY unmasked as soon
as the other port opens.

For the down port, adin1110_port_rx_ready() returns false:

	if (!netif_oper_up(port_priv->netdev))
		return false;

So adin1110_irq() never drains that port's FIFO. It only writes STATUS1
with priv->irq_mask and returns IRQ_HANDLED.

The interrupt is requested with IRQF_TRIGGER_LOW. Frames can be left in
the FIFO, for example frames that arrive between the IMASK1 write and
phy_stop(). The commit message describes this exact state: "the stopped
port also keeps re-raising its interrupt with nobody draining the FIFO".
Wouldn't that state still be reachable after this patch?

The handler always returns IRQ_HANDLED, so the spurious IRQ detector
would not disable the line. The threaded handler would keep running SPI
transactions under priv->lock.

Also, priv->irq_mask is overwritten in adin1110_net_open() and never
updated in adin1110_net_stop(). The driver therefore does not track which
ports have RX_RDY masked.

Should adin1110_net_open() unmask only the opening port's RX_RDY bit with
a per-port read-modify-write, like adin1110_net_stop() does? Should the
stopped port's RX FIFO also be drained or flushed on stop?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261103-adin1110-net-stop-1-yuehongwu%40cmss.chinamobile.com
Technical Details
Message-ID: <179406205322.994134.9029665354316624384@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358397-linux-kernel-netdev=dewy.ru
References: <20261103-adin1110-net-stop-1-yuehongwu@cmss.chinamobile.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358397-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: ethernet: adi: adin1110: mask the RX IRQ of the
 port being stopped
Date: Sat, 07 Nov 2026 14:34:13 +0000
Organization: Usenet Network
Message-ID: <179406205322.994134.9029665354316624384@kernel.org>
References: <20261103-adin1110-net-stop-1-yuehongwu@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4136563"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:R1gVtzwLyzeFcVZxgi58uPj3yJ8= sha256:9+TvghXHrR7rMetrTTpR0IVIH+gJ6c/doEj2eLFPY6E=
	sha1:uGNjPI9W27ebLxvXkfJk3SJzaOE= sha256:UOfbDOYvysI7tuqqmJIbuBOkt5FHJRqCdVwmaAxOYoM=
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 9246611344C; Sat,  7 Nov 2026 19:04:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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, URIBL_BLOCKED=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 Xug5F1jM0t1h;
	Sat,  7 Nov 2026 19:04:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358397-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 9A815113433; Sat,  7 Nov 2026 19:04:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 8D74D884D5; Sat,  7 Nov 2026 14:34:36 +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=1794062065;
	b=JljLZkVQJhfhqtOPORcbLIgequIC7ofxmNn+DAAjdyeG0UPcjrSu2zra81ChN6gZvnBo
	 lui75Ff5GOIRbUJ8NJ4GRadE9/7h+Elb+9Zs8x/yfNmvsozdVUEmuzOXA7AzhdRk5YCVI
	 9WePr3dKBOaMKlF3yyLZtxe9oJrrnJ2Js22vLOddMcNcmQtDgqAko9Zv9zpJPzuihvmfD
	 mPWrUb477NRJVl8vRuAds+5CuU4P9XZejtL0JnDlSGOfLPRFuJ8Gv+NNbCrku3ZASQ1bb
	 cbNoD0oFn76ja8nz8eVC/fCYLOPagSrzfoXxRi/iRbIvzmwpV1w+HxFRepOCqn/DXnA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794062065;
	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=ooMpLLI6XN4Ow1z0b2jGvivbcReoXWTuSem8zxU6oD0=;
	b=R4hK2kw4Fizsa60NXqDL2w7eg89QUv97V4YduZ7RJWsGuQXddOdAJQmwHu2RZTfr1+JX
	 t3HLKGpXOyNWnVrEaGsv0ksjYzBQfirf8du/q/TAnSJs+XlcY1KJC2lRj0GtGOkn1ug88
	 2hJ5HjlDyypJ/F3P2mCwMaLcvMmsr0pwUi2Mln9hp6HRSNCSBdv5oHA6hg/ctXZt2fJlv
	 1OKHc3JMls/J59oiSxrWo0zn5FW3jthRs8mi8H3Fqj0pJeTHhse4xiKQLWhT3tXH7uoEa
	 OXD8fLl1tWouTCkBVjaS0JtE9j8P5EUF6tNdcAk7gtQUk5KiHbMpwv3vf3OqaJfJ/iA==
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=cBLCHJ8q;
	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 676FF606A33F;
	Sat,  7 Nov 2026 14:34:25 +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=cBLCHJ8q
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=1794062054;
	b=NaHBtfp1CWAxl7LXU+ewAit0JIv0smpJvSshruTklqyvtRDSkXZWxdlg7AgGx27LObXf
	 iSrfOANgiSf13tTxcsGgasZFrzNddOxjLbuVUrsM65y+kapDG0gJt8pyG+Uy9bgK1eqcJ
	 XN8uI/HP850uo0KNuHiciS4HPqbc8Uy3rPoqa3gPttvPBo4GI7Wi5Sfnm4NFUaLsBQLSB
	 CBPKR9BFdGgW0Pso0HtwrxbXIShUm89S37KeQl+0nqLcXLIozoogFKx0x/4B6YKsBS6w9
	 QQMqtr/JouWmCr9DcaXp9xBzUXSA81iWSbeD+Oug2+70IdtY+PaSxkTufA5G49/+fHA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794062054;
	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=ooMpLLI6XN4Ow1z0b2jGvivbcReoXWTuSem8zxU6oD0=;
	b=TNAOTc95wMzBYg9Ubu/od5fjxkYK+v5LZ3LAvY+IxUnAhy8fxXlJc5Wnf5M30lt90rwX
	 U4kYUjeAJJ66Zcmm1ZNJxei0kayrDQstAKXga0fqoetElTXNzhP9fNfN9Rx+HYf3O69AK
	 Yvgv8pffGcQEK8fbzL+KmAfgxlWyemYiDObTwODBpOVyrReiSFBguuvo7iNrx6ifi+AaZ
	 JJE/d2pOTDNsInJj0I48AZrRWNEJQZXhrJ7ewob7ureYGzOSmEH8Otu7Sfnnjd5DYcWza
	 BnI7bI3yzTSZ20VburEKDNlWq+Id+n54R7pkQEdIDF6haUPNmZ3XU81g9zbRAOs+0Aw==
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=cBLCHJ8q;
	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 3FBB0606A335;
	Sat,  7 Nov 2026 14:34:14 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF1BA1F008A1;
	Sat,  7 Nov 2026 14:34:13 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794062054;
	bh=ooMpLLI6XN4Ow1z0b2jGvivbcReoXWTuSem8zxU6oD0=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=cBLCHJ8q/lpUaXnrNwsHxFX5FpDkt/5Lb3TEPDV/bH18woT78r0BxKk+jugamxQ7z
	 S5vO0JgjGbw9fCwEcm+MteQuky+8aZa66QBw5vxr4FyeAMb5IQsKBFXCuSBN6cd6Ix
	 W7WMiSvR04lpFzLzxapJ3d2aNo/NC5d7GqW3qiDnVDhkNuPb8XFUuc1jeWoqAXqIvW
	 utvXq11cigJsD05hnFzff0vnFXuJEV/Gsp5QicsKI0uTgv3KXXVzK9JTLnsnDSZxa5
	 i7RaYsm06wIWtMuaTJNjgRjRQRdVNjJsgObHNPQ6FGTr/lQKjRFSlnLuYBNxWg9i4k
	 W7g0Bzc81pJKw==
X-Cc: netdev@vger.kernel.org, alexandru.tachici@analog.com,
 linux-kernel@vger.kernel.org, kuba@kernel.org
X-In-Reply-To: <20261103-adin1110-net-stop-1-yuehongwu@cmss.chinamobile.com>
X-sashiko-severity: High
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