c946c33c2544d76c1f3dce655c79711f152ca413
[dpdk.git] / doc / guides / freebsd_gsg / install_from_ports.rst
1 ..  BSD LICENSE
2     Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
3     All rights reserved.
4
5     Redistribution and use in source and binary forms, with or without
6     modification, are permitted provided that the following conditions
7     are met:
8
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
14     distribution.
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.
18
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.
30
31 .. _install_from_ports:
32
33 Installing Intel® DPDK from the Ports Collection
34 ================================================
35
36 The easiest way to get up and running with the Intel® 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:
39
40         https://www.freebsd.org/doc/handbook/ports-using.html
41
42 .. note::
43
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*.
47
48 Installing the Intel® DPDK FreeBSD Port
49 ---------------------------------------
50
51 On a system with the ports collection installed in /usr/ports, the Intel® DPDK
52 can be installed using the commands:
53
54 .. code-block:: console
55
56     root@host:~ # cd /usr/ports/net/dpdk
57
58     root@host:~ # make install
59
60 After the installation of the Intel® DPDK port, instructions will be printed on
61 how to install the kernel modules required to use the Intel® 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".
65
66 .. code-block:: console
67
68     # reserve 2 x 1G blocks of contiguous memory using contigmem driver
69     hw.contigmem.num_buffers=2
70     hw.contigmem.buffer_size=1073741824
71     contigmem_load="YES"
72     # identify NIC devices for Intel® DPDK apps to use and load nic_uio driver
73     hw.nic_uio.bdfs="2:0:0,2:0:1"
74     nic_uio_load="YES"
75
76 Compiling and Running the Example Applications
77 ----------------------------------------------
78
79 When the Intel® 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:
84
85 * RTE_SDK=/usr/local/share/dpdk
86
87 * RTE_TARGET=x86_64-native-bsdapp-clang
88
89 .. note::
90
91         To install a copy of the Intel® DPDK compiled using gcc, please download the
92         official Intel® DPDK package from http://dpdk.org/ and install manually using
93         the instructions given in the next chapter, :ref:`building_from_source`
94
95 An example application can therefore be copied to a user's home directory and
96 compiled and run as below:
97
98 .. code-block:: console
99
100     user@host:~$ export RTE_SDK=/usr/local/share/dpdk
101
102     user@host:~$ export RTE_TARGET=x86_64-native-bsdapp-clang
103
104     user@host:~$ cp -r /usr/local/share/dpdk/examples/helloworld .
105
106     user@host:~$ cd helloworld/
107
108     user@host:~/helloworld$ gmake
109       CC main.o
110       LD helloworld
111       INSTALL-APP helloworld
112       INSTALL-MAP helloworld.map
113
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
149     hello from core 1
150     hello from core 2
151     hello from core 3
152     hello from core 0
153
154 .. note::
155
156         To run an Intel® 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`
159
160 .. note::
161         For an explanation of the command-line parameters that can be passed to an
162         Intel® DPDK application, see section :ref:`running_sample_app`.