IFLIB(4)
bestie, you've landed on IFLIB(4), straight out of the Kernel Interfaces Manual π grab a snack, this one's a whole framework
πΈ NAME πΈ
iflib β Network Interface Driver Framework
β¨ SYNOPSIS β¨
device pci
device iflib
π¦ DESCRIPTION π¦
So iflib is the framework that network interface drivers for FreeBSD get to live inside, and honestly? It's a gift. It exists to delete a huge chunk of the boilerplate that basically every modern network interface device needs, which means driver authors get to put their whole entire brain on the code that's actually specific to their hardware instead of re-typing the same scaffolding forever. π
And the glow-up doesn't stop there: because everybody's using the framework, everyone shares one set of sysctl(8) names instead of each driver inventing its own. iconic, no cap π
π SYSCTL VARIABLES π
Heads up bestie: these ones have to be set before you load the driver β either through loader.conf(5) or by using kenv(1). And they're all prefixed with dev.X.Y.iflib. where X is the driver name and Y is the instance number. Keep that in your notes π
override_nrxdsβ overrides how many RX descriptors each queue gets. The value is a comma separated list of positive integers β some drivers only use a single value, but others may use more. These numbers must be powers of two, and0means "just use the default." Individual drivers may have additional restrictions on what values are allowed. Defaults to all zeros.override_ntxdsβ same deal but for the number of TX descriptors per queue. Comma separated list of positive integers; some drivers use one value, others use more; must be powers of two;0means use the default. Individual drivers may have additional restrictions on allowable values. Defaults to all zeros.override_qs_enableβ when this is set, the number of transmit queues and receive queues are allowed to be different. If it's not set, the lower of the number of TX or RX queues gets used for both. so it's giving β¨compromiseβ¨override_nrxqsβ sets the number of RX queues. If it's0, the number of RX queues is derived from the number of cores on the socket connected to the controller. Defaults to0.override_ntxqsβ sets the number of TX queues. If it's0, the number of TX queues is derived from the number of cores on the socket connected to the controller.disable_msixβ disables MSI-X interrupts for the device. that's it, that's the whole thing πcore_offsetβ specifies a starting core offset to assign queues to. If the value is unspecified, or if it's65535, cores get assigned sequentially across controllers.separate_txrxβ requests that RX and TX queues not be paired on the same core. If it's zero or not set, one RX and TX queue pair gets assigned to each core. When it's set to a non-zero value, TX queues are assigned to cores following the last RX queue.
π these sysctl(8) variables can be changed at any time
tx_abdicateβ controls how the transmit ring is serviced. If set to zero, then when a frame is submitted to the transmission ring, the same task that's submitting it will service the ring β unless there's already a task servicing the TX ring. This is what makes sure that whenever there's a pending transmission, the transmit ring is being serviced, and it results in higher transmit throughput. If set to a non-zero value, the task returns immediately and the transmit ring gets serviced by a different task. That hands control back to the caller faster, and under high receive load it may result in fewer dropped RX frames.rx_budgetβ sets the max number of frames that get received at a time. Zero (which is the default) means the default (currently16) should be used.
π global sysctls, they change vibes for all drivers
These affect the behaviour for every driver, and they may be changed at any time.
net.iflib.min_tx_latencyβ if this is set to a non-zero value,iflibwill avoid any attempt to combine multiple transmits, and it notifies the hardware as quickly as possible about new descriptors. This lowers the maximum throughput, but it also lowers transmit latency. tradeoffs, we love them πnet.iflib.no_tx_batchβ some NICs allow processing completed transmit descriptors in batches. Doing that usually increases transmit throughput by reducing the number of transmit interrupts. Setting this to a non-zero value disables the use of this feature.
β read-only sysctl(8) variables
driver_versionβ a string indicating the internal version of the driver. look but don't touch π«Ά
π queue state sysctl(8) variables
There are a whole bunch of these too, bestie:
txqZβ the following are repeated for each transmit queue, whereZis the transmit queue instance number:r_abdicationsβ number of consumer abdications in the MP ring for this queue. An abdication occurs on every ring submission whentx_abdicateis true.r_restartsβ number of consumer restarts in the MP ring for this queue. A restart occurs when an attempt to drain a non-empty ring fails, and the ring is already in theSTALLEDstate.r_stallsβ number of consumer stalls in the MP ring for this queue. A stall occurs when an attempt to drain a non-empty ring fails.r_startsβ number of normal consumer starts in the MP ring for this queue. A start occurs when the MP ring transitions fromIDLEtoBUSY.r_dropsβ number of drops in the MP ring for this queue. A drop occurs when there's an attempt to add an entry to an MP ring that has no available space.r_enqueuesβ number of entries which have been enqueued to the MP ring for this queue.ring_stateβ MP (soft) ring state. This provides a snapshot of the current MP ring state, including the producer head and tail indexes, the consumer index, and the state. The state is one of"IDLE","BUSY","STALLED", or"ABDICATED".txq_cleanedβ the number of transmit descriptors which have been reclaimed. Total cleaned.txq_processedβ the number of transmit descriptors which have been processed, but may not yet have been reclaimed.txq_in_useβ descriptors which have been added to the transmit queue, but have not yet been cleaned. This value will include both untransmitted descriptors as well as descriptors which have been processed.txq_cidx_processedβ the transmit queue consumer index of the next descriptor to process.txq_cidxβ the transmit queue consumer index of the oldest descriptor to reclaim.txq_pidxβ the transmit queue producer index where the next descriptor to transmit will be inserted.no_tx_dma_setupβ number of times DMA mapping a transmit mbuf failed for reasons other thanEFBIG.txd_encap_efbigβ number of times DMA mapping a transmit mbuf failed due to requiring too many segments.tx_map_failedβ number of times DMA mapping a transmit mbuf failed for any reason (sum ofno_tx_dma_setupandtxd_encap_efbig)no_desc_availβ number of times a descriptor couldn't be added to the transmit ring because the transmit ring was full.mbuf_defrag_failedβ number of times bothm_collapse(9)andm_defrag(9)failed after anEFBIGerror result from DMA mapping a transmit mbuf.m_pullupsβ number of timesm_pullup(9)was called attempting to parse a header.mbuf_defragβ number of timesm_defrag(9)was called.
rxqZβ the following are repeated for each receive queue, whereZis the receive queue instance number:rxq_fl0.creditsβ credits currently available in the receive ring.rxq_fl0.cidxβ current receive ring consumer index.rxq_fl0.pidxβ current receive ring producer index.
π§ psst β additional OIDs that are useful for driver andiflibdevelopment get exposed when theINVARIANTSand/orWITNESSoptions are enabled in the kernel. freebies, but only for the devs β¨
π₯ SEE ALSO π₯
π HISTORY π
This framework was introduced in FreeBSD 11.0. baby framework, all grown up now π₯Ή
and that's the whole page, bestie!! this one comes to you from Debian, dated September 27, 2018 π go forth and configure your queues responsibly, ily ππ¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms