xref: /freebsd/share/man/man4/ptnet.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1*76ed4255SVincenzo Maffione.\" Copyright (c) 2018 Vincenzo Maffione
2*76ed4255SVincenzo Maffione.\" All rights reserved.
3*76ed4255SVincenzo Maffione.\"
4*76ed4255SVincenzo Maffione.\" Redistribution and use in source and binary forms, with or without
5*76ed4255SVincenzo Maffione.\" modification, are permitted provided that the following conditions
6*76ed4255SVincenzo Maffione.\" are met:
7*76ed4255SVincenzo Maffione.\" 1. Redistributions of source code must retain the above copyright
8*76ed4255SVincenzo Maffione.\"    notice, this list of conditions and the following disclaimer.
9*76ed4255SVincenzo Maffione.\" 2. Redistributions in binary form must reproduce the above copyright
10*76ed4255SVincenzo Maffione.\"    notice, this list of conditions and the following disclaimer in the
11*76ed4255SVincenzo Maffione.\"    documentation and/or other materials provided with the distribution.
12*76ed4255SVincenzo Maffione.\"
13*76ed4255SVincenzo Maffione.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*76ed4255SVincenzo Maffione.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*76ed4255SVincenzo Maffione.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*76ed4255SVincenzo Maffione.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*76ed4255SVincenzo Maffione.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*76ed4255SVincenzo Maffione.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*76ed4255SVincenzo Maffione.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*76ed4255SVincenzo Maffione.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*76ed4255SVincenzo Maffione.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*76ed4255SVincenzo Maffione.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*76ed4255SVincenzo Maffione.\" SUCH DAMAGE.
24*76ed4255SVincenzo Maffione.\"
25*76ed4255SVincenzo Maffione.Dd December 11, 2018
26*76ed4255SVincenzo Maffione.Dt PTNET 4
27*76ed4255SVincenzo Maffione.Os
28*76ed4255SVincenzo Maffione.Sh NAME
29*76ed4255SVincenzo Maffione.Nm ptnet
30*76ed4255SVincenzo Maffione.Nd Ethernet driver for passed-through netmap ports
31*76ed4255SVincenzo Maffione.Sh SYNOPSIS
32*76ed4255SVincenzo MaffioneThis network driver is included in
33*76ed4255SVincenzo Maffione.Xr netmap 4 ,
34*76ed4255SVincenzo Maffioneand it can be compiled into the kernel by adding the following
35*76ed4255SVincenzo Maffioneline in your kernel configuration file:
36*76ed4255SVincenzo Maffione.Bd -ragged -offset indent
37*76ed4255SVincenzo Maffione.Cd "device netmap"
38*76ed4255SVincenzo Maffione.Ed
39*76ed4255SVincenzo Maffione.Sh DESCRIPTION
40*76ed4255SVincenzo MaffioneThe
41*76ed4255SVincenzo Maffione.Nm
42*76ed4255SVincenzo Maffionedevice driver provides direct access to host netmap ports,
43*76ed4255SVincenzo Maffionefrom within a Virtual Machine (VM).
44*76ed4255SVincenzo MaffioneApplications running inside
45*76ed4255SVincenzo Maffionethe VM can access the TX/RX rings and buffers of a netmap port
46*76ed4255SVincenzo Maffionethat the hypervisor has passed-through to the VM.
47*76ed4255SVincenzo MaffioneHypervisor support for
48*76ed4255SVincenzo Maffione.Nm
49*76ed4255SVincenzo Maffioneis currently available for QEMU/KVM.
50*76ed4255SVincenzo MaffioneAny
51*76ed4255SVincenzo Maffione.Xr netmap 4
52*76ed4255SVincenzo Maffioneport can be passed-through, including physical NICs,
53*76ed4255SVincenzo Maffione.Xr vale 4
54*76ed4255SVincenzo Maffioneports, netmap pipes, etc.
55*76ed4255SVincenzo Maffione.Pp
56*76ed4255SVincenzo MaffioneThe main use-case for netmap passthrough is Network Function
57*76ed4255SVincenzo MaffioneVirtualization (NFV), where middlebox applications running within
58*76ed4255SVincenzo MaffioneVMs may want to process very high packet rates (e.g., 1-10 millions
59*76ed4255SVincenzo Maffionepackets per second or more).
60*76ed4255SVincenzo MaffioneNote, however, that those applications
61*76ed4255SVincenzo Maffionemust use the device in netmap mode in order to achieve such rates.
62*76ed4255SVincenzo MaffioneIn addition to the general advantages of netmap, the improved
63*76ed4255SVincenzo Maffioneperformance of
64*76ed4255SVincenzo Maffione.Nm
65*76ed4255SVincenzo Maffionewhen compared to hypervisor device emulation or paravirtualization (e.g.,
66*76ed4255SVincenzo Maffione.Xr vtnet 4 ,
67*76ed4255SVincenzo Maffione.Xr vmx 4 )
68*76ed4255SVincenzo Maffionecomes from the hypervisor being completely bypassed in the data-path.
69*76ed4255SVincenzo MaffioneFor example, when using
70*76ed4255SVincenzo Maffione.Xr vtnet 4
71*76ed4255SVincenzo Maffionethe VM has to convert each
72*76ed4255SVincenzo Maffione.Xr mbuf 9
73*76ed4255SVincenzo Maffioneto a VirtIO-specific packet representation
74*76ed4255SVincenzo Maffioneand publish that to a VirtIO queue; on the hypervisor side, the
75*76ed4255SVincenzo Maffionepacket is extracted from the VirtIO queue and converted to a
76*76ed4255SVincenzo Maffionehypervisor-specific packet representation.
77*76ed4255SVincenzo MaffioneThe overhead of format conversions (and packet copies, in same cases) is not
78*76ed4255SVincenzo Maffioneincured by
79*76ed4255SVincenzo Maffione.Nm
80*76ed4255SVincenzo Maffionein netmap mode, because mbufs are not used at all, and the packet format
81*76ed4255SVincenzo Maffioneis the one defined by netmap (e.g.,
82*76ed4255SVincenzo Maffione.Ar struct netmap_slot )
83*76ed4255SVincenzo Maffionealong the whole data-path.
84*76ed4255SVincenzo MaffioneNo format conversions or copies happen.
85*76ed4255SVincenzo Maffione.Pp
86*76ed4255SVincenzo MaffioneIt is also possible to use a
87*76ed4255SVincenzo Maffione.Nm
88*76ed4255SVincenzo Maffionedevice like a regular network interface, which interacts with the
89*76ed4255SVincenzo Maffione.Fx
90*76ed4255SVincenzo Maffionenetwork stack (i.e., not in netmap mode).
91*76ed4255SVincenzo MaffioneHowever, in that case it is necessary to pay the cost of data copies
92*76ed4255SVincenzo Maffionebetween mbufs and netmap buffers, which generally results in lower
93*76ed4255SVincenzo MaffioneTCP/UDP performance than
94*76ed4255SVincenzo Maffione.Xr vtnet 4
95*76ed4255SVincenzo Maffioneor other paravirtualized network devices.
96*76ed4255SVincenzo MaffioneIf the passed-through netmap port supports the VirtIO network header,
97*76ed4255SVincenzo Maffione.Nm
98*76ed4255SVincenzo Maffioneis able to use it, and support TCP/UDP checksum offload (for both transmit
99*76ed4255SVincenzo Maffioneand receive), TCP segmentation offload (TSO) and TCP large receive offload
100*76ed4255SVincenzo Maffione(LRO).
101*76ed4255SVincenzo MaffioneCurrently,
102*76ed4255SVincenzo Maffione.Xr vale 4
103*76ed4255SVincenzo Maffioneports support the header.
104*76ed4255SVincenzo MaffioneNote that the VirtIO network header is generally not used in NFV
105*76ed4255SVincenzo Maffioneuse-cases, because middleboxes are not endpoints of TCP/UDP connections.
106*76ed4255SVincenzo Maffione.Sh TUNABLES
107*76ed4255SVincenzo MaffioneTunables can be set at the
108*76ed4255SVincenzo Maffione.Xr loader 8
109*76ed4255SVincenzo Maffioneprompt before booting the kernel or stored in
110*76ed4255SVincenzo Maffione.Xr loader.conf 5 .
111*76ed4255SVincenzo Maffione.Bl -tag -width "xxxxxx"
112*76ed4255SVincenzo Maffione.It Va dev.netmap.ptnet_vnet_hdr
113*76ed4255SVincenzo MaffioneThis tunable enables (1) or disables (0) the VirtIO network header.
114*76ed4255SVincenzo MaffioneIf enabled,
115*76ed4255SVincenzo Maffione.Nm
116*76ed4255SVincenzo Maffioneuses the same header used by
117*76ed4255SVincenzo Maffione.Xr vtnet 4
118*76ed4255SVincenzo Maffioneto exchange offload metadata with the hypervisor.
119*76ed4255SVincenzo MaffioneIf disabled, no header is prepended to transmitted and received
120*76ed4255SVincenzo Maffionepackets.
121*76ed4255SVincenzo MaffioneThe metadata is necessary to support TCP/UDP checksum offloads,
122*76ed4255SVincenzo MaffioneTSO, and LRO.
123*76ed4255SVincenzo MaffioneThe default value is 1.
124*76ed4255SVincenzo Maffione.El
125*76ed4255SVincenzo Maffione.Sh SEE ALSO
126*76ed4255SVincenzo Maffione.Xr netintro 4 ,
127*76ed4255SVincenzo Maffione.Xr netmap 4 ,
128*76ed4255SVincenzo Maffione.Xr vale 4 ,
129*76ed4255SVincenzo Maffione.Xr virtio 4 ,
130*76ed4255SVincenzo Maffione.Xr vmx 4 ,
131*76ed4255SVincenzo Maffione.Xr ifconfig 8
132*76ed4255SVincenzo Maffione.Sh HISTORY
133*76ed4255SVincenzo MaffioneThe
134*76ed4255SVincenzo Maffione.Nm
135*76ed4255SVincenzo Maffionedriver was written by
136*76ed4255SVincenzo Maffione.An Vincenzo Maffione Aq Mt vmaffione@FreeBSD.org .
137*76ed4255SVincenzo MaffioneIt first appeared in
138*76ed4255SVincenzo Maffione.Fx 12.0 .
139