summaryrefslogtreecommitdiffstats
path: root/doc/book-enea-nfv-access-platform-guide/doc/dpdk.xml
blob: e96dd801882fda34171a04662df5ec3e07c3fd49 (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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<chapter id="dpdk">
  <title>Data Plane Development Kit</title>

  <para>The Intel Data Plane Development Kit (DPDK) is a set of user-space
  libraries and drivers that provides a programming framework for high-speed
  packet processing applications. The DPDK includes a number of Poll Mode
  Drivers that enable direct packet transfer between the physical NIC and
  user-space without using interrupts, bypassing the Linux kernel network
  stack entirely.</para>

  <para>In order to take advantage of DPDK, Linux <ulink
  url="https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt">huge
  pages</ulink> must be enabled in the system. The allocation of huge pages
  should preferably be done at boot time by passing parameters on the kernel
  command line. Add the following to the kernel boot parameters:</para>

  <programlisting>default_hugepagesz=1GB hugepagesz=1GB hugepages=8 hugepagesz=2M hugepages=2048</programlisting>

  <para>For DPDK documentation, see <ulink
  url="http://dpdk.org/doc/guides-17.02/index.html">http://dpdk.org/doc/guides-17.02/index.html</ulink></para>

  <section id="pktgen">
    <title>Pktgen</title>

    <para>In addition to DPDK, Enea NFV Access Platform includes Pktgen, a
    software traffic generator that is powered by the DPDK packet processing
    framework. Pktgen can act as a transmitter or receiver and is capable of
    generating 10Gbit wire rate traffic with 64 byte frames.</para>

    <para>Pktgen is installed in <literal>/usr/share/apps/pktgen/</literal>
    and needs to be executed from this directory.</para>

    <para>For Pktgen documentation, see <ulink
    url="http://pktgen-dpdk.readthedocs.io">http://pktgen-dpdk.readthedocs.io</ulink></para>
  </section>

  <section id="dpdk-setup">
    <title>DPDK setup instructions</title>

    <para>The following setup instructions apply to both host and
    guest.</para>

    <orderedlist>
      <listitem>
        <para>To make the hugepage memory available for DPDK, it must be
        mounted:</para>

        <programlisting>mkdir /mnt/huge
mount -t hugetlbfs nodev /mnt/huge</programlisting>
      </listitem>

      <listitem>
        <para>Load the DPDK igb_uio kernel module:</para>

        <programlisting>modprobe igb_uio</programlisting>
      </listitem>

      <listitem>
        <para>Bind the device to the igb_uio driver:</para>

        <para><programlisting>dpdk-devbind --bind=igb_uio &lt;PCI device number&gt;</programlisting>The
        DPDK provides the dpdk-devbind tool to help binding/unbinding devices
        from specific drivers. See <ulink
        url="http://dpdk.org/doc/guides-17.02/tools/devbind.html">http://dpdk.org/doc/guides-17.02/tools/devbind.html</ulink>
        for more information.</para>
      </listitem>
    </orderedlist>

    <para>To print the current status of all known network
    interfaces:<programlisting>dpdk-devbind --status</programlisting></para>

    <para>At this point the system is ready to run DPDK applications.</para>
  </section>

  <section id="dpdk-example-test-setup">
    <title>DPDK example test setup</title>

    <para>This is a simple DPDK test setup using two boards connected
    back-to-back. One board generates traffic using the Pktgen application,
    and the other board runs the DPDK testpmd example to forward packets back
    on the same interface.</para>

    <programlisting>Pktgen [DPDK] - Board 1 PHY &lt;--&gt; Board 2 PHY - [DPDK] testpmd</programlisting>

    <orderedlist>
      <listitem>
        <para>Setup DPDK on both boards, following the instructions in
        [FIXME]:</para>
      </listitem>

      <listitem>
        <para>On board 1, start the Pktgen application:</para>

        <programlisting>cd /usr/share/apps/pktgen/
./pktgen -c 0x7 -n 4 --socket-mem 1024 -- -P -m "[1:2].0"</programlisting>

        <para>In the Pktgen console, run:</para>

        <programlisting>start 0</programlisting>

        <para>The Pktgen output will display the traffic configuration and
        statistics.</para>
      </listitem>

      <listitem>
        <para>On board 2, start the testpmd application:</para>

        <programlisting>testpmd -c 0x7 -n 4 -- --txd=512 --rxd=512  --port-topology=chained</programlisting>

        <para>For more information, refer to the testpmd application user
        guide: <ulink
        url="http://dpdk.org/doc/guides-17.02/testpmd_app_ug/index.html">http://dpdk.org/doc/guides-17.02/testpmd_app_ug/index.html</ulink>.</para>
      </listitem>
    </orderedlist>
  </section>
</chapter>