🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12825

[PATCH net 1/2] net: sparx5: fix RX ring stall on frames from inactive ports

#12825
From: memoriaru
Date: Sun, 08 Nov 2026 18:45
67 lines
11480 bytes
From: Zhang Hewei <79190669+memoriaru@users.noreply.github.com>

When the FDMA RX path receives a frame whose source port does not map
to an active netdev, sparx5_fdma_rx_get_frame() logs an error, flushes
the extraction FIFO and returns false - without advancing the FDMA
software cursor and without releasing the skb, which has already been
extended with skb_put().

The DCB for this frame still carries its hardware DONE bit, so the next
NAPI poll picks up the same DCB, takes the same inactive-port branch and
returns false again. The software cursor never moves past this DCB, so
RX traffic on all ports stalls until the module is reloaded. The
sparx5_xtr_flush() call only drains the QS_XTR hardware FIFO and does
not touch the DCB ring or the software cursor, so it does not clear the
stall.

Treat a bogus frame as consumed: free the skb, clear its slot in the
rx->skb[][] array and return true, so the NAPI loop advances past the
DB the same way it does for any other received frame. The slot is
refilled by sparx5_fdma_rx_dataptr_cb() when the DCB is recycled.

Found by code inspection; the stall needs the hardware to emit a frame
with an invalid source port, which cannot be triggered without hardware.

Fixes: 10615907e9b5 ("net: sparx5: switchdev: adding frame DMA functionality")
Signed-off-by: Zhang Hewei <79190669+memoriaru@users.noreply.github.com>
---
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c

+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c

@@ -159,7 +159,14 @@

 	if (!port || !port->ndev) {

 		dev_err(sparx5->dev, "Data on inactive port %d\n", fi.src_port);

 		sparx5_xtr_flush(sparx5, XTR_QUEUE);

-		return false;

+		/*

+		 * The frame is bogus: free it and let the caller advance

+		 * past this DB. Returning false here would stall the RX

+		 * ring, as this DCB is never consumed by the software.

+		 */

+		dev_kfree_skb_any(skb);

+		rx->skb[fdma->dcb_index][fdma->db_index] = NULL;

+		return true;

 	}

 	skb->dev = port->ndev;

 	skb_pull(skb, IFH_LEN * sizeof(u32));


-- 
2.39.5 (Apple Git-154)
Technical Details
Message-ID: <tencent_D3F64049D3E34AACEB2B5B11CB8D0C821408@qq.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358830-linux-kernel-netdev=dewy.ru
References: <20261108184541.74618-1-memoriaru@foxmail.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-358830-linux-kernel-netdev=dewy.ru
From: memoriaru@foxmail.com
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/2] net: sparx5: fix RX ring stall on frames from inactive ports
Date: Mon,  9 Nov 2026 02:45:40 +0800
Organization: Usenet Network
Message-ID: <tencent_D3F64049D3E34AACEB2B5B11CB8D0C821408@qq.com>
References: <20261108184541.74618-1-memoriaru@foxmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="179224"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:mup1z0CN6LKBoFk7bEnSkh5qwUk= sha256:jMgFImkeonJk17GLh3p1OS3KYxzft8oWW51Jfro30+4=
	sha1:TmOs4bo7c/bFnWnmbCfeMR8gnvU= sha256:k9N/32AgIvo0VyEzidmAyBunuDxwBINne5iC5wsjRCQ=
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 3EF271135E2; Sun,  8 Nov 2026 21:46:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	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 (1024-bit key)
	header.d=foxmail.com
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 Y5ADMZNfCUIv;
	Sun,  8 Nov 2026 21:46:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-358830-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=foxmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id F25821135C8; Sun,  8 Nov 2026 21:46:23 +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 7B460621DF; Sun,  8 Nov 2026 18:45:58 +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=1794163556;
	b=is/kVrISEAtI7ONXOul2vKBDvg5jQyJrNqSJqJGIU8hyhP5Svsz+yF+JHvjrLlIELoTE
	 Xv0N/+aJMg5neZ+DqfUWSgMjGJt6nxrFmnSE1q2RJ2K7DABbi7p0ZleMpcxqi2dbEhGX4
	 FDaUv1JMh7ZQpMfhiW8WqXr864XnpccjsRJmH//kbq8B1vexV5Lg/JPn/5MlEoB9a/swM
	 Q8MZrOzNt0hJC1iO2bh9KuPb2uA9v7KMXZSpZOfKYOb8AJCR964NgHbJUIxoqZIjl1fjv
	 kRLhlQSDNQz67YXPeFlM3eHp3NkcitbDg6N6MV1dK7g7spZsAtm39xA4BzC1CP6VZqw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794163556;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:X-QQ-mid:
	 Message-ID:X-QQ-XMAILINFO:X-QQ-XMRINFO:From:To:Cc:Subject:Date:
	 X-OQ-MSGID:X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=59PcqYceFmLmXAG+Y80JUvL8xmpcARc+z5WhilxBos0=;
	b=HR4zF5UgqDtyHoxpt6cnmqvTf4E3KhiWDLhH5LobVlwIrjJ4I454JIzsyCrIZLKnUOhG
	 Ujgs8qJ/d45z4SQb1GBq6PZvN4b3tRBjWVbMEjA5I2JE2g20oQfZybwnN5m1WKx30GLf+
	 r5NSQ0ohMyOBXW2WiHwQMXtY4NceWpMG8UKlvrnUFdl4mwZqg/icrYMKjcQGTauKLP/5V
	 EPYjgrSFBs0uc+3U0R+PRlORQqAB8VwqJGT2/ZLyui/uKF1ieAlzSmb8ik/bYlDcsQc3U
	 u7J6dDyOwEtGkTr/BRjvG/0a4XHpBB+scRUUR8A7XMtLKwfOJ/IL6emUbsU1YZ0f5bQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=foxmail.com header.i=@foxmail.com header.a=rsa-sha256 header.s=s201512 header.b=q8z3L7fD;
	dmarc=pass header.from=foxmail.com;
	spf=pass smtp.mailfrom=foxmail.com;
	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 77552606A33B;
	Sun,  8 Nov 2026 18:45:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.a=rsa-sha256 header.s=s201512 header.b=q8z3L7fD
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=203.205.221.235
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794163555;
	b=kng2I8m65QvsbH1j4wOYWhjmIyaCEpiLV1cOVMi2sx3phGcuSvRF/NXQhSAfCMNEJqBQ
	 JJjZ+7V0rkfkI6QDkWQdMtNvyun/eFe1taS4yV94WLVRmgtRFe1YRtyei+9MhIF+yrBaA
	 Y4SQaKxKoxoPbobBWHU/q0SsBY3qiQsCtkmIaKZ1QmE5q2DzU/dzxSnJdMnBlVODvsnQ2
	 MnIeSYN3ihCC+eYbAUmnwoG+kmMsPG9U/O/+5SqUsHPuulN3CRf8wt3Uzq6db+h303/HI
	 zqM8QTooptxDMpLpTrljv5GpSfPFz5Sj/aMyJQIPz5IPfE6Cvt0SzrxDOU50DsJgFIQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794163555;
	h=DMARC-Filter:DKIM-Signature:Received:X-QQ-mid:Message-ID:
	 X-QQ-XMAILINFO:X-QQ-XMRINFO:From:To:Cc:Subject:Date:X-OQ-MSGID:
	 X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=59PcqYceFmLmXAG+Y80JUvL8xmpcARc+z5WhilxBos0=;
	b=OtUr2OT5MQ6hUvlHVrshkg0LR2e012uTT5bq81n3we2sd/zzD5KjEkuIsizvFt3lrfmv
	 NiYgqZFdz4fytO5kJlulIPLFt4flcgWXUMyrkt1oPF5o6wanBhC9PsaWZzUbR7vWrJc89
	 /InO3VODbl8e8UMjc5XgtrQY9jRZWQzv+aNVCfi6jm7TkPspzj59gRfC1VyI4Aw8BTvVZ
	 ul/MoOOYKUUdQlgW9eCHs/SY194cnJq+C1dLWr5KBeVoFekdob/gDz21/PVLqvzCgS4By
	 OdqkqrjslQkP9+o5vlvRcySBWV16cpMWUPoj9s+tBJ3recsO8Im3ti24a8urOnwL0sA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=foxmail.com;
	spf=pass smtp.mailfrom=foxmail.com;
	dkim=pass header.d=foxmail.com header.i=@foxmail.com header.a=rsa-sha256 header.s=s201512 header.b=q8z3L7fD;
	arc=none smtp.remote-ip=203.205.221.235
X-Received: from out203-205-221-235.mail.qq.com (out203-205-221-235.mail.qq.com [203.205.221.235])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD658606A32A
	for <netdev@vger.kernel.org>; Sun,  8 Nov 2026 18:45:53 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AD658606A32A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com;
	s=s201512; t=1794163545;
	bh=59PcqYceFmLmXAG+Y80JUvL8xmpcARc+z5WhilxBos0=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=q8z3L7fD4ElUoPUIgXZMlf7VnnuER16X05pJb5huyuZ7e2mx4FlWvCHk03DRerJAg
	 Ak3yyZOz/mqdNjZy29yBTpNz9JIf6F/iLJjcdMlBnnnJHQAHotsEzRXQ8uhCeFODI9
	 tYVX/A9nVPk+Z/+qwYabf3HasISRsQ9+9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+nzDrVsgrH83hfLq+sgiXvoYkvIBptRTSrkf
	 zSSrOCIsDSs3ke8YKOo9nz2fFUYYGMq6rqN1rvIfTERswuC1aEfBDtIu2qxTWClYYvdDB+IEWxfj
	 9Zz93ijmX2pbjI5l0mR2Mfg/4pRIU1NFykHaP4l9OUom0uB8KbEHPgkrMJ3RGzlcruFzFA8pdrNx
	 EuiBkeKkyUm34+4vrf1Tw188tUT81doGtWaHQd3bUks00fTkp2
X-QQ-XMRINFO: NI4Ajvh11aEjEMj13RCX7UuhPEoou2bs1g==
X-Cc: Steen.Hegelund@microchip.com,
	daniel.machon@microchip.com,
	UNGLinuxDriver@microchip.com,
	79190669+memoriaru@users.noreply.github.com
X-OQ-MSGID: <20261108184541.74618-2-memoriaru@foxmail.com>
X-Mailer: git-send-email 2.39.5 (Apple Git-154)
X-In-Reply-To: <20261108184541.74618-1-memoriaru@foxmail.com>
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