New upstream version 17.11-rc3
[deb_dpdk.git] / doc / guides / nics / nfp.rst
1 ..  BSD LICENSE
2     Copyright(c) 2015-2017 Netronome Systems, Inc. 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 NFP poll mode driver library
32 ============================
33
34 Netronome's sixth generation of flow processors pack 216 programmable
35 cores and over 100 hardware accelerators that uniquely combine packet,
36 flow, security and content processing in a single device that scales
37 up to 400 Gbps.
38
39 This document explains how to use DPDK with the Netronome Poll Mode
40 Driver (PMD) supporting Netronome's Network Flow Processor 6xxx
41 (NFP-6xxx) and Netronome's Flow Processor 4xxx (NFP-4xxx).
42
43 NFP is a SRIOV capable device and the PMD driver supports the physical
44 function (PF) and virtual functions (VFs).
45
46 Dependencies
47 ------------
48
49 Before using the Netronome's DPDK PMD some NFP configuration,
50 which is not related to DPDK, is required. The system requires
51 installation of **Netronome's BSP (Board Support Package)** along
52 with some specific NFP firmware application. Netronome's NSP ABI
53 version should be 0.20 or higher.
54
55 If you have a NFP device you should already have the code and
56 documentation for doing all this configuration. Contact
57 **support@netronome.com** to obtain the latest available firmware.
58
59 The NFP Linux netdev kernel driver for VFs is part of vanilla kernel
60 since kernel version 4.5, and support for the PF since kernel version
61 4.11. Support for older kernels can be obtained on Github at
62 **https://github.com/Netronome/nfp-drv-kmods** along with build
63 instructions.
64
65 NFP PMD needs to be used along with UIO ``igb_uio`` or VFIO (``vfio-pci``)
66 Linux kernel driver.
67
68 Building the software
69 ---------------------
70
71 Netronome's PMD code is provided in the **drivers/net/nfp** directory.
72 Although NFP PMD has NetronomeĀ“s BSP dependencies, it is possible to
73 compile it along with other DPDK PMDs even if no BSP was installed before.
74 Of course, a DPDK app will require such a BSP installed for using the
75 NFP PMD, along with a specific NFP firmware application.
76
77 Default PMD configuration is at **common_linuxapp configuration** file:
78
79 - **CONFIG_RTE_LIBRTE_NFP_PMD=y**
80
81 Once DPDK is built all the DPDK apps and examples include support for
82 the NFP PMD.
83
84
85 Driver compilation and testing
86 ------------------------------
87
88 Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
89 for details.
90
91 Using the PF
92 ------------
93
94 NFP PMD has support for using the NFP PF as another DPDK port, but it does not
95 have any functionality for controlling VFs. In fact, it is not possible to use
96 the PMD with the VFs if the PF is being used by DPDK, that is, with the NFP PF
97 bound to ``igb_uio`` or ``vfio-pci`` kernel drivers. Future DPDK version will
98 have a PMD able to work with the PF and VFs at the same time and with the PF
99 implementing VF management along with other PF-only functionalities/offloads.
100
101 The PMD PF has extra work to do which will delay the DPDK app initialization
102 like checking if a firmware is already available in the device, uploading the
103 firmware if necessary, and configure the Link state properly when starting or
104 stopping a PF port. Note that firmware upload is not always necessary which is
105 the main delay for NFP PF PMD initialization.
106
107 Depending on the Netronome product installed in the system, firmware files
108 should be available under ``/lib/firmware/netronome``. DPDK PMD supporting the
109 PF requires a specific link, ``/lib/firmware/netronome/nic_dpdk_default.nffw``,
110 which should be created automatically with Netronome's Agilio products
111 installation.
112
113 PF multiport support
114 --------------------
115
116 Some NFP cards support several physical ports with just one single PCI device.
117 DPDK core is designed with the 1:1 relationship between PCI devices and DPDK
118 ports, so NFP PMD PF support requires handling the multiport case specifically.
119 During NFP PF initialization, the PMD will extract the information about the
120 number of PF ports from the firmware and will create as many DPDK ports as
121 needed.
122
123 Because the unusual relationship between a single PCI device and several DPDK
124 ports, there are some limitations when using more than one PF DPDK ports: there
125 is no support for RX interrupts and it is not possible either to use those PF
126 ports with the device hotplug functionality.
127
128
129 System configuration
130 --------------------
131
132 #. **Enable SR-IOV on the NFP device:** The current NFP PMD supports the PF and
133    the VFs on a NFP device. However, it is not possible to work with both at the
134    same time because the VFs require the PF being bound to the NFP PF Linux
135    netdev driver.  Make sure you are working with a kernel with NFP PF support or
136    get the drivers from the above Github repository and follow the instructions
137    for building and installing it.
138
139    Virtual Functions need to be enabled before they can be used with the PMD.
140    Before enabling the VFs it is useful to obtain information about the
141    current NFP PCI device detected by the system:
142
143    .. code-block:: console
144
145       lspci -d19ee:
146
147    Now, for example, configure two virtual functions on a NFP-6xxx device
148    whose PCI system identity is "0000:03:00.0":
149
150    .. code-block:: console
151
152       echo 2 > /sys/bus/pci/devices/0000:03:00.0/sriov_numvfs
153
154    The result of this command may be shown using lspci again:
155
156    .. code-block:: console
157
158       lspci -d19ee: -k
159
160    Two new PCI devices should appear in the output of the above command. The
161    -k option shows the device driver, if any, that devices are bound to.
162    Depending on the modules loaded at this point the new PCI devices may be
163    bound to nfp_netvf driver.