10b5927cbSNicolas Chautru.. SPDX-License-Identifier: BSD-3-Clause 20b5927cbSNicolas Chautru Copyright(c) 2019 Intel Corporation 30b5927cbSNicolas Chautru 40b5927cbSNicolas ChautruIntel(R) FPGA 5GNR FEC Poll Mode Driver 50b5927cbSNicolas Chautru======================================= 60b5927cbSNicolas Chautru 70b5927cbSNicolas ChautruThe BBDEV FPGA 5GNR FEC poll mode driver (PMD) supports an FPGA implementation of a VRAN 80b5927cbSNicolas ChautruLDPC Encode / Decode 5GNR wireless acceleration function, using Intel's PCI-e and FPGA 90b5927cbSNicolas Chautrubased Vista Creek device. 100b5927cbSNicolas Chautru 110b5927cbSNicolas ChautruFeatures 120b5927cbSNicolas Chautru-------- 130b5927cbSNicolas Chautru 140b5927cbSNicolas ChautruFPGA 5GNR FEC PMD supports the following features: 150b5927cbSNicolas Chautru 1644dc6faaSNicolas Chautru- LDPC Encode in the DL 1744dc6faaSNicolas Chautru- LDPC Decode in the UL 180b5927cbSNicolas Chautru- 8 VFs per PF (physical device) 190b5927cbSNicolas Chautru- Maximum of 32 UL queues per VF 200b5927cbSNicolas Chautru- Maximum of 32 DL queues per VF 210b5927cbSNicolas Chautru- PCIe Gen-3 x8 Interface 220b5927cbSNicolas Chautru- MSI-X 230b5927cbSNicolas Chautru- SR-IOV 240b5927cbSNicolas Chautru 2544dc6faaSNicolas ChautruFPGA 5GNR FEC PMD supports the following BBDEV capabilities: 2644dc6faaSNicolas Chautru 2744dc6faaSNicolas Chautru* For the LDPC encode operation: 2844dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` : set to attach CRC24B to CB(s) 2944dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_RATE_MATCH`` : if set then do not do Rate Match bypass 3044dc6faaSNicolas Chautru 3144dc6faaSNicolas Chautru* For the LDPC decode operation: 3244dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` : check CRC24B from CB(s) 3344dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE`` : disable early termination 3444dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` : drops CRC24B bits appended while decoding 3544dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE`` : provides an input for HARQ combining 3644dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE`` : provides an input for HARQ combining 3744dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE`` : HARQ memory input is internal 3844dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE`` : HARQ memory output is internal 3944dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK`` : loopback data to/from HARQ memory 4044dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS`` : HARQ memory includes the fillers bits 4144dc6faaSNicolas Chautru 4244dc6faaSNicolas Chautru 430b5927cbSNicolas ChautruLimitations 440b5927cbSNicolas Chautru----------- 450b5927cbSNicolas Chautru 460b5927cbSNicolas ChautruFPGA 5GNR FEC does not support the following: 470b5927cbSNicolas Chautru 480b5927cbSNicolas Chautru- Scatter-Gather function 490b5927cbSNicolas Chautru 500b5927cbSNicolas Chautru 510b5927cbSNicolas ChautruInstallation 520b5927cbSNicolas Chautru------------ 530b5927cbSNicolas Chautru 5407a2a572SCiara PowerSection 3 of the DPDK manual provides instructions on installing and compiling DPDK. 550b5927cbSNicolas Chautru 560b5927cbSNicolas ChautruDPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual. 570b5927cbSNicolas ChautruThe bbdev test application has been tested with a configuration 40 x 1GB hugepages. The 580b5927cbSNicolas Chautruhugepage configuration of a server may be examined using: 590b5927cbSNicolas Chautru 600b5927cbSNicolas Chautru.. code-block:: console 610b5927cbSNicolas Chautru 620b5927cbSNicolas Chautru grep Huge* /proc/meminfo 630b5927cbSNicolas Chautru 640b5927cbSNicolas Chautru 650b5927cbSNicolas ChautruInitialization 660b5927cbSNicolas Chautru-------------- 670b5927cbSNicolas Chautru 680b5927cbSNicolas ChautruWhen the device first powers up, its PCI Physical Functions (PF) can be listed through this command: 690b5927cbSNicolas Chautru 700b5927cbSNicolas Chautru.. code-block:: console 710b5927cbSNicolas Chautru 720b5927cbSNicolas Chautru sudo lspci -vd8086:0d8f 730b5927cbSNicolas Chautru 740b5927cbSNicolas ChautruThe physical and virtual functions are compatible with Linux UIO drivers: 7533f32941SDavid Marchand``vfio_pci`` and ``igb_uio``. However, in order to work the FPGA 5GNR FEC device firstly needs 760b5927cbSNicolas Chautruto be bound to one of these linux drivers through DPDK. 770b5927cbSNicolas Chautru 7833f32941SDavid MarchandFor more details on how to bind the PF device and create VF devices, see 7933f32941SDavid Marchand:ref:`linux_gsg_binding_kernel`. 8044dc6faaSNicolas Chautru 812d430643SNicolas ChautruConfigure the VFs through PF 822d430643SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 832d430643SNicolas Chautru 842d430643SNicolas ChautruThe PCI virtual functions must be configured before working or getting assigned 852d430643SNicolas Chautruto VMs/Containers. The configuration involves allocating the number of hardware 862d430643SNicolas Chautruqueues, priorities, load balance, bandwidth and other settings necessary for the 872d430643SNicolas Chautrudevice to perform FEC functions. 882d430643SNicolas Chautru 892d430643SNicolas ChautruThis configuration needs to be executed at least once after reboot or PCI FLR and can 907adbb468SMaxime Coquelinbe achieved by using the function ``rte_fpga_5gnr_fec_configure()``, which sets up the 917adbb468SMaxime Coquelinparameters defined in ``rte_fpga_5gnr_fec_conf`` structure: 922d430643SNicolas Chautru 932d430643SNicolas Chautru.. code-block:: c 942d430643SNicolas Chautru 957adbb468SMaxime Coquelin struct rte_fpga_5gnr_fec_conf { 962d430643SNicolas Chautru bool pf_mode_en; 972d430643SNicolas Chautru uint8_t vf_ul_queues_number[FPGA_5GNR_FEC_NUM_VFS]; 982d430643SNicolas Chautru uint8_t vf_dl_queues_number[FPGA_5GNR_FEC_NUM_VFS]; 992d430643SNicolas Chautru uint8_t ul_bandwidth; 1002d430643SNicolas Chautru uint8_t dl_bandwidth; 1012d430643SNicolas Chautru uint8_t ul_load_balance; 1022d430643SNicolas Chautru uint8_t dl_load_balance; 1032d430643SNicolas Chautru }; 1042d430643SNicolas Chautru 1052d430643SNicolas Chautru- ``pf_mode_en``: identifies whether only PF is to be used, or the VFs. PF and 1062d430643SNicolas Chautru VFs are mutually exclusive and cannot run simultaneously. 1072d430643SNicolas Chautru Set to 1 for PF mode enabled. 1082d430643SNicolas Chautru If PF mode is enabled all queues available in the device are assigned 1092d430643SNicolas Chautru exclusively to PF and 0 queues given to VFs. 1102d430643SNicolas Chautru 1112d430643SNicolas Chautru- ``vf_*l_queues_number``: defines the hardware queue mapping for every VF. 1122d430643SNicolas Chautru 1132d430643SNicolas Chautru- ``*l_bandwidth``: in case of congestion on PCIe interface. The device 1142d430643SNicolas Chautru allocates different bandwidth to UL and DL. The weight is configured by this 1152d430643SNicolas Chautru setting. The unit of weight is 3 code blocks. For example, if the code block 1162d430643SNicolas Chautru cbps (code block per second) ratio between UL and DL is 12:1, then the 1172d430643SNicolas Chautru configuration value should be set to 36:3. The schedule algorithm is based 1182d430643SNicolas Chautru on code block regardless the length of each block. 1192d430643SNicolas Chautru 1202d430643SNicolas Chautru- ``*l_load_balance``: hardware queues are load-balanced in a round-robin 1212d430643SNicolas Chautru fashion. Queues get filled first-in first-out until they reach a pre-defined 1222d430643SNicolas Chautru watermark level, if exceeded, they won't get assigned new code blocks.. 1232d430643SNicolas Chautru This watermark is defined by this setting. 1242d430643SNicolas Chautru 1252d430643SNicolas Chautru If all hardware queues exceeds the watermark, no code blocks will be 1262d430643SNicolas Chautru streamed in from UL/DL code block FIFO. 1272d430643SNicolas Chautru 1282d430643SNicolas Chautru 1297adbb468SMaxime CoquelinAn example configuration code calling the function ``rte_fpga_5gnr_fec_configure()`` is shown 1302d430643SNicolas Chautrubelow: 1312d430643SNicolas Chautru 1322d430643SNicolas Chautru.. code-block:: c 1332d430643SNicolas Chautru 1347adbb468SMaxime Coquelin struct rte_fpga_5gnr_fec_conf conf; 1352d430643SNicolas Chautru unsigned int i; 1362d430643SNicolas Chautru 1377adbb468SMaxime Coquelin memset(&conf, 0, sizeof(struct rte_fpga_5gnr_fec_conf)); 1382d430643SNicolas Chautru conf.pf_mode_en = 1; 1392d430643SNicolas Chautru 1402d430643SNicolas Chautru for (i = 0; i < FPGA_5GNR_FEC_NUM_VFS; ++i) { 1412d430643SNicolas Chautru conf.vf_ul_queues_number[i] = 4; 1422d430643SNicolas Chautru conf.vf_dl_queues_number[i] = 4; 1432d430643SNicolas Chautru } 1442d430643SNicolas Chautru conf.ul_bandwidth = 12; 1452d430643SNicolas Chautru conf.dl_bandwidth = 5; 1462d430643SNicolas Chautru conf.dl_load_balance = 64; 1472d430643SNicolas Chautru conf.ul_load_balance = 64; 1482d430643SNicolas Chautru 1492d430643SNicolas Chautru /* setup FPGA PF */ 1507adbb468SMaxime Coquelin ret = rte_fpga_5gnr_fec_configure(info->dev_name, &conf); 1512d430643SNicolas Chautru TEST_ASSERT_SUCCESS(ret, 152*a46c1225SHernan Vargas "Failed to configure 5GNR FPGA PF for bbdev %s", 1532d430643SNicolas Chautru info->dev_name); 1542d430643SNicolas Chautru 1552d430643SNicolas Chautru 1562d430643SNicolas ChautruTest Application 1572d430643SNicolas Chautru---------------- 1582d430643SNicolas Chautru 1592d430643SNicolas ChautruBBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing 16022900d7fSNicolas Chautruthe functionality of the device, depending on the device's capabilities. 1612d430643SNicolas Chautru 16222900d7fSNicolas ChautruFor more details on how to use the test application, 16322900d7fSNicolas Chautrusee :ref:`test_bbdev_application`. 1642d430643SNicolas Chautru 1652d430643SNicolas Chautru 16644dc6faaSNicolas ChautruTest Vectors 16744dc6faaSNicolas Chautru~~~~~~~~~~~~ 16844dc6faaSNicolas Chautru 16944dc6faaSNicolas ChautruIn addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides 17044dc6faaSNicolas Chautrua range of additional tests under the test_vectors folder, which may be useful. The results 17144dc6faaSNicolas Chautruof these tests will depend on the FPGA 5GNR FEC capabilities. 172fbef5a42SNicolas Chautru 173fbef5a42SNicolas Chautru 174fbef5a42SNicolas ChautruAlternate Baseband Device configuration tool 175fbef5a42SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 176fbef5a42SNicolas Chautru 177fbef5a42SNicolas ChautruOn top of the embedded configuration feature supported in test-bbdev using "- -init-device" 178fbef5a42SNicolas Chautruoption, there is also a tool available to perform that device configuration using a companion 179fbef5a42SNicolas Chautruapplication. 180fbef5a42SNicolas ChautruThe ``pf_bb_config`` application notably enables then to run bbdev-test from the VF 181fbef5a42SNicolas Chautruand not only limited to the PF as captured above. 182fbef5a42SNicolas Chautru 183fbef5a42SNicolas ChautruSee for more details: https://github.com/intel/pf-bb-config 184fbef5a42SNicolas Chautru 185fbef5a42SNicolas ChautruSpecifically for the BBDEV FPGA 5GNR FEC PMD, the command below can be used: 186fbef5a42SNicolas Chautru 187fbef5a42SNicolas Chautru.. code-block:: console 188fbef5a42SNicolas Chautru 189fbef5a42SNicolas Chautru ./pf_bb_config FPGA_5GNR -c fpga_5gnr/fpga_5gnr_config_vf.cfg 190db27370bSStephen Hemminger ./test-bbdev.py -e="-c 0xff0 -a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v ./ldpc_dec_default.data 191