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 9*9e3ffd38SHernan Vargasbased Vista Creek (N3000, referred to as VC_5GNR in the code) 10*9e3ffd38SHernan Vargasas well as Arrow Creek (N6000, referred to as AGX100 in the code). 110b5927cbSNicolas Chautru 120b5927cbSNicolas ChautruFeatures 130b5927cbSNicolas Chautru-------- 140b5927cbSNicolas Chautru 15*9e3ffd38SHernan VargasFPGA 5GNR FEC PMD supports the following BBDEV capabilities: 160b5927cbSNicolas Chautru 1744dc6faaSNicolas Chautru- LDPC Encode in the DL 1844dc6faaSNicolas Chautru- LDPC Decode in the UL 190b5927cbSNicolas Chautru- 8 VFs per PF (physical device) 200b5927cbSNicolas Chautru- Maximum of 32 UL queues per VF 210b5927cbSNicolas Chautru- Maximum of 32 DL queues per VF 220b5927cbSNicolas Chautru- PCIe Gen-3 x8 Interface 230b5927cbSNicolas Chautru- MSI-X 240b5927cbSNicolas Chautru- SR-IOV 250b5927cbSNicolas Chautru 2644dc6faaSNicolas ChautruFPGA 5GNR FEC PMD supports the following BBDEV capabilities: 2744dc6faaSNicolas Chautru 2844dc6faaSNicolas Chautru* For the LDPC encode operation: 2944dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` : set to attach CRC24B to CB(s) 3044dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_RATE_MATCH`` : if set then do not do Rate Match bypass 3144dc6faaSNicolas Chautru 3244dc6faaSNicolas Chautru* For the LDPC decode operation: 3344dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK`` : check CRC24B from CB(s) 3444dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE`` : disable early termination 3544dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP`` : drops CRC24B bits appended while decoding 3644dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE`` : provides an input for HARQ combining 3744dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE`` : provides an input for HARQ combining 3844dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE`` : HARQ memory input is internal 3944dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE`` : HARQ memory output is internal 4044dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK`` : loopback data to/from HARQ memory 4144dc6faaSNicolas Chautru - ``RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS`` : HARQ memory includes the fillers bits 4244dc6faaSNicolas Chautru 4344dc6faaSNicolas Chautru 440b5927cbSNicolas ChautruLimitations 450b5927cbSNicolas Chautru----------- 460b5927cbSNicolas Chautru 470b5927cbSNicolas ChautruFPGA 5GNR FEC does not support the following: 480b5927cbSNicolas Chautru 490b5927cbSNicolas Chautru- Scatter-Gather function 500b5927cbSNicolas Chautru 510b5927cbSNicolas Chautru 520b5927cbSNicolas ChautruInstallation 530b5927cbSNicolas Chautru------------ 540b5927cbSNicolas Chautru 5507a2a572SCiara PowerSection 3 of the DPDK manual provides instructions on installing and compiling DPDK. 560b5927cbSNicolas Chautru 570b5927cbSNicolas ChautruDPDK requires hugepages to be configured as detailed in section 2 of the DPDK manual. 580b5927cbSNicolas ChautruThe bbdev test application has been tested with a configuration 40 x 1GB hugepages. The 590b5927cbSNicolas Chautruhugepage configuration of a server may be examined using: 600b5927cbSNicolas Chautru 610b5927cbSNicolas Chautru.. code-block:: console 620b5927cbSNicolas Chautru 630b5927cbSNicolas Chautru grep Huge* /proc/meminfo 640b5927cbSNicolas Chautru 650b5927cbSNicolas Chautru 660b5927cbSNicolas ChautruInitialization 670b5927cbSNicolas Chautru-------------- 680b5927cbSNicolas Chautru 690b5927cbSNicolas ChautruWhen the device first powers up, its PCI Physical Functions (PF) can be listed through this command: 700b5927cbSNicolas Chautru 71*9e3ffd38SHernan VargasVista Creek (N3000) 72*9e3ffd38SHernan Vargas 730b5927cbSNicolas Chautru.. code-block:: console 740b5927cbSNicolas Chautru 750b5927cbSNicolas Chautru sudo lspci -vd8086:0d8f 760b5927cbSNicolas Chautru 77*9e3ffd38SHernan VargasArrow Creek (N6000) 78*9e3ffd38SHernan Vargas 79*9e3ffd38SHernan Vargas.. code-block:: console 80*9e3ffd38SHernan Vargas 81*9e3ffd38SHernan Vargas sudo lspci -vd8086:5799 82*9e3ffd38SHernan Vargas 830b5927cbSNicolas ChautruThe physical and virtual functions are compatible with Linux UIO drivers: 8433f32941SDavid Marchand``vfio_pci`` and ``igb_uio``. However, in order to work the FPGA 5GNR FEC device firstly needs 850b5927cbSNicolas Chautruto be bound to one of these linux drivers through DPDK. 860b5927cbSNicolas Chautru 8733f32941SDavid MarchandFor more details on how to bind the PF device and create VF devices, see 8833f32941SDavid Marchand:ref:`linux_gsg_binding_kernel`. 8944dc6faaSNicolas Chautru 90*9e3ffd38SHernan Vargas 912d430643SNicolas ChautruConfigure the VFs through PF 922d430643SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932d430643SNicolas Chautru 942d430643SNicolas ChautruThe PCI virtual functions must be configured before working or getting assigned 952d430643SNicolas Chautruto VMs/Containers. The configuration involves allocating the number of hardware 962d430643SNicolas Chautruqueues, priorities, load balance, bandwidth and other settings necessary for the 972d430643SNicolas Chautrudevice to perform FEC functions. 982d430643SNicolas Chautru 992d430643SNicolas ChautruThis configuration needs to be executed at least once after reboot or PCI FLR and can 1007adbb468SMaxime Coquelinbe achieved by using the function ``rte_fpga_5gnr_fec_configure()``, which sets up the 1017adbb468SMaxime Coquelinparameters defined in ``rte_fpga_5gnr_fec_conf`` structure: 1022d430643SNicolas Chautru 1032d430643SNicolas Chautru.. code-block:: c 1042d430643SNicolas Chautru 1057adbb468SMaxime Coquelin struct rte_fpga_5gnr_fec_conf { 1062d430643SNicolas Chautru bool pf_mode_en; 1072d430643SNicolas Chautru uint8_t vf_ul_queues_number[FPGA_5GNR_FEC_NUM_VFS]; 1082d430643SNicolas Chautru uint8_t vf_dl_queues_number[FPGA_5GNR_FEC_NUM_VFS]; 1092d430643SNicolas Chautru uint8_t ul_bandwidth; 1102d430643SNicolas Chautru uint8_t dl_bandwidth; 1112d430643SNicolas Chautru uint8_t ul_load_balance; 1122d430643SNicolas Chautru uint8_t dl_load_balance; 1132d430643SNicolas Chautru }; 1142d430643SNicolas Chautru 1152d430643SNicolas Chautru- ``pf_mode_en``: identifies whether only PF is to be used, or the VFs. PF and 1162d430643SNicolas Chautru VFs are mutually exclusive and cannot run simultaneously. 1172d430643SNicolas Chautru Set to 1 for PF mode enabled. 1182d430643SNicolas Chautru If PF mode is enabled all queues available in the device are assigned 1192d430643SNicolas Chautru exclusively to PF and 0 queues given to VFs. 1202d430643SNicolas Chautru 1212d430643SNicolas Chautru- ``vf_*l_queues_number``: defines the hardware queue mapping for every VF. 1222d430643SNicolas Chautru 123*9e3ffd38SHernan Vargas- ``*l_bandwidth``: Only used for the Vista Creek schedule algorithm 124*9e3ffd38SHernan Vargas in case of congestion on PCIe interface. 125*9e3ffd38SHernan Vargas The device allocates different bandwidth to UL and DL. 126*9e3ffd38SHernan Vargas The weight is configured by this setting. 127*9e3ffd38SHernan Vargas The unit of weight is 3 code blocks. 128*9e3ffd38SHernan Vargas For example, if the code block cbps (code block per second) ratio 129*9e3ffd38SHernan Vargas between UL and DL is 12:1, then the configuration value should be set to 36:3. 130*9e3ffd38SHernan Vargas The schedule algorithm is based on code block regardless the length of each block. 1312d430643SNicolas Chautru 1322d430643SNicolas Chautru- ``*l_load_balance``: hardware queues are load-balanced in a round-robin 1332d430643SNicolas Chautru fashion. Queues get filled first-in first-out until they reach a pre-defined 1342d430643SNicolas Chautru watermark level, if exceeded, they won't get assigned new code blocks.. 1352d430643SNicolas Chautru This watermark is defined by this setting. 1362d430643SNicolas Chautru 1372d430643SNicolas Chautru If all hardware queues exceeds the watermark, no code blocks will be 1382d430643SNicolas Chautru streamed in from UL/DL code block FIFO. 1392d430643SNicolas Chautru 1402d430643SNicolas Chautru 1417adbb468SMaxime CoquelinAn example configuration code calling the function ``rte_fpga_5gnr_fec_configure()`` is shown 1422d430643SNicolas Chautrubelow: 1432d430643SNicolas Chautru 1442d430643SNicolas Chautru.. code-block:: c 1452d430643SNicolas Chautru 1467adbb468SMaxime Coquelin struct rte_fpga_5gnr_fec_conf conf; 1472d430643SNicolas Chautru unsigned int i; 1482d430643SNicolas Chautru 1497adbb468SMaxime Coquelin memset(&conf, 0, sizeof(struct rte_fpga_5gnr_fec_conf)); 1502d430643SNicolas Chautru conf.pf_mode_en = 1; 1512d430643SNicolas Chautru 1522d430643SNicolas Chautru for (i = 0; i < FPGA_5GNR_FEC_NUM_VFS; ++i) { 1532d430643SNicolas Chautru conf.vf_ul_queues_number[i] = 4; 1542d430643SNicolas Chautru conf.vf_dl_queues_number[i] = 4; 1552d430643SNicolas Chautru } 1562d430643SNicolas Chautru conf.ul_bandwidth = 12; 1572d430643SNicolas Chautru conf.dl_bandwidth = 5; 1582d430643SNicolas Chautru conf.dl_load_balance = 64; 1592d430643SNicolas Chautru conf.ul_load_balance = 64; 1602d430643SNicolas Chautru 1612d430643SNicolas Chautru /* setup FPGA PF */ 1627adbb468SMaxime Coquelin ret = rte_fpga_5gnr_fec_configure(info->dev_name, &conf); 1632d430643SNicolas Chautru TEST_ASSERT_SUCCESS(ret, 164a46c1225SHernan Vargas "Failed to configure 5GNR FPGA PF for bbdev %s", 1652d430643SNicolas Chautru info->dev_name); 1662d430643SNicolas Chautru 1672d430643SNicolas Chautru 1682d430643SNicolas ChautruTest Application 1692d430643SNicolas Chautru---------------- 1702d430643SNicolas Chautru 1712d430643SNicolas ChautruBBDEV provides a test application, ``test-bbdev.py`` and range of test data for testing 17222900d7fSNicolas Chautruthe functionality of the device, depending on the device's capabilities. 1732d430643SNicolas Chautru 174*9e3ffd38SHernan Vargas.. code-block:: console 175*9e3ffd38SHernan Vargas 176*9e3ffd38SHernan Vargas "-p", "--testapp-path": specifies path to the bbdev test app. 177*9e3ffd38SHernan Vargas "-e", "--eal-params" : EAL arguments which are passed to the test app. 178*9e3ffd38SHernan Vargas "-t", "--timeout" : Timeout in seconds (default=300). 179*9e3ffd38SHernan Vargas "-c", "--test-cases" : Defines test cases to run. Run all if not specified. 180*9e3ffd38SHernan Vargas "-v", "--test-vector" : Test vector path (default=dpdk_path+/app/test-bbdev/test_vectors/bbdev_null.data). 181*9e3ffd38SHernan Vargas "-n", "--num-ops" : Number of operations to process on device (default=32). 182*9e3ffd38SHernan Vargas "-b", "--burst-size" : Operations enqueue/dequeue burst size (default=32). 183*9e3ffd38SHernan Vargas "-l", "--num-lcores" : Number of lcores to run (default=16). 184*9e3ffd38SHernan Vargas "-i", "--init-device" : Initialise PF device with default values. 185*9e3ffd38SHernan Vargas 186*9e3ffd38SHernan Vargas 187*9e3ffd38SHernan VargasTo execute the test application tool using simple decode or encode data, 188*9e3ffd38SHernan Vargastype one of the following: 189*9e3ffd38SHernan Vargas 190*9e3ffd38SHernan Vargas.. code-block:: console 191*9e3ffd38SHernan Vargas 192*9e3ffd38SHernan Vargas ./test-bbdev.py -c validation -n 64 -b 1 -v ./ldpc_dec_default.data 193*9e3ffd38SHernan Vargas ./test-bbdev.py -c validation -n 64 -b 1 -v ./ldpc_enc_default.data 194*9e3ffd38SHernan Vargas 195*9e3ffd38SHernan Vargas 196*9e3ffd38SHernan VargasThe test application ``test-bbdev.py`` supports the ability to configure the PF device 197*9e3ffd38SHernan Vargaswith a default set of values, if the "-i" or "- -init-device" option is included. 198*9e3ffd38SHernan VargasThe default values are defined in ``test_bbdev_perf.c`` as: 199*9e3ffd38SHernan Vargas 200*9e3ffd38SHernan Vargas- VF_UL_QUEUE_VALUE 4 201*9e3ffd38SHernan Vargas- VF_DL_QUEUE_VALUE 4 202*9e3ffd38SHernan Vargas- UL_BANDWIDTH 3 203*9e3ffd38SHernan Vargas- DL_BANDWIDTH 3 204*9e3ffd38SHernan Vargas- UL_LOAD_BALANCE 128 205*9e3ffd38SHernan Vargas- DL_LOAD_BALANCE 128 2062d430643SNicolas Chautru 2072d430643SNicolas Chautru 20844dc6faaSNicolas ChautruTest Vectors 20944dc6faaSNicolas Chautru~~~~~~~~~~~~ 21044dc6faaSNicolas Chautru 21144dc6faaSNicolas ChautruIn addition to the simple LDPC decoder and LDPC encoder tests, bbdev also provides 21244dc6faaSNicolas Chautrua range of additional tests under the test_vectors folder, which may be useful. The results 21344dc6faaSNicolas Chautruof these tests will depend on the FPGA 5GNR FEC capabilities. 214fbef5a42SNicolas Chautru 215fbef5a42SNicolas Chautru 216fbef5a42SNicolas ChautruAlternate Baseband Device configuration tool 217fbef5a42SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218fbef5a42SNicolas Chautru 219fbef5a42SNicolas ChautruOn top of the embedded configuration feature supported in test-bbdev using "- -init-device" 220fbef5a42SNicolas Chautruoption, there is also a tool available to perform that device configuration using a companion 221fbef5a42SNicolas Chautruapplication. 222fbef5a42SNicolas ChautruThe ``pf_bb_config`` application notably enables then to run bbdev-test from the VF 223fbef5a42SNicolas Chautruand not only limited to the PF as captured above. 224fbef5a42SNicolas Chautru 225fbef5a42SNicolas ChautruSee for more details: https://github.com/intel/pf-bb-config 226fbef5a42SNicolas Chautru 227fbef5a42SNicolas ChautruSpecifically for the BBDEV FPGA 5GNR FEC PMD, the command below can be used: 228fbef5a42SNicolas Chautru 229*9e3ffd38SHernan VargasVista Creek (N3000) 230*9e3ffd38SHernan Vargas 231fbef5a42SNicolas Chautru.. code-block:: console 232fbef5a42SNicolas Chautru 233fbef5a42SNicolas Chautru ./pf_bb_config FPGA_5GNR -c fpga_5gnr/fpga_5gnr_config_vf.cfg 234db27370bSStephen Hemminger ./test-bbdev.py -e="-c 0xff0 -a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v ./ldpc_dec_default.data 235*9e3ffd38SHernan Vargas 236*9e3ffd38SHernan VargasArrow Creek (N6000) 237*9e3ffd38SHernan Vargas 238*9e3ffd38SHernan Vargas.. code-block:: console 239*9e3ffd38SHernan Vargas 240*9e3ffd38SHernan Vargas ./pf_bb_config AGX100 -c agx100/agx100_config_1vf.cfg 241*9e3ffd38SHernan Vargas ./test-bbdev.py -e="-c 0xff0 -a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v ./ldpc_dec_default.data 242