2 Copyright(c) 2016 IGEL Co., Ltd.. All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in
13 the documentation and/or other materials provided with the
15 * Neither the name of IGEL Co., Ltd. nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 Poll Mode Driver that wraps vhost library
32 =========================================
34 This PMD is a thin wrapper of the DPDK vhost library.
35 The user can handle virtqueues as one of normal DPDK port.
37 Vhost Implementation in DPDK
38 ----------------------------
40 Please refer to Chapter "Vhost Library" of *DPDK Programmer's Guide* to know detail of vhost.
42 Features and Limitations of vhost PMD
43 -------------------------------------
45 Currently, the vhost PMD provides the basic functionality of packet reception, transmission and event handling.
47 * It has multiple queues support.
49 * It supports ``RTE_ETH_EVENT_INTR_LSC`` and ``RTE_ETH_EVENT_QUEUE_STATE`` events.
51 * It supports Port Hotplug functionality.
53 * Don't need to stop RX/TX, when the user wants to stop a guest or a virtio-net driver on guest.
58 The user can specify below arguments in `--vdev` option.
62 It is used to specify a path to connect to a QEMU virtio-net device.
66 It is used to specify the number of queues virtio-net device has.
71 It is used to enable iommu support in vhost library.
72 (Default: 0 (disabled))
74 Vhost PMD event handling
75 ------------------------
77 This section describes how to handle vhost PMD events.
79 The user can register an event callback handler with ``rte_eth_dev_callback_register()``.
80 The registered callback handler will be invoked with one of below event types.
82 #. ``RTE_ETH_EVENT_INTR_LSC``:
84 It means link status of the port was changed.
86 #. ``RTE_ETH_EVENT_QUEUE_STATE``:
88 It means some of queue statuses were changed. Call ``rte_eth_vhost_get_queue_event()`` in the callback handler.
89 Because changing multiple statuses may occur only one event, call the function repeatedly as long as it doesn't return negative value.
91 Vhost PMD with testpmd application
92 ----------------------------------
94 This section demonstrates vhost PMD with testpmd DPDK sample application.
96 #. Launch the testpmd with vhost PMD:
98 .. code-block:: console
100 ./testpmd -l 0-3 -n 4 --vdev 'net_vhost0,iface=/tmp/sock0,queues=1' -- -i
102 Other basic DPDK preparations like hugepage enabling here.
103 Please refer to the *DPDK Getting Started Guide* for detailed instructions.
107 .. code-block:: console
109 qemu-system-x86_64 <snip>
110 -chardev socket,id=chr0,path=/tmp/sock0 \
111 -netdev vhost-user,id=net0,chardev=chr0,vhostforce,queues=1 \
112 -device virtio-net-pci,netdev=net0
114 This command attaches one virtio-net device to QEMU guest.
115 After initialization processes between QEMU and DPDK vhost library are done, status of the port will be linked up.