1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2016 Intel Corporation.
4 .. _virtio_user_as_exceptional_path:
6 Virtio_user as Exceptional Path
7 ===============================
9 The virtual device, virtio-user, was originally introduced with vhost-user
10 backend, as a high performance solution for IPC (Inter-Process Communication)
11 and user space container networking.
13 Virtio_user with vhost-kernel backend is a solution for exceptional path,
14 such as KNI which exchanges packets with kernel networking stack. This
15 solution is very promising in:
19 All kernel modules needed by this solution, vhost and vhost-net (kernel),
20 are upstreamed and extensively used kernel module.
24 vhost-net is born to be a networking solution, which has lots of networking
25 related features, like multi queue, tso, multi-seg mbuf, etc.
29 similar to KNI, this solution would use one or more kthreads to
30 send/receive packets to/from user space DPDK applications, which has little
31 impact on user space polling thread (except that it might enter into kernel
32 space to wake up those kthreads if necessary).
34 The overview of an application using virtio-user as exceptional path is shown
35 in :numref:`figure_virtio_user_as_exceptional_path`.
37 .. _figure_virtio_user_as_exceptional_path:
39 .. figure:: img/virtio_user_as_exceptional_path.*
41 Overview of a DPDK app using virtio-user as exceptional path
47 As a prerequisite, the vhost/vhost-net kernel CONFIG should be chosen before
48 compiling the kernel and those kernel modules should be inserted.
50 #. Compile DPDK and bind a physical NIC to igb_uio/uio_pci_generic/vfio-pci.
52 This physical NIC is for communicating with outside.
56 .. code-block:: console
58 $(testpmd) -l 2-3 -n 4 \
59 --vdev=virtio_user0,path=/dev/vhost-net,queue_size=1024 \
60 -- -i --tx-offloads=0x0000002c --enable-lro \
63 This command runs testpmd with two ports, one physical NIC to communicate
64 with outside, and one virtio-user to communicate with kernel.
68 This is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
69 VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from kernel can be
70 transmitted to DPDK application and further TSOed by physical NIC.
74 256 by default. To avoid shortage of descriptors, we can increase it to 1024.
78 Number of multi-queues. Each queue will be served by a kthread. For example:
80 .. code-block:: console
82 $(testpmd) -l 2-3 -n 4 \
83 --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 \
84 -- -i --tx-offloads=0x0000002c --enable-lro \
85 --txq=2 --rxq=2 --txd=1024 --rxd=1024
87 #. Enable Rx checksum offloads in testpmd:
89 .. code-block:: console
92 (testpmd) port config 0 rx_offload tcp_cksum on
93 (testpmd) port config 0 rx_offload udp_cksum on
94 (testpmd) port start 0
98 .. code-block:: console
102 #. Configure IP address and start tap:
104 .. code-block:: console
106 ifconfig tap0 1.1.1.1/24 up
110 The tap device will be named tap0, tap1, etc, by kernel.
112 Then, all traffic from physical NIC can be forwarded into kernel stack, and all
113 traffic on the tap0 can be sent out from physical NIC.
118 This solution is only available on Linux systems.