IFLIB(4)
πΈ NAME πΈ
iflib β Network Interface Driver Framework. Bestie, this is the iflib(4) page from the Kernel Interfaces Manual, and it's lowkey the framework that makes NIC drivers way less of a whole thing. π
β¨ SYNOPSIS β¨
device pci
device iflib
π DESCRIPTION π
iflib is a framework for network interface drivers for FreeBSD. It's designed to remove a large amount of the boilerplate that is often needed for modern network interface devices, allowing driver authors to focus on the specific code needed for their hardware. This allows for a shared set of sysctl(8) names, rather than each driver naming them individually. Slay, honestly. β¨
π SYSCTL VARIABLES π
These variables must be set before loading the driver β either via loader.conf(5) or through the use of kenv(1). They are all prefixed by dev.X.Y.iflib. where X is the driver name, and Y is the instance number.
Set them early, bestie! This first batch is not the "change it whenever" kind.
override_nrxdsβ Override the number of RX descriptors for each queue. 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, and zero means to use the default. Individual drivers may have additional restrictions on allowable values. Defaults to all zeros.override_ntxdsβ Override the number of TX descriptors for each queue. 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, and zero means to use the default. Individual drivers may have additional restrictions on allowable values. Defaults to all zeros.override_qs_enableβ When set, allows the number of transmit and receive queues to be different. If not set, the lower of the number of TX or RX queues will be used for both.override_nrxqsβ Set the number of RX queues. If zero, the number of RX queues is derived from the number of cores on the socket connected to the controller. Defaults to0.override_ntxqsβ Set the number of TX queues. If zero, 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.core_offsetβ Specifies a starting core offset to assign queues to. If the value is unspecified or65535, cores are assigned sequentially across controllers.separate_txrxβ Requests that RX and TX queues not be paired on the same core. If this is zero or not set, an RX and TX queue pair will be assigned to each core. When set to a non-zero value, TX queues are assigned to cores following the last RX queue.simple_txβ When set to one,iflibuses a simple transmit routine with no queuing at all. By default,iflibuses a highly optimized, lockless, transmit queue calledmp_ring. This performs well when there are more CPU cores than NIC queues and prevents lock contention for transmit resources. Unfortunately,mp_ringincurs unneeded overheads on workloads where resource contention is not a problem (well behaved applications on systems where there are as many NIC queues as CPU cores). Note that when this is enabled, thetx_abdicatesysctl is no longer applicable and is ignored. Defaults to zero.
These sysctl(8) variables can be changed at any time:
tx_abdicateβ Controls how the transmit ring is serviced. If set to zero, when a frame is submitted to the transmission ring, the same task that is submitting it will service the ring unless there's already a task servicing the TX ring. This ensures that whenever there is a pending transmission, the transmit ring is being serviced. This results in higher transmit throughput. If set to a non-zero value, task returns immediately and the transmit ring is serviced by a different task. This returns control to the caller faster and under high receive load, may result in fewer dropped RX frames.tx_reclaim_threshβ Controls the threshold in packets beforeiflibwill ask the driver how many transmitted packets can be reclaimed. Determining how many packets can be reclaimed can be expensive on some drivers.tx_reclaim_ticksβ Controls the time in ticks beforeiflibwill ask the driver how many transmitted packets can be reclaimed. Determining how many packets can be reclaimed can be expensive on some drivers.rx_budgetβ Sets the maximum number of frames to be received at a time. Zero (the default) indicates the default (currently16) should be used.
There are also some global sysctls which can change behaviour for all drivers, and may be changed at any time. Global vibes only.
net.iflib.min_tx_latencyβ If this is set to a non-zero value,iflibwill avoid any attempt to combine multiple transmits, and notify the hardware as quickly as possible of new descriptors. This will lower the maximum throughput, but will also lower transmit latency.net.iflib.no_tx_batchβ Some NICs allow processing completed transmit descriptors in batches. Doing so usually increases the transmit throughput by reducing the number of transmit interrupts. Setting this to a non-zero value will disable the use of this feature.
These sysctl(8) variables are read-only: look, don't touch.
driver_versionβ A string indicating the internal version of the driver.
There are a number of queue state sysctl(8) variables as well:
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 the STALLED state.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 from IDLE to BUSY.r_dropsβ Number of drops in the MP ring for this queue. A drop occurs when there is an attempt to add an entry to an MP ring with 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 than EFBIG.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 an EFBIG error 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.
Additional OIDs useful for driver and iflib development are exposed when the INVARIANTS and/or WITNESS options are enabled in the kernel. iykyk π
π¦ SEE ALSO π¦
π HISTORY π
This framework was introduced in FreeBSD 11.0. Iconic since day one.
xoxo, your Debian bestie π β source/version: Debian, dated August 20, 2025. Periodt. π«Ά
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms