Page MenuHomeFreeBSD

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

Authored by marius on Feb 2 2019, 7:44 PM.

Details

Summary
  • 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

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 22340

Event Timeline

marius created this revision.Feb 2 2019, 7:44 PM
marius edited the summary of this revision. (Show Details)Feb 2 2019, 7:47 PM
marius updated this revision to Diff 53578.Feb 4 2019, 2:00 PM

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

shurd accepted this revision.Feb 4 2019, 8:18 PM

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.