Page MenuHomeFreeBSD

Change iflib(4) to employ the usual convention of "descriptor"

Authored by marius on Feb 2 2019, 7:44 PM.
Referenced Files
Unknown Object (File)
Sun, May 28, 12:46 PM
Unknown Object (File)
Wed, May 24, 6:08 PM
Unknown Object (File)
May 8 2023, 11:08 PM
Unknown Object (File)
May 7 2023, 12:53 AM
Unknown Object (File)
May 3 2023, 1:22 AM
Unknown Object (File)
Apr 22 2023, 10:41 AM
Unknown Object (File)
Apr 10 2023, 1:42 AM
Unknown Object (File)
Feb 13 2023, 12:07 PM


  • As illustrated by e. g. figure 7-14 of the Intel 82599 10 GbE controller datasheet revision 3.3, in the context of Ethernet MACs the control data describing the packet buffers typically are named "descriptors". Each of these descriptors references one buffer, multiple of which a packet can be composed of. By contrast, in comments, messages and the names of structure members, iflib(4) refers to DMA resources employed for RX and TX buffers (rather than control data) as "descriptors". This odd naming convention of iflib(4) made reviewing r343085 and identifying wrong and missing bus_dmamap_sync(9) calls in particular way harder than it already is. This convention may also explain why the netmap(4) part of iflib(4) pairs the DMA tags for control data with DMA maps of buffers and vice versa in calls to bus_dma(9) functions. Therefore, change iflib(4) to refer to buf(fers) when buffers and not the usual understanding of descriptors is meant. This change does not include corrections to the DMA resources used in the netmap(4) parts. However, it revises error messages to state which kind of allocation/creation failed. Specifically, the "Unable to allocate tx_buffer (map) memory" copy & pasted inappropriately on several occasions was replaced with proper messages.
  • Enhance some other error messages to indicate which half - RX or TX - they apply to instead of using identical text in both cases and generally canonicalize them.
  • Correct the descriptions of iflib_{r,t}xsd_alloc() to reflect reality; current code doesn't use {r,t}x_buffer structures.
  • In iflib_queues_alloc():
    • Remove redundant BUS_DMA_NOWAIT of iflib_dma_alloc() calls,
    • change the M_NOWAIT from malloc(9) calls into M_NOWAIT. The return values are already checked, deferred DMA allocations not being an option at this point, BUS_DMA_NOWAIT has to be used anyway and prior malloc(9) calls in this function also specify M_NOWAIT.

Diff Detail

rS FreeBSD src repository - subversion
Lint Not Applicable
Tests Not Applicable

Event Timeline

Fixed a typo (RX vs. TX) in one of the messages altered by the previous patch

I love everything about this. If you plan to use the summary as the commit message though you should modify "change the M_NOWAIT from malloc(9) calls into M_NOWAIT." bit to mention M_WAITOK.

This revision is now accepted and ready to land.Feb 4 2019, 8:18 PM
This revision was automatically updated to reflect the committed changes.