git: a35f66510917 - main - if_genet: don't load DMA mapping when tx_queue is full
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 27 Jun 2024 17:44:56 UTC
The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a35f66510917f5ac21c11e9642174cda7718fbc6 commit a35f66510917f5ac21c11e9642174cda7718fbc6 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2024-06-27 17:26:54 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2024-06-27 17:44:36 +0000 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 --- sys/arm64/broadcom/genet/if_genet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index e102b6c3a95f..ccc35fe841df 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -1069,6 +1069,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;