aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2024-06-27 17:26:54 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2024-07-04 13:31:54 +0000
commit8daa60945080c602f2a65ed2a0f2333c15bd947e (patch)
treeaf68d4d9a8e0d28d1bda410744fbb5ba8b2f561a
parent08b083932c6f4193ba108739fea1d2ce0619f10e (diff)
downloadsrc-8daa60945080c602f2a65ed2a0f2333c15bd947e.tar.gz
src-8daa60945080c602f2a65ed2a0f2333c15bd947e.zip
if_genet: don't load DMA mapping when tx_queue is full
gen_encap() always calls bus_dmamap_load_mbuf_sg() into 'map' (which is the current tx_queue). If the tx_queue is full, it will load with a 'map' that already has a currently active mapping. This violates the busdma(9) KPI. Checking for a full queue and returning ENOBUFS will allow gen_start_locked() to set the IFF_DRV_OACTIVE faster without having to needlessly check if the mbuf will fit (it won't). PR: 256482 Reviewed by: mhorne MFC after: 1 week Submitted by: ghuckriede@blackberry.com (cherry picked from commit a35f66510917f5ac21c11e9642174cda7718fbc6)
-rw-r--r--sys/arm64/broadcom/genet/if_genet.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c
index 40fc096208c6..8fb46a7552f1 100644
--- a/sys/arm64/broadcom/genet/if_genet.c
+++ b/sys/arm64/broadcom/genet/if_genet.c
@@ -1070,6 +1070,10 @@ gen_encap(struct gen_softc *sc, struct mbuf **mp)
GEN_ASSERT_LOCKED(sc);
q = &sc->tx_queue[DEF_TXQUEUE];
+ if (q->queued == q->nentries) {
+ /* tx_queue is full */
+ return (ENOBUFS);
+ }
m = *mp;