xref: /dpdk/doc/guides/nics/nfb.rst (revision 1b4081870eaf2f5dca834edbf469998d43058b5c)
16435f9a0SRastislav Cernay..  SPDX-License-Identifier: BSD-3-Clause
26435f9a0SRastislav Cernay    Copyright 2019 Cesnet
36435f9a0SRastislav Cernay    Copyright 2019 Netcope Technologies
46435f9a0SRastislav Cernay
56435f9a0SRastislav CernayNFB poll mode driver library
66435f9a0SRastislav Cernay=================================
76435f9a0SRastislav Cernay
86435f9a0SRastislav CernayThe NFB poll mode driver library implements support for the Netcope
9f37c57a1SRastislav CernayFPGA Boards (**NFB-40G2, NFB-100G2, NFB-200G2QL**) and Silicom **FB2CGG3** card,
10f37c57a1SRastislav CernayFPGA-based programmable NICs. The NFB PMD uses interface provided by the libnfb
11f37c57a1SRastislav Cernaylibrary to communicate with these cards over the nfb layer.
126435f9a0SRastislav Cernay
136435f9a0SRastislav CernayMore information about the
14878722e7SMartin Spinler`NFB cards <https://www.liberouter.org/technologies/cards/>`_
156435f9a0SRastislav Cernayand used technology
16878722e7SMartin Spinler(`Network Development Kit <https://www.liberouter.org/ndk/>`_)
17878722e7SMartin Spinlercan be found on the `Liberouter website <http://www.liberouter.org/>`_.
186435f9a0SRastislav Cernay
196435f9a0SRastislav Cernay.. note::
206435f9a0SRastislav Cernay
216435f9a0SRastislav Cernay   Currently the driver is supported only on x86_64 architectures.
226435f9a0SRastislav Cernay   Only x86_64 versions of the external libraries are provided.
236435f9a0SRastislav Cernay
246435f9a0SRastislav CernayPrerequisites
256435f9a0SRastislav Cernay-------------
266435f9a0SRastislav Cernay
276435f9a0SRastislav CernayThis PMD requires kernel modules which are responsible for initialization and
286435f9a0SRastislav Cernayallocation of resources needed for nfb layer function.
296435f9a0SRastislav CernayCommunication between PMD and kernel modules is mediated by libnfb library.
306435f9a0SRastislav CernayThese kernel modules and library are not part of DPDK and must be installed
316435f9a0SRastislav Cernayseparately:
326435f9a0SRastislav Cernay
336435f9a0SRastislav Cernay*  **libnfb library**
346435f9a0SRastislav Cernay
356435f9a0SRastislav Cernay   The library provides API for initialization of nfb transfers, receiving and
366435f9a0SRastislav Cernay   transmitting data segments.
376435f9a0SRastislav Cernay
386435f9a0SRastislav Cernay*  **Kernel modules**
396435f9a0SRastislav Cernay
406435f9a0SRastislav Cernay   * nfb
416435f9a0SRastislav Cernay
426435f9a0SRastislav Cernay   Kernel modules manage initialization of hardware, allocation and
436435f9a0SRastislav Cernay   sharing of resources for user space applications.
446435f9a0SRastislav Cernay
456435f9a0SRastislav CernayDependencies can be found here:
46878722e7SMartin Spinler`Netcope common <https://github.com/CESNET/ndk-sw>`_.
476435f9a0SRastislav Cernay
486435f9a0SRastislav CernayVersions of the packages
496435f9a0SRastislav Cernay~~~~~~~~~~~~~~~~~~~~~~~~
506435f9a0SRastislav Cernay
516435f9a0SRastislav CernayThe minimum version of the provided packages:
526435f9a0SRastislav Cernay
536435f9a0SRastislav Cernay* for DPDK from 19.05
546435f9a0SRastislav Cernay
556435f9a0SRastislav CernayConfiguration
566435f9a0SRastislav Cernay-------------
576435f9a0SRastislav Cernay
589c7fd48fSRastislav CernayTimestamps
599c7fd48fSRastislav Cernay
609c7fd48fSRastislav CernayThe PMD supports hardware timestamps of frame receipt on physical network interface. In order to use
619c7fd48fSRastislav Cernaythe timestamps, the hardware timestamping unit must be enabled (follow the documentation of the NFB
62*1b408187SMartin Spinlerproducts). The standard `RTE_ETH_RX_OFFLOAD_TIMESTAMP` flag can be used for this feature.
639c7fd48fSRastislav Cernay
64*1b408187SMartin SpinlerWhen the timestamps are enabled, a timestamp validity flag is set in the MBUFs
659c7fd48fSRastislav Cernaycontaining received frames and timestamp is inserted into the `rte_mbuf` struct.
669c7fd48fSRastislav Cernay
679c7fd48fSRastislav CernayThe timestamp is an `uint64_t` field. Its lower 32 bits represent *seconds* portion of the timestamp
689c7fd48fSRastislav Cernay(number of seconds elapsed since 1.1.1970 00:00:00 UTC) and its higher 32 bits represent
699c7fd48fSRastislav Cernay*nanosecond* portion of the timestamp (number of nanoseconds elapsed since the beginning of the
709c7fd48fSRastislav Cernaysecond in the *seconds* portion.
719c7fd48fSRastislav Cernay
729c7fd48fSRastislav Cernay
736435f9a0SRastislav CernayUsing the NFB PMD
746435f9a0SRastislav Cernay----------------------
756435f9a0SRastislav Cernay
766435f9a0SRastislav CernayKernel modules have to be loaded before running the DPDK application.
776435f9a0SRastislav Cernay
786435f9a0SRastislav CernayNFB card architecture
796435f9a0SRastislav Cernay---------------------
806435f9a0SRastislav Cernay
816435f9a0SRastislav CernayThe NFB cards are multi-port multi-queue cards, where (generally) data from any
826435f9a0SRastislav CernayEthernet port may be sent to any queue.
836435f9a0SRastislav CernayThey are represented in DPDK as a single port.
846435f9a0SRastislav Cernay
85d629b7b5SJohn McNamaraNFB-200G2QL card employs an add-on cable which allows to connect it to two
866435f9a0SRastislav Cernayphysical PCI-E slots at the same time (see the diagram below).
876435f9a0SRastislav CernayThis is done to allow 200 Gbps of traffic to be transferred through the PCI-E
886435f9a0SRastislav Cernaybus (note that a single PCI-E 3.0 x16 slot provides only 125 Gbps theoretical
896435f9a0SRastislav Cernaythroughput).
906435f9a0SRastislav Cernay
916435f9a0SRastislav CernayAlthough each slot may be connected to a different CPU and therefore to a different
926435f9a0SRastislav CernayNUMA node, the card is represented as a single port in DPDK. To work with data
936435f9a0SRastislav Cernayfrom the individual queues on the right NUMA node, connection of NUMA nodes on
946435f9a0SRastislav Cernayfirst and last queue (each NUMA node has half of the queues) need to be checked.
956435f9a0SRastislav Cernay
966435f9a0SRastislav CernayLimitations
976435f9a0SRastislav Cernay-----------
986435f9a0SRastislav Cernay
996435f9a0SRastislav CernayDriver is usable only on Linux architecture, namely on CentOS.
1006435f9a0SRastislav Cernay
1016435f9a0SRastislav CernaySince a card is always represented as a single port, but can be connected to two
1026435f9a0SRastislav CernayNUMA nodes, there is need for manual check where master/slave is connected.
1036435f9a0SRastislav Cernay
1046435f9a0SRastislav CernayExample of usage
1056435f9a0SRastislav Cernay----------------
1066435f9a0SRastislav Cernay
1076435f9a0SRastislav CernayRead packets from 0. and 1. receive queue and write them to 0. and 1.
1086435f9a0SRastislav Cernaytransmit queue:
1096435f9a0SRastislav Cernay
1106435f9a0SRastislav Cernay.. code-block:: console
1116435f9a0SRastislav Cernay
11268d99d00SCiara Power   ./<build_dir>/app/dpdk-testpmd -l 0-3 -n 2 \
1136435f9a0SRastislav Cernay   -- --port-topology=chained --rxq=2 --txq=2 --nb-cores=2 -i -a
1146435f9a0SRastislav Cernay
1156435f9a0SRastislav CernayExample output:
1166435f9a0SRastislav Cernay
1176435f9a0SRastislav Cernay.. code-block:: console
1186435f9a0SRastislav Cernay
1196435f9a0SRastislav Cernay   [...]
1206435f9a0SRastislav Cernay   EAL: PCI device 0000:06:00.0 on NUMA socket -1
1216435f9a0SRastislav Cernay   EAL:   probe driver: 1b26:c1c1 net_nfb
1226435f9a0SRastislav Cernay   PMD: Initializing NFB device (0000:06:00.0)
1236435f9a0SRastislav Cernay   PMD: Available DMA queues RX: 8 TX: 8
1246435f9a0SRastislav Cernay   PMD: NFB device (0000:06:00.0) successfully initialized
1256435f9a0SRastislav Cernay   Interactive-mode selected
1266435f9a0SRastislav Cernay   Auto-start selected
1276435f9a0SRastislav Cernay   Configuring Port 0 (socket 0)
1286435f9a0SRastislav Cernay   Port 0: 00:11:17:00:00:00
1296435f9a0SRastislav Cernay   Checking link statuses...
1306435f9a0SRastislav Cernay   Port 0 Link Up - speed 10000 Mbps - full-duplex
1316435f9a0SRastislav Cernay   Done
1326435f9a0SRastislav Cernay   Start automatic packet forwarding
1336435f9a0SRastislav Cernay     io packet forwarding - CRC stripping disabled - packets/burst=32
1346435f9a0SRastislav Cernay     nb forwarding cores=2 - nb forwarding ports=1
1356435f9a0SRastislav Cernay     RX queues=2 - RX desc=128 - RX free threshold=0
1366435f9a0SRastislav Cernay     RX threshold registers: pthresh=0 hthresh=0 wthresh=0
1376435f9a0SRastislav Cernay     TX queues=2 - TX desc=512 - TX free threshold=0
1386435f9a0SRastislav Cernay     TX threshold registers: pthresh=0 hthresh=0 wthresh=0
1396435f9a0SRastislav Cernay     TX RS bit threshold=0 - TXQ flags=0x0
1406435f9a0SRastislav Cernay   testpmd>
141