1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2016 Intel Corporation.
4 .. _virtio_user_as_excpetional_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 featuers, 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 excpetional 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 --txqflags=0x0 --enable-lro \
61 --enable-rx-cksum --rxd=1024 --txd=1024
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.
72 * ``--enable-rx-cksum``
74 This is used to negotiate VIRTIO_NET_F_GUEST_CSUM so that packets from
75 kernel can be deemed as valid Rx checksumed.
79 256 by default. To avoid shortage of descriptors, we can increase it to 1024.
83 Number of multi-queues. Each qeueue will be served by a kthread. For example:
85 .. code-block:: console
87 $(testpmd) -l 2-3 -n 4 \
88 --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 \
89 -- -i --txqflags=0x0 --enable-lro \
90 --enable-rx-cksum --txq=2 --rxq=2 --rxd=1024 \
95 .. code-block:: console
99 #. Configure IP address and start tap:
101 .. code-block:: console
103 ifconfig tap0 1.1.1.1/24 up
107 The tap device will be named tap0, tap1, etc, by kernel.
109 Then, all traffic from physical NIC can be forwarded into kernel stack, and all
110 traffic on the tap0 can be sent out from physical NIC.
115 This solution is only available on Linux systems.