f-stack/dpdk/doc/guides/nics/nfp.rst

393 lines
16 KiB
ReStructuredText
Raw Normal View History

2020-06-18 16:55:50 +00:00
.. SPDX-License-Identifier: BSD-3-Clause
Copyright(c) 2015-2017 Netronome Systems, Inc. All rights reserved.
2025-01-10 11:50:43 +00:00
Copyright(c) 2021 Corigine, Inc. All rights reserved.
2017-04-21 10:43:26 +00:00
NFP poll mode driver library
============================
2025-01-10 11:50:43 +00:00
Netronome and Corigine's sixth generation of flow processors pack 216
programmable cores and over 100 hardware accelerators that uniquely combine
packet, flow, security and content processing in a single device that scales
2018-11-21 08:34:11 +00:00
up to 400-Gb/s.
2017-04-21 10:43:26 +00:00
2025-01-10 11:50:43 +00:00
This document explains how to use DPDK with the Network Flow Processor (NFP)
Poll Mode Driver (PMD) supporting Netronome and Corigine's NFP-6xxx, NFP-4xxx
and NFP-38xx product lines.
2017-04-21 10:43:26 +00:00
2025-01-10 11:50:43 +00:00
NFP is a SR-IOV capable device and the PMD supports the physical
2018-11-21 08:34:11 +00:00
function (PF) and the virtual functions (VFs).
2017-04-21 10:43:26 +00:00
Dependencies
------------
2025-01-10 11:50:43 +00:00
Before using the NFP DPDK PMD some NFP configuration,
2017-04-21 10:43:26 +00:00
which is not related to DPDK, is required. The system requires
2025-01-10 11:50:43 +00:00
installation of the **nfp-bsp (Board Support Package)** along
with a specific NFP firmware application. The NSP ABI
version should be 0.20 or higher.
2017-04-21 10:43:26 +00:00
2025-01-10 11:50:43 +00:00
If you have a NFP device you should already have the documentation to perform
this configuration. Contact **support@netronome.com** (for Netronome products)
or **smartnic-support@corigine.com** (for Corigine products) to obtain the
latest available firmware.
2017-04-21 10:43:26 +00:00
2018-11-21 08:34:11 +00:00
The NFP Linux netdev kernel driver for VFs has been a part of the
vanilla kernel since kernel version 4.5, and support for the PF
since kernel version 4.11. Support for older kernels can be obtained
on Github at
**https://github.com/Netronome/nfp-drv-kmods** along with the build
2017-04-21 10:43:26 +00:00
instructions.
NFP PMD needs to be used along with UIO ``igb_uio`` or VFIO (``vfio-pci``)
Linux kernel driver.
2017-04-21 10:43:26 +00:00
Building the software
---------------------
2025-01-10 11:50:43 +00:00
The NFP PMD code is provided in the **drivers/net/nfp** directory. Although
NFP PMD has BSP dependencies, it is possible to compile it along with other
DPDK PMDs even if no BSP was installed previously.
Of course, a DPDK app will require such a BSP installed for using the
NFP PMD, along with a specific NFP firmware application.
2018-11-21 08:34:11 +00:00
Once the DPDK is built all the DPDK apps and examples include support for
2017-04-21 10:43:26 +00:00
the NFP PMD.
Driver compilation and testing
------------------------------
2017-04-21 10:43:26 +00:00
2025-01-10 11:50:43 +00:00
Refer to the document
:ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` for details.
2017-04-21 10:43:26 +00:00
Using the PF
------------
2017-04-21 10:43:26 +00:00
2019-06-25 11:12:58 +00:00
The PMD PF has extra work to do which will delay the DPDK app initialization
2025-01-10 11:50:43 +00:00
like uploading the firmware and configure the Link state properly when starting
or stopping a PF port. Since DPDK 18.05 the firmware upload happens when
2019-06-25 11:12:58 +00:00
a PF is initialized, which was not always true with older DPDK versions.
2025-01-10 11:50:43 +00:00
Depending on the product installed in the system, firmware files should be
available under ``/lib/firmware/netronome``. DPDK PMD supporting the PF looks
for a firmware file in this order:
2019-06-25 11:12:58 +00:00
1) First try to find a firmware image specific for this device using the
NFP serial number:
serial-00-15-4d-12-20-65-10-ff.nffw
2) Then try the PCI name:
pci-0000:04:00.0.nffw
3) Finally try the card type and media:
nic_AMDA0099-0001_2x25.nffw
2025-01-10 11:50:43 +00:00
Netronome and Corigine's software packages install firmware files under
``/lib/firmware/netronome`` to support all the Netronome and Corigine SmartNICs
and different firmware applications. This is usually done using file names
based on SmartNIC type and media and with a directory per firmware application.
Options 1 and 2 for firmware filenames allow more than one SmartNIC, same type
of SmartNIC or different ones, and to upload a different firmware to each
SmartNIC.
2019-06-25 11:12:58 +00:00
2021-01-28 17:08:59 +00:00
.. Note::
2025-01-10 11:50:43 +00:00
Currently the NFP PMD supports using the PF with Agilio Firmware with
NFD3 and Agilio Firmware with NFDk. See
`Netronome Support <https://help.netronome.com/support/solutions>`_.
2023-09-13 12:21:49 +00:00
for more information on the various firmwares supported by the Netronome
2025-01-10 11:50:43 +00:00
Agilio SmartNIC range, or
`Corigine Support <https://www.corigine.com/productsOverviewList-30.html>`_.
for more information about Corigine's range.
PF multiport support
--------------------
2017-04-21 10:43:26 +00:00
2021-01-28 17:08:59 +00:00
The NFP PMD can work with up to 8 ports on the same PF device. The number of
available ports is firmware and hardware dependent, and the driver looks for a
firmware symbol during initialization to know how many can be used.
2017-04-21 10:43:26 +00:00
2021-01-28 17:08:59 +00:00
DPDK apps work with ports, and a port is usually a PF or a VF PCI device.
However, with the NFP PF multiport there is just one PF PCI device. Supporting
2025-01-10 11:50:43 +00:00
this particular configuration requires the PMD to create ports in a special
way, although once they are created, DPDK apps should be able to use them as
normal PCI ports.
2017-04-21 10:43:26 +00:00
2025-01-10 11:50:43 +00:00
NFP ports belonging to the same PF can be seen inside PMD initialization with a
2022-09-02 04:40:05 +00:00
suffix added to the PCI ID: wwww:xx:yy.z_portn. For example, a PF with PCI ID
2021-01-28 17:08:59 +00:00
0000:03:00.0 and four ports is seen by the PMD code as:
.. code-block:: console
2022-09-02 04:40:05 +00:00
0000:03:00.0_port0
0000:03:00.0_port1
0000:03:00.0_port2
0000:03:00.0_port3
2021-01-28 17:08:59 +00:00
.. Note::
There are some limitations with multiport support: RX interrupts and
device hot-plugging are not supported.
2017-04-21 10:43:26 +00:00
2020-06-18 16:55:50 +00:00
PF multiprocess support
-----------------------
2025-01-10 11:50:43 +00:00
The NFP PMD supports the PF multiprocess.
Having basic multiprocess support is important for allowing development
and debugging through the PF using a secondary process,
which will create a CPP bridge for user space tools accessing the NFP.
2020-06-18 16:55:50 +00:00
System configuration
--------------------
2017-04-21 10:43:26 +00:00
#. **Enable SR-IOV on the NFP device:** The current NFP PMD supports the PF and
2025-01-10 11:50:43 +00:00
the VFs on a NFP device. However, it is not possible to work with both at
the same time when using the ``nfp`` Linux netdev kernel driver. If the PF
is bound to the ``nfp`` kernel module, and VFs are created, the VFs may be
bound to the ``vfio-pci`` kernel module. It is also possible to bind the PF
to the ``vfio-pci`` kernel module, and create VFs afterwards. This requires
loading the ``vfio-pci`` module with the following parameters:
.. code-block:: console
modprobe vfio-pci enable_sriov=1 disable_idle_d3=1
2017-04-21 10:43:26 +00:00
2025-01-10 11:50:43 +00:00
VFs need to be enabled before they can be used with the PMD. Before enabling
the VFs it is useful to obtain information about the current NFP PCI device
detected by the system. This can be done on Netronome SmartNICs using:
2017-04-21 10:43:26 +00:00
.. code-block:: console
2025-01-10 11:50:43 +00:00
lspci -d 19ee:
2017-04-21 10:43:26 +00:00
2025-01-10 11:50:43 +00:00
and on Corigine SmartNICs using:
.. code-block:: console
lspci -d 1da8:
Now, for example, to configure two virtual functions on a NFP device
2017-04-21 10:43:26 +00:00
whose PCI system identity is "0000:03:00.0":
.. code-block:: console
echo 2 > /sys/bus/pci/devices/0000:03:00.0/sriov_numvfs
2025-01-10 11:50:43 +00:00
The result of this command may be shown using lspci again on Netronome
SmartNICs:
2017-04-21 10:43:26 +00:00
.. code-block:: console
2025-01-10 11:50:43 +00:00
lspci -kd 19ee:
and on Corigine SmartNICs:
.. code-block:: console
lspci -kd 1da8:
2017-04-21 10:43:26 +00:00
Two new PCI devices should appear in the output of the above command. The
2025-01-10 11:50:43 +00:00
-k option shows the device driver, if any, that the devices are bound to.
Depending on the modules loaded, at this point the new PCI devices may be
bound to the ``nfp`` kernel driver or ``vfio-pci``.
2023-09-13 12:21:49 +00:00
Flow offload
------------
2025-01-10 11:50:43 +00:00
Using the flower firmware application, some types of Netronome or Corigine
SmartNICs can offload the flows onto the cards.
2023-09-13 12:21:49 +00:00
The flower firmware application requires the PMD running two services:
* PF vNIC service: handling the feedback traffic.
* ctrl vNIC service: communicate between PMD and firmware through
2025-01-10 11:50:43 +00:00
control messages.
2023-09-13 12:21:49 +00:00
To achieve the offload of flow, the representor ports are exposed to OVS.
2025-01-10 11:50:43 +00:00
The flower firmware application supports representor port for VF and physical
2023-09-13 12:21:49 +00:00
port. There will always exist a representor port for each physical port,
and the number of the representor port for VF is specified by the user through
2025-01-10 11:50:43 +00:00
a parameter.
2023-09-13 12:21:49 +00:00
In the Rx direction, the flower firmware application will prepend the input
port information into metadata for each packet which can't offloaded. The PF
vNIC service will keep polling packets from the firmware, and multiplex them
to the corresponding representor port.
In the Tx direction, the representor port will prepend the output port
2025-01-10 11:50:43 +00:00
information into metadata for each packet, and then send it to the firmware
through the PF vNIC.
The ctrl vNIC service handles various control messages, for example, the
creation and configuration of representor port, the pattern and action of flow
rules, the statistics of flow rules, etc.
Metadata Format
---------------
The NFP packet metadata format
NFD3
~~~~
The packet metadata starts with a field type header that can contain up-to
8 4-bit datatype specifiers (32-bits in total). This is followed by up to 8
32-bit words of data for each field described in the header. And directly
following the metadata (header and data) comes the packet.
The order of type is correspond with the data, but the nums of data field are
decided by the corresponding type, if the type need N data field, it need to
be wrote N times in the heads.
::
3 2 1 0
2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type7 | Type6 | Type5 | Type4 | Type3 | Type2 | Type1 | Type0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 3 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 5 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 6 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 7 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Packet Data |
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
NFDk
~~~~
The packet metadata starts with a field type header that can contain 8 bit
metadata length and 6 4-bit datatype specifiers (32-bits in total). This is
followed by up to 6 32-bit words of data for each field described in the
header. And directly following the metadata (header and data) comes the
packet.
The order of type is correspond with the data, but the nums of data field are
decided by the corresponding type, if the type need N data field, it need to
be wrote N times in the heads. It is the same with NFD3.
::
3 2 1 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type5 | Type4 | Type3 | Type2 | Type1 | Type0 |metadata length|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 3 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 4 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data for field 5 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Packet Data |
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
There are two classes of metadata one for ingress and one for egress. In each
class the supported NFP types are:
RX
~~
NFP_NET_META_HASH
The hash type is 4 bit which is next field type after NFP_NET_META_HASH in
the header. The hash value is 32 bit which need 1 data field.
::
-----------------------------------------------------------------
3 2 1 0
2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Hash value |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
NFP_NET_META_VLAN
Metadata with L2 (1W/4B)
::
----------------------------------------------------------------
3 2 1 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|f| reserved | tpid| PCP |p| vlan outermost VID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
^ ^
NOTE: | TCI |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
f 0 -> not stripping
1 -> stripping
tpid 0 -> RTE_ETHER_TYPE_VLAN 0x8100 IEEE 802.1Q VLAN tagging
1 -> RTE_ETHER_TYPE_QINQ 0x88a8 IEEE 802.1ad QINQ tagging
Tpid just be stored, now we don't handle it
The vlan[0] is the innermost VLAN
The vlan[1] is the QinQ info
NFP_NET_META_IPSEC
The IPsec type requires 4 bit.
The SA index value is 32 bit which need 1 data field.
::
----------------------------------------------------------------
3 2 1 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| sa_idx |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
TX
~~
NFP_NET_META_VLAN
::
-----------------------------------------------------------------
3 2 1 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TPID | PCP |p| vlan outermost VID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
^ ^
NOTE: | TCI |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
NFP_NET_META_IPSEC
The IPsec type requires 12 bit, because it requires three data fields.
::
----------------------------------------------------------------
3 2 1 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| sa_idx |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| nfp_ipsec_force_seq_low |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| nfp_ipsec_force_seq_hi |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The sa_idx is 32 bit which need 1 data field.
The nfp_ipsec_force_seq_low & nfp_ipsec_force_seq_hi is Anti-re-anti-count,
which is 64 bit need two data fields.