Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795021986; b=v256gp2PSZhYISBFTqkCE4ifTPffbRaCx6HNcFEbywRuRU7u3vulmSpFPN3LWSAZIIZo 6asvEzi+m3jW0ymUY06LnrVcoUjcgaFV5Su38+ZCJvt8OviaTKqt20ICkTnAKIKp7iOjC fs25jfme3rRWf4ZNlEtxbGT/o7y2PP1hN1gHqGIqWlBq5fdbFdxk900C0Bh1fDm56IS6Y r6LX6QbUeHKYWXD7+wiQbWm0tiTxfKbD+LXc3KE0FYCM3VKVsweqgWP8QGUiQdPUQ5L1m RqnP5Dedc/JyggHoLbWSM1BbV9s6Kn0vAknZ+lnzm41MXqGjNisZLDG8dgVw4lbAm6w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795021986; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=5HFNPBt2aNYJaKhYy+WdD/MHi227nST+OKDYDJYGsZ0=; b=5dVp6QWutiEK1gI4ubpcPCtPN9qC6IpAFh9FSNa6dlA/dBW6fTgABruq/l6Bni91S0uQ jzUvQfjfgJ7dHNymWMfA23DaT9y3aMTDpTH8AoyfAOFrW895vbOAmPy4hIYH52kzIpYyw JR/7H38Eb2P0u5ZgvvX9p5U1qV11owvmuuwVjx3xFg9NCVhh90xL8Uz14sfoRksk1KjZc RlgK8CTKeBSFIH9t2z0Yl1NnvmpX2NxonVQQxQ697fPY6WXT6xlocoaz8F91bs3hpHYdf i0G5Ia4mIBjrV+gn1gI6pc5zsGMaWG98lsoy/YD13Zfr2gp0/pxFlLg97gFD5TMy+Ug== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=t5Vj1Uaw; arc=none smtp.remote-ip=100.103.45.18 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 B9D6B606A31C; Wed, 18 Nov 2026 17:13:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=t5Vj1Uaw Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17F7D1F000C4; Wed, 18 Nov 2026 17:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795021986; bh=5HFNPBt2aNYJaKhYy+WdD/MHi227nST+OKDYDJYGsZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=t5Vj1UawwixACsmTZlHpY3DxU2YGYDrdoC0G+qdSHjG+kdDg82qiFBw7+SpndjRHO cAeWA8fNIkLJEbCSg/1H1RFwxyW5fCtzgcBhXqiCanwx35hYfQ6KHVMw98mKWMYPOK rWvOBIPX0BsJsaIwDEyeLs27zzIropT/oQrLROhs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniel Machon , Jakub Kicinski , Sasha Levin Subject: [PATCH 7.3 2503/2651] net: microchip: fdma: fix DCB corruption under sustained load Date: Wed, 18 Nov 2026 16:02:23 +0100 Message-ID: <20261118150414.897687683@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150247.972732815@linuxfoundation.org> References: <20261118150247.972732815@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Machon [ Upstream commit 573a6d4c7a21e34d7a2174b8d3c7ca67a5e850b6 ] __fdma_dcb_add() prepares a DCB and links it into a channel's chain by writing its address to the NEXT_PTR of the current last DCB. The FDMA may be processing the chain while this happens. Before this patch, the link is written before the new DCB's own nextptr and info fields, so the FDMA can follow it to a DCB that hasn't been fully prepared yet. Under sustained load this stalls the FDMA. Prepare the new DCB fully before linking it, and update the previous DCB's NEXT_PTR using the two-step sequence from the datasheet (poison the LSB and flush, then clear it) so the FDMA never observes a partially-updated pointer. Reported by a customer running iperf3 --bidir against a lan969x board. Reproduced on lan969x with iperf3, throughput collapsing to zero: [ 5] 1.00-2.00 sec 73.9 MBytes 620 Mbits/sec 0 305 KBytes [ 5] 2.00-3.00 sec 73.9 MBytes 620 Mbits/sec 0 305 KBytes [ 5] 3.00-4.00 sec 13.9 MBytes 116 Mbits/sec 2 1.41 KBytes [ 5] 4.00-5.00 sec 0.00 Bytes 0.00 bits/sec 1 1.41 KBytes [ 5] 5.00-6.00 sec 0.00 Bytes 0.00 bits/sec 0 1.41 KBytes [ 5] 6.00-7.00 sec 0.00 Bytes 0.00 bits/sec 1 1.41 KBytes The race is timing-dependent: across three reproductions the stall appeared anywhere from ~400s to ~3000s into the run. Fixes: 30e48a75df9c ("net: microchip: add FDMA library") Signed-off-by: Daniel Machon Link: https://patch.msgid.link/20261026-microchip-fdma-dcb-corruption-v1-1-36dab6caca07@microchip.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- .../net/ethernet/microchip/fdma/fdma_api.c | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/microchip/fdma/fdma_api.c b/drivers/net/ethernet/microchip/fdma/fdma_api.c index 6dfe36f58d67a..a85dcb492829d 100644 --- a/drivers/net/ethernet/microchip/fdma/fdma_api.c +++ b/drivers/net/ethernet/microchip/fdma/fdma_api.c @@ -43,9 +43,19 @@ int __fdma_dcb_add(struct fdma *fdma, int dcb_idx, u64 info, u64 status, u64 *dataptr)) { struct fdma_dcb *dcb = fdma_dcb_get(fdma, dcb_idx); + struct fdma_dcb *prev = fdma->last_dcb; u64 nextptr; int i, err; + /* Per the FDMA datasheet, adding a DCB to an active channel takes + * three steps: + * 1) Write NEXT_PTR of the current last DCB with the LSB forced to + * FDMA_DCB_INVALID_DATA, and flush that write. + * 2) Clear the LSB to complete the link. + * 3) Reload the channel (FDMA_CH_RELOAD); this is done by the caller + * once the chain has been extended. + */ + for (i = 0; i < fdma->n_dbs; i++) { err = __fdma_db_add(fdma, dcb_idx, i, status, db_cb); if (unlikely(err)) @@ -56,13 +66,25 @@ int __fdma_dcb_add(struct fdma *fdma, int dcb_idx, u64 info, u64 status, if (unlikely(err)) return err; - fdma->last_dcb->nextptr = cpu_to_le64(nextptr); - - fdma->last_dcb = dcb; - dcb->nextptr = cpu_to_le64(FDMA_DCB_INVALID_DATA); dcb->info = cpu_to_le64(info); + /* On the first DCB of fdma_dcbs_init() prev is the DCB itself; + * don't link it to itself. + */ + if (prev != dcb) { + /* Write NEXT_PTR of the current last DCB with the LSB forced + * to FDMA_DCB_INVALID_DATA, and flush that write. + */ + prev->nextptr = cpu_to_le64(nextptr | FDMA_DCB_INVALID_DATA); + dma_wmb(); + + /* Clear the LSB to complete the link. */ + prev->nextptr = cpu_to_le64(nextptr); + } + + fdma->last_dcb = dcb; + return 0; } EXPORT_SYMBOL_GPL(__fdma_dcb_add); -- 2.53.0