summaryrefslogtreecommitdiff
path: root/README.rst
blob: 2c956a161ac240a27a7ed3c21c1db588e2229a03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
.. Copyright 2013 6WIND S.A.
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
   - Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.
   - Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
     distribution.
   - Neither the name of 6WIND S.A. nor the names of its
     contributors may be used to endorse or promote products derived
     from this software without specific prior written permission.
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   OF THE POSSIBILITY OF SUCH DAMAGE.

virtio-net-pmd
==============

DESCRIPTION
-----------

Here is a Poll-Mode Driver (PMD) for the VirtI/O based linux paravirtualized
NIC, for Intel DPDK.

The standard Linux kernel driver for this vNIC is called virtio-net,
it depends on virtio-ring and virtio-pci. However, there is no need
for this driver to be supported by the guest for the PMD to work.
Additionnaly, some features such as multiqueue support do not depend
on the support in the guest kernel.

The DPDK driver is a shared object (``librte_pmd_virtio.so``) that must be
loaded as a DPDK extension.
This driver gets hardware access through the PCIe I/O mapped in the upper
range of the ioports, and thus requires special privileges automatically
obtained through ``iopl()``.

HOW TO BUILD
------------

There are two build dependencies: VirtI/O headers and DPDK >= 1.2.3r4.

The virtio headers can be obtained when installing the linux kernel headers,
or directly in the linux kernel tree, in linux-source/usr/include/

DPDK must be built first in order to have all its header files in the same
directory, that RTE_INCLUDE must point to.

Example::

  dpdk$ make config T=x86_64-native-linuxapp-gcc
  [...]
  dpdk$ make
  [...]
  dpdk$ cd ../virtio
  virtio$ make RTE_INCLUDE=../dpdk/build/include
  [...]

Build options can be displayed using ``make help``.

HOW TO RUN
----------

Because QEMU fixes the number of descriptor per queue through an hardcoded
value, it's very important that DPDK parameters ``--rxd`` and ``--txd`` are
set to ``256``. It won't work otherwise.

Also, since VirtI/O net uses queue pairs, the number of Tx and Rx queues must
be equal. When multiqueue is enabled, their value should be inferior or equal
to the number of queues given as a parameter to QEMU.
Multiqueue is supported since Linux 3.8 and QEMU 1.4.

The userland driver, ``librte_pmd_virtio.so``, must be loaded by the DPDK using
the ``-d`` option.

``testpmd`` example for two ports::

  $ ../dpdk/build/app/testpmd -c 0xff -n 1 \
    -d librte_pmd_virtio.so \
    -- \
    --disable-hw-vlan --disable-rss \
    -i --rxq=1 --txq=1 --rxd=256 --txd=256
  [...]
  EAL: probe driver: 1af4:1000 rte_virtio_net_pmd
  EAL: probe driver: 1af4:1000 rte_virtio_net_pmd
  Interactive-mode selected
  [...]
  testpmd>

HOW TO RESTART APPLICATIONS
---------------------------

During initialization, the virtio PMD checks if the virtio-net device is in an
unused state to prevent two different applications to use the same device which
would lead in QEMU exiting because of indices incoherency.
Thus, in order to relaunch a DPDK application using the virtio PMD, the
dev_close function must have been called before exiting the application to
ensure the device is left in an unused state.