git: 26b27a828803 - stable/15 - dpaa2: Perform bus_dma pre-write sync before enqueue operation

From: Dmitry Salychev <dsl_at_FreeBSD.org>
Date: Sat, 04 Apr 2026 09:35:24 UTC
The branch stable/15 has been updated by dsl:

URL: https://cgit.FreeBSD.org/src/commit/?id=26b27a82880347828205700a5d54a0516a3f15b1

commit 26b27a82880347828205700a5d54a0516a3f15b1
Author:     Dmitry Salychev <dsl@FreeBSD.org>
AuthorDate: 2026-03-28 18:57:45 +0000
Commit:     Dmitry Salychev <dsl@FreeBSD.org>
CommitDate: 2026-04-04 09:28:09 +0000

    dpaa2: Perform bus_dma pre-write sync before enqueue operation
    
    Without a proper synchronization payload of the egress TCP segments
    can be corrupted as tuexen@ described in
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292006#c31.
    
    This patch is indirectly related to 292006 because a properly enabled
    and announced support for the TX checksum offloading hides potentially
    corrupted frame payload.
    
    PR:             292006
    Reported by:    tuexen@
    Reviewed by:    tuexen@
    Tested by:      dsl@, tuexen@
    Differential Revision:  https://reviews.freebsd.org/D56144
    MFC after:      3 days
    
    (cherry picked from commit 5812415bee55a9063508b02fda9418b0eadb0bb4)
---
 sys/dev/dpaa2/dpaa2_ni.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/dpaa2/dpaa2_ni.c b/sys/dev/dpaa2/dpaa2_ni.c
index 98a6c6047188..9389c6fff31a 100644
--- a/sys/dev/dpaa2/dpaa2_ni.c
+++ b/sys/dev/dpaa2/dpaa2_ni.c
@@ -3006,6 +3006,9 @@ dpaa2_ni_tx(struct dpaa2_ni_softc *sc, struct dpaa2_channel *ch,
 		goto err_unload;
 	}
 
+	bus_dmamap_sync(buf->dmat, buf->dmap, BUS_DMASYNC_PREWRITE);
+	bus_dmamap_sync(sgt->dmat, sgt->dmap, BUS_DMASYNC_PREWRITE);
+
 	/* TODO: Enqueue several frames in a single command */
 	for (int i = 0; i < DPAA2_NI_ENQUEUE_RETRIES; i++) {
 		/* TODO: Return error codes instead of # of frames */
@@ -3015,9 +3018,6 @@ dpaa2_ni_tx(struct dpaa2_ni_softc *sc, struct dpaa2_channel *ch,
 		}
 	}
 
-	bus_dmamap_sync(buf->dmat, buf->dmap, BUS_DMASYNC_PREWRITE);
-	bus_dmamap_sync(sgt->dmat, sgt->dmap, BUS_DMASYNC_PREWRITE);
-
 	if (rc != 1) {
 		fq->chan->tx_dropped++;
 		goto err_unload;