a895d61806da5a4cb2e1c4c0cb06602e6ba8ff79
[dpdk.git] / doc / guides / freebsd_gsg / install_from_ports.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2010-2014 Intel Corporation.
3
4 .. _install_from_ports:
5
6 Installing DPDK from the Ports Collection
7 =========================================
8
9 The easiest way to get up and running with the DPDK on FreeBSD is to
10 install it from the ports collection. Details of getting and using the ports
11 collection are documented in the
12 `FreeBSD Handbook <http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html>`_.
13
14 .. note::
15
16     Testing has been performed using FreeBSD 10.0-RELEASE (x86_64) and requires the
17     installation of the kernel sources, which should be included during the
18     installation of FreeBSD.
19
20 Installing the DPDK FreeBSD Port
21 --------------------------------
22
23 On a system with the ports collection installed in ``/usr/ports``, the DPDK
24 can be installed using the commands:
25
26 .. code-block:: console
27
28     cd /usr/ports/net/dpdk
29
30     make install
31
32 After the installation of the DPDK port, instructions will be printed on
33 how to install the kernel modules required to use the DPDK. A more
34 complete version of these instructions can be found in the sections
35 :ref:`loading_contigmem` and :ref:`loading_nic_uio`. Normally, lines like
36 those below would be added to the file ``/boot/loader.conf``.
37
38 .. code-block:: console
39
40     # Reserve 2 x 1G blocks of contiguous memory using contigmem driver:
41     hw.contigmem.num_buffers=2
42     hw.contigmem.buffer_size=1073741824
43     contigmem_load="YES"
44
45     # Identify NIC devices for DPDK apps to use and load nic_uio driver:
46     hw.nic_uio.bdfs="2:0:0,2:0:1"
47     nic_uio_load="YES"
48
49 .. note::
50
51    Please ensure that the latest patches are applied to third party libraries
52    and software to avoid any known vulnerabilities.
53
54
55 Compiling and Running the Example Applications
56 ----------------------------------------------
57
58 When the DPDK has been installed from the ports collection it installs
59 its example applications in ``/usr/local/share/dpdk/examples`` - also accessible via
60 symlink as ``/usr/local/share/examples/dpdk``. These examples can be compiled and
61 run as described in :ref:`compiling_sample_apps`. In this case, the required
62 environmental variables should be set as below:
63
64 * ``RTE_SDK=/usr/local/share/dpdk``
65
66 * ``RTE_TARGET=x86_64-native-freebsd-clang``
67
68 .. note::
69
70    To install a copy of the DPDK compiled using gcc, please download the
71    official DPDK package from http://core.dpdk.org/download/ and install manually using
72    the instructions given in the next chapter, :ref:`building_from_source`
73
74 An example application can therefore be copied to a user's home directory and
75 compiled and run as below:
76
77 .. code-block:: console
78
79     export RTE_SDK=/usr/local/share/dpdk
80
81     export RTE_TARGET=x86_64-native-freebsd-clang
82
83     cp -r /usr/local/share/dpdk/examples/helloworld .
84
85     cd helloworld/
86
87     gmake
88       CC main.o
89       LD helloworld
90       INSTALL-APP helloworld
91       INSTALL-MAP helloworld.map
92
93     sudo ./build/helloworld -l 0-3 -n 2
94
95     EAL: Contigmem driver has 2 buffers, each of size 1GB
96     EAL: Sysctl reports 8 cpus
97     EAL: Detected lcore 0
98     EAL: Detected lcore 1
99     EAL: Detected lcore 2
100     EAL: Detected lcore 3
101     EAL: Support maximum 64 logical core(s) by configuration.
102     EAL: Detected 4 lcore(s)
103     EAL: Setting up physically contiguous memory...
104     EAL: Mapped memory segment 1 @ 0x802400000: len 1073741824
105     EAL: Mapped memory segment 2 @ 0x842400000: len 1073741824
106     EAL: WARNING: clock_gettime cannot use CLOCK_MONOTONIC_RAW and HPET
107          is not available - clock timings may be less accurate.
108     EAL: TSC frequency is ~3569023 KHz
109     EAL: PCI scan found 24 devices
110     EAL: Master core 0 is ready (tid=0x802006400)
111     EAL: Core 1 is ready (tid=0x802006800)
112     EAL: Core 3 is ready (tid=0x802007000)
113     EAL: Core 2 is ready (tid=0x802006c00)
114     EAL: PCI device 0000:01:00.0 on NUMA socket 0
115     EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
116     EAL:   PCI memory mapped at 0x80074a000
117     EAL:   PCI memory mapped at 0x8007ca000
118     EAL: PCI device 0000:01:00.1 on NUMA socket 0
119     EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
120     EAL:   PCI memory mapped at 0x8007ce000
121     EAL:   PCI memory mapped at 0x80084e000
122     EAL: PCI device 0000:02:00.0 on NUMA socket 0
123     EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
124     EAL:   PCI memory mapped at 0x800852000
125     EAL:   PCI memory mapped at 0x8008d2000
126     EAL: PCI device 0000:02:00.1 on NUMA socket 0
127     EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
128     EAL:   PCI memory mapped at 0x801b3f000
129     EAL:   PCI memory mapped at 0x8008d6000
130     hello from core 1
131     hello from core 2
132     hello from core 3
133     hello from core 0
134
135 .. note::
136
137    To run a DPDK process as a non-root user, adjust the permissions on
138    the ``/dev/contigmem`` and ``/dev/uio device`` nodes as described in section
139    :ref:`running_non_root`
140
141 .. note::
142
143    For an explanation of the command-line parameters that can be passed to an
144    DPDK application, see section :ref:`running_sample_app`.