Article View: linux.kernel.netdev
Article #12822[PATCH net 2/2] net: lan969x: fix RX ring stall on frames from inactive ports
From: memoriaru
Date: Sun, 08 Nov 2026 18:45
Date: Sun, 08 Nov 2026 18:45
122 lines
12002 bytes
12002 bytes
From: Zhang Hewei <79190669+memoriaru@users.noreply.github.com>
When a received frame's source port does not map to an active netdev,
lan969x_fdma_rx_get_frame() recycles the page via the page pool and
returns NULL, which makes lan969x_fdma_napi_poll() break out of the RX
loop without advancing the FDMA software cursor.
As on sparx5, the DCB still carries its hardware DONE bit, so every
following NAPI poll picks the same DCB, hits the same inactive-port
branch and breaks again: RX traffic stalls on all ports until the
module is reloaded.
A NULL return currently covers two different situations: a failed
build_skb() (allocation failure - breaking out and retrying the same
DCB later is correct) and a bogus frame (which must be dropped and
skipped). Split the two: recycle the page and return ERR_PTR(-EINVAL)
for a bogus frame, and advance past such a DB in the poll loop.
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: d84ad2c0d80c ("net: lan969x: add FDMA implementation")
Signed-off-by: Zhang Hewei <79190669+memoriaru@users.noreply.github.com>
---
--- a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
+++ b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c
@@ -3,6 +3,7 @@
*
* Copyright (c) 2025 Microchip Technology Inc. and its subsidiaries.
*/
+#include <linux/err.h>
#include <net/page_pool/helpers.h>
#include "../sparx5_main.h"
@@ -113,8 +114,15 @@
sparx5_ifh_parse(sparx5, page_address(page), &fi);
port = fi.src_port < consts->n_ports ? sparx5->ports[fi.src_port] :
NULL;
- if (WARN_ON(!port))
- goto free_page;
+ if (WARN_ON(!port)) {
+ page_pool_recycle_direct(rx->page_pool, page);
+ /*
+ * Signal a bogus frame so the caller advances past this
+ * DB. Returning NULL would make the poll loop break
+ * without advancing, stalling the RX ring forever.
+ */
+ return ERR_PTR(-EINVAL);
+ }
skb = build_skb(page_address(page), fdma->db_size);
if (unlikely(!skb))
@@ -258,6 +266,18 @@
break;
skb = lan969x_fdma_rx_get_frame(sparx5, rx);
+ if (IS_ERR(skb)) {
+ /* Bogus frame, buffer already recycled: advance past
+ * this DB, or the same DCB stalls the ring forever.
+ */
+ fdma_db_advance(fdma);
+ counter++;
+ if (fdma_dcb_is_reusable(fdma))
+ continue;
+ fdma_db_reset(fdma);
+ fdma_dcb_advance(fdma);
+ continue;
+ }
if (!skb)
break;
--
2.39.5 (Apple Git-154)
Technical Details
Message-ID:
<tencent_8006708A5820F7E91C2584F5CFADC3E50C07@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-358828-linux-kernel-netdev=dewy.ruReferences:
<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-358828-linux-kernel-netdev=dewy.ru From: memoriaru@foxmail.com Newsgroups: linux.kernel.netdev Subject: [PATCH net 2/2] net: lan969x: fix RX ring stall on frames from inactive ports Date: Mon, 9 Nov 2026 02:45:41 +0800 Organization: Usenet Network Message-ID: <tencent_8006708A5820F7E91C2584F5CFADC3E50C07@qq.com> References: <20261108184541.74618-1-memoriaru@foxmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="179122"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:mWSLUQlYr9UqEFgJ0P1PmZ7yc/c= sha256:1DSLNIOQkf8Bs3OrGXfkho6DWFgr5T5TuGTha8ZJjZA= sha1:7K5pjp+pVKvp+1/Me11vCPTyUyY= sha256:eJ7TajUmxSaaqlntRy2JYUQ1CszBQjgqKjHaJHPjQuw= 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 54BCF1135E2; Sun, 8 Nov 2026 21:46:19 +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 qWOOSb1h2WHL; Sun, 8 Nov 2026 21:46:16 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-358828-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 446D31135C8; Sun, 8 Nov 2026 21:46:05 +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 973C7627AE; Sun, 8 Nov 2026 18:45:54 +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=1794163553; b=Rn6+AKVRJgC01Z2mz0aBOm4+UgPS5gx502chqBkcn9F0fchsPmpb/KYCShRwKBSxo7qI 9/xA4IjnqC/4jPLLYP/5zxOiX49uJX+mlPzJBdjModyV7vBSsQZSUp8gO2hEA35kOvvCQ LfPN9Bn1sYEqzEFTZhKta3ff89KQtmVr6gcp9spRbO1eaMXooF7wj+ZYMCk6xpcfupJ6q bGXUxXAMiuw2x7IFtwxocrn+rilMH+9Njo0yYbW1MwWjACYQ6pQz7wOws7z4JVkYEGmWI 0AyCCR8Qr8tMZizJDxIFce4qHgB1YrMYMZjZkAaK/HLw6nm6XgDyhEosh5Y60X+sICg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794163553; 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=YnVXjbVHXvvZOcIS/H5qlfvrL3Uc9t/RPStARuKZcOc=; b=FsgFyUX32cCViLCjKkgpF2M6J8ga7HGMKRZDaZheZVeLclvVcgQl6oZeMSXAiAJTXOX+ v2tY/wFitbO2ahgtbUaGf/mOOglQMqkZMFl7gZSEOg8UdnuKwuaPnnTi80Mu2kUHk7R6c QJbOUoVT/RPLkSosCM96+dT/j6Hbh6EEuBQJK9A4ukcQYEs8m0yeLbyxHvoP3/BxACe1i YIp1potA4nHUPf0Pjd5e6HjK7nUEh8AEicuc3dWmIZ6RQ3RDOF8RPhXHKuKYt1B/M9JkA ZSNLEyxONEABQDDnPWsq5XZDhuFHjRInQKzpxLEkFmTRddowxekgzXtVd4+SnW6XGyg== 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=jQkdMcxd; 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 E7DFE606A321; Sun, 8 Nov 2026 18:45:52 +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=jQkdMcxd X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=203.205.221.242 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794163552; b=gcVAWs037msJKKzdzXM8/l6p3Q7Xq7ZuB6hTRNJoMoFQ4pe70yokcV2eCwia4pXhdW8h ZlXSrsA5AJGFJZtyLnHo0O3Y0SVsPS15wvt9EbIDvmt+3zGgs3KbWcArtENz+z1NJ1tz4 Ft/EVoQp4jgjjqzggm+r/AD91r7+XfKD2IdLOFiR2WFHKlOXvVQ98KiMwtoKQ0YgnbSV8 ZLz6PGXwmfdWsTSx6AgGmifpmoBMx5Yes4P0apFvoU3895a8qCiX5s2BQ2VDGb8ZtAAsS chleD9T3XiTk7ZtOCDdVTmAIQfBKUVkO+Kzp2w1E9jVg7EARQP8oSLVIyKr44M/ELKQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794163552; 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=YnVXjbVHXvvZOcIS/H5qlfvrL3Uc9t/RPStARuKZcOc=; b=Bu4yulsTxYLwrcFkJGFTWvzUgLI3kydYKNrBTJJKpScxTCjLNACXcKCLlq4puGXAKVkP TmwzcVv9TbgxmylvDyTfB5lalwYKMgKUwENxJpTvRjg/uS0g3s9EaN3lcWTgUwnkHr9+s ZD2/3E/ybC8u3gvlWgFMZLvzApHOOG5XAmiCBYuMPVK9v6dLXK8UPfJNCbOpaCJZNGLdw qzLc1+uawksnB23KX8i8grCzNUS6dKJ3clIVRMXQwpfQW+//UtPnP6tg1IrdKLWX6VXCW hGKjW90W3uJg7DVwHVpWIADKaqsDvVXKopaUXA6/bqHmkyslCONKsVT+UsCk6Nur8Xw== 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=jQkdMcxd; arc=none smtp.remote-ip=203.205.221.242 X-Received: from out203-205-221-242.mail.qq.com (out203-205-221-242.mail.qq.com [203.205.221.242]) (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 6D5AF606A326 for <netdev@vger.kernel.org>; Sun, 8 Nov 2026 18:45:48 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6D5AF606A326 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=1794163546; bh=YnVXjbVHXvvZOcIS/H5qlfvrL3Uc9t/RPStARuKZcOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jQkdMcxdP3NfiRlh6mUVlMWqt1oj1rrowcmfLTYFVjnWiOcfpbi8X6Q+bQtQDF2tw P/+5/e3MjuyO9sl9lXRez2mXd5nu35bcGWl6z8Z928QKYDA5yBjt+SArdRGcA35XAJ kMH6xpv8FJerYaO+Es/jFBPr3eBLyWG+BQmL0Z7s= X-Received: from localhost.localdomain ([183.23.108.92]) by newxmesmtplogicsvrszc43-0.qq.com (NewEsmtp) with SMTP id B6A9EADA; Mon, 09 Nov 2026 02:45:42 +0800 X-QQ-mid: xmsmtpt1794163544tnio22w09 X-QQ-XMAILINFO: NHTNowOA4hJdCBJvAUSXHaaU/10PjGxjUWXhanrO2Y5v2GZ8gDMMcCEKwDXUfR 8CLVmtSTSB0rr7rwKpNJGp1uarS2aLxNYr9kxmgcwJxs6oZpkctSBzfcvnQ4dg6smLODvmuCBFwP sk0UV7Vahk3l+/EqGFB1y56+JTD4JnvbbxDp5bu53Ik33HaSF4DmjhuvB/e0xgs6c+oa2U/nHky2 pxBXvfmpXBFPZ/uEmZHlfk8C0GyZ5B7vLZgohmvUDpeaApBXz8FjS/xNTirj7IEhlREMfnGZNV/k yL+o15q6bEkM4ncBdO0hEqfykjXUElrmU2DnVJg8dTS7vTOKTCs5BIFAVfLio6x8WWps7Q77Uowc O7WbZZdHHAgARsudU55xfSl4QXIo0O5+L1HUnDgN6C0icRadd3Zocuxzu/ItKsxfDHAL80qIxoVf elIkJLvh7paeYROO5r03HpX15IzqQK7TiSQDA/q1wW2m6W1m19yC3XZ9ymztoL9SkA/aYnlW7UVb E8HCp8uV37RxhRxFzwOmr3Vv/A9PAaSvsjm3NvTPplPnHOMfz8CbVFaKHPJBMgyjXEBeULZEG2wu 5j5DNezR/T0l1ZVRrM8ykrFve5dgw9OtTddkbXBZ10U+TPDdjSaFfdZFOtI3bAZUqQjPRlJ3Wlav HaZjhIVG5uyE5ZcXhBWwYN5X3wyW/X6MdI3uOoY/5V5WSqljt1hfd84CyIjmZ67RyiorlHkMlOPt c2PngjzQjT6HjuH6sRlA4tPeaIS/W4Z4pMhIfZUo+k3bUOEboPJfmsemJrSemmBYu9xRzg5zxlpM 5v5Drwo4SSx2cWR93+iUvDK7TGQGtFe6BGTuh/tbghpDfGg0eYYGf8lAwsDfWDwANuIVJ1QXCB5I Ys6TT0fk6Adxl/bRRen443fzI/kDS6n7PsP4R8nzfFBDvR0Dp7qCZQKemtwfB/2tIzzBpYB89IrL tJ04HmFbD3vvsHar2UNKXPTqdtNcAJgPvfWDj16NWSgyzP9oLWktYpzf/isTlVAe6T+IZ2cPoy+l 0k016+PRw0WKHVWsVNP9Q79ZHhxfI= X-QQ-XMRINFO: OD9hHCdaPRBwH5bRRRw8tsiH4UAatJqXfg== X-Cc: Steen.Hegelund@microchip.com, daniel.machon@microchip.com, UNGLinuxDriver@microchip.com, 79190669+memoriaru@users.noreply.github.com X-OQ-MSGID: <20261108184541.74618-3-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