summaryrefslogtreecommitdiff
path: root/doc/virtio-net-pmd.html
blob: 334ade30495e81cf190216688c25914558cbe516 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name=viewport content="width=device-width, initial-scale=1" />
		<title>DPDK doc</title>
		<link rel="stylesheet" href="/reset.css" />
		<link rel="stylesheet" href="/layout.css" />
		<link rel="stylesheet" href="/content.css" />
		<script type="text/javascript">
			var _gaq = _gaq || [];
			_gaq.push(['_setAccount', 'UA-39229303-1']);
			_gaq.push(['_setDomainName', 'dpdk.org']);
			_gaq.push(['_setAllowLinker', true]);
			_gaq.push(['_trackPageview']);
			(function() {
				var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
				ga.src = '//www.google-analytics.com/ga.js';
				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
			})();
		</script>
	</head>
	<body>
		<header>
			<h1><a href="//dpdk.org/"><img src="/logos/dpdk.png"
				alt="DPDK: Data Plane Development Kit"></a></h1>
			<nav>
				<ul>
					<li><a href="/">Home</a></li>
					<li><a href="/download">Download</a></li>
					<li><a href="/doc" id="current">Documentation</a></li>
					<li><a href="/dev">Development</a></li>
					<li><a href="/ml">Mailing Lists</a></li>
					<li><a href="/events">Events</a></li>
					<li><a href="/news">News</a></li>
					<li><a href="/about">About</a></li>
				</ul>
			</nav>
		</header>
		<section>
<h2>virtio-net-pmd</h2>

<!-- 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. -->
<h3>DESCRIPTION</h3>
<p>Here is a Poll-Mode Driver (PMD) for the VirtI/O based linux paravirtualized
NIC, for DPDK.</p>
<p>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.</p>
<p>The DPDK driver is a shared object (<span class="pre">librte_pmd_virtio.so</span>) 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 <span class="pre">iopl()</span>.</p>
<h3>HOW TO BUILD</h3>
<p>There are two build dependencies: VirtI/O headers and DPDK &gt;= 1.2.3r4.</p>
<p>The virtio headers can be obtained when installing the linux kernel headers,
or directly in the linux kernel tree, in linux-source/usr/include/</p>
<p>DPDK must be built first in order to have all its header files in the same
directory, that RTE_INCLUDE must point to.</p>
<p>Example:</p>
<pre>
dpdk$ make config T=x86_64-native-linuxapp-gcc
[...]
dpdk$ make
[...]
dpdk$ cd ../virtio
virtio$ make RTE_INCLUDE=../dpdk/build/include
[...]
</pre>
<p>Build options can be displayed using <span class="pre">make help</span>.</p>
<h3>HOW TO RUN</h3>
<p>Because QEMU fixes the number of descriptor per queue through an hardcoded
value, it's very important that DPDK parameters <span class="pre">--rxd</span> and <span class="pre">--txd</span> are
set to <span class="pre">256</span>. It won't work otherwise.</p>
<p>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.</p>
<p>The userland driver, <span class="pre">librte_pmd_virtio.so</span>, must be loaded by the DPDK using
the <span class="pre">-d</span> option.</p>
<p><span class="pre">testpmd</span> example for two ports:</p>
<pre>
$ ../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&gt;
</pre>
<h3>HOW TO RESTART APPLICATIONS</h3>
<p>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.</p>
		</section>
		<footer></footer>
	</body>
</html>