2 Copyright(c) 2010-2014 Intel Corporation. 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 Intel Corporation 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 .. _install_from_ports:
33 Installing DPDK from the Ports Collection
34 =========================================
36 The easiest way to get up and running with the DPDK on FreeBSD is to
37 install it from the ports collection. Details of getting and using the ports
38 collection are documented in the FreeBSD Handbook at:
40 https://www.freebsd.org/doc/handbook/ports-using.html
44 Testing has been performed using FreeBSD* 10.0-RELEASE (x86_64) and requires the
45 installation of the kernel sources, which should be included during the
46 installation of FreeBSD*.
48 Installing the DPDK FreeBSD Port
49 --------------------------------
51 On a system with the ports collection installed in /usr/ports, the DPDK
52 can be installed using the commands:
54 .. code-block:: console
56 root@host:~ # cd /usr/ports/net/dpdk
58 root@host:~ # make install
60 After the installation of the DPDK port, instructions will be printed on
61 how to install the kernel modules required to use the DPDK. A more
62 complete version of these instructions can be found in the sections
63 :ref:`loading_contigmem` and :ref:`loading_nic_uio`. Normally, lines like
64 those below would be added to the file "/boot/loader.conf".
66 .. code-block:: console
68 # reserve 2 x 1G blocks of contiguous memory using contigmem driver
69 hw.contigmem.num_buffers=2
70 hw.contigmem.buffer_size=1073741824
72 # identify NIC devices for DPDK apps to use and load nic_uio driver
73 hw.nic_uio.bdfs="2:0:0,2:0:1"
76 Compiling and Running the Example Applications
77 ----------------------------------------------
79 When the DPDK has been installed from the ports collection it installs
80 its example applications in "/usr/local/share/dpdk/examples" - also accessible via
81 symlink as "/usr/local/share/examples/dpdk". These examples can be compiled and
82 run as described in :ref:`compiling_sample_apps`. In this case, the required
83 environmental variables should be set as below:
85 * RTE_SDK=/usr/local/share/dpdk
87 * RTE_TARGET=x86_64-native-bsdapp-clang
91 To install a copy of the DPDK compiled using gcc, please download the
92 official DPDK package from http://dpdk.org/ and install manually using
93 the instructions given in the next chapter, :ref:`building_from_source`
95 An example application can therefore be copied to a user's home directory and
96 compiled and run as below:
98 .. code-block:: console
100 user@host:~$ export RTE_SDK=/usr/local/share/dpdk
102 user@host:~$ export RTE_TARGET=x86_64-native-bsdapp-clang
104 user@host:~$ cp -r /usr/local/share/dpdk/examples/helloworld .
106 user@host:~$ cd helloworld/
108 user@host:~/helloworld$ gmake
111 INSTALL-APP helloworld
112 INSTALL-MAP helloworld.map
114 user@host:~/helloworld$ sudo ./build/helloworld -c F -n 2
115 EAL: Contigmem driver has 2 buffers, each of size 1GB
116 EAL: Sysctl reports 8 cpus
117 EAL: Detected lcore 0
118 EAL: Detected lcore 1
119 EAL: Detected lcore 2
120 EAL: Detected lcore 3
121 EAL: Support maximum 64 logical core(s) by configuration.
122 EAL: Detected 4 lcore(s)
123 EAL: Setting up physically contiguous memory...
124 EAL: Mapped memory segment 1 @ 0x802400000: physaddr:0x40000000, len 1073741824
125 EAL: Mapped memory segment 2 @ 0x842400000: physaddr:0x100000000, len 1073741824
126 EAL: WARNING: clock_gettime cannot use CLOCK_MONOTONIC_RAW and HPET is not available - clock timings may be less accurate.
127 EAL: TSC frequency is ~3569023 KHz
128 EAL: PCI scan found 24 devices
129 EAL: Master core 0 is ready (tid=0x802006400)
130 EAL: Core 1 is ready (tid=0x802006800)
131 EAL: Core 3 is ready (tid=0x802007000)
132 EAL: Core 2 is ready (tid=0x802006c00)
133 EAL: PCI device 0000:01:00.0 on NUMA socket 0
134 EAL: probe driver: 8086:10fb rte_ixgbe_pmd
135 EAL: PCI memory mapped at 0x80074a000
136 EAL: PCI memory mapped at 0x8007ca000
137 EAL: PCI device 0000:01:00.1 on NUMA socket 0
138 EAL: probe driver: 8086:10fb rte_ixgbe_pmd
139 EAL: PCI memory mapped at 0x8007ce000
140 EAL: PCI memory mapped at 0x80084e000
141 EAL: PCI device 0000:02:00.0 on NUMA socket 0
142 EAL: probe driver: 8086:10fb rte_ixgbe_pmd
143 EAL: PCI memory mapped at 0x800852000
144 EAL: PCI memory mapped at 0x8008d2000
145 EAL: PCI device 0000:02:00.1 on NUMA socket 0
146 EAL: probe driver: 8086:10fb rte_ixgbe_pmd
147 EAL: PCI memory mapped at 0x801b3f000
148 EAL: PCI memory mapped at 0x8008d6000
156 To run a DPDK process as a non-root user, adjust the permissions on
157 the /dev/contigmem and /dev/uio device nodes as described in section
158 :ref:`running_non_root`
161 For an explanation of the command-line parameters that can be passed to an
162 DPDK application, see section :ref:`running_sample_app`.