New upstream version 18.02
[deb_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 Compiling and Running the Example Applications
50 ----------------------------------------------
51
52 When the DPDK has been installed from the ports collection it installs
53 its example applications in ``/usr/local/share/dpdk/examples`` - also accessible via
54 symlink as ``/usr/local/share/examples/dpdk``. These examples can be compiled and
55 run as described in :ref:`compiling_sample_apps`. In this case, the required
56 environmental variables should be set as below:
57
58 * ``RTE_SDK=/usr/local/share/dpdk``
59
60 * ``RTE_TARGET=x86_64-native-bsdapp-clang``
61
62 .. note::
63
64    To install a copy of the DPDK compiled using gcc, please download the
65    official DPDK package from http://dpdk.org/ and install manually using
66    the instructions given in the next chapter, :ref:`building_from_source`
67
68 An example application can therefore be copied to a user's home directory and
69 compiled and run as below:
70
71 .. code-block:: console
72
73     export RTE_SDK=/usr/local/share/dpdk
74
75     export RTE_TARGET=x86_64-native-bsdapp-clang
76
77     cp -r /usr/local/share/dpdk/examples/helloworld .
78
79     cd helloworld/
80
81     gmake
82       CC main.o
83       LD helloworld
84       INSTALL-APP helloworld
85       INSTALL-MAP helloworld.map
86
87     sudo ./build/helloworld -l 0-3 -n 2
88
89     EAL: Contigmem driver has 2 buffers, each of size 1GB
90     EAL: Sysctl reports 8 cpus
91     EAL: Detected lcore 0
92     EAL: Detected lcore 1
93     EAL: Detected lcore 2
94     EAL: Detected lcore 3
95     EAL: Support maximum 64 logical core(s) by configuration.
96     EAL: Detected 4 lcore(s)
97     EAL: Setting up physically contiguous memory...
98     EAL: Mapped memory segment 1 @ 0x802400000: len 1073741824
99     EAL: Mapped memory segment 2 @ 0x842400000: len 1073741824
100     EAL: WARNING: clock_gettime cannot use CLOCK_MONOTONIC_RAW and HPET
101          is not available - clock timings may be less accurate.
102     EAL: TSC frequency is ~3569023 KHz
103     EAL: PCI scan found 24 devices
104     EAL: Master core 0 is ready (tid=0x802006400)
105     EAL: Core 1 is ready (tid=0x802006800)
106     EAL: Core 3 is ready (tid=0x802007000)
107     EAL: Core 2 is ready (tid=0x802006c00)
108     EAL: PCI device 0000:01:00.0 on NUMA socket 0
109     EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
110     EAL:   PCI memory mapped at 0x80074a000
111     EAL:   PCI memory mapped at 0x8007ca000
112     EAL: PCI device 0000:01:00.1 on NUMA socket 0
113     EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
114     EAL:   PCI memory mapped at 0x8007ce000
115     EAL:   PCI memory mapped at 0x80084e000
116     EAL: PCI device 0000:02:00.0 on NUMA socket 0
117     EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
118     EAL:   PCI memory mapped at 0x800852000
119     EAL:   PCI memory mapped at 0x8008d2000
120     EAL: PCI device 0000:02:00.1 on NUMA socket 0
121     EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
122     EAL:   PCI memory mapped at 0x801b3f000
123     EAL:   PCI memory mapped at 0x8008d6000
124     hello from core 1
125     hello from core 2
126     hello from core 3
127     hello from core 0
128
129 .. note::
130
131    To run a DPDK process as a non-root user, adjust the permissions on
132    the ``/dev/contigmem`` and ``/dev/uio device`` nodes as described in section
133    :ref:`running_non_root`
134
135 .. note::
136
137    For an explanation of the command-line parameters that can be passed to an
138    DPDK application, see section :ref:`running_sample_app`.