14935e1e9SAmr Mokhtar.. SPDX-License-Identifier: BSD-3-Clause 24935e1e9SAmr Mokhtar Copyright(c) 2017 Intel Corporation 34935e1e9SAmr Mokhtar 44935e1e9SAmr MokhtarWireless Baseband Device Library 54935e1e9SAmr Mokhtar================================ 64935e1e9SAmr Mokhtar 74935e1e9SAmr MokhtarThe Wireless Baseband library provides a common programming framework that 84935e1e9SAmr Mokhtarabstracts HW accelerators based on FPGA and/or Fixed Function Accelerators that 97273821fSKamil Chalupnikassist with 3GPP Physical Layer processing. Furthermore, it decouples the 104935e1e9SAmr Mokhtarapplication from the compute-intensive wireless functions by abstracting their 114935e1e9SAmr Mokhtaroptimized libraries to appear as virtual bbdev devices. 124935e1e9SAmr Mokhtar 134935e1e9SAmr MokhtarThe functional scope of the BBDEV library are those functions in relation to 147273821fSKamil Chalupnikthe 3GPP Layer 1 signal processing (channel coding, modulation, ...). 154935e1e9SAmr Mokhtar 16cbcda56cSNicolas ChautruThe framework currently only supports FEC function. 174935e1e9SAmr Mokhtar 184935e1e9SAmr Mokhtar 194935e1e9SAmr MokhtarDesign Principles 204935e1e9SAmr Mokhtar----------------- 214935e1e9SAmr Mokhtar 224935e1e9SAmr MokhtarThe Wireless Baseband library follows the same ideology of DPDK's Ethernet 234935e1e9SAmr MokhtarDevice and Crypto Device frameworks. Wireless Baseband provides a generic 244935e1e9SAmr Mokhtaracceleration abstraction framework which supports both physical (hardware) and 254935e1e9SAmr Mokhtarvirtual (software) wireless acceleration functions. 264935e1e9SAmr Mokhtar 274935e1e9SAmr MokhtarDevice Management 284935e1e9SAmr Mokhtar----------------- 294935e1e9SAmr Mokhtar 304935e1e9SAmr MokhtarDevice Creation 314935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~ 324935e1e9SAmr Mokhtar 334935e1e9SAmr MokhtarPhysical bbdev devices are discovered during the PCI probe/enumeration of the 344935e1e9SAmr MokhtarEAL function which is executed at DPDK initialization, based on 354935e1e9SAmr Mokhtartheir PCI device identifier, each unique PCI BDF (bus/bridge, device, 364935e1e9SAmr Mokhtarfunction). 374935e1e9SAmr Mokhtar 384935e1e9SAmr MokhtarVirtual devices can be created by two mechanisms, either using the EAL command 394935e1e9SAmr Mokhtarline options or from within the application using an EAL API directly. 404935e1e9SAmr Mokhtar 414935e1e9SAmr MokhtarFrom the command line using the --vdev EAL option 424935e1e9SAmr Mokhtar 434935e1e9SAmr Mokhtar.. code-block:: console 444935e1e9SAmr Mokhtar 457ce00bf3SKamil Chalupnik --vdev 'baseband_turbo_sw,max_nb_queues=8,socket_id=0' 464935e1e9SAmr Mokhtar 478b283e90SThierry HerbelotOr using the rte_vdev_init API within the application code. 484935e1e9SAmr Mokhtar 494935e1e9SAmr Mokhtar.. code-block:: c 504935e1e9SAmr Mokhtar 517ce00bf3SKamil Chalupnik rte_vdev_init("baseband_turbo_sw", "max_nb_queues=2,socket_id=0") 524935e1e9SAmr Mokhtar 534935e1e9SAmr MokhtarAll virtual bbdev devices support the following initialization parameters: 544935e1e9SAmr Mokhtar 554935e1e9SAmr Mokhtar- ``max_nb_queues`` - maximum number of queues supported by the device. 564935e1e9SAmr Mokhtar 574935e1e9SAmr Mokhtar- ``socket_id`` - socket on which to allocate the device resources on. 584935e1e9SAmr Mokhtar 594935e1e9SAmr Mokhtar 604935e1e9SAmr MokhtarDevice Identification 614935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~~ 624935e1e9SAmr Mokhtar 634935e1e9SAmr MokhtarEach device, whether virtual or physical is uniquely designated by two 644935e1e9SAmr Mokhtaridentifiers: 654935e1e9SAmr Mokhtar 664935e1e9SAmr Mokhtar- A unique device index used to designate the bbdev device in all functions 674935e1e9SAmr Mokhtar exported by the bbdev API. 684935e1e9SAmr Mokhtar 694935e1e9SAmr Mokhtar- A device name used to designate the bbdev device in console messages, for 704935e1e9SAmr Mokhtar administration or debugging purposes. For ease of use, the port name includes 714935e1e9SAmr Mokhtar the port index. 724935e1e9SAmr Mokhtar 734935e1e9SAmr Mokhtar 744935e1e9SAmr MokhtarDevice Configuration 754935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~ 764935e1e9SAmr Mokhtar 774935e1e9SAmr MokhtarFrom the application point of view, each instance of a bbdev device consists of 784935e1e9SAmr Mokhtarone or more queues identified by queue IDs. While different devices may have 794935e1e9SAmr Mokhtardifferent capabilities (e.g. support different operation types), all queues on 804935e1e9SAmr Mokhtara device support identical configuration possibilities. A queue is configured 81d629b7b5SJohn McNamarafor only one type of operation and is configured at initialization time. 824935e1e9SAmr MokhtarWhen an operation is enqueued to a specific queue ID, the result is dequeued 834935e1e9SAmr Mokhtarfrom the same queue ID. 844935e1e9SAmr Mokhtar 854935e1e9SAmr MokhtarConfiguration of a device has two different levels: configuration that applies 864935e1e9SAmr Mokhtarto the whole device, and configuration that applies to a single queue. 874935e1e9SAmr Mokhtar 884935e1e9SAmr MokhtarDevice configuration is applied with 894935e1e9SAmr Mokhtar``rte_bbdev_setup_queues(dev_id,num_queues,socket_id)`` 904935e1e9SAmr Mokhtarand queue configuration is applied with 914935e1e9SAmr Mokhtar``rte_bbdev_queue_configure(dev_id,queue_id,conf)``. Note that, although all 924935e1e9SAmr Mokhtarqueues on a device support same capabilities, they can be configured differently 934935e1e9SAmr Mokhtarand will then behave differently. 944935e1e9SAmr MokhtarDevices supporting interrupts can enable them by using 954935e1e9SAmr Mokhtar``rte_bbdev_intr_enable(dev_id)``. 964935e1e9SAmr Mokhtar 974935e1e9SAmr MokhtarThe configuration of each bbdev device includes the following operations: 984935e1e9SAmr Mokhtar 994935e1e9SAmr Mokhtar- Allocation of resources, including hardware resources if a physical device. 1004935e1e9SAmr Mokhtar- Resetting the device into a well-known default state. 1014935e1e9SAmr Mokhtar- Initialization of statistics counters. 1024935e1e9SAmr Mokhtar 1034935e1e9SAmr MokhtarThe ``rte_bbdev_setup_queues`` API is used to setup queues for a bbdev device. 1044935e1e9SAmr Mokhtar 1054935e1e9SAmr Mokhtar.. code-block:: c 1064935e1e9SAmr Mokhtar 1074935e1e9SAmr Mokhtar int rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, 1084935e1e9SAmr Mokhtar int socket_id); 1094935e1e9SAmr Mokhtar 1104935e1e9SAmr Mokhtar- ``num_queues`` argument identifies the total number of queues to setup for 1114935e1e9SAmr Mokhtar this device. 1124935e1e9SAmr Mokhtar 1134935e1e9SAmr Mokhtar- ``socket_id`` specifies which socket will be used to allocate the memory. 1144935e1e9SAmr Mokhtar 1154935e1e9SAmr Mokhtar 1164935e1e9SAmr MokhtarThe ``rte_bbdev_intr_enable`` API is used to enable interrupts for a bbdev 1174935e1e9SAmr Mokhtardevice, if supported by the driver. Should be called before starting the device. 1184935e1e9SAmr Mokhtar 1194935e1e9SAmr Mokhtar.. code-block:: c 1204935e1e9SAmr Mokhtar 1214935e1e9SAmr Mokhtar int rte_bbdev_intr_enable(uint16_t dev_id); 1224935e1e9SAmr Mokhtar 1234935e1e9SAmr Mokhtar 1244935e1e9SAmr MokhtarQueues Configuration 1254935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~ 1264935e1e9SAmr Mokhtar 1274935e1e9SAmr MokhtarEach bbdev devices queue is individually configured through the 1284935e1e9SAmr Mokhtar``rte_bbdev_queue_configure()`` API. 1294935e1e9SAmr MokhtarEach queue resources may be allocated on a specified socket. 1304935e1e9SAmr Mokhtar 1314935e1e9SAmr Mokhtar.. code-block:: c 1324935e1e9SAmr Mokhtar 1334935e1e9SAmr Mokhtar struct rte_bbdev_queue_conf { 1344935e1e9SAmr Mokhtar int socket; 1354935e1e9SAmr Mokhtar uint32_t queue_size; 1364935e1e9SAmr Mokhtar uint8_t priority; 1374935e1e9SAmr Mokhtar bool deferred_start; 1384935e1e9SAmr Mokhtar enum rte_bbdev_op_type op_type; 1394935e1e9SAmr Mokhtar }; 1404935e1e9SAmr Mokhtar 1414935e1e9SAmr MokhtarDevice & Queues Management 1424935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~~~~~~~ 1434935e1e9SAmr Mokhtar 1444935e1e9SAmr MokhtarAfter initialization, devices are in a stopped state, so must be started by the 1454935e1e9SAmr Mokhtarapplication. If an application is finished using a device it can close the 1464935e1e9SAmr Mokhtardevice. Once closed, it cannot be restarted. 1474935e1e9SAmr Mokhtar 1484935e1e9SAmr Mokhtar.. code-block:: c 1494935e1e9SAmr Mokhtar 1504935e1e9SAmr Mokhtar int rte_bbdev_start(uint16_t dev_id) 1514935e1e9SAmr Mokhtar int rte_bbdev_stop(uint16_t dev_id) 1524935e1e9SAmr Mokhtar int rte_bbdev_close(uint16_t dev_id) 1534935e1e9SAmr Mokhtar int rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id) 1544935e1e9SAmr Mokhtar int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id) 1554935e1e9SAmr Mokhtar 1564935e1e9SAmr Mokhtar 1574935e1e9SAmr MokhtarBy default, all queues are started when the device is started, but they can be 1584935e1e9SAmr Mokhtarstopped individually. 1594935e1e9SAmr Mokhtar 1604935e1e9SAmr Mokhtar.. code-block:: c 1614935e1e9SAmr Mokhtar 1624935e1e9SAmr Mokhtar int rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id) 1634935e1e9SAmr Mokhtar int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id) 1644935e1e9SAmr Mokhtar 1654935e1e9SAmr Mokhtar 1664935e1e9SAmr MokhtarLogical Cores, Memory and Queues Relationships 1674935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1684935e1e9SAmr Mokhtar 1693f3f6081SNicolas ChautruThe bbdev poll mode device driver library supports NUMA architecture, in which 1703f3f6081SNicolas Chautrua processor's logical cores and interfaces utilize it's local memory. Therefore 1713f3f6081SNicolas Chautruwith baseband operations, the mbuf being operated on should be allocated from memory 1724935e1e9SAmr Mokhtarpools created in the local memory. The buffers should, if possible, remain on 1734935e1e9SAmr Mokhtarthe local processor to obtain the best performance results and buffer 1744935e1e9SAmr Mokhtardescriptors should be populated with mbufs allocated from a mempool allocated 1754935e1e9SAmr Mokhtarfrom local memory. 1764935e1e9SAmr Mokhtar 1774935e1e9SAmr MokhtarThe run-to-completion model also performs better, especially in the case of 1784935e1e9SAmr Mokhtarvirtual bbdev devices, if the baseband operation and data buffers are in local 1794935e1e9SAmr Mokhtarmemory instead of a remote processor's memory. This is also true for the 1804935e1e9SAmr Mokhtarpipe-line model provided all logical cores used are located on the same processor. 1814935e1e9SAmr Mokhtar 1824935e1e9SAmr MokhtarMultiple logical cores should never share the same queue for enqueuing 1834935e1e9SAmr Mokhtaroperations or dequeuing operations on the same bbdev device since this would 1844935e1e9SAmr Mokhtarrequire global locks and hinder performance. It is however possible to use a 1854935e1e9SAmr Mokhtardifferent logical core to dequeue an operation on a queue pair from the logical 1864935e1e9SAmr Mokhtarcore which it was enqueued on. This means that a baseband burst enqueue/dequeue 1874935e1e9SAmr MokhtarAPIs are a logical place to transition from one logical core to another in a 1884935e1e9SAmr Mokhtarpacket processing pipeline. 1894935e1e9SAmr Mokhtar 1904935e1e9SAmr Mokhtar 1914935e1e9SAmr MokhtarDevice Operation Capabilities 1924935e1e9SAmr Mokhtar----------------------------- 1934935e1e9SAmr Mokhtar 1944935e1e9SAmr MokhtarCapabilities (in terms of operations supported, max number of queues, etc.) 1954935e1e9SAmr Mokhtaridentify what a bbdev is capable of performing that differs from one device to 1964935e1e9SAmr Mokhtaranother. For the full scope of the bbdev capability see the definition of the 1974935e1e9SAmr Mokhtarstructure in the *DPDK API Reference*. 1984935e1e9SAmr Mokhtar 1994935e1e9SAmr Mokhtar.. code-block:: c 2004935e1e9SAmr Mokhtar 2014935e1e9SAmr Mokhtar struct rte_bbdev_op_cap; 2024935e1e9SAmr Mokhtar 2034935e1e9SAmr MokhtarA device reports its capabilities when registering itself in the bbdev framework. 2044935e1e9SAmr MokhtarWith the aid of this capabilities mechanism, an application can query devices to 2057273821fSKamil Chalupnikdiscover which operations within the 3GPP physical layer they are capable of 2064935e1e9SAmr Mokhtarperforming. Below is an example of the capabilities for a PMD it supports in 2074935e1e9SAmr Mokhtarrelation to Turbo Encoding and Decoding operations. 2084935e1e9SAmr Mokhtar 2094935e1e9SAmr Mokhtar.. code-block:: c 2104935e1e9SAmr Mokhtar 2114935e1e9SAmr Mokhtar static const struct rte_bbdev_op_cap bbdev_capabilities[] = { 2124935e1e9SAmr Mokhtar { 2134935e1e9SAmr Mokhtar .type = RTE_BBDEV_OP_TURBO_DEC, 2144935e1e9SAmr Mokhtar .cap.turbo_dec = { 2154935e1e9SAmr Mokhtar .capability_flags = 2164935e1e9SAmr Mokhtar RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE | 2174935e1e9SAmr Mokhtar RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN | 2184935e1e9SAmr Mokhtar RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN | 2197273821fSKamil Chalupnik RTE_BBDEV_TURBO_CRC_TYPE_24B | 2207273821fSKamil Chalupnik RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP | 2217273821fSKamil Chalupnik RTE_BBDEV_TURBO_EARLY_TERMINATION, 2227273821fSKamil Chalupnik .max_llr_modulus = 16, 2233f3f6081SNicolas Chautru .num_buffers_src = RTE_BBDEV_TURBO_MAX_CODE_BLOCKS, 2244935e1e9SAmr Mokhtar .num_buffers_hard_out = 2253f3f6081SNicolas Chautru RTE_BBDEV_TURBO_MAX_CODE_BLOCKS, 2264935e1e9SAmr Mokhtar .num_buffers_soft_out = 0, 2274935e1e9SAmr Mokhtar } 2284935e1e9SAmr Mokhtar }, 2294935e1e9SAmr Mokhtar { 2304935e1e9SAmr Mokhtar .type = RTE_BBDEV_OP_TURBO_ENC, 2314935e1e9SAmr Mokhtar .cap.turbo_enc = { 2324935e1e9SAmr Mokhtar .capability_flags = 2334935e1e9SAmr Mokhtar RTE_BBDEV_TURBO_CRC_24B_ATTACH | 2347273821fSKamil Chalupnik RTE_BBDEV_TURBO_CRC_24A_ATTACH | 2354935e1e9SAmr Mokhtar RTE_BBDEV_TURBO_RATE_MATCH | 2364935e1e9SAmr Mokhtar RTE_BBDEV_TURBO_RV_INDEX_BYPASS, 2373f3f6081SNicolas Chautru .num_buffers_src = RTE_BBDEV_TURBO_MAX_CODE_BLOCKS, 2383f3f6081SNicolas Chautru .num_buffers_dst = RTE_BBDEV_TURBO_MAX_CODE_BLOCKS, 2394935e1e9SAmr Mokhtar } 2404935e1e9SAmr Mokhtar }, 2414935e1e9SAmr Mokhtar RTE_BBDEV_END_OF_CAPABILITIES_LIST() 2424935e1e9SAmr Mokhtar }; 2434935e1e9SAmr Mokhtar 2444935e1e9SAmr MokhtarCapabilities Discovery 2454935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~~~ 2464935e1e9SAmr Mokhtar 2474935e1e9SAmr MokhtarDiscovering the features and capabilities of a bbdev device poll mode driver 2484935e1e9SAmr Mokhtaris achieved through the ``rte_bbdev_info_get()`` function. 2494935e1e9SAmr Mokhtar 2504935e1e9SAmr Mokhtar.. code-block:: c 2514935e1e9SAmr Mokhtar 2524935e1e9SAmr Mokhtar int rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info) 2534935e1e9SAmr Mokhtar 2544935e1e9SAmr MokhtarThis allows the user to query a specific bbdev PMD and get all the device 2554935e1e9SAmr Mokhtarcapabilities. The ``rte_bbdev_info`` structure provides two levels of 2564935e1e9SAmr Mokhtarinformation: 2574935e1e9SAmr Mokhtar 2584935e1e9SAmr Mokhtar- Device relevant information, like: name and related rte_bus. 2594935e1e9SAmr Mokhtar 2604935e1e9SAmr Mokhtar- Driver specific information, as defined by the ``struct rte_bbdev_driver_info`` 2614935e1e9SAmr Mokhtar structure, this is where capabilities reside along with other specifics like: 2624935e1e9SAmr Mokhtar maximum queue sizes and priority level. 2634935e1e9SAmr Mokhtar 2646d69a1a6SNicolas Chautru.. literalinclude:: ../../../lib/bbdev/rte_bbdev.h 2656d69a1a6SNicolas Chautru :language: c 2666d69a1a6SNicolas Chautru :start-after: Structure rte_bbdev_driver_info 8< 2676d69a1a6SNicolas Chautru :end-before: >8 End of structure rte_bbdev_driver_info. 2684935e1e9SAmr Mokhtar 2696d69a1a6SNicolas Chautru.. literalinclude:: ../../../lib/bbdev/rte_bbdev.h 2706d69a1a6SNicolas Chautru :language: c 2716d69a1a6SNicolas Chautru :start-after: Structure rte_bbdev_info 8< 2726d69a1a6SNicolas Chautru :end-before: >8 End of structure rte_bbdev_info. 2736d69a1a6SNicolas Chautru 2746d69a1a6SNicolas ChautruCapabilities details for LDPC Decoder 2756d69a1a6SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2766d69a1a6SNicolas Chautru 2776d69a1a6SNicolas ChautruOn top of the ``RTE_BBDEV_LDPC_<*>`` capabilities 2786d69a1a6SNicolas Chautruthe device also exposes the LLR numerical representation 2796d69a1a6SNicolas Chautruexpected by the decoder as a fractional fixed-point representation. 2806d69a1a6SNicolas ChautruFor instance, when the representation (``llr_size``, ``llr_decimals``) = (8, 2) respectively, 2816d69a1a6SNicolas Chautruthis means that each input LLR in the data provided by the application must be computed 2826d69a1a6SNicolas Chautruas 8 total bits (including sign bit) 2836d69a1a6SNicolas Chautruwhere 2 of these are fractions bits (also referred to as S8.2 format). 2846d69a1a6SNicolas ChautruIt is up to the user application during LLR generation to scale the LLR 2856d69a1a6SNicolas Chautruaccording to this optimal numerical representation. 2866d69a1a6SNicolas ChautruAny mis-scaled LLR would cause wireless performance degradation. 2876d69a1a6SNicolas Chautru 2886d69a1a6SNicolas ChautruThe ``harq_buffer_size`` exposes the amount of dedicated DDR 2896d69a1a6SNicolas Chautrumade available for the device operation. 2906d69a1a6SNicolas ChautruThis is specific for accelerator non-integrated on the CPU (separate PCIe device) 2916d69a1a6SNicolas Chautruwhich may include separate on-card memory. 2926d69a1a6SNicolas Chautru 2936d69a1a6SNicolas ChautruCapabilities details for FFT function 2946d69a1a6SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2956d69a1a6SNicolas Chautru 2966d69a1a6SNicolas ChautruThe total number of distinct time windows supported 2976d69a1a6SNicolas Chautrufor the post-FFT point-wise multiplication is exposed as ``fft_windows_num``. 2986d69a1a6SNicolas ChautruThe ``window_index`` provided for each cyclic shift 2996d69a1a6SNicolas Chautruin each ``rte_bbdev_op_fft`` operation is expected to be limited to that size. 3006d69a1a6SNicolas Chautru 3016d69a1a6SNicolas ChautruThe information related to the width of each of these pre-configured window 3026d69a1a6SNicolas Chautruis also exposed using the ``fft_window_width`` array. 3036d69a1a6SNicolas ChautruThis provides the number of non-null samples 3046d69a1a6SNicolas Chautruused for each window index when scaling back the size to a reference of 1024 FFT. 3056d69a1a6SNicolas ChautruThe actual shape size is effectively scaled up or down 3066d69a1a6SNicolas Chautrubased on the dynamic size of the FFT operation being used. 3076d69a1a6SNicolas Chautru 3086d69a1a6SNicolas ChautruThis allows to distinguish different version of the flexible pointwise windowing 3096d69a1a6SNicolas Chautruapplied to the FFT and exposes this platform configuration to the application. 3106d69a1a6SNicolas Chautru 3116d69a1a6SNicolas ChautruOther optional capabilities exposed during device discovery 3126d69a1a6SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3136d69a1a6SNicolas Chautru 3146d69a1a6SNicolas ChautruThe device status can be used to expose additional information 3156d69a1a6SNicolas Chautrurelated to the state of the platform notably based on its configuration state 3166d69a1a6SNicolas Chautruor related to error management (correctable or non). 3176d69a1a6SNicolas Chautru 3186d69a1a6SNicolas ChautruThe queue topology exposed to the device is provided on top of the capabilities. 3196d69a1a6SNicolas ChautruThis provides the number of queues available 3206d69a1a6SNicolas Chautrufor the exposed bbdev device (the physical device may have more) 3216d69a1a6SNicolas Chautrufor each operation as well as the different level of priority available for arbitration. 3226d69a1a6SNicolas ChautruThese are based on the arrays and parameters 3236d69a1a6SNicolas Chautru``num_queues``, ``queue_priority``, ``max_num_queues``, ``queue_size_lim``. 3244935e1e9SAmr Mokhtar 3253f3f6081SNicolas Chautru 3264935e1e9SAmr MokhtarOperation Processing 3274935e1e9SAmr Mokhtar-------------------- 3284935e1e9SAmr Mokhtar 3294935e1e9SAmr MokhtarScheduling of baseband operations on DPDK's application data path is 3304935e1e9SAmr Mokhtarperformed using a burst oriented asynchronous API set. A queue on a bbdev 3314935e1e9SAmr Mokhtardevice accepts a burst of baseband operations using enqueue burst API. On physical 3324935e1e9SAmr Mokhtarbbdev devices the enqueue burst API will place the operations to be processed 3334935e1e9SAmr Mokhtaron the device's hardware input queue, for virtual devices the processing of the 3344935e1e9SAmr Mokhtarbaseband operations is usually completed during the enqueue call to the bbdev 3354935e1e9SAmr Mokhtardevice. The dequeue burst API will retrieve any processed operations available 3364935e1e9SAmr Mokhtarfrom the queue on the bbdev device, from physical devices this is usually 3374935e1e9SAmr Mokhtardirectly from the device's processed queue, and for virtual device's from a 3386b1a74efSThierry Herbelot``rte_ring`` where processed operations are placed after being processed on the 3394935e1e9SAmr Mokhtarenqueue call. 3404935e1e9SAmr Mokhtar 3414935e1e9SAmr Mokhtar 3424935e1e9SAmr MokhtarEnqueue / Dequeue Burst APIs 3434935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3444935e1e9SAmr Mokhtar 3454935e1e9SAmr MokhtarThe burst enqueue API uses a bbdev device identifier and a queue 3464935e1e9SAmr Mokhtaridentifier to specify the bbdev device queue to schedule the processing on. 3474935e1e9SAmr MokhtarThe ``num_ops`` parameter is the number of operations to process which are 3484935e1e9SAmr Mokhtarsupplied in the ``ops`` array of ``rte_bbdev_*_op`` structures. 3494935e1e9SAmr MokhtarThe enqueue function returns the number of operations it actually enqueued for 3504935e1e9SAmr Mokhtarprocessing, a return value equal to ``num_ops`` means that all packets have been 3514935e1e9SAmr Mokhtarenqueued. 3524935e1e9SAmr Mokhtar 3534935e1e9SAmr Mokhtar.. code-block:: c 3544935e1e9SAmr Mokhtar 3554935e1e9SAmr Mokhtar uint16_t rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id, 3564935e1e9SAmr Mokhtar struct rte_bbdev_enc_op **ops, uint16_t num_ops) 3574935e1e9SAmr Mokhtar 3584935e1e9SAmr Mokhtar uint16_t rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id, 3594935e1e9SAmr Mokhtar struct rte_bbdev_dec_op **ops, uint16_t num_ops) 3604935e1e9SAmr Mokhtar 3614935e1e9SAmr MokhtarThe dequeue API uses the same format as the enqueue API of processed but 3624935e1e9SAmr Mokhtarthe ``num_ops`` and ``ops`` parameters are now used to specify the max processed 3634935e1e9SAmr Mokhtaroperations the user wishes to retrieve and the location in which to store them. 3644935e1e9SAmr MokhtarThe API call returns the actual number of processed operations returned, this 3654935e1e9SAmr Mokhtarcan never be larger than ``num_ops``. 3664935e1e9SAmr Mokhtar 3674935e1e9SAmr Mokhtar.. code-block:: c 3684935e1e9SAmr Mokhtar 3694935e1e9SAmr Mokhtar uint16_t rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id, 3704935e1e9SAmr Mokhtar struct rte_bbdev_enc_op **ops, uint16_t num_ops) 3714935e1e9SAmr Mokhtar 3724935e1e9SAmr Mokhtar uint16_t rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id, 3734935e1e9SAmr Mokhtar struct rte_bbdev_dec_op **ops, uint16_t num_ops) 3744935e1e9SAmr Mokhtar 3754935e1e9SAmr MokhtarOperation Representation 3764935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~~~~~ 3774935e1e9SAmr Mokhtar 3784935e1e9SAmr MokhtarAn encode bbdev operation is represented by ``rte_bbdev_enc_op`` structure, 3794935e1e9SAmr Mokhtarand by ``rte_bbdev_dec_op`` for decode. These structures act as metadata 3804935e1e9SAmr Mokhtarcontainers for all necessary information required for the bbdev operation to be 3814935e1e9SAmr Mokhtarprocessed on a particular bbdev device poll mode driver. 3824935e1e9SAmr Mokhtar 3834935e1e9SAmr Mokhtar.. code-block:: c 3844935e1e9SAmr Mokhtar 3854935e1e9SAmr Mokhtar struct rte_bbdev_enc_op { 3864935e1e9SAmr Mokhtar int status; 3874935e1e9SAmr Mokhtar struct rte_mempool *mempool; 3884935e1e9SAmr Mokhtar void *opaque_data; 3893f3f6081SNicolas Chautru union { 3904935e1e9SAmr Mokhtar struct rte_bbdev_op_turbo_enc turbo_enc; 3913f3f6081SNicolas Chautru struct rte_bbdev_op_ldpc_enc ldpc_enc; 3923f3f6081SNicolas Chautru } 3934935e1e9SAmr Mokhtar }; 3944935e1e9SAmr Mokhtar 3954935e1e9SAmr Mokhtar struct rte_bbdev_dec_op { 3964935e1e9SAmr Mokhtar int status; 3974935e1e9SAmr Mokhtar struct rte_mempool *mempool; 3984935e1e9SAmr Mokhtar void *opaque_data; 3993f3f6081SNicolas Chautru union { 4003f3f6081SNicolas Chautru struct rte_bbdev_op_turbo_dec turbo_enc; 4013f3f6081SNicolas Chautru struct rte_bbdev_op_ldpc_dec ldpc_enc; 4023f3f6081SNicolas Chautru } 4034935e1e9SAmr Mokhtar }; 4044935e1e9SAmr Mokhtar 4054935e1e9SAmr MokhtarThe operation structure by itself defines the operation type. It includes an 4064935e1e9SAmr Mokhtaroperation status, a reference to the operation specific data, which can vary in 4074935e1e9SAmr Mokhtarsize and content depending on the operation being provisioned. It also contains 4084935e1e9SAmr Mokhtarthe source mempool for the operation, if it is allocated from a mempool. 4094935e1e9SAmr Mokhtar 4104935e1e9SAmr MokhtarIf bbdev operations are allocated from a bbdev operation mempool, see next 4114935e1e9SAmr Mokhtarsection, there is also the ability to allocate private memory with the 4124935e1e9SAmr Mokhtaroperation for applications purposes. 4134935e1e9SAmr Mokhtar 4144935e1e9SAmr MokhtarApplication software is responsible for specifying all the operation specific 4154935e1e9SAmr Mokhtarfields in the ``rte_bbdev_*_op`` structure which are then used by the bbdev PMD 4164935e1e9SAmr Mokhtarto process the requested operation. 4174935e1e9SAmr Mokhtar 4184935e1e9SAmr Mokhtar 4194935e1e9SAmr MokhtarOperation Management and Allocation 4204935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4214935e1e9SAmr Mokhtar 4224935e1e9SAmr MokhtarThe bbdev library provides an API set for managing bbdev operations which 4234935e1e9SAmr Mokhtarutilize the Mempool Library to allocate operation buffers. Therefore, it ensures 4244935e1e9SAmr Mokhtarthat the bbdev operation is interleaved optimally across the channels and 4254935e1e9SAmr Mokhtarranks for optimal processing. 4264935e1e9SAmr Mokhtar 4274935e1e9SAmr Mokhtar.. code-block:: c 4284935e1e9SAmr Mokhtar 4294935e1e9SAmr Mokhtar struct rte_mempool * 4304935e1e9SAmr Mokhtar rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type, 4314935e1e9SAmr Mokhtar unsigned int num_elements, unsigned int cache_size, 4324935e1e9SAmr Mokhtar int socket_id) 4334935e1e9SAmr Mokhtar 4344935e1e9SAmr Mokhtar``rte_bbdev_*_op_alloc_bulk()`` and ``rte_bbdev_*_op_free_bulk()`` are used to 4354935e1e9SAmr Mokhtarallocate bbdev operations of a specific type from a given bbdev operation mempool. 4364935e1e9SAmr Mokhtar 4374935e1e9SAmr Mokhtar.. code-block:: c 4384935e1e9SAmr Mokhtar 4394935e1e9SAmr Mokhtar int rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool, 4404935e1e9SAmr Mokhtar struct rte_bbdev_enc_op **ops, uint16_t num_ops) 4414935e1e9SAmr Mokhtar 4424935e1e9SAmr Mokhtar int rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool, 4434935e1e9SAmr Mokhtar struct rte_bbdev_dec_op **ops, uint16_t num_ops) 4444935e1e9SAmr Mokhtar 4454935e1e9SAmr Mokhtar``rte_bbdev_*_op_free_bulk()`` is called by the application to return an 4464935e1e9SAmr Mokhtaroperation to its allocating pool. 4474935e1e9SAmr Mokhtar 4484935e1e9SAmr Mokhtar.. code-block:: c 4494935e1e9SAmr Mokhtar 4504935e1e9SAmr Mokhtar void rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, 4514935e1e9SAmr Mokhtar unsigned int num_ops) 4524935e1e9SAmr Mokhtar void rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, 4534935e1e9SAmr Mokhtar unsigned int num_ops) 4544935e1e9SAmr Mokhtar 4557273821fSKamil ChalupnikBBDEV Inbound/Outbound Memory 4567273821fSKamil Chalupnik~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4574935e1e9SAmr Mokhtar 4584935e1e9SAmr MokhtarThe bbdev operation structure contains all the mutable data relating to 4593f3f6081SNicolas Chautruperforming Turbo and LDPC coding on a referenced mbuf data buffer. It is used for either 4607273821fSKamil Chalupnikencode or decode operations. 4614935e1e9SAmr Mokhtar 4623f3f6081SNicolas Chautru 4633f3f6081SNicolas Chautru.. csv-table:: Operation I/O 4643f3f6081SNicolas Chautru :header: "FEC", "In", "Out" 4653f3f6081SNicolas Chautru :widths: 20, 30, 30 4663f3f6081SNicolas Chautru 4673f3f6081SNicolas Chautru "Turbo Encode", "input", "output" 4683f3f6081SNicolas Chautru "Turbo Decode", "input", "hard output" 4693f3f6081SNicolas Chautru " ", " ", "soft output (optional)" 4703f3f6081SNicolas Chautru "LDPC Encode", "input", "output" 4713f3f6081SNicolas Chautru "LDPC Decode", "input", "hard output" 4723f3f6081SNicolas Chautru "", "HQ combine (optional)", "HQ combine (optional)" 4733f3f6081SNicolas Chautru " ", "", "soft output (optional)" 4743f3f6081SNicolas Chautru 4754935e1e9SAmr Mokhtar 4767273821fSKamil ChalupnikIt is expected that the application provides input and output mbuf pointers 4773f3f6081SNicolas Chautruallocated and ready to use. 4783f3f6081SNicolas Chautru 4793f3f6081SNicolas ChautruThe baseband framework supports FEC coding on Code Blocks (CB) and 4803f3f6081SNicolas ChautruTransport Blocks (TB). 4814935e1e9SAmr Mokhtar 4827273821fSKamil ChalupnikFor the output buffer(s), the application is required to provide an allocated 4833f3f6081SNicolas Chautruand free mbuf, to which the resulting output will be written. 4844935e1e9SAmr Mokhtar 4857273821fSKamil ChalupnikThe support of split "scattered" buffers is a driver-specific feature, so it is 4867273821fSKamil Chalupnikreported individually by the supporting driver as a capability. 4877273821fSKamil Chalupnik 4887273821fSKamil ChalupnikInput and output data buffers are identified by ``rte_bbdev_op_data`` structure, 4897273821fSKamil Chalupnikas follows: 4907273821fSKamil Chalupnik 4917273821fSKamil Chalupnik.. code-block:: c 4927273821fSKamil Chalupnik 4937273821fSKamil Chalupnik struct rte_bbdev_op_data { 4947273821fSKamil Chalupnik struct rte_mbuf *data; 4957273821fSKamil Chalupnik uint32_t offset; 4967273821fSKamil Chalupnik uint32_t length; 4977273821fSKamil Chalupnik }; 4987273821fSKamil Chalupnik 4997273821fSKamil Chalupnik 5007273821fSKamil ChalupnikThis structure has three elements: 5017273821fSKamil Chalupnik 5027273821fSKamil Chalupnik- ``data``: This is the mbuf data structure representing the data for BBDEV 5037273821fSKamil Chalupnik operation. 5047273821fSKamil Chalupnik 5057273821fSKamil Chalupnik This mbuf pointer can point to one Code Block (CB) data buffer or multiple CBs 5067273821fSKamil Chalupnik contiguously located next to each other. A Transport Block (TB) represents a 5077273821fSKamil Chalupnik whole piece of data that is divided into one or more CBs. Maximum number of 5083f3f6081SNicolas Chautru CBs can be contained in one TB is defined by 5093f3f6081SNicolas Chautru ``RTE_BBDEV_(TURBO/LDPC)MAX_CODE_BLOCKS``. 5107273821fSKamil Chalupnik 5117273821fSKamil Chalupnik An mbuf data structure cannot represent more than one TB. The smallest piece 5127273821fSKamil Chalupnik of data that can be contained in one mbuf is one CB. 5137273821fSKamil Chalupnik An mbuf can include one contiguous CB, subset of contiguous CBs that are 5143f3f6081SNicolas Chautru belonging to one TB, or all contiguous CBs that belong to one TB. 5157273821fSKamil Chalupnik 5167273821fSKamil Chalupnik If a BBDEV PMD supports the extended capability "Scatter-Gather", then it is 5177273821fSKamil Chalupnik capable of collecting (gathering) non-contiguous (scattered) data from 5187273821fSKamil Chalupnik multiple locations in the memory. 5197273821fSKamil Chalupnik This capability is reported by the capability flags: 5207273821fSKamil Chalupnik 5213f3f6081SNicolas Chautru - ``RTE_BBDEV_TURBO_ENC_SCATTER_GATHER``, ``RTE_BBDEV_TURBO_DEC_SCATTER_GATHER``, 5227273821fSKamil Chalupnik 5233f3f6081SNicolas Chautru - ``RTE_BBDEV_LDPC_ENC_SCATTER_GATHER``, ``RTE_BBDEV_LDPC_DEC_SCATTER_GATHER``. 5247273821fSKamil Chalupnik 5253f3f6081SNicolas Chautru Chained mbuf data structures are only accepted if a BBDEV PMD supports this 5263f3f6081SNicolas Chautru feature. A chained mbuf can represent one non-contiguous CB or multiple non-contiguous 5273f3f6081SNicolas Chautru CBs. The first mbuf segment in the given chained mbuf represents the first piece 5287273821fSKamil Chalupnik of the CB. Offset is only applicable to the first segment. ``length`` is the 5297273821fSKamil Chalupnik total length of the CB. 5307273821fSKamil Chalupnik 5317273821fSKamil Chalupnik BBDEV driver is responsible for identifying where the split is and enqueue 5327273821fSKamil Chalupnik the split data to its internal queues. 5337273821fSKamil Chalupnik 5347273821fSKamil Chalupnik If BBDEV PMD does not support this feature, it will assume inbound mbuf data 5357273821fSKamil Chalupnik contains one segment. 5367273821fSKamil Chalupnik 5377273821fSKamil Chalupnik The output mbuf data though is always one segment, even if the input was a 5387273821fSKamil Chalupnik chained mbuf. 5397273821fSKamil Chalupnik 5407273821fSKamil Chalupnik 5417273821fSKamil Chalupnik- ``offset``: This is the starting point of the BBDEV (encode/decode) operation, 5427273821fSKamil Chalupnik in bytes. 5437273821fSKamil Chalupnik 5447273821fSKamil Chalupnik BBDEV starts to read data past this offset. 5457273821fSKamil Chalupnik In case of chained mbuf, this offset applies only to the first mbuf segment. 5467273821fSKamil Chalupnik 5477273821fSKamil Chalupnik 5487273821fSKamil Chalupnik- ``length``: This is the total data length to be processed in one operation, 5497273821fSKamil Chalupnik in bytes. 5507273821fSKamil Chalupnik 5517273821fSKamil Chalupnik In case the mbuf data is representing one CB, this is the length of the CB 5527273821fSKamil Chalupnik undergoing the operation. 5537273821fSKamil Chalupnik If it is for multiple CBs, this is the total length of those CBs undergoing 5547273821fSKamil Chalupnik the operation. 5557273821fSKamil Chalupnik If it is for one TB, this is the total length of the TB under operation. 5567273821fSKamil Chalupnik In case of chained mbuf, this data length includes the lengths of the 5577273821fSKamil Chalupnik "scattered" data segments undergoing the operation. 5587273821fSKamil Chalupnik 5597273821fSKamil Chalupnik 5607273821fSKamil ChalupnikBBDEV Turbo Encode Operation 5617273821fSKamil Chalupnik~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5624935e1e9SAmr Mokhtar 563c49c880fSNicolas Chautru.. literalinclude:: ../../../lib/bbdev/rte_bbdev_op.h 564c49c880fSNicolas Chautru :language: c 565c49c880fSNicolas Chautru :start-after: Structure rte_bbdev_op_turbo_enc 8< 566c49c880fSNicolas Chautru :end-before: >8 End of structure rte_bbdev_op_turbo_enc. 5674935e1e9SAmr Mokhtar 5683f3f6081SNicolas ChautruThe Turbo encode structure includes the ``input`` and ``output`` mbuf 5693f3f6081SNicolas Chautrudata pointers. The provided mbuf pointer of ``input`` needs to be big 5703f3f6081SNicolas Chautruenough to stretch for extra CRC trailers. 5714935e1e9SAmr Mokhtar 5723f3f6081SNicolas Chautru.. csv-table:: **struct rte_bbdev_op_turbo_enc** parameters 5733f3f6081SNicolas Chautru :header: "Parameter", "Description" 5743f3f6081SNicolas Chautru :widths: 10, 30 5757273821fSKamil Chalupnik 5763f3f6081SNicolas Chautru "input","input CB or TB data" 5773f3f6081SNicolas Chautru "output","rate matched CB or TB output buffer" 5783f3f6081SNicolas Chautru "op_flags","bitmask of all active operation capabilities" 5793f3f6081SNicolas Chautru "rv_index","redundancy version index [0..3]" 5803f3f6081SNicolas Chautru "code_block_mode","code block or transport block mode" 5813f3f6081SNicolas Chautru "cb_params", "code block specific parameters (code block mode only)" 5823f3f6081SNicolas Chautru "tb_params", "transport block specific parameters (transport block mode only)" 5833f3f6081SNicolas Chautru 5847273821fSKamil Chalupnik 5857273821fSKamil ChalupnikThe encode interface works on both the code block (CB) and the transport block 5867273821fSKamil Chalupnik(TB). An operation executes in "CB-mode" when the CB is standalone. While 5877273821fSKamil Chalupnik"TB-mode" executes when an operation performs on one or multiple CBs that 5887273821fSKamil Chalupnikbelong to a TB. Therefore, a given data can be standalone CB, full-size TB or 5897273821fSKamil Chalupnikpartial TB. Partial TB means that only a subset of CBs belonging to a bigger TB 5907273821fSKamil Chalupnikare being enqueued. 5917273821fSKamil Chalupnik 5927273821fSKamil Chalupnik **NOTE:** It is assumed that all enqueued ops in one ``rte_bbdev_enqueue_enc_ops()`` 5937273821fSKamil Chalupnik call belong to one mode, either CB-mode or TB-mode. 5947273821fSKamil Chalupnik 5953f3f6081SNicolas ChautruIn case that the TB is smaller than Z (6144 bits), then effectively the TB = CB. 5967273821fSKamil ChalupnikCRC24A is appended to the tail of the CB. The application is responsible for 5977273821fSKamil Chalupnikcalculating and appending CRC24A before calling BBDEV in case that the 5987273821fSKamil Chalupnikunderlying driver does not support CRC24A generation. 5997273821fSKamil Chalupnik 6007273821fSKamil ChalupnikIn CB-mode, CRC24A/B is an optional operation. 6013f3f6081SNicolas ChautruThe CB parameter ``k`` is the size of the CB (this maps to K as described 6023f3f6081SNicolas Chautruin 3GPP TS 36.212 section 5.1.2), this size is inclusive of CRC24A/B. 6037273821fSKamil ChalupnikThe ``length`` is inclusive of CRC24A/B and equals to ``k`` in this case. 6047273821fSKamil Chalupnik 6057273821fSKamil ChalupnikNot all BBDEV PMDs are capable of CRC24A/B calculation. Flags 6067273821fSKamil Chalupnik``RTE_BBDEV_TURBO_CRC_24A_ATTACH`` and ``RTE_BBDEV_TURBO_CRC_24B_ATTACH`` 6077273821fSKamil Chalupnikinforms the application with relevant capability. These flags can be set in the 6083f3f6081SNicolas Chautru``op_flags`` parameter to indicate to BBDEV to calculate and append CRC24A/B 6093f3f6081SNicolas Chautruto CB before going forward with Turbo encoding. 6107273821fSKamil Chalupnik 6117273821fSKamil ChalupnikOutput format of the CB encode will have the encoded CB in ``e`` size output 6127273821fSKamil Chalupnik(this maps to E described in 3GPP TS 36.212 section 5.1.4.1.2). The output mbuf 6137273821fSKamil Chalupnikbuffer size needs to be big enough to hold the encoded buffer of size ``e``. 6147273821fSKamil Chalupnik 6157273821fSKamil ChalupnikIn TB-mode, CRC24A is assumed to be pre-calculated and appended to the inbound 6167273821fSKamil ChalupnikTB mbuf data buffer. 6177273821fSKamil ChalupnikThe output mbuf data structure is expected to be allocated by the application 6187273821fSKamil Chalupnikwith enough room for the output data. 6197273821fSKamil Chalupnik 6207273821fSKamil ChalupnikThe difference between the partial and full-size TB is that we need to know the 6217273821fSKamil Chalupnikindex of the first CB in this group and the number of CBs contained within. 6227273821fSKamil ChalupnikThe first CB index is given by ``r`` but the number of the remaining CBs is 6237273821fSKamil Chalupnikcalculated automatically by BBDEV before passing down to the driver. 6247273821fSKamil Chalupnik 6257273821fSKamil ChalupnikThe number of remaining CBs should not be confused with ``c``. ``c`` is the 6267273821fSKamil Chalupniktotal number of CBs that composes the whole TB (this maps to C as 6277273821fSKamil Chalupnikdescribed in 3GPP TS 36.212 section 5.1.2). 6287273821fSKamil Chalupnik 6297273821fSKamil ChalupnikThe ``length`` is total size of the CBs inclusive of any CRC24A and CRC24B in 6307273821fSKamil Chalupnikcase they were appended by the application. 6317273821fSKamil Chalupnik 6327273821fSKamil ChalupnikThe case when one CB belongs to TB and is being enqueued individually to BBDEV, 6337273821fSKamil Chalupnikthis case is considered as a special case of partial TB where its number of CBs 6347273821fSKamil Chalupnikis 1. Therefore, it requires to get processed in TB-mode. 6357273821fSKamil Chalupnik 63654c4cbb6SAmr MokhtarThe figure below visualizes the encoding of CBs using BBDEV interface in 63754c4cbb6SAmr MokhtarTB-mode. CB-mode is a reduced version, where only one CB exists: 63854c4cbb6SAmr Mokhtar 63954c4cbb6SAmr Mokhtar.. _figure_turbo_tb_encode: 64054c4cbb6SAmr Mokhtar 641e90561ffSThomas Monjalon.. figure:: img/turbo_tb_encode.* 64254c4cbb6SAmr Mokhtar 64354c4cbb6SAmr Mokhtar Turbo encoding of Code Blocks in mbuf structure 64454c4cbb6SAmr Mokhtar 6457273821fSKamil Chalupnik 6467273821fSKamil ChalupnikBBDEV Turbo Decode Operation 6477273821fSKamil Chalupnik~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6484935e1e9SAmr Mokhtar 649c49c880fSNicolas Chautru.. literalinclude:: ../../../lib/bbdev/rte_bbdev_op.h 650c49c880fSNicolas Chautru :language: c 651c49c880fSNicolas Chautru :start-after: Structure rte_bbdev_op_turbo_dec 8< 652c49c880fSNicolas Chautru :end-before: >8 End of structure rte_bbdev_op_turbo_dec. 6534935e1e9SAmr Mokhtar 6543f3f6081SNicolas ChautruThe Turbo decode structure includes the ``input``, ``hard_output`` and 6553f3f6081SNicolas Chautruoptionally the ``soft_output`` mbuf data pointers. 6564935e1e9SAmr Mokhtar 6573f3f6081SNicolas Chautru.. csv-table:: **struct rte_bbdev_op_turbo_dec** parameters 6583f3f6081SNicolas Chautru :header: "Parameter", "Description" 6593f3f6081SNicolas Chautru :widths: 10, 30 6604935e1e9SAmr Mokhtar 6613f3f6081SNicolas Chautru "input","virtual circular buffer, wk, size 3*Kpi for each CB" 6623f3f6081SNicolas Chautru "hard output","hard decisions buffer, decoded output, size K for each CB" 6633f3f6081SNicolas Chautru "soft output","soft LLR output buffer (optional)" 6643f3f6081SNicolas Chautru "op_flags","bitmask of all active operation capabilities" 6653f3f6081SNicolas Chautru "rv_index","redundancy version index [0..3]" 6669c30a6f3SHenry Nadeau "iter_max","maximum number of iterations to perform in decode all CBs" 6673f3f6081SNicolas Chautru "iter_min","minimum number of iterations to perform in decoding all CBs" 6683f3f6081SNicolas Chautru "iter_count","number of iterations to performed in decoding all CBs" 6693f3f6081SNicolas Chautru "ext_scale","scale factor on extrinsic info (5 bits)" 6703f3f6081SNicolas Chautru "num_maps","number of MAP engines to use in decode" 6713f3f6081SNicolas Chautru "code_block_mode","code block or transport block mode" 6723f3f6081SNicolas Chautru "cb_params", "code block specific parameters (code block mode only)" 6733f3f6081SNicolas Chautru "tb_params", "transport block specific parameters (transport block mode only)" 6744935e1e9SAmr Mokhtar 6757273821fSKamil ChalupnikSimilarly, the decode interface works on both the code block (CB) and the 6767273821fSKamil Chalupniktransport block (TB). An operation executes in "CB-mode" when the CB is 6777273821fSKamil Chalupnikstandalone. While "TB-mode" executes when an operation performs on one or 6787273821fSKamil Chalupnikmultiple CBs that belong to a TB. Therefore, a given data can be standalone CB, 6797273821fSKamil Chalupnikfull-size TB or partial TB. Partial TB means that only a subset of CBs belonging 6807273821fSKamil Chalupnikto a bigger TB are being enqueued. 6817273821fSKamil Chalupnik 6827273821fSKamil Chalupnik **NOTE:** It is assumed that all enqueued ops in one ``rte_bbdev_enqueue_dec_ops()`` 6837273821fSKamil Chalupnik call belong to one mode, either CB-mode or TB-mode. 6847273821fSKamil Chalupnik 6853f3f6081SNicolas Chautru 6863f3f6081SNicolas ChautruThe CB parameter ``k`` is the size of the decoded CB (this maps to K as described in 6877273821fSKamil Chalupnik3GPP TS 36.212 section 5.1.2), this size is inclusive of CRC24A/B. 6887273821fSKamil ChalupnikThe ``length`` is inclusive of CRC24A/B and equals to ``k`` in this case. 6897273821fSKamil Chalupnik 6907273821fSKamil ChalupnikThe input encoded CB data is the Virtual Circular Buffer data stream, wk, with 6917273821fSKamil Chalupnikthe null padding included as described in 3GPP TS 36.212 section 5.1.4.1.2 and 6927273821fSKamil Chalupnikshown in 3GPP TS 36.212 section 5.1.4.1 Figure 5.1.4-1. 6937273821fSKamil ChalupnikThe size of the virtual circular buffer is 3*Kpi, where Kpi is the 32 byte 6947273821fSKamil Chalupnikaligned value of K, as specified in 3GPP TS 36.212 section 5.1.4.1.1. 6957273821fSKamil Chalupnik 6967273821fSKamil ChalupnikEach byte in the input circular buffer is the LLR value of each bit of the 6977273821fSKamil Chalupnikoriginal CB. 6987273821fSKamil Chalupnik 6997273821fSKamil Chalupnik``hard_output`` is a mandatory capability that all BBDEV PMDs support. This is 7007273821fSKamil Chalupnikthe decoded CBs of K sizes (CRC24A/B is the last 24-bit in each decoded CB). 7017273821fSKamil ChalupnikSoft output is an optional capability for BBDEV PMDs. Setting flag 7027273821fSKamil Chalupnik``RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP`` in ``op_flags`` directs BBDEV to retain 7037273821fSKamil ChalupnikCRC24B at the end of each CB. This might be useful for the application in debug 7047273821fSKamil Chalupnikmode. 7057273821fSKamil ChalupnikAn LLR rate matched output is computed in the ``soft_output`` buffer structure 7063f3f6081SNicolas Chautrufor the given CB parameter ``e`` size (this maps to E described in 7073f3f6081SNicolas Chautru3GPP TS 36.212 section 5.1.4.1.2). The output mbuf buffer size needs to be big 7083f3f6081SNicolas Chautruenough to hold the encoded buffer of size ``e``. 7097273821fSKamil Chalupnik 7107273821fSKamil ChalupnikThe first CB Virtual Circular Buffer (VCB) index is given by ``r`` but the 7117273821fSKamil Chalupniknumber of the remaining CB VCBs is calculated automatically by BBDEV before 7127273821fSKamil Chalupnikpassing down to the driver. 7137273821fSKamil Chalupnik 7147273821fSKamil ChalupnikThe number of remaining CB VCBs should not be confused with ``c``. ``c`` is the 7157273821fSKamil Chalupniktotal number of CBs that composes the whole TB (this maps to C as 7167273821fSKamil Chalupnikdescribed in 3GPP TS 36.212 section 5.1.2). 7177273821fSKamil Chalupnik 7187273821fSKamil ChalupnikThe ``length`` is total size of the CBs inclusive of any CRC24A and CRC24B in 7197273821fSKamil Chalupnikcase they were appended by the application. 7207273821fSKamil Chalupnik 7217273821fSKamil ChalupnikThe case when one CB belongs to TB and is being enqueued individually to BBDEV, 7227273821fSKamil Chalupnikthis case is considered as a special case of partial TB where its number of CBs 7237273821fSKamil Chalupnikis 1. Therefore, it requires to get processed in TB-mode. 7247273821fSKamil Chalupnik 7257273821fSKamil ChalupnikThe output mbuf data structure is expected to be allocated by the application 7267273821fSKamil Chalupnikwith enough room for the output data. 7277273821fSKamil Chalupnik 72854c4cbb6SAmr MokhtarThe figure below visualizes the decoding of CBs using BBDEV interface in 72954c4cbb6SAmr MokhtarTB-mode. CB-mode is a reduced version, where only one CB exists: 73054c4cbb6SAmr Mokhtar 73154c4cbb6SAmr Mokhtar.. _figure_turbo_tb_decode: 73254c4cbb6SAmr Mokhtar 733e90561ffSThomas Monjalon.. figure:: img/turbo_tb_decode.* 73454c4cbb6SAmr Mokhtar 73554c4cbb6SAmr Mokhtar Turbo decoding of Code Blocks in mbuf structure 73654c4cbb6SAmr Mokhtar 7373f3f6081SNicolas ChautruBBDEV LDPC Encode Operation 7383f3f6081SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7393f3f6081SNicolas Chautru 7403f3f6081SNicolas ChautruThe operation flags that can be set for each LDPC encode operation are 7413f3f6081SNicolas Chautrugiven below. 7423f3f6081SNicolas Chautru 7433f3f6081SNicolas Chautru **NOTE:** The actual operation flags that may be used with a specific 7443f3f6081SNicolas Chautru BBDEV PMD are dependent on the driver capabilities as reported via 7453f3f6081SNicolas Chautru ``rte_bbdev_info_get()``, and may be a subset of those below. 7463f3f6081SNicolas Chautru 7473f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7483f3f6081SNicolas Chautru|Description of LDPC encode capability flags | 7493f3f6081SNicolas Chautru+====================================================================+ 7503f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_INTERLEAVER_BYPASS | 7513f3f6081SNicolas Chautru| Set to bypass bit-level interleaver on output stream | 7523f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7533f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_RATE_MATCH | 7543f3f6081SNicolas Chautru| Set to enabling the RATE_MATCHING processing | 7553f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7563f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_CRC_24A_ATTACH | 7573f3f6081SNicolas Chautru| Set to attach transport block CRC-24A | 7583f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7593f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_CRC_24B_ATTACH | 7603f3f6081SNicolas Chautru| Set to attach code block CRC-24B | 7613f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7623f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_CRC_16_ATTACH | 7633f3f6081SNicolas Chautru| Set to attach code block CRC-16 | 7643f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7653f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_ENC_INTERRUPTS | 7663f3f6081SNicolas Chautru| Set if a device supports encoder dequeue interrupts | 7673f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7683f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_ENC_SCATTER_GATHER | 7693f3f6081SNicolas Chautru| Set if a device supports scatter-gather functionality | 7703f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7713f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_ENC_CONCATENATION | 7723f3f6081SNicolas Chautru| Set if a device supports concatenation of non byte aligned output | 7733f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 7743f3f6081SNicolas Chautru 7753f3f6081SNicolas ChautruThe structure passed for each LDPC encode operation is given below, 7763f3f6081SNicolas Chautruwith the operation flags forming a bitmask in the ``op_flags`` field. 7773f3f6081SNicolas Chautru 778c49c880fSNicolas Chautru.. literalinclude:: ../../../lib/bbdev/rte_bbdev_op.h 779c49c880fSNicolas Chautru :language: c 780c49c880fSNicolas Chautru :start-after: Structure rte_bbdev_op_ldpc_enc 8< 781c49c880fSNicolas Chautru :end-before: >8 End of structure rte_bbdev_op_ldpc_enc. 7823f3f6081SNicolas Chautru 7833f3f6081SNicolas ChautruThe LDPC encode parameters are set out in the table below. 7843f3f6081SNicolas Chautru 7853f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 7863f3f6081SNicolas Chautru|Parameter |Description | 7873f3f6081SNicolas Chautru+================+====================================================================+ 7883f3f6081SNicolas Chautru|input |input CB or TB data | 7893f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 7903f3f6081SNicolas Chautru|output |rate matched CB or TB output buffer | 7913f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 7923f3f6081SNicolas Chautru|op_flags |bitmask of all active operation capabilities | 7933f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 7943f3f6081SNicolas Chautru|rv_index |redundancy version index [0..3] | 7953f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 7963f3f6081SNicolas Chautru|basegraph |Basegraph 1 or 2 | 7973f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 7983f3f6081SNicolas Chautru|z_c |Zc, LDPC lifting size | 7993f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 8003f3f6081SNicolas Chautru|n_cb |Ncb, length of the circular buffer in bits. | 8013f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 8023f3f6081SNicolas Chautru|q_m |Qm, modulation order {2,4,6,8,10} | 8033f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 8043f3f6081SNicolas Chautru|n_filler |number of filler bits | 8053f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 8063f3f6081SNicolas Chautru|code_block_mode |code block or transport block mode | 8073f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 8083f3f6081SNicolas Chautru|op_flags |bitmask of all active operation capabilities | 8093f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 8103f3f6081SNicolas Chautru|**cb_params** |code block specific parameters (code block mode only) | 8113f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 8123f3f6081SNicolas Chautru| |e |E, length of the rate matched output sequence in bits | 8133f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 8143f3f6081SNicolas Chautru|**tb_params** | transport block specific parameters (transport block mode only) | 8153f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 8163f3f6081SNicolas Chautru| |c |number of CBs in the TB or partial TB | 8173f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 8183f3f6081SNicolas Chautru| |r |index of the first CB in the inbound mbuf data | 8193f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 82015a9ef84SThomas Monjalon| |c_ab |number of CBs that use Ea before switching to Eb | 8213f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 8223f3f6081SNicolas Chautru| |ea |Ea, length of the RM output sequence in bits, r < cab | 8233f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 8243f3f6081SNicolas Chautru| |eb |Eb, length of the RM output sequence in bits, r >= cab | 8253f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 8263f3f6081SNicolas Chautru 8273f3f6081SNicolas ChautruThe mbuf input ``input`` is mandatory for all BBDEV PMDs and is the 8283f3f6081SNicolas Chautruincoming code block or transport block data. 8293f3f6081SNicolas Chautru 8303f3f6081SNicolas ChautruThe mbuf output ``output`` is mandatory and is the encoded CB(s). In 8313f3f6081SNicolas ChautruCB-mode ut contains the encoded CB of size ``e`` (E in 3GPP TS 38.212 8323f3f6081SNicolas Chautrusection 6.2.5). In TB-mode it contains multiple contiguous encoded CBs 8333f3f6081SNicolas Chautruof size ``ea`` or ``eb``. 8343f3f6081SNicolas ChautruThe ``output`` buffer is allocated by the application with enough room 8353f3f6081SNicolas Chautrufor the output data. 8363f3f6081SNicolas Chautru 8373f3f6081SNicolas ChautruThe encode interface works on both a code block (CB) and a transport 8383f3f6081SNicolas Chautrublock (TB) basis. 8393f3f6081SNicolas Chautru 8403f3f6081SNicolas Chautru **NOTE:** All enqueued ops in one ``rte_bbdev_enqueue_enc_ops()`` 8413f3f6081SNicolas Chautru call belong to one mode, either CB-mode or TB-mode. 8423f3f6081SNicolas Chautru 8433f3f6081SNicolas ChautruThe valid modes of operation are: 8443f3f6081SNicolas Chautru 8453f3f6081SNicolas Chautru* CB-mode: one CB (attach CRC24B if required) 8463f3f6081SNicolas Chautru* CB-mode: one CB making up one TB (attach CRC24A if required) 8473f3f6081SNicolas Chautru* TB-mode: one or more CB of a partial TB (attach CRC24B(s) if required) 8483f3f6081SNicolas Chautru* TB-mode: one or more CB of a complete TB (attach CRC24AB(s) if required) 8493f3f6081SNicolas Chautru 8503f3f6081SNicolas ChautruIn CB-mode if ``RTE_BBDEV_LDPC_CRC_24A_ATTACH`` is set then CRC24A 8513f3f6081SNicolas Chautruis appended to the CB. If ``RTE_BBDEV_LDPC_CRC_24A_ATTACH`` is not 8523f3f6081SNicolas Chautruset the application is responsible for calculating and appending CRC24A 8533f3f6081SNicolas Chautrubefore calling BBDEV. The input data mbuf ``length`` is inclusive of 8543f3f6081SNicolas ChautruCRC24A/B where present and is equal to the code block size ``K``. 8553f3f6081SNicolas Chautru 8563f3f6081SNicolas ChautruIn TB-mode, CRC24A is assumed to be pre-calculated and appended to the 8573f3f6081SNicolas Chautruinbound TB data buffer, unless the ``RTE_BBDEV_LDPC_CRC_24A_ATTACH`` 8583f3f6081SNicolas Chautruflag is set when it is the responsibility of BBDEV. The input data 8593f3f6081SNicolas Chautrumbuf ``length`` is total size of the CBs inclusive of any CRC24A and 8603f3f6081SNicolas ChautruCRC24B in the case they were appended by the application. 8613f3f6081SNicolas Chautru 8623f3f6081SNicolas ChautruNot all BBDEV PMDs may be capable of CRC24A/B calculation. Flags 8633f3f6081SNicolas Chautru``RTE_BBDEV_LDPC_CRC_24A_ATTACH`` and ``RTE_BBDEV_LDPC_CRC_24B_ATTACH`` 8643f3f6081SNicolas Chautruinform the application of the relevant capability. These flags can be set 8653f3f6081SNicolas Chautruin the ``op_flags`` parameter to indicate BBDEV to calculate and append 8663f3f6081SNicolas ChautruCRC24A to CB before going forward with LDPC encoding. 8673f3f6081SNicolas Chautru 8683f3f6081SNicolas ChautruThe difference between the partial and full-size TB is that BBDEV needs 8693f3f6081SNicolas Chautruthe index of the first CB in this group and the number of CBs in the group. 8703f3f6081SNicolas ChautruThe first CB index is given by ``r`` but the number of the CBs is 8713f3f6081SNicolas Chautrucalculated by BBDEV before signalling to the driver. 8723f3f6081SNicolas Chautru 8733f3f6081SNicolas ChautruThe number of CBs in the group should not be confused with ``c``, the 8743f3f6081SNicolas Chautrutotal number of CBs in the full TB (``C`` as per 3GPP TS 38.212 section 5.2.2) 8753f3f6081SNicolas Chautru 87615a9ef84SThomas MonjalonFigure :numref:`figure_turbo_tb_encode` above 87715a9ef84SThomas Monjalonshowing the Turbo encoding of CBs using BBDEV interface in TB-mode 87815a9ef84SThomas Monjalonis also valid for LDPC encode. 8793f3f6081SNicolas Chautru 8803f3f6081SNicolas ChautruBBDEV LDPC Decode Operation 8813f3f6081SNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8823f3f6081SNicolas Chautru 8833f3f6081SNicolas ChautruThe operation flags that can be set for each LDPC decode operation are 8843f3f6081SNicolas Chautrugiven below. 8853f3f6081SNicolas Chautru 8863f3f6081SNicolas Chautru **NOTE:** The actual operation flags that may be used with a specific 8873f3f6081SNicolas Chautru BBDEV PMD are dependent on the driver capabilities as reported via 8883f3f6081SNicolas Chautru ``rte_bbdev_info_get()``, and may be a subset of those below. 8893f3f6081SNicolas Chautru 8903f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 8913f3f6081SNicolas Chautru|Description of LDPC decode capability flags | 8923f3f6081SNicolas Chautru+====================================================================+ 8933f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK | 8943f3f6081SNicolas Chautru| Set for transport block CRC-24A checking | 8953f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 8963f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK | 8973f3f6081SNicolas Chautru| Set for code block CRC-24B checking | 8983f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 8993f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP | 9003f3f6081SNicolas Chautru| Set to drop the last CRC bits decoding output | 9013f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 902cc360fd3SNicolas Chautru|RTE_BBDEV_LDPC_CRC_TYPE_16_CHECK | 903cc360fd3SNicolas Chautru| Set for code block CRC-16 checking | 904cc360fd3SNicolas Chautru+--------------------------------------------------------------------+ 9053f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_DEINTERLEAVER_BYPASS | 9063f3f6081SNicolas Chautru| Set for bit-level de-interleaver bypass on input stream | 9073f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9083f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE | 9093f3f6081SNicolas Chautru| Set for HARQ combined input stream enable | 9103f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9113f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE | 9123f3f6081SNicolas Chautru| Set for HARQ combined output stream enable | 9133f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9143f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_DECODE_BYPASS | 9153f3f6081SNicolas Chautru| Set for LDPC decoder bypass | 9163f3f6081SNicolas Chautru| | 9173f3f6081SNicolas Chautru| RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE must be set | 9183f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9193f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_DECODE_SOFT_OUT | 9203f3f6081SNicolas Chautru| Set for soft-output stream enable | 9213f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9223f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_SOFT_OUT_RM_BYPASS | 9233f3f6081SNicolas Chautru| Set for Rate-Matching bypass on soft-out stream | 9243f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9253f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_SOFT_OUT_DEINTERLEAVER_BYPASS | 9263f3f6081SNicolas Chautru| Set for bit-level de-interleaver bypass on soft-output stream | 9273f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9283f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE | 9293f3f6081SNicolas Chautru| Set for iteration stopping on successful decode condition enable | 9303f3f6081SNicolas Chautru| | 9313f3f6081SNicolas Chautru| Where a successful decode is a successful syndrome check | 9323f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9333f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_DEC_INTERRUPTS | 9343f3f6081SNicolas Chautru| Set if a device supports decoder dequeue interrupts | 9353f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9363f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_DEC_SCATTER_GATHER | 9373f3f6081SNicolas Chautru| Set if a device supports scatter-gather functionality | 9383f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9393f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION | 9403f3f6081SNicolas Chautru| Set if a device supports input/output HARQ compression | 941cbcda56cSNicolas Chautru| Data is packed as 6 bits by dropping and saturating the MSBs | 9423f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9433f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_LLR_COMPRESSION | 9443f3f6081SNicolas Chautru| Set if a device supports input LLR compression | 945cbcda56cSNicolas Chautru| Data is packed as 6 bits by dropping and saturating the MSBs | 9463f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9473f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE | 9483f3f6081SNicolas Chautru| Set if a device supports HARQ input to device's internal memory | 9493f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9503f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE | 9513f3f6081SNicolas Chautru| Set if a device supports HARQ output to device's internal memory | 9523f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 9533f3f6081SNicolas Chautru|RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK | 9543f3f6081SNicolas Chautru| Set if a device supports loopback access to HARQ internal memory | 9553f3f6081SNicolas Chautru+--------------------------------------------------------------------+ 956f4e6c4efSNicolas Chautru|RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS | 957f4e6c4efSNicolas Chautru| Set if a device includes LLR filler bits in HARQ circular buffer | 958f4e6c4efSNicolas Chautru+--------------------------------------------------------------------+ 959f4e6c4efSNicolas Chautru|RTE_BBDEV_LDPC_HARQ_4BIT_COMPRESSION | 960f4e6c4efSNicolas Chautru|Set if a device supports input/output 4 bits HARQ compression | 961f4e6c4efSNicolas Chautru+--------------------------------------------------------------------+ 9623f3f6081SNicolas Chautru 9633f3f6081SNicolas ChautruThe structure passed for each LDPC decode operation is given below, 9643f3f6081SNicolas Chautruwith the operation flags forming a bitmask in the ``op_flags`` field. 9653f3f6081SNicolas Chautru 966c49c880fSNicolas Chautru.. literalinclude:: ../../../lib/bbdev/rte_bbdev_op.h 967c49c880fSNicolas Chautru :language: c 968c49c880fSNicolas Chautru :start-after: Structure rte_bbdev_op_ldpc_dec 8< 969c49c880fSNicolas Chautru :end-before: >8 End of structure rte_bbdev_op_ldpc_dec. 9703f3f6081SNicolas Chautru 9713f3f6081SNicolas ChautruThe LDPC decode parameters are set out in the table below. 9723f3f6081SNicolas Chautru 9733f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9743f3f6081SNicolas Chautru|Parameter |Description | 9753f3f6081SNicolas Chautru+================+====================================================================+ 9763f3f6081SNicolas Chautru|input |input CB or TB data | 9773f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9783f3f6081SNicolas Chautru|hard_output |hard decisions buffer, decoded output | 9793f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9803f3f6081SNicolas Chautru|soft_output |soft LLR output buffer (optional) | 9813f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9823f3f6081SNicolas Chautru|harq_comb_input |HARQ combined input buffer (optional) | 9833f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9843f3f6081SNicolas Chautru|harq_comb_output|HARQ combined output buffer (optional) | 9853f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9863f3f6081SNicolas Chautru|op_flags |bitmask of all active operation capabilities | 9873f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9883f3f6081SNicolas Chautru|rv_index |redundancy version index [0..3] | 9893f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9903f3f6081SNicolas Chautru|basegraph |Basegraph 1 or 2 | 9913f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9923f3f6081SNicolas Chautru|z_c |Zc, LDPC lifting size | 9933f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9943f3f6081SNicolas Chautru|n_cb |Ncb, length of the circular buffer in bits. | 9953f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9963f3f6081SNicolas Chautru|q_m |Qm, modulation order {1,2,4,6,8} from pi/2-BPSK to 256QAM | 9973f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 9983f3f6081SNicolas Chautru|n_filler |number of filler bits | 9993f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 10003f3f6081SNicolas Chautru|iter_max |maximum number of iterations to perform in decode all CBs | 10013f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 10023f3f6081SNicolas Chautru|iter_count |number of iterations performed in decoding all CBs | 10033f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 10043f3f6081SNicolas Chautru|code_block_mode |code block or transport block mode | 10053f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 10063f3f6081SNicolas Chautru|op_flags |bitmask of all active operation capabilities | 10073f3f6081SNicolas Chautru+----------------+--------------------------------------------------------------------+ 10083f3f6081SNicolas Chautru|**cb_params** |code block specific parameters (code block mode only) | 10093f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 10103f3f6081SNicolas Chautru| |e |E, length of the rate matched output sequence in bits | 10113f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 10123f3f6081SNicolas Chautru|**tb_params** | transport block specific parameters (transport block mode only) | 10133f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 10143f3f6081SNicolas Chautru| |c |number of CBs in the TB or partial TB | 10153f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 10163f3f6081SNicolas Chautru| |r |index of the first CB in the inbound mbuf data | 10173f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 10183f3f6081SNicolas Chautru| |c_ab |number of CBs that use Ea before switching to Eb | 10193f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 10203f3f6081SNicolas Chautru| |ea |Ea, length of the RM output sequence in bits, r < cab | 10213f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 10223f3f6081SNicolas Chautru| |eb |Eb, length of the RM output sequence in bits r >= cab | 10233f3f6081SNicolas Chautru+----------------+------------+-------------------------------------------------------+ 1024*591d38ccSNicolas Chautru| |k0 |Optional k0 Rate matching starting position override | 1025*591d38ccSNicolas Chautru+----------------+------------+-------------------------------------------------------+ 10263f3f6081SNicolas Chautru 10273f3f6081SNicolas ChautruThe mbuf input ``input`` encoded CB data is mandatory for all BBDEV PMDs 10283f3f6081SNicolas Chautruand is the Virtual Circular Buffer data stream with null padding. 10293f3f6081SNicolas ChautruEach byte in the input circular buffer is the LLR value of each bit of 10303f3f6081SNicolas Chautruthe original CB. 10313f3f6081SNicolas Chautru 10323f3f6081SNicolas ChautruThe mbuf output ``hard_output`` is mandatory and is the decoded CBs size 10333f3f6081SNicolas ChautruK (CRC24A/B is the last 24-bit in each decoded CB). 10343f3f6081SNicolas Chautru 10353f3f6081SNicolas ChautruThe mbuf output ``soft_output`` is optional and is an LLR rate matched 10363f3f6081SNicolas Chautruoutput of size ``e`` (this is ``E`` as per 3GPP TS 38.212 section 6.2.5). 10373f3f6081SNicolas Chautru 10383f3f6081SNicolas ChautruThe mbuf input ``harq_combine_input`` is optional and is a buffer with 10393f3f6081SNicolas Chautruthe input to the HARQ combination function of the device. If the 10403f3f6081SNicolas Chautrucapability RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE is set 10413f3f6081SNicolas Chautruthen the HARQ is stored in memory internal to the device and not visible 10423f3f6081SNicolas Chautruto BBDEV. 10433f3f6081SNicolas Chautru 10443f3f6081SNicolas ChautruThe mbuf output ``harq_combine_output`` is optional and is a buffer for 10453f3f6081SNicolas Chautruthe output of the HARQ combination function of the device. If the 10463f3f6081SNicolas Chautrucapability RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE is set 10473f3f6081SNicolas Chautruthen the HARQ is stored in memory internal to the device and not visible 10483f3f6081SNicolas Chautruto BBDEV. 10493f3f6081SNicolas Chautru 1050d7e38056SNicolas Chautru.. note:: 1051d7e38056SNicolas Chautru 1052d7e38056SNicolas Chautru More explicitly for a typical usage of HARQ retransmission 1053d7e38056SNicolas Chautru in a VRAN application using a HW PMD, there will be 2 cases. 1054d7e38056SNicolas Chautru 1055d7e38056SNicolas Chautru For 1st transmission, only the HARQ output is enabled: 1056d7e38056SNicolas Chautru 1057d7e38056SNicolas Chautru - the harq_combined_output.offset is provided to a given address. 1058d7e38056SNicolas Chautru ie. typically an integer index * 32K, 1059d7e38056SNicolas Chautru where the index is tracked by the application based on code block index 1060d7e38056SNicolas Chautru for a given UE and HARQ process. 1061d7e38056SNicolas Chautru 1062d7e38056SNicolas Chautru - the related operation flag would notably include 1063d7e38056SNicolas Chautru RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE and RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION. 1064d7e38056SNicolas Chautru 1065d7e38056SNicolas Chautru - note that no explicit flush or reset of the memory is required. 1066d7e38056SNicolas Chautru 1067d7e38056SNicolas Chautru For 2nd transmission, an input is also required to benefit from HARQ combination gain: 1068d7e38056SNicolas Chautru 1069d7e38056SNicolas Chautru - the changes mentioned above are the same (note that rvIndex may be adjusted). 1070d7e38056SNicolas Chautru 1071d7e38056SNicolas Chautru - the operation flag would additionally include the LDPC_HQ_COMBINE_IN_ENABLE flag. 1072d7e38056SNicolas Chautru 1073d7e38056SNicolas Chautru - the harq_combined_input.offset must be set to the address of the related code block 1074d7e38056SNicolas Chautru (ie. same as the harq_combine_output index above for the same code block, HARQ process, UE). 1075d7e38056SNicolas Chautru 1076d7e38056SNicolas Chautru - the harq_combined_input.length must be set to the length 1077d7e38056SNicolas Chautru which was provided back in the related harq_combined_output.length 1078d7e38056SNicolas Chautru when it has processed and dequeued (previous HARQ iteration). 1079d7e38056SNicolas Chautru 1080d7e38056SNicolas Chautru 10813f3f6081SNicolas ChautruThe output mbuf data structures are expected to be allocated by the 10823f3f6081SNicolas Chautruapplication with enough room for the output data. 10833f3f6081SNicolas Chautru 10843f3f6081SNicolas ChautruAs with the LDPC encode, the decode interface works on both a code block 10853f3f6081SNicolas Chautru(CB) and a transport block (TB) basis. 10863f3f6081SNicolas Chautru 10873f3f6081SNicolas Chautru **NOTE:** All enqueued ops in one ``rte_bbdev_enqueue_dec_ops()`` 10883f3f6081SNicolas Chautru call belong to one mode, either CB-mode or TB-mode. 10893f3f6081SNicolas Chautru 10903f3f6081SNicolas ChautruThe valid modes of operation are: 10913f3f6081SNicolas Chautru 10923f3f6081SNicolas Chautru* CB-mode: one CB (check CRC24B if required) 10933f3f6081SNicolas Chautru* CB-mode: one CB making up one TB (check CRC24A if required) 10943f3f6081SNicolas Chautru* TB-mode: one or more CB making up a partial TB (check CRC24B(s) if required) 10953f3f6081SNicolas Chautru* TB-mode: one or more CB making up a complete TB (check CRC24B(s) if required) 10963f3f6081SNicolas Chautru 10973f3f6081SNicolas ChautruThe mbuf ``length`` is inclusive of CRC24A/B where present and is equal 10983f3f6081SNicolas Chautruthe code block size ``K``. 10993f3f6081SNicolas Chautru 11003f3f6081SNicolas ChautruThe first CB Virtual Circular Buffer (VCB) index is given by ``r`` but the 1101f43d3dbbSDavid Marchandnumber of the remaining CB VCBs is calculated automatically by BBDEV 11023f3f6081SNicolas Chautruand passed down to the driver. 11033f3f6081SNicolas Chautru 11043f3f6081SNicolas ChautruThe number of remaining CB VCBs should not be confused with ``c``, the 11053f3f6081SNicolas Chautrutotal number of CBs in the full TB (``C`` as per 3GPP TS 38.212 section 5.2.2) 11063f3f6081SNicolas Chautru 11073f3f6081SNicolas ChautruThe ``length`` is total size of the CBs inclusive of any CRC24A and CRC24B in 11083f3f6081SNicolas Chautrucase they were appended by the application. 11093f3f6081SNicolas Chautru 111015a9ef84SThomas MonjalonFigure :numref:`figure_turbo_tb_decode` above 111115a9ef84SThomas Monjalonshowing the Turbo decoding of CBs using BBDEV interface in TB-mode 111215a9ef84SThomas Monjalonis also valid for LDPC decode. 11133f3f6081SNicolas Chautru 11149d393325SNicolas ChautruBBDEV FFT Operation 11159d393325SNicolas Chautru~~~~~~~~~~~~~~~~~~~ 11169d393325SNicolas Chautru 11179d393325SNicolas ChautruThis operation allows to run a combination of DFT and/or IDFT and/or time-domain windowing. 11189d393325SNicolas ChautruThese can be used in a modular fashion (using bypass modes) or as a processing pipeline 11199d393325SNicolas Chautruwhich can be used for FFT-based baseband signal processing. 11209d393325SNicolas Chautru 11219d393325SNicolas ChautruIn more details it allows : 11229d393325SNicolas Chautru 11239d393325SNicolas Chautru* to process the data first through an IDFT of adjustable size and padding; 11249d393325SNicolas Chautru* to perform the windowing as a programmable cyclic shift offset of the data 11259d393325SNicolas Chautru followed by a pointwise multiplication by a time domain window; 11269d393325SNicolas Chautru* to process the related data through a DFT of adjustable size and 11279d393325SNicolas Chautru de-padding for each such cyclic shift output. 11289d393325SNicolas Chautru 11299d393325SNicolas ChautruA flexible number of Rx antennas are being processed in parallel with the same configuration. 11309d393325SNicolas ChautruThe API allows more generally for flexibility in what the PMD may support (capability flags) and 11319d393325SNicolas Chautruflexibility to adjust some of the parameters of the processing. 11329d393325SNicolas Chautru 1133c49c880fSNicolas ChautruThe structure passed for each FFT operation is given below, 1134c49c880fSNicolas Chautruwith the operation flags forming a bitmask in the ``op_flags`` field. 11359d393325SNicolas Chautru 11369d393325SNicolas Chautru **NOTE:** The actual operation flags that may be used with a specific 11379d393325SNicolas Chautru bbdev PMD are dependent on the driver capabilities as reported via 11389d393325SNicolas Chautru ``rte_bbdev_info_get()``, and may be a subset of those below. 11399d393325SNicolas Chautru 1140c49c880fSNicolas Chautru.. literalinclude:: ../../../lib/bbdev/rte_bbdev_op.h 1141c49c880fSNicolas Chautru :language: c 1142c49c880fSNicolas Chautru :start-after: Structure rte_bbdev_op_fft 8< 1143c49c880fSNicolas Chautru :end-before: >8 End of structure rte_bbdev_op_fft. 1144c49c880fSNicolas Chautru 11459d393325SNicolas Chautru+--------------------------------------------------------------------+ 11469d393325SNicolas Chautru|Description of FFT capability flags | 11479d393325SNicolas Chautru+====================================================================+ 11489d393325SNicolas Chautru|RTE_BBDEV_FFT_WINDOWING | 11499d393325SNicolas Chautru| Set to enable/support windowing in time domain | 11509d393325SNicolas Chautru+--------------------------------------------------------------------+ 11519d393325SNicolas Chautru|RTE_BBDEV_FFT_CS_ADJUSTMENT | 11529d393325SNicolas Chautru| Set to enable/support the cyclic shift time offset adjustment | 11539d393325SNicolas Chautru+--------------------------------------------------------------------+ 11549d393325SNicolas Chautru|RTE_BBDEV_FFT_DFT_BYPASS | 11559d393325SNicolas Chautru| Set to bypass the DFT and use directly the IDFT as an option | 11569d393325SNicolas Chautru+--------------------------------------------------------------------+ 11579d393325SNicolas Chautru|RTE_BBDEV_FFT_IDFT_BYPASS | 11589d393325SNicolas Chautru| Set to bypass the IDFT and use directly the DFT as an option | 11599d393325SNicolas Chautru+--------------------------------------------------------------------+ 11609d393325SNicolas Chautru|RTE_BBDEV_FFT_WINDOWING_BYPASS | 11619d393325SNicolas Chautru| Set to bypass the time domain windowing as an option | 11629d393325SNicolas Chautru+--------------------------------------------------------------------+ 11639d393325SNicolas Chautru|RTE_BBDEV_FFT_POWER_MEAS | 11649d393325SNicolas Chautru| Set to provide an optional power measurement of the DFT output | 11659d393325SNicolas Chautru+--------------------------------------------------------------------+ 11669d393325SNicolas Chautru|RTE_BBDEV_FFT_FP16_INPUT | 11679d393325SNicolas Chautru| Set if the input data shall use FP16 format instead of INT16 | 11689d393325SNicolas Chautru+--------------------------------------------------------------------+ 11699d393325SNicolas Chautru|RTE_BBDEV_FFT_FP16_OUTPUT | 11709d393325SNicolas Chautru| Set if the output data shall use FP16 format instead of INT16 | 11719d393325SNicolas Chautru+--------------------------------------------------------------------+ 11720aa8b208SNicolas Chautru|RTE_BBDEV_FFT_TIMING_OFFSET_PER_CS | 11730aa8b208SNicolas Chautru| Set if device supports adjusting time offset per CS | 11740aa8b208SNicolas Chautru+--------------------------------------------------------------------+ 11750aa8b208SNicolas Chautru|RTE_BBDEV_FFT_TIMING_ERROR | 11760aa8b208SNicolas Chautru| Set if device supports correcting for timing error | 11770aa8b208SNicolas Chautru+--------------------------------------------------------------------+ 11780aa8b208SNicolas Chautru|RTE_BBDEV_FFT_DEWINDOWING | 11790aa8b208SNicolas Chautru| Set if enabling the option FFT Dewindowing in Frequency domain | 11800aa8b208SNicolas Chautru+--------------------------------------------------------------------+ 11810aa8b208SNicolas Chautru|RTE_BBDEV_FFT_FREQ_RESAMPLING | 11820aa8b208SNicolas Chautru| Set if device supports the optional frequency resampling | 11830aa8b208SNicolas Chautru+--------------------------------------------------------------------+ 11849d393325SNicolas Chautru 11859d393325SNicolas ChautruThe FFT parameters are set out in the table below. 11869d393325SNicolas Chautru 11879d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 11889d393325SNicolas Chautru|Parameter |Description | 11899d393325SNicolas Chautru+=========================+==============================================================+ 11909d393325SNicolas Chautru|base_input |input data | 11919d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 11929d393325SNicolas Chautru|base_output |output data | 11939d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 11940aa8b208SNicolas Chautru|dewindowing_input |optional frequency domain dewindowing input data | 11950aa8b208SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 11969d393325SNicolas Chautru|power_meas_output |optional output data with power measurement on DFT output | 11979d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 11989d393325SNicolas Chautru|op_flags |bitmask of all active operation capabilities | 11999d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12009d393325SNicolas Chautru|input_sequence_size |size of the input sequence in 32-bits points per antenna | 12019d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12029d393325SNicolas Chautru|input_leading_padding |number of points padded at the start of input data | 12039d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12049d393325SNicolas Chautru|output_sequence_size |size of the output sequence per antenna and cyclic shift | 12059d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12069d393325SNicolas Chautru|output_leading_depadding |number of points de-padded at the start of output data | 12079d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12089d393325SNicolas Chautru|window_index |optional windowing profile index used for each cyclic shift | 12099d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12109d393325SNicolas Chautru|cs_bitmap |bitmap of the cyclic shift output requested (LSB for index 0) | 12119d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12129d393325SNicolas Chautru|num_antennas_log2 |number of antennas as a log2 (10 maps to 1024...) | 12139d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12149d393325SNicolas Chautru|idft_log2 |IDFT size as a log2 | 12159d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12169d393325SNicolas Chautru|dft_log2 |DFT size as a log2 | 12179d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12189d393325SNicolas Chautru|cs_time_adjustment |adjustment of time position of all the cyclic shift output | 12199d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12209d393325SNicolas Chautru|idft_shift |shift down of signal level post iDFT | 12219d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12229d393325SNicolas Chautru|dft_shift |shift down of signal level post DFT | 12239d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12249d393325SNicolas Chautru|ncs_reciprocal |inverse of max number of CS normalized to 15b (ie. 231 for 12)| 12259d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12269d393325SNicolas Chautru|power_shift |shift down of level of power measurement when enabled | 12279d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12289d393325SNicolas Chautru|fp16_exp_adjust |value added to FP16 exponent at conversion from INT16 | 12299d393325SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12300aa8b208SNicolas Chautru|freq_resample_mode |frequency ressampling mode (0:transparent, 1-2: resample) | 12310aa8b208SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12320aa8b208SNicolas Chautru| output_depadded_size |output depadded size prior to frequency resampling | 12330aa8b208SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12340aa8b208SNicolas Chautru|cs_theta_0 |timing error correction initial phase | 12350aa8b208SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12360aa8b208SNicolas Chautru|cs_theta_d |timing error correction phase increment | 12370aa8b208SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12380aa8b208SNicolas Chautru|time_offset |time offset per CS of time domain samples | 12390aa8b208SNicolas Chautru+-------------------------+--------------------------------------------------------------+ 12409d393325SNicolas Chautru 12419d393325SNicolas ChautruThe mbuf input ``base_input`` is mandatory for all bbdev PMDs and 12429d393325SNicolas Chautruis the incoming data for the processing. Its size may not fit into an actual mbuf, 12439d393325SNicolas Chautrubut the structure is used to pass iova address. 12449d393325SNicolas ChautruThe mbuf output ``output`` is mandatory and is output of the FFT processing chain. 12459d393325SNicolas ChautruEach point is a complex number of 32bits : 12469d393325SNicolas Chautrueither as 2 INT16 or as 2 FP16 based when the option supported. 12479d393325SNicolas ChautruThe data layout is based on contiguous concatenation of output data 12489d393325SNicolas Chautrufirst by cyclic shift then by antenna. 12494935e1e9SAmr Mokhtar 1250089148fcSNicolas ChautruBBDEV MLD-TS Operation 1251089148fcSNicolas Chautru~~~~~~~~~~~~~~~~~~~~~~ 1252089148fcSNicolas Chautru 1253089148fcSNicolas ChautruThis operation allows to run the Tree Search (TS) portion of a Maximum Likelihood processing (MLD). 1254089148fcSNicolas Chautru 1255089148fcSNicolas ChautruThis alternate equalization option accelerates the exploration of the best combination of 1256089148fcSNicolas Chautrutransmitted symbols across layers minimizing the Euclidean distance between the received and 1257089148fcSNicolas Chautrureconstructed signal, then generates the LLRs to be used by the LDPC Decoder. 1258089148fcSNicolas ChautruThe input is the results of the Q R decomposition: Q^Hy signal and R matrix. 1259089148fcSNicolas Chautru 1260089148fcSNicolas ChautruThe structure passed for each MLD-TS operation is given below, 1261089148fcSNicolas Chautruwith the operation flags forming a bitmask in the ``op_flags`` field. 1262089148fcSNicolas Chautru 1263089148fcSNicolas Chautru **NOTE:** The actual operation flags that may be used with a specific 1264089148fcSNicolas Chautru bbdev PMD are dependent on the driver capabilities as reported via 1265089148fcSNicolas Chautru ``rte_bbdev_info_get()``, and may be a subset of those below. 1266089148fcSNicolas Chautru 1267089148fcSNicolas Chautru.. literalinclude:: ../../../lib/bbdev/rte_bbdev_op.h 1268089148fcSNicolas Chautru :language: c 1269089148fcSNicolas Chautru :start-after: Structure rte_bbdev_op_mldts 8< 1270089148fcSNicolas Chautru :end-before: >8 End of structure rte_bbdev_op_mldts. 1271089148fcSNicolas Chautru 1272089148fcSNicolas Chautru+--------------------------------------------------------------------+ 1273089148fcSNicolas Chautru|Description of MLD-TS capability flags | 1274089148fcSNicolas Chautru+====================================================================+ 1275089148fcSNicolas Chautru|RTE_BBDEV_MLDTS_REP | 1276089148fcSNicolas Chautru| Set if the option to use repeated data from R channel is supported | 1277089148fcSNicolas Chautru+--------------------------------------------------------------------+ 1278089148fcSNicolas Chautru 1279089148fcSNicolas ChautruThe MLD-TS parameters are set out in the table below. 1280089148fcSNicolas Chautru 1281089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1282089148fcSNicolas Chautru|Parameter |Description | 1283089148fcSNicolas Chautru+=========================+==============================================================+ 1284089148fcSNicolas Chautru|qhy_input |input data qHy | 1285089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1286089148fcSNicolas Chautru|r_input |input data R triangular matrix | 1287089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1288089148fcSNicolas Chautru|output |output data (LLRs) | 1289089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1290089148fcSNicolas Chautru|op_flags |bitmask of all active operation capabilities | 1291089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1292089148fcSNicolas Chautru|num_rbs |number of Resource Blocks | 1293089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1294089148fcSNicolas Chautru|num_layers |number of overlapping layers | 1295089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1296089148fcSNicolas Chautru|q_m |array of modulation order for each layer | 1297089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1298089148fcSNicolas Chautru|r_rep |optional row repetition for the R matrix (subcarriers) | 1299089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1300089148fcSNicolas Chautru|c_rep |optional column repetition for the R matrix (symbols) | 1301089148fcSNicolas Chautru+-------------------------+--------------------------------------------------------------+ 1302089148fcSNicolas Chautru 13034935e1e9SAmr MokhtarSample code 13044935e1e9SAmr Mokhtar----------- 13054935e1e9SAmr Mokhtar 13064935e1e9SAmr MokhtarThe baseband device sample application gives an introduction on how to use the 13074935e1e9SAmr Mokhtarbbdev framework, by giving a sample code performing a loop-back operation with a 13084935e1e9SAmr Mokhtarbaseband processor capable of transceiving data packets. 13094935e1e9SAmr Mokhtar 13104935e1e9SAmr MokhtarThe following sample C-like pseudo-code shows the basic steps to encode several 1311d629b7b5SJohn McNamarabuffers using (**sw_turbo**) bbdev PMD. 13124935e1e9SAmr Mokhtar 13134935e1e9SAmr Mokhtar.. code-block:: c 13144935e1e9SAmr Mokhtar 13154935e1e9SAmr Mokhtar /* EAL Init */ 13164935e1e9SAmr Mokhtar ret = rte_eal_init(argc, argv); 13174935e1e9SAmr Mokhtar if (ret < 0) 13184935e1e9SAmr Mokhtar rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n"); 13194935e1e9SAmr Mokhtar 13204935e1e9SAmr Mokhtar /* Get number of available bbdev devices */ 13214935e1e9SAmr Mokhtar nb_bbdevs = rte_bbdev_count(); 13224935e1e9SAmr Mokhtar if (nb_bbdevs == 0) 13234935e1e9SAmr Mokhtar rte_exit(EXIT_FAILURE, "No bbdevs detected!\n"); 13244935e1e9SAmr Mokhtar 13254935e1e9SAmr Mokhtar /* Create bbdev op pools */ 13264935e1e9SAmr Mokhtar bbdev_op_pool[RTE_BBDEV_OP_TURBO_ENC] = 13274935e1e9SAmr Mokhtar rte_bbdev_op_pool_create("bbdev_op_pool_enc", 13284935e1e9SAmr Mokhtar RTE_BBDEV_OP_TURBO_ENC, NB_MBUF, 128, rte_socket_id()); 13294935e1e9SAmr Mokhtar 13304935e1e9SAmr Mokhtar /* Get information for this device */ 13314935e1e9SAmr Mokhtar rte_bbdev_info_get(dev_id, &info); 13324935e1e9SAmr Mokhtar 13334935e1e9SAmr Mokhtar /* Setup BBDEV device queues */ 13344935e1e9SAmr Mokhtar ret = rte_bbdev_setup_queues(dev_id, qs_nb, info.socket_id); 13354935e1e9SAmr Mokhtar if (ret < 0) 13364935e1e9SAmr Mokhtar rte_exit(EXIT_FAILURE, 13374935e1e9SAmr Mokhtar "ERROR(%d): BBDEV %u not configured properly\n", 13384935e1e9SAmr Mokhtar ret, dev_id); 13394935e1e9SAmr Mokhtar 13404935e1e9SAmr Mokhtar /* setup device queues */ 13414935e1e9SAmr Mokhtar qconf.socket = info.socket_id; 13424935e1e9SAmr Mokhtar qconf.queue_size = info.drv.queue_size_lim; 13434935e1e9SAmr Mokhtar qconf.op_type = RTE_BBDEV_OP_TURBO_ENC; 13444935e1e9SAmr Mokhtar 13454935e1e9SAmr Mokhtar for (q_id = 0; q_id < qs_nb; q_id++) { 13464935e1e9SAmr Mokhtar /* Configure all queues belonging to this bbdev device */ 13474935e1e9SAmr Mokhtar ret = rte_bbdev_queue_configure(dev_id, q_id, &qconf); 13484935e1e9SAmr Mokhtar if (ret < 0) 13494935e1e9SAmr Mokhtar rte_exit(EXIT_FAILURE, 13504935e1e9SAmr Mokhtar "ERROR(%d): BBDEV %u queue %u not configured properly\n", 13514935e1e9SAmr Mokhtar ret, dev_id, q_id); 13524935e1e9SAmr Mokhtar } 13534935e1e9SAmr Mokhtar 13544935e1e9SAmr Mokhtar /* Start bbdev device */ 13554935e1e9SAmr Mokhtar ret = rte_bbdev_start(dev_id); 13564935e1e9SAmr Mokhtar 13574935e1e9SAmr Mokhtar /* Create the mbuf mempool for pkts */ 13584935e1e9SAmr Mokhtar mbuf_pool = rte_pktmbuf_pool_create("bbdev_mbuf_pool", 13594935e1e9SAmr Mokhtar NB_MBUF, MEMPOOL_CACHE_SIZE, 0, 13604935e1e9SAmr Mokhtar RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); 13614935e1e9SAmr Mokhtar if (mbuf_pool == NULL) 13624935e1e9SAmr Mokhtar rte_exit(EXIT_FAILURE, 13634935e1e9SAmr Mokhtar "Unable to create '%s' pool\n", pool_name); 13644935e1e9SAmr Mokhtar 13654935e1e9SAmr Mokhtar while (!global_exit_flag) { 13664935e1e9SAmr Mokhtar 13674935e1e9SAmr Mokhtar /* Allocate burst of op structures in preparation for enqueue */ 13684935e1e9SAmr Mokhtar if (rte_bbdev_enc_op_alloc_bulk(bbdev_op_pool[RTE_BBDEV_OP_TURBO_ENC], 13694935e1e9SAmr Mokhtar ops_burst, op_num) != 0) 13704935e1e9SAmr Mokhtar continue; 13714935e1e9SAmr Mokhtar 13724935e1e9SAmr Mokhtar /* Allocate input mbuf pkts */ 13734935e1e9SAmr Mokhtar ret = rte_pktmbuf_alloc_bulk(mbuf_pool, input_pkts_burst, MAX_PKT_BURST); 13744935e1e9SAmr Mokhtar if (ret < 0) 13754935e1e9SAmr Mokhtar continue; 13764935e1e9SAmr Mokhtar 13774935e1e9SAmr Mokhtar /* Allocate output mbuf pkts */ 13784935e1e9SAmr Mokhtar ret = rte_pktmbuf_alloc_bulk(mbuf_pool, output_pkts_burst, MAX_PKT_BURST); 13794935e1e9SAmr Mokhtar if (ret < 0) 13804935e1e9SAmr Mokhtar continue; 13814935e1e9SAmr Mokhtar 13824935e1e9SAmr Mokhtar for (j = 0; j < op_num; j++) { 13834935e1e9SAmr Mokhtar /* Append the size of the ethernet header */ 13844935e1e9SAmr Mokhtar rte_pktmbuf_append(input_pkts_burst[j], 13856d13ea8eSOlivier Matz sizeof(struct rte_ether_hdr)); 13864935e1e9SAmr Mokhtar 13874935e1e9SAmr Mokhtar /* set op */ 13884935e1e9SAmr Mokhtar 13894935e1e9SAmr Mokhtar ops_burst[j]->turbo_enc.input.offset = 13906d13ea8eSOlivier Matz sizeof(struct rte_ether_hdr); 13914935e1e9SAmr Mokhtar 13924935e1e9SAmr Mokhtar ops_burst[j]->turbo_enc->input.length = 13934935e1e9SAmr Mokhtar rte_pktmbuf_pkt_len(bbdev_pkts[j]); 13944935e1e9SAmr Mokhtar 13954935e1e9SAmr Mokhtar ops_burst[j]->turbo_enc->input.data = 13964935e1e9SAmr Mokhtar input_pkts_burst[j]; 13974935e1e9SAmr Mokhtar 13984935e1e9SAmr Mokhtar ops_burst[j]->turbo_enc->output.offset = 13996d13ea8eSOlivier Matz sizeof(struct rte_ether_hdr); 14004935e1e9SAmr Mokhtar 14014935e1e9SAmr Mokhtar ops_burst[j]->turbo_enc->output.data = 14024935e1e9SAmr Mokhtar output_pkts_burst[j]; 14034935e1e9SAmr Mokhtar } 14044935e1e9SAmr Mokhtar 14054935e1e9SAmr Mokhtar /* Enqueue packets on BBDEV device */ 14064935e1e9SAmr Mokhtar op_num = rte_bbdev_enqueue_enc_ops(qconf->bbdev_id, 14074935e1e9SAmr Mokhtar qconf->bbdev_qs[q], ops_burst, 14084935e1e9SAmr Mokhtar MAX_PKT_BURST); 14094935e1e9SAmr Mokhtar 14104935e1e9SAmr Mokhtar /* Dequeue packets from BBDEV device*/ 14114935e1e9SAmr Mokhtar op_num = rte_bbdev_dequeue_enc_ops(qconf->bbdev_id, 14124935e1e9SAmr Mokhtar qconf->bbdev_qs[q], ops_burst, 14134935e1e9SAmr Mokhtar MAX_PKT_BURST); 14144935e1e9SAmr Mokhtar } 14154935e1e9SAmr Mokhtar 14164935e1e9SAmr Mokhtar 14174935e1e9SAmr MokhtarBBDEV Device API 14184935e1e9SAmr Mokhtar~~~~~~~~~~~~~~~~ 14194935e1e9SAmr Mokhtar 14204935e1e9SAmr MokhtarThe bbdev Library API is described in the *DPDK API Reference* document. 1421