1.Dd September 27, 2018 2.Dt IFLIB 4 3.Os 4.Sh NAME 5.Nm iflib 6.Nd Network Interface Driver Framework 7.Sh SYNOPSIS 8.Cd "device pci" 9.Cd "device iflib" 10.Sh DESCRIPTION 11.Nm 12is a framework for network interface drivers for 13.Fx . 14It is designed to remove a large amount of the boilerplate that is often 15needed for modern network interface devices, allowing driver authors to 16focus on the specific code needed for their hardware. 17This allows for a shared set of 18.Xr sysctl 8 19names, rather than each driver naming them individually. 20.Sh SYSCTL VARIABLES 21These variables must be set before loading the driver, either via 22.Xr loader.conf 5 23or through the use of 24.Xr kenv 1 . 25They are all prefixed by 26.Va dev.X.Y.iflib\&. 27where X is the driver name, and Y is the instance number. 28.Bl -tag -width indent 29.It Va override_nrxds 30Override the number of RX descriptors for each queue. 31The value is a comma separated list of positive integers. 32Some drivers only use a single value, but others may use more. 33These numbers must be powers of two, and zero means to use the default. 34Individual drivers may have additional restrictions on allowable values. 35Defaults to all zeros. 36.It Va override_ntxds 37Override the number of TX descriptors for each queue. 38The value is a comma separated list of positive integers. 39Some drivers only use a single value, but others may use more. 40These numbers must be powers of two, and zero means to use the default. 41Individual drivers may have additional restrictions on allowable values. 42Defaults to all zeros. 43.It Va override_qs_enable 44When set, allows the number of transmit and receive queues to be different. 45If not set, the lower of the number of TX or RX queues will be used for both. 46.It Va override_nrxqs 47Set the number of RX queues. 48If zero, the number of RX queues is derived from the number of cores on the 49socket connected to the controller. 50Defaults to 0. 51.It Va override_ntxqs 52Set the number of TX queues. 53If zero, the number of TX queues is derived from the number of cores on the 54socket connected to the controller. 55.It Va disable_msix 56Disables MSI-X interrupts for the device. 57.It Va core_offset 58Specifies a starting core offset to assign queues to. 59If the value is unspecified or 65535, cores are assigned sequentially across 60controllers. 61.It Va separate_txrx 62Requests that RX and TX queues not be paired on the same core. 63If this is zero or not set, an RX and TX queue pair will be assigned to each 64core. 65When set to a non-zero value, TX queues are assigned to cores following the 66last RX queue. 67.El 68.Pp 69These 70.Xr sysctl 8 71variables can be changed at any time: 72.Bl -tag -width indent 73.It Va tx_abdicate 74Controls how the transmit ring is serviced. 75If set to zero, when a frame is submitted to the transmission ring, the same 76task that is submitting it will service the ring unless there's already a 77task servicing the TX ring. 78This ensures that whenever there is a pending transmission, 79the transmit ring is being serviced. 80This results in higher transmit throughput. 81If set to a non-zero value, task returns immediately and the transmit 82ring is serviced by a different task. 83This returns control to the caller faster and under high receive load, 84may result in fewer dropped RX frames. 85.It Va rx_budget 86Sets the maximum number of frames to be received at a time. 87Zero (the default) indicates the default (currently 16) should be used. 88.El 89.Pp 90There are also some global sysctls which can change behaviour for all drivers, 91and may be changed at any time. 92.Bl -tag -width indent 93.It Va net.iflib.min_tx_latency 94If this is set to a non-zero value, iflib will avoid any attempt to combine 95multiple transmits, and notify the hardware as quickly as possible of 96new descriptors. 97This will lower the maximum throughput, but will also lower transmit latency. 98.It Va net.iflib.no_tx_batch 99Some NICs allow processing completed transmit descriptors in batches. 100Doing so usually increases the transmit throughput by reducing the number of 101transmit interrupts. 102Setting this to a non-zero value will disable the use of this feature. 103.El 104.Pp 105These 106.Xr sysctl 8 107variables are read-only: 108.Bl -tag -width indent 109.It Va driver_version 110A string indicating the internal version of the driver. 111.El 112.Pp 113There are a number of queue state 114.Xr sysctl 8 115variables as well: 116.Bl -tag -width indent 117.It Va txqZ 118The following are repeated for each transmit queue, where Z is the transmit 119queue instance number: 120.Bl -tag -width indent 121.It Va r_abdications 122Number of consumer abdications in the MP ring for this queue. 123An abdication occurs on every ring submission when tx_abdicate is true. 124.It Va r_restarts 125Number of consumer restarts in the MP ring for this queue. 126A restart occurs when an attempt to drain a non-empty ring fails, 127and the ring is already in the STALLED state. 128.It Va r_stalls 129Number of consumer stalls in the MP ring for this queue. 130A stall occurs when an attempt to drain a non-empty ring fails. 131.It Va r_starts 132Number of normal consumer starts in the MP ring for this queue. 133A start occurs when the MP ring transitions from IDLE to BUSY. 134.It Va r_drops 135Number of drops in the MP ring for this queue. 136A drop occurs when there is an attempt to add an entry to an MP ring with 137no available space. 138.It Va r_enqueues 139Number of entries which have been enqueued to the MP ring for this queue. 140.It Va ring_state 141MP (soft) ring state. 142This provides a snapshot of the current MP ring state, including the producer 143head and tail indexes, the consumer index, and the state. 144The state is one of "IDLE", "BUSY", 145"STALLED", or "ABDICATED". 146.It Va txq_cleaned 147The number of transmit descriptors which have been reclaimed. 148Total cleaned. 149.It Va txq_processed 150The number of transmit descriptors which have been processed, but may not yet 151have been reclaimed. 152.It Va txq_in_use 153Descriptors which have been added to the transmit queue, 154but have not yet been cleaned. 155This value will include both untransmitted descriptors as well as descriptors 156which have been processed. 157.It Va txq_cidx_processed 158The transmit queue consumer index of the next descriptor to process. 159.It Va txq_cidx 160The transmit queue consumer index of the oldest descriptor to reclaim. 161.It Va txq_pidx 162The transmit queue producer index where the next descriptor to transmit will 163be inserted. 164.It Va no_tx_dma_setup 165Number of times DMA mapping a transmit mbuf failed for reasons other than 166.Er EFBIG . 167.It Va txd_encap_efbig 168Number of times DMA mapping a transmit mbuf failed due to requiring too many 169segments. 170.It Va tx_map_failed 171Number of times DMA mapping a transmit mbuf failed for any reason 172(sum of no_tx_dma_setup and txd_encap_efbig) 173.It Va no_desc_avail 174Number of times a descriptor couldn't be added to the transmit ring because 175the transmit ring was full. 176.It Va mbuf_defrag_failed 177Number of times both 178.Xr m_collapse 9 179and 180.Xr m_defrag 9 181failed after an 182.Er EFBIG 183error 184result from DMA mapping a transmit mbuf. 185.It Va m_pullups 186Number of times 187.Xr m_pullup 9 188was called attempting to parse a header. 189.It Va mbuf_defrag 190Number of times 191.Xr m_defrag 9 192was called. 193.El 194.It Va rxqZ 195The following are repeated for each receive queue, where Z is the 196receive queue instance number: 197.Bl -tag -width indent 198.It Va rxq_fl0.credits 199Credits currently available in the receive ring. 200.It Va rxq_fl0.cidx 201Current receive ring consumer index. 202.It Va rxq_fl0.pidx 203Current receive ring producer index. 204.El 205.El 206.Pp 207Additional OIDs useful for driver and iflib development are exposed when the 208INVARIANTS and/or WITNESS options are enabled in the kernel. 209.Sh SEE ALSO 210.Xr iflib 9 211.Sh HISTORY 212This framework was introduced in 213.Fx 11.0 . 214