Bug 256482 - [genet] gen_encap() dma loads into active map when 'tx_queue' is full
Summary: [genet] gen_encap() dma loads into active map when 'tx_queue' is full
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-08 14:48 UTC by ghuckriede
Modified: 2024-06-04 18:51 UTC (History)
3 users (show)

See Also:


Attachments
Potential Fix (648 bytes, patch)
2021-06-08 14:48 UTC, ghuckriede
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ghuckriede 2021-06-08 14:48:32 UTC
Created attachment 225638 [details]
Potential Fix

In gen_encap() #n1053 it 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.

https://www.freebsd.org/cgi/man.cgi?query=busdma&sektion=9
bus_dmamap_load: "map     A DMA map without a currently active mapping."

Also "(if nsegs == 0)" #n1077 shouldn't bus_dmamap_unload() be called as bus_dmamap_load_mbuf_sq() was successful?

See https://cgit.freebsd.org/src/tree/sys/arm64/broadcom/genet/if_genet.c?id=f66a1f40740c63741b6ebe48cb0cbce9e52ef34e for line number references.

Attached is diff with a potential fix.

Checking for a full queue and returning ENOMEM 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).