1.\" Copyright (c) 2011 Bryan Venteicher 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.Dd September 4, 2025 26.Dt VTNET 4 27.Os 28.Sh NAME 29.Nm vtnet 30.Nd VirtIO Ethernet driver 31.Sh SYNOPSIS 32To compile this driver into the kernel, 33place the following lines in your 34kernel configuration file: 35.Bd -ragged -offset indent 36.Cd "device vtnet" 37.Ed 38.Pp 39Alternatively, to load the driver as a 40module at boot time, place the following line in 41.Xr loader.conf 5 : 42.Bd -literal -offset indent 43if_vtnet_load="YES" 44.Ed 45.Sh DESCRIPTION 46The 47.Nm 48device driver provides support for VirtIO Ethernet devices. 49.Pp 50If the hypervisor advertises the appropriate features, the 51.Nm 52driver supports TCP/UDP checksum offload for both transmit and receive, 53TCP segmentation offload (TSO), TCP large receive offload (LRO), 54hardware VLAN tag stripping/insertion features, a multicast hash filter, 55as well as Jumbo Frames (up to 9216 bytes), which can be 56configured via the interface MTU setting. 57Selecting an MTU larger than 1500 bytes with the 58.Xr ifconfig 8 59utility configures the adapter to receive and transmit Jumbo Frames. 60.Pp 61For more information on configuring this device, see 62.Xr ifconfig 8 . 63.Sh LOADER TUNABLES 64Tunables can be set at the 65.Xr loader 8 66prompt before booting the kernel or stored in 67.Xr loader.conf 5 . 68.Bl -tag -width "xxxxxx" 69.It Va hw.vtnet.csum_disable 70.It Va hw.vtnet. Ns Ar X Ns Va .csum_disable 71This tunable disables receive and transmit checksum offloading for TCP and 72UDP. 73This also implies that TCP segmentation offloading and large receive offload 74are disabled. 75The default value is 0. 76.It Va hw.vtnet.fixup_needs_csum 77.It Va hw.vtnet. Ns Ar X Ns Va .fixup_needs_csum 78This tunable enforces the calculation of a valid TCP or UDP checksum for 79packets received with 80.Dv VIRTIO_NET_HDR_F_NEEDS_CSUM 81being set in the 82.Va flags 83field of the structure 84.Vt struct virtio_net_hdr . 85It also marks the checksum as being correct in the mbuf packet header. 86The default value is 0. 87.It Va hw.vtnet.tso_disable 88.It Va hw.vtnet. Ns Ar X Ns Va .tso_disable 89This tunable disables TCP segmentation offloading. 90The default value is 0. 91.It Va hw.vtnet.lro_disable 92.It Va hw.vtnet. Ns Ar X Ns Va .lro_disable 93This tunable disables large receive offload. 94The default value is 0. 95.It Va hw.vtnet.mq_disable 96.It Va hw.vtnet. Ns Ar X Ns Va .mq_disable 97This tunable disables multiqueue. 98The default value is 0. 99.It Va hw.vtnet.mq_max_pairs 100.It Va hw.vtnet. Ns Ar X Ns Va .mq_max_pairs 101This tunable sets the maximum number of transmit and receive queue pairs. 102Multiple queues are only supported when the Multiqueue feature is negotiated. 103This driver supports a maximum of 8 queue pairs. 104The number of queue pairs used is the lesser of the maximum supported by the 105driver and the hypervisor, the number of CPUs present in the guest, and this 106tunable if not zero. 107The default value is 0. 108.It Va hw.vtnet.tso_maxlen 109.It Va hw.vtnet. Ns Ar X Ns Va .tso_maxlen 110This tunable sets the TSO burst limit. 111The default value is 65535. 112.It Va hw.vtnet.rx_process_limit 113.It Va hw.vtnet. Ns Ar X Ns Va .rx_process_limit 114This tunable sets the number of RX segments processed in one pass. 115The default value is 1024. 116.It Va hw.vtnet.lro_entry_count 117.It Va hw.vtnet. Ns Ar X Ns Va .lro_entry_count 118This tunable sets the software LRO entry count. 119The default value is 128, the minimum value is 8. 120.It Va hw.vtnet.lro_mbufq_depth 121.It Va hw.vtnet. Ns Ar X Ns Va .lro_mbufq_depth 122This tunable sets the depth of the software LRO mbuf queue. 123The default value is 0. 124.It Va hw.vtnet.altq_disable 125This tunable disables ALTQ support, allowing the use of multiqueue instead. 126This option applies to all interfaces. 127The default value is 0. 128.El 129.Sh TRANSMIT QUEUE STATISTICS 130For each transmit queue of each interface the following read-only statistics 131are provided: 132.Bl -tag -width "xxxxxx" 133.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .rescheduled 134The number of times the transmit interrupt handler was rescheduled. 135.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .tso 136The number of times TCP segment offloading was performed. 137.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .csum 138The number of times transmit checksum offloading for UDP or TCP was 139performed. 140.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .omcasts 141The number of multicast packets that were transmitted. 142.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .obytes 143The number of bytes that were transmitted (based on Ethernet frames). 144.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .opackets 145The number of packets that were transmitted (Ethernet frames). 146.El 147.Sh RECEIVE QUEUE STATISTICS 148For each receive queue of each interface the following read-only statistics 149are provided: 150.Bl -tag -width "xxxxxx" 151.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .rescheduled 152The number of times the receive interrupt handler was rescheduled. 153.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .host_lro 154The number of times TCP large receive offload was performed. 155.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum_failed 156The number of times a packet with a request for receive or transmit checksum 157offloading was received and this request failed. 158The different reasons for the failure are counted by 159.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_inaccessible_ipproto , 160.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ipproto , 161.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ethtype , 162and 163.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_offset . 164.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum 165The number of times receive checksum offloading for UDP or TCP was performed. 166.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .ierrors 167The number of times an error occurred during input processing. 168.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .iqdrops 169The number of times a packet was dropped during input processing. 170.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .ibytes 171The number of bytes that were received (based on Ethernet frames). 172.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .ipackets 173The number of packets that were received (Ethernet frames). 174.El 175.Sh INTERFACE TRANSMIT STATISTICS 176For each interface the following read-only transmit statistics are provided: 177.Bl -tag -width "xxxxxx" 178.It Va dev.vtnet. Ns Ar X Ns Va .tx_task_rescheduled 179The sum of 180.Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .rescheduled 181over all transmit queues of the interface. 182.It Va dev.vtnet. Ns Ar X Ns Va .tx_tso_offloaded 183The sum of 184.Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .tso 185over all transmit queues of the interface. 186.It Va dev.vtnet. Ns Ar X Ns Va .tx_csum_offloaded 187The sum of 188.Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .csum 189over all transmit queues of the interface. 190.It Va dev.vtnet. Ns Ar X Ns Va .tx_defrag_failed 191The number of times an attempt to defragment an mbuf chain failed during a 192transmit operation. 193.It Va dev.vtnet. Ns Ar X Ns Va .tx_defragged 194The number of times an mbuf chain was defragmented during a transmit operation. 195.It Va dev.vtnet. Ns Ar X Ns Va .tx_tso_without_csum 196The number of times TCP segment offloading was attempted without transmit 197checksum offloading. 198.It Va dev.vtnet. Ns Ar X Ns Va .tx_tso_not_tcp 199The number of times TCP segment offloading was attempted for a non-TCP packet. 200.It Va dev.vtnet. Ns Ar X Ns Va .tx_csum_proto_mismatch 201The number of times the IP protocol version of the transmit checksum 202offloading request did not match the IP protocol version of the packet. 203.It Va dev.vtnet. Ns Ar X Ns Va .tx_csum_unknown_ethtype 204The number of times a transmit offload operation was requested for an 205ethernet frame for which the EtherType was neither IPv4 nor IPv6 206(considering simple VLAN tagging). 207.El 208.Sh INTERFACE RECEIVE STATISTICS 209For each interface the following read-only receive statistics are provided: 210.Bl -tag -width "xxxxxx" 211.It Va dev.vtnet. Ns Ar X Ns Va .rx_task_rescheduled 212The sum of 213.Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .rescheduled 214over all receive queues of the interface. 215.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_offloaded 216The sum of 217.Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum 218over all receive queues of the interface. 219.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_failed 220The sum of 221.Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum_failed 222over all receive queues of the interface. 223.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_inaccessible_ipproto 224The number of times a packet with a request for receive or transmit checksum 225offloading was received where the IP protocol was not accessible. 226.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_offset 227The number of times fixing the checksum required by 228.Va hw.vtnet.fixup_needs_csum 229or 230.Va hw.vtnet. Ns Ar X Ns Va .fixup_needs_csum 231was attempted for a packet where the csum is not located in the first mbuf. 232.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ipproto 233The number of times a packet with a request for receive or transmit checksum 234offloading was received where the IP protocol was neither TCP nor UDP. 235.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ethtype 236The number of times a packet with a request for receive or transmit checksum 237offloading was received where the EtherType was neither IPv4 nor IPv6. 238.It Va dev.vtnet. Ns Ar X Ns Va .rx_mergeable_failed 239The number of times receiving a mergable buffer failed. 240.It Va dev.vtnet. Ns Ar X Ns Va .rx_enq_replacement_failed 241The number of times the enqueuing the replacement receive mbuf chain failed. 242.It Va dev.vtnet. Ns Ar X Ns Va .rx_frame_too_large 243The number of times the frame was loger than the mbuf chain during large 244receive offload without mergeable buffers. 245.It Va dev.vtnet. Ns Ar X Ns Va .mbuf_alloc_failed 246The number of times an mbuf cluster allocation for the receive buffer failed. 247.El 248.Sh INTERFACE CONFIGURATION PARAMETER 249For each interface the following read-only configuration parameters are 250provided: 251.Bl -tag -width "xxxxxx" 252.It Va dev.vtnet. Ns Ar X Ns Va .act_vq_pairs 253The number of active virtqueue pairs. 254.It Va dev.vtnet. Ns Ar X Ns Va .req_vq_pairs 255The number of requested virtqueue pairs. 256.It Va dev.vtnet. Ns Ar X Ns Va .max_vq_pairs 257The maximum number of supported virtqueue pairs. 258.El 259.Sh SEE ALSO 260.Xr arp 4 , 261.Xr netintro 4 , 262.Xr ng_ether 4 , 263.Xr virtio 4 , 264.Xr vlan 4 , 265.Xr ifconfig 8 266.Sh HISTORY 267The 268.Nm 269driver was written by 270.An Bryan Venteicher Aq Mt bryanv@FreeBSD.org . 271It first appeared in 272.Fx 9.0 . 273.Sh CAVEATS 274The 275.Nm 276driver only supports LRO when the hypervisor advertises the 277mergeable buffer feature. 278