xref: /freebsd/share/man/man4/vtnet.4 (revision d9cc3d558d00ee7f62dbef2032f099033c91d2a1)
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 16, 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.
87This tunable is deprecated and will be removed in
88.Fx 16 .
89.It Va hw.vtnet.tso_disable
90.It Va hw.vtnet. Ns Ar X Ns Va .tso_disable
91This tunable disables TCP segmentation offloading.
92The default value is 0.
93.It Va hw.vtnet.lro_disable
94.It Va hw.vtnet. Ns Ar X Ns Va .lro_disable
95This tunable disables large receive offload.
96The default value is 0.
97.It Va hw.vtnet.mq_disable
98.It Va hw.vtnet. Ns Ar X Ns Va .mq_disable
99This tunable disables multiqueue.
100The default value is 0.
101.It Va hw.vtnet.mq_max_pairs
102.It Va hw.vtnet. Ns Ar X Ns Va .mq_max_pairs
103This tunable sets the maximum number of transmit and receive queue pairs.
104Multiple queues are only supported when the Multiqueue feature is negotiated.
105This driver supports a maximum of 8 queue pairs.
106The number of queue pairs used is the lesser of the maximum supported by the
107driver and the hypervisor, the number of CPUs present in the guest, and this
108tunable if not zero.
109The default value is 0.
110.It Va hw.vtnet.tso_maxlen
111.It Va hw.vtnet. Ns Ar X Ns Va .tso_maxlen
112This tunable sets the TSO burst limit.
113The default value is 65535.
114.It Va hw.vtnet.rx_process_limit
115.It Va hw.vtnet. Ns Ar X Ns Va .rx_process_limit
116This tunable sets the number of RX segments processed in one pass.
117The default value is 1024.
118.It Va hw.vtnet.lro_entry_count
119.It Va hw.vtnet. Ns Ar X Ns Va .lro_entry_count
120This tunable sets the software LRO entry count.
121The default value is 128, the minimum value is 8.
122.It Va hw.vtnet.lro_mbufq_depth
123.It Va hw.vtnet. Ns Ar X Ns Va .lro_mbufq_depth
124This tunable sets the depth of the software LRO mbuf queue.
125The default value is 0.
126.It Va hw.vtnet.altq_disable
127This tunable disables ALTQ support, allowing the use of multiqueue instead.
128This option applies to all interfaces.
129The default value is 0.
130.El
131.Sh TRANSMIT QUEUE STATISTICS
132For each transmit queue of each interface the following read-only statistics
133are provided:
134.Bl -tag -width "xxxxxx"
135.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .rescheduled
136The number of times the transmit interrupt handler was rescheduled.
137.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .tso
138The number of times TCP segment offloading was performed.
139.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .csum
140The number of times transmit checksum offloading for UDP or TCP was
141performed.
142.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .omcasts
143The number of multicast packets that were transmitted.
144.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .obytes
145The number of bytes that were transmitted (based on Ethernet frames).
146.It Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .opackets
147The number of packets that were transmitted (Ethernet frames).
148.El
149.Sh RECEIVE QUEUE STATISTICS
150For each receive queue of each interface the following read-only statistics
151are provided:
152.Bl -tag -width "xxxxxx"
153.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .rescheduled
154The number of times the receive interrupt handler was rescheduled.
155.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .host_lro
156The number of times TCP large receive offload was performed.
157.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum_failed
158The number of times a packet with a request for receive or transmit checksum
159offloading was received and this request failed.
160The different reasons for the failure are counted by
161.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_inaccessible_ipproto ,
162.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ipproto ,
163.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ethtype ,
164and
165.Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_offset .
166.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum
167The number of times receive checksum offloading for UDP or TCP was performed.
168.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .ierrors
169The number of times an error occurred during input processing.
170.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .iqdrops
171The number of times a packet was dropped during input processing.
172.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .ibytes
173The number of bytes that were received (based on Ethernet frames).
174.It Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .ipackets
175The number of packets that were received (Ethernet frames).
176.El
177.Sh INTERFACE TRANSMIT STATISTICS
178For each interface the following read-only transmit statistics are provided:
179.Bl -tag -width "xxxxxx"
180.It Va dev.vtnet. Ns Ar X Ns Va .tx_task_rescheduled
181The sum of
182.Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .rescheduled
183over all transmit queues of the interface.
184.It Va dev.vtnet. Ns Ar X Ns Va .tx_tso_offloaded
185The sum of
186.Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .tso
187over all transmit queues of the interface.
188.It Va dev.vtnet. Ns Ar X Ns Va .tx_csum_offloaded
189The sum of
190.Va dev.vtnet. Ns Ar X Ns Va .txq Ns Ar Y Ns Va .csum
191over all transmit queues of the interface.
192.It Va dev.vtnet. Ns Ar X Ns Va .tx_defrag_failed
193The number of times an attempt to defragment an mbuf chain failed during a
194transmit operation.
195.It Va dev.vtnet. Ns Ar X Ns Va .tx_defragged
196The number of times an mbuf chain was defragmented during a transmit operation.
197.It Va dev.vtnet. Ns Ar X Ns Va .tx_tso_without_csum
198The number of times TCP segment offloading was attempted without transmit
199checksum offloading.
200.It Va dev.vtnet. Ns Ar X Ns Va .tx_tso_not_tcp
201The number of times TCP segment offloading was attempted for a non-TCP packet.
202.It Va dev.vtnet. Ns Ar X Ns Va .tx_csum_proto_mismatch
203The number of times the IP protocol version of the transmit checksum
204offloading request did not match the IP protocol version of the packet.
205.It Va dev.vtnet. Ns Ar X Ns Va .tx_csum_unknown_ethtype
206The number of times a transmit offload operation was requested for an
207ethernet frame for which the EtherType was neither IPv4 nor IPv6
208(considering simple VLAN tagging).
209.El
210.Sh INTERFACE RECEIVE STATISTICS
211For each interface the following read-only receive statistics are provided:
212.Bl -tag -width "xxxxxx"
213.It Va dev.vtnet. Ns Ar X Ns Va .rx_task_rescheduled
214The sum of
215.Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .rescheduled
216over all receive queues of the interface.
217.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_offloaded
218The sum of
219.Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum
220over all receive queues of the interface.
221.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_failed
222The sum of
223.Va dev.vtnet. Ns Ar X Ns Va .rxq Ns Ar Y Ns Va .csum_failed
224over all receive queues of the interface.
225.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_inaccessible_ipproto
226The number of times a packet with a request for receive or transmit checksum
227offloading was received where the IP protocol was not accessible.
228.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_offset
229The number of times fixing the checksum required by
230.Va hw.vtnet.fixup_needs_csum
231or
232.Va hw.vtnet. Ns Ar X Ns Va .fixup_needs_csum
233was attempted for a packet where the csum is not located in the first mbuf.
234.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ipproto
235The number of times a packet with a request for receive or transmit checksum
236offloading was received where the IP protocol was neither TCP nor UDP.
237.It Va dev.vtnet. Ns Ar X Ns Va .rx_csum_bad_ethtype
238The number of times a packet with a request for receive or transmit checksum
239offloading was received where the EtherType was neither IPv4 nor IPv6.
240.It Va dev.vtnet. Ns Ar X Ns Va .rx_mergeable_failed
241The number of times receiving a mergable buffer failed.
242.It Va dev.vtnet. Ns Ar X Ns Va .rx_enq_replacement_failed
243The number of times the enqueuing the replacement receive mbuf chain failed.
244.It Va dev.vtnet. Ns Ar X Ns Va .rx_frame_too_large
245The number of times the frame was loger than the mbuf chain during large
246receive offload without mergeable buffers.
247.It Va dev.vtnet. Ns Ar X Ns Va .mbuf_alloc_failed
248The number of times an mbuf cluster allocation for the receive buffer failed.
249.El
250.Sh INTERFACE CONFIGURATION PARAMETER
251For each interface the following read-only configuration parameters are
252provided:
253.Bl -tag -width "xxxxxx"
254.It Va dev.vtnet. Ns Ar X Ns Va .act_vq_pairs
255The number of active virtqueue pairs.
256.It Va dev.vtnet. Ns Ar X Ns Va .req_vq_pairs
257The number of requested virtqueue pairs.
258.It Va dev.vtnet. Ns Ar X Ns Va .max_vq_pairs
259The maximum number of supported virtqueue pairs.
260.El
261.Sh SEE ALSO
262.Xr arp 4 ,
263.Xr netintro 4 ,
264.Xr ng_ether 4 ,
265.Xr virtio 4 ,
266.Xr vlan 4 ,
267.Xr ifconfig 8
268.Sh HISTORY
269The
270.Nm
271driver was written by
272.An Bryan Venteicher Aq Mt bryanv@FreeBSD.org .
273It first appeared in
274.Fx 9.0 .
275.Sh CAVEATS
276The
277.Nm
278driver only supports LRO when the hypervisor advertises the
279mergeable buffer feature.
280