doc: update example output in FreeBSD guide
[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 Installing the DPDK FreeBSD Port
15 --------------------------------
16
17 On a system with the ports collection installed in ``/usr/ports``, the DPDK
18 can be installed using the commands:
19
20 .. code-block:: console
21
22     cd /usr/ports/net/dpdk
23
24     make install
25
26 After the installation of the DPDK port, instructions will be printed on
27 how to install the kernel modules required to use the DPDK. A more
28 complete version of these instructions can be found in the sections
29 :ref:`loading_contigmem` and :ref:`loading_nic_uio`. Normally, lines like
30 those below would be added to the file ``/boot/loader.conf``.
31
32 .. code-block:: console
33
34     # Reserve 2 x 1G blocks of contiguous memory using contigmem driver:
35     hw.contigmem.num_buffers=2
36     hw.contigmem.buffer_size=1073741824
37     contigmem_load="YES"
38
39     # Identify NIC devices for DPDK apps to use and load nic_uio driver:
40     hw.nic_uio.bdfs="2:0:0,2:0:1"
41     nic_uio_load="YES"
42
43 .. note::
44
45    Please ensure that the latest patches are applied to third party libraries
46    and software to avoid any known vulnerabilities.
47
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-freebsd-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://core.dpdk.org/download/ 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-freebsd-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
88     EAL: Sysctl reports 8 cpus
89     EAL: Detected 8 lcore(s)
90     EAL: Detected 1 NUMA nodes
91     EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
92     EAL: Selected IOVA mode 'PA'
93     EAL: Contigmem driver has 2 buffers, each of size 1GB
94     EAL: Mapped memory segment 0 @ 0x1040000000: physaddr:0x180000000, len 1073741824
95     EAL: Mapped memory segment 1 @ 0x1080000000: physaddr:0x1c0000000, len 1073741824
96     EAL: PCI device 0000:00:19.0 on NUMA socket 0
97     EAL:   probe driver: 8086:153b net_e1000_em
98     EAL:   0000:00:19.0 not managed by UIO driver, skipping
99     EAL: PCI device 0000:01:00.0 on NUMA socket 0
100     EAL:   probe driver: 8086:1572 net_i40e
101     EAL:   0000:01:00.0 not managed by UIO driver, skipping
102     EAL: PCI device 0000:01:00.1 on NUMA socket 0
103     EAL:   probe driver: 8086:1572 net_i40e
104     EAL:   0000:01:00.1 not managed by UIO driver, skipping
105     EAL: PCI device 0000:01:00.2 on NUMA socket 0
106     EAL:   probe driver: 8086:1572 net_i40e
107     EAL:   0000:01:00.2 not managed by UIO driver, skipping
108     EAL: PCI device 0000:01:00.3 on NUMA socket 0
109     EAL:   probe driver: 8086:1572 net_i40e
110     EAL:   0000:01:00.3 not managed by UIO driver, skipping
111     hello from core 1
112     hello from core 2
113     hello from core 3
114     hello from core 0
115
116
117 .. note::
118
119    To run a DPDK process as a non-root user, adjust the permissions on
120    the ``/dev/contigmem`` and ``/dev/uio device`` nodes as described in section
121    :ref:`running_non_root`
122
123 .. note::
124
125    For an explanation of the command-line parameters that can be passed to an
126    DPDK application, see section :ref:`running_sample_app`.