aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Salychev <dsl@FreeBSD.org>2026-03-28 18:57:45 +0000
committerDmitry Salychev <dsl@FreeBSD.org>2026-03-29 18:23:51 +0000
commit968164eb650fd986f293512a3faac5c1c9e4d51f (patch)
treebd7ace71abc076f55047f5dd2e47c39670e7326d
parent0d9676e1ca92febd42fbebef8d6833a0939d3f7c (diff)
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: ... Tested by: dsl@ Differential Revision: <https://reviews.freebsd.org/D###> MFC after: 3 days
-rw-r--r--sys/dev/dpaa2/dpaa2_ni.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/dpaa2/dpaa2_ni.c b/sys/dev/dpaa2/dpaa2_ni.c
index c72e68b8a62f..49e72c8ee14f 100644
--- a/sys/dev/dpaa2/dpaa2_ni.c
+++ b/sys/dev/dpaa2/dpaa2_ni.c
@@ -3004,6 +3004,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 */
@@ -3013,9 +3016,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++;
if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);