| Summary: | [genet] gen_encap() dma loads into active map when 'tx_queue' is full | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | ghuckriede | ||||
| Component: | arm | Assignee: | Mitchell Horne <mhorne> | ||||
| Status: | In Progress --- | ||||||
| Severity: | Affects Only Me | CC: | grahamperrin, markj, mhorne, tod.jackson | ||||
| Priority: | --- | ||||||
| Version: | CURRENT | ||||||
| Hardware: | arm64 | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
ghuckriede
2021-06-08 14:48:32 UTC
A commit in branch main references this bug: 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(+) Hi, thanks for the submission. I considered the part about calling bus_dmamap_unload(). This seems to be a grey area of the busdma API, but the majority of other ethernet drivers following this pattern do not call bus_dmamap_unload() when nsegs == 0. Looking at the busdma implementations, it is not clear when it is possible to return 0 with nsegs == 0; most paths will return some kind of error. The most likely meaning of this scenario (nsegs == 0) is that the call was successful but nothing was actually mapped. Therefore the call to bus_dmamap_unload() is unnecessary. |