summaryrefslogtreecommitdiff
path: root/doc/memnic-pmd.html
blob: e29bafde3b45b4338e625d6518d4eb810ac19e59 (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
<!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>MEMNIC PMD</h2>

<!-- Copyright 2014 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>This is a Poll-Mode Driver (PMD) for DPDK, provided as a DPDK extension
that must be loaded at DPDK startup.</p>
<p>It allows creating virtual NICs based on a shared memory.
On guest side, it uses an ivshmem virtual PCI device.
On host side, the shared memory is a mmap'd file.</p>
<p>This virtual NIC permits to achieve high performance for virtualized
environment by directly sharing rings between the host and the guest
VMs, bypassing the Virtual Machine Manager and thus, removing any
hypercalls that would have taken place otherwise.</p>
<p>This virtual NIC also avoids to share the whole DPDK memory between the
host and the guest. When transmitting a packet from guest to host, the
packets are copied from rte_mbufs owned by a guest to the shared memory,
then from the shared memory to a rte_mbuf structure owned by the host.
The same approach is applied when transmitting from host to guest. This
approach prevents a guest to modify a packet owned by the host or
another guest, providing more security.</p>
<h3 id="build">HOW TO BUILD</h3>
<p>There is only one build dependency: DPDK.</p>
<p>This driver aims to be compiled and run on <strong>guest side</strong>. See in
<a class="reference internal" href="#run">HOW TO RUN</a> for how to boot your guest.</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>
<pre>
cd /path/to/dpdk
make config T=x86_64-native-linuxapp-gcc
make
cd /path/to/memnic/pmd
make RTE_INCLUDE=/path/to/dpdk/build/include
</pre>
<p>It results in creating a library librte_pmd_memnic_copy.so in current
directory. To install it, use:</p>
<pre>
make install
</pre>
<p>The default installation path is
<span class="pre">/usr/local/lib/librte_pmd_memnic_copy.so</span>. It can be
overidden by setting <span class="pre">DESTDIR</span> variable when invoking make install
command. In this case, the library will be copied in
<span class="pre">$(DESTDIR)/usr/local/lib/librte_pmd_memnic_copy.so</span>.</p>
<p>Build options can be displayed using <span class="pre">make help</span>.</p>
<h3 id="run">HOW TO RUN</h3>
<p>On host, the shared memory must be initialized by an application using memnic.</p>
<p>Only QEMU hypervised systems are supported at the moment. We assume that
the DPDK and librte_pmd_memnic_copy are already installed on the guest.
To run the guest with qemu, you can use a command line similar to this one:</p>
<pre>
qemu-system-x86_64 -enable-kvm -cpu host -smp 3 -m 512 \
    -device ivshmem,size=16,shm=/../../mnt/huge/ivshm
</pre>
<p>Run the testpmd application on the guest:</p>
<pre>
echo 64 &gt; /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
mount -t hugetlbfs nodev /mnt/huge
/path/to/dpdk/testpmd -c7 -n3 \
    -d /path/to/librte_pmd_memnic_copy.so \
    -- -i --nb-cores=2 --nb-ports=1 --port-topology=chained
</pre>
		</section>
		<footer></footer>
	</body>
</html>