1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
5 #ifndef _RTE_BBDEV_OP_H_
6 #define _RTE_BBDEV_OP_H_
11 * Defines wireless base band layer 1 operations and capabilities
14 * @b EXPERIMENTAL: this API may change without prior notice
23 #include <rte_common.h>
25 #include <rte_memory.h>
26 #include <rte_mempool.h>
28 /* Number of columns in sub-block interleaver (36.212, section 5.1.4.1.1) */
29 #define RTE_BBDEV_TURBO_C_SUBBLOCK (32)
30 /* Maximum size of Transport Block (36.213, Table, Table 7.1.7.2.5-1) */
31 #define RTE_BBDEV_TURBO_MAX_TB_SIZE (391656)
32 /* Maximum size of Code Block (36.212, Table 5.1.3-3) */
33 #define RTE_BBDEV_TURBO_MAX_CB_SIZE (6144)
34 /* Maximum size of Code Block */
35 #define RTE_BBDEV_LDPC_MAX_CB_SIZE (8448)
36 /* Minimum size of Code Block (36.212, Table 5.1.3-3) */
37 #define RTE_BBDEV_TURBO_MIN_CB_SIZE (40)
38 /* Maximum size of circular buffer */
39 #define RTE_BBDEV_TURBO_MAX_KW (18528)
41 * Turbo: Maximum number of Code Blocks in Transport Block. It is calculated
42 * based on maximum size of one Code Block and one Transport Block
43 * (considering CRC24A and CRC24B):
44 * (391656 + 24) / (6144 - 24) = 64
46 #define RTE_BBDEV_TURBO_MAX_CODE_BLOCKS (64)
47 /* LDPC: Maximum number of Code Blocks in Transport Block.*/
48 #define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
50 /** Flags for turbo decoder operation and capability structure */
51 enum rte_bbdev_op_td_flag_bitmasks {
52 /** If sub block de-interleaving is to be performed. */
53 RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE = (1ULL << 0),
54 /** To use CRC Type 24B (otherwise use CRC Type 24A). */
55 RTE_BBDEV_TURBO_CRC_TYPE_24B = (1ULL << 1),
56 /** If turbo equalization is to be performed. */
57 RTE_BBDEV_TURBO_EQUALIZER = (1ULL << 2),
58 /** If set, saturate soft output to +/-127 */
59 RTE_BBDEV_TURBO_SOFT_OUT_SATURATE = (1ULL << 3),
60 /** Set to 1 to start iteration from even, else odd; one iteration =
63 RTE_BBDEV_TURBO_HALF_ITERATION_EVEN = (1ULL << 4),
64 /** If 0, TD stops after CRC matches; else if 1, runs to end of next
65 * odd iteration after CRC matches
67 RTE_BBDEV_TURBO_CONTINUE_CRC_MATCH = (1ULL << 5),
68 /** Set if soft output is required to be output */
69 RTE_BBDEV_TURBO_SOFT_OUTPUT = (1ULL << 6),
70 /** Set to enable early termination mode */
71 RTE_BBDEV_TURBO_EARLY_TERMINATION = (1ULL << 7),
72 /** Set if a device supports decoder dequeue interrupts */
73 RTE_BBDEV_TURBO_DEC_INTERRUPTS = (1ULL << 9),
74 /** Set if positive LLR encoded input is supported. Positive LLR value
75 * represents the level of confidence for bit '1', and vice versa for
77 * This is mutually exclusive with RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN
78 * when used to formalize the input data format.
80 RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN = (1ULL << 10),
81 /** Set if negative LLR encoded input is supported. Negative LLR value
82 * represents the level of confidence for bit '1', and vice versa for
84 * This is mutually exclusive with RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN
85 * when used to formalize the input data format.
87 RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN = (1ULL << 11),
88 /** Set if positive LLR soft output is supported. Positive LLR value
89 * represents the level of confidence for bit '1', and vice versa for
91 * This is mutually exclusive with
92 * RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT when used to formalize
93 * the input data format.
95 RTE_BBDEV_TURBO_POS_LLR_1_BIT_SOFT_OUT = (1ULL << 12),
96 /** Set if negative LLR soft output is supported. Negative LLR value
97 * represents the level of confidence for bit '1', and vice versa for
99 * This is mutually exclusive with
100 * RTE_BBDEV_TURBO_POS_LLR_1_BIT_SOFT_OUT when used to formalize the
103 RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT = (1ULL << 13),
104 /** Set if driver supports flexible parallel MAP engine decoding. If
105 * not supported, num_maps (number of MAP engines) argument is unusable.
107 RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
108 /** Set if a device supports scatter-gather functionality */
109 RTE_BBDEV_TURBO_DEC_SCATTER_GATHER = (1ULL << 15),
110 /** Set to keep CRC24B bits appended while decoding. Only usable when
111 * decoding Transport Blocks (code_block_mode = 0).
113 RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP = (1ULL << 16)
117 /** Flags for turbo encoder operation and capability structure */
118 enum rte_bbdev_op_te_flag_bitmasks {
119 /** Ignore rv_index and set K0 = 0 */
120 RTE_BBDEV_TURBO_RV_INDEX_BYPASS = (1ULL << 0),
121 /** If rate matching is to be performed */
122 RTE_BBDEV_TURBO_RATE_MATCH = (1ULL << 1),
123 /** This bit must be set to enable CRC-24B generation */
124 RTE_BBDEV_TURBO_CRC_24B_ATTACH = (1ULL << 2),
125 /** This bit must be set to enable CRC-24A generation */
126 RTE_BBDEV_TURBO_CRC_24A_ATTACH = (1ULL << 3),
127 /** Set if a device supports encoder dequeue interrupts */
128 RTE_BBDEV_TURBO_ENC_INTERRUPTS = (1ULL << 4),
129 /** Set if a device supports scatter-gather functionality */
130 RTE_BBDEV_TURBO_ENC_SCATTER_GATHER = (1ULL << 5)
133 /** Flags for LDPC decoder operation and capability structure */
134 enum rte_bbdev_op_ldpcdec_flag_bitmasks {
135 /** Set for transport block CRC-24A checking */
136 RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK = (1ULL << 0),
137 /** Set for code block CRC-24B checking */
138 RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK = (1ULL << 1),
139 /** Set to drop the last CRC bits decoding output */
140 RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP = (1ULL << 2),
141 /** Set for bit-level de-interleaver bypass on Rx stream. */
142 RTE_BBDEV_LDPC_DEINTERLEAVER_BYPASS = (1ULL << 3),
143 /** Set for HARQ combined input stream enable. */
144 RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE = (1ULL << 4),
145 /** Set for HARQ combined output stream enable. */
146 RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE = (1ULL << 5),
147 /** Set for LDPC decoder bypass.
148 * RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE must be set.
150 RTE_BBDEV_LDPC_DECODE_BYPASS = (1ULL << 6),
151 /** Set for soft-output stream enable */
152 RTE_BBDEV_LDPC_SOFT_OUT_ENABLE = (1ULL << 7),
153 /** Set for Rate-Matching bypass on soft-out stream. */
154 RTE_BBDEV_LDPC_SOFT_OUT_RM_BYPASS = (1ULL << 8),
155 /** Set for bit-level de-interleaver bypass on soft-output stream. */
156 RTE_BBDEV_LDPC_SOFT_OUT_DEINTERLEAVER_BYPASS = (1ULL << 9),
157 /** Set for iteration stopping on successful decode condition
158 * i.e. a successful syndrome check.
160 RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE = (1ULL << 10),
161 /** Set if a device supports decoder dequeue interrupts. */
162 RTE_BBDEV_LDPC_DEC_INTERRUPTS = (1ULL << 11),
163 /** Set if a device supports scatter-gather functionality. */
164 RTE_BBDEV_LDPC_DEC_SCATTER_GATHER = (1ULL << 12),
165 /** Set if a device supports input/output HARQ compression. */
166 RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION = (1ULL << 13),
167 /** Set if a device supports input LLR compression. */
168 RTE_BBDEV_LDPC_LLR_COMPRESSION = (1ULL << 14),
169 /** Set if a device supports HARQ input from
170 * device's internal memory.
172 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE = (1ULL << 15),
173 /** Set if a device supports HARQ output to
174 * device's internal memory.
176 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE = (1ULL << 16),
177 /** Set if a device supports loop-back access to
178 * HARQ internal memory. Intended for troubleshooting.
180 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK = (1ULL << 17)
183 /** Flags for LDPC encoder operation and capability structure */
184 enum rte_bbdev_op_ldpcenc_flag_bitmasks {
185 /** Set for bit-level interleaver bypass on output stream. */
186 RTE_BBDEV_LDPC_INTERLEAVER_BYPASS = (1ULL << 0),
187 /** If rate matching is to be performed */
188 RTE_BBDEV_LDPC_RATE_MATCH = (1ULL << 1),
189 /** Set for transport block CRC-24A attach */
190 RTE_BBDEV_LDPC_CRC_24A_ATTACH = (1ULL << 2),
191 /** Set for code block CRC-24B attach */
192 RTE_BBDEV_LDPC_CRC_24B_ATTACH = (1ULL << 3),
193 /** Set for code block CRC-16 attach */
194 RTE_BBDEV_LDPC_CRC_16_ATTACH = (1ULL << 4),
195 /** Set if a device supports encoder dequeue interrupts. */
196 RTE_BBDEV_LDPC_ENC_INTERRUPTS = (1ULL << 5),
197 /** Set if a device supports scatter-gather functionality. */
198 RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
199 /** Set if a device supports concatenation of non byte aligned output */
200 RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
203 /** Data input and output buffer for BBDEV operations */
204 struct rte_bbdev_op_data {
205 /** The mbuf data structure representing the data for BBDEV operation.
207 * This mbuf pointer can point to one Code Block (CB) data buffer or
208 * multiple CBs contiguously located next to each other.
209 * A Transport Block (TB) represents a whole piece of data that is
210 * divided into one or more CBs. Maximum number of CBs can be contained
211 * in one TB is defined by RTE_BBDEV_(TURBO/LDPC)_MAX_CODE_BLOCKS.
213 * An mbuf data structure cannot represent more than one TB. The
214 * smallest piece of data that can be contained in one mbuf is one CB.
215 * An mbuf can include one contiguous CB, subset of contiguous CBs that
216 * are belonging to one TB, or all contiguous CBs that are belonging to
219 * If a BBDEV PMD supports the extended capability "Scatter-Gather",
220 * then it is capable of collecting (gathering) non-contiguous
221 * (scattered) data from multiple locations in the memory.
222 * This capability is reported by the capability flags:
223 * - RTE_BBDEV_(TURBO/LDPC)_ENC_SCATTER_GATHER and
224 * - RTE_BBDEV_(TURBO/LDPC)_DEC_SCATTER_GATHER.
225 * Only if a BBDEV PMD supports this feature, chained mbuf data
226 * structures are accepted. A chained mbuf can represent one
227 * non-contiguous CB or multiple non-contiguous CBs.
228 * If BBDEV PMD does not support this feature, it will assume inbound
229 * mbuf data contains one segment.
231 * The output mbuf data though is always one segment, even if the input
232 * was a chained mbuf.
234 struct rte_mbuf *data;
235 /** The starting point of the BBDEV (encode/decode) operation,
238 * BBDEV starts to read data past this offset.
239 * In case of chained mbuf, this offset applies only to the first mbuf
243 /** The total data length to be processed in one operation, in bytes.
245 * In case the mbuf data is representing one CB, this is the length of
246 * the CB undergoing the operation.
247 * If it's for multiple CBs, this is the total length of those CBs
248 * undergoing the operation.
249 * If it is for one TB, this is the total length of the TB under
252 * In case of chained mbuf, this data length includes the lengths of the
253 * "scattered" data segments undergoing the operation.
258 /** Turbo decode code block parameters */
259 struct rte_bbdev_op_dec_turbo_cb_params {
260 /** The K size of the input CB, in bits [40:6144], as specified in
262 * This size is inclusive of CRC bits, regardless whether it was
263 * pre-calculated by the application or not.
266 /** The E length of the CB rate matched LLR output, in bytes, as in
272 /** LDPC decode code block parameters */
273 struct rte_bbdev_op_dec_ldpc_cb_params {
274 /** Rate matching output sequence length in bits or LLRs.
275 * [3GPP TS38.212, section 5.4.2.1]
280 /** Turbo decode transport block parameters */
281 struct rte_bbdev_op_dec_turbo_tb_params {
282 /** The K- size of the input CB, in bits [40:6144], that is in the
283 * Turbo operation when r < C-, as in 3GPP TS 36.212.
286 /** The K+ size of the input CB, in bits [40:6144], that is in the
287 * Turbo operation when r >= C-, as in 3GPP TS 36.212.
290 /** The number of CBs that have K- size, [0:63] */
292 /** The total number of CBs in the TB,
293 * [1:RTE_BBDEV_TURBO_MAX_CODE_BLOCKS]
296 /** The number of CBs that uses Ea before switching to Eb, [0:63] */
298 /** The E size of the CB rate matched output to use in the Turbo
299 * operation when r < cab
302 /** The E size of the CB rate matched output to use in the Turbo
303 * operation when r >= cab
306 /** The index of the first CB in the inbound mbuf data, default is 0 */
310 /** LDPC decode transport block parameters */
311 struct rte_bbdev_op_dec_ldpc_tb_params {
312 /** Ea, length after rate matching in bits, r < cab.
313 * [3GPP TS38.212, section 5.4.2.1]
316 /** Eb, length after rate matching in bits, r >= cab.
317 * [3GPP TS38.212, section 5.4.2.1]
320 /** The total number of CBs in the TB or partial TB
321 * [1:RTE_BBDEV_LDPC_MAX_CODE_BLOCKS]
324 /** The index of the first CB in the inbound mbuf data, default is 0 */
326 /** The number of CBs that use Ea before switching to Eb, [0:63] */
330 /** Operation structure for Turbo decode.
331 * An operation can be performed on one CB at a time "CB-mode".
332 * An operation can be performed on one or multiple CBs that logically
333 * belong to one TB "TB-mode".
334 * The provided K size parameter of the CB is its size coming from the
336 * CRC24A/B check is requested by the application by setting the flag
337 * RTE_BBDEV_TURBO_CRC_TYPE_24B for CRC24B check or CRC24A otherwise.
338 * In TB-mode, BBDEV concatenates the decoded CBs one next to the other with
339 * relevant CRC24B in between.
341 * The input encoded CB data is the Virtual Circular Buffer data stream, wk,
342 * with the null padding included as described in 3GPP TS 36.212
343 * section 5.1.4.1.2 and shown in 3GPP TS 36.212 section 5.1.4.1 Figure 5.1.4-1.
344 * The size of the virtual circular buffer is 3*Kpi, where Kpi is the 32 byte
345 * aligned value of K, as specified in 3GPP TS 36.212 section 5.1.4.1.1.
347 * Each byte in the input circular buffer is the LLR value of each bit of the
350 * Hard output is a mandatory capability that all BBDEV PMDs support. This is
351 * the decoded CBs of K sizes (CRC24A/B is the last 24-bit in each decoded CB).
352 * Soft output is an optional capability for BBDEV PMDs. If supported, an LLR
353 * rate matched output is computed in the soft_output buffer structure.
355 * The output mbuf data structure is expected to be allocated by the
356 * application with enough room for the output data.
358 struct rte_bbdev_op_turbo_dec {
359 /** The Virtual Circular Buffer, wk, size 3*Kpi for each CB */
360 struct rte_bbdev_op_data input;
361 /** The hard decisions buffer for the decoded output,
364 struct rte_bbdev_op_data hard_output;
365 /** The soft LLR output buffer - optional */
366 struct rte_bbdev_op_data soft_output;
368 /** Flags from rte_bbdev_op_td_flag_bitmasks */
371 /** Rv index for rate matching [0:3] */
373 /** The minimum number of iterations to perform in decoding all CBs in
374 * this operation - input
377 /** The maximum number of iterations to perform in decoding all CBs in
378 * this operation - input
381 /** The maximum number of iterations that were performed in decoding
382 * all CBs in this decode operation - output
385 /** 5 bit extrinsic scale (scale factor on extrinsic info) */
387 /** Number of MAP engines to use in decode,
388 * must be power of 2 (or 0 to auto-select)
392 /**< [0 - TB : 1 - CB] */
393 uint8_t code_block_mode;
395 /**< Struct which stores Code Block specific parameters */
396 struct rte_bbdev_op_dec_turbo_cb_params cb_params;
397 /**< Struct which stores Transport Block specific parameters */
398 struct rte_bbdev_op_dec_turbo_tb_params tb_params;
402 /** Operation structure for LDPC decode.
404 * An operation can be performed on one CB at a time "CB-mode".
405 * An operation can also be performed on one or multiple CBs that logically
406 * belong to a TB "TB-mode" (Currently not supported).
408 * The input encoded CB data is the Virtual Circular Buffer data stream.
410 * Each byte in the input circular buffer is the LLR value of each bit of the
413 * Hard output is a mandatory capability that all BBDEV PMDs support. This is
414 * the decoded CBs (CRC24A/B is the last 24-bit in each decoded CB).
416 * Soft output is an optional capability for BBDEV PMDs. If supported, an LLR
417 * rate matched output is computed in the soft_output buffer structure.
418 * These are A Posteriori Probabilities (APP) LLR samples for coded bits.
420 * HARQ combined output is an optional capability for BBDEV PMDs.
421 * If supported, a LLR output is streamed to the harq_combined_output
424 * HARQ combined input is an optional capability for BBDEV PMDs.
425 * If supported, a LLR input is streamed from the harq_combined_input
428 * The output mbuf data structure is expected to be allocated by the
429 * application with enough room for the output data.
431 struct rte_bbdev_op_ldpc_dec {
432 /** The Virtual Circular Buffer for this code block, one LLR
433 * per bit of the original CB.
435 struct rte_bbdev_op_data input;
436 /** The hard decisions buffer for the decoded output,
439 struct rte_bbdev_op_data hard_output;
440 /** The soft LLR output LLR stream buffer - optional */
441 struct rte_bbdev_op_data soft_output;
442 /** The HARQ combined LLR stream input buffer - optional */
443 struct rte_bbdev_op_data harq_combined_input;
444 /** The HARQ combined LLR stream output buffer - optional */
445 struct rte_bbdev_op_data harq_combined_output;
447 /** Flags from rte_bbdev_op_ldpcdec_flag_bitmasks */
450 /** Rate matching redundancy version
451 * [3GPP TS38.212, section 5.4.2.1]
454 /** The maximum number of iterations to perform in decoding CB in
455 * this operation - input
458 /** The number of iterations that were performed in decoding
459 * CB in this decode operation - output
462 /** 1: LDPC Base graph 1, 2: LDPC Base graph 2.
463 * [3GPP TS38.212, section 5.2.2]
466 /** Zc, LDPC lifting size.
467 * [3GPP TS38.212, section 5.2.2]
470 /** Ncb, length of the circular buffer in bits.
471 * [3GPP TS38.212, section 5.4.2.1]
474 /** Qm, modulation order {1,2,4,6,8}.
475 * [3GPP TS38.212, section 5.4.2.2]
478 /** Number of Filler bits, n_filler = K – K’
479 * [3GPP TS38.212 section 5.2.2]
482 /** [0 - TB : 1 - CB] */
483 uint8_t code_block_mode;
485 /** Struct which stores Code Block specific parameters */
486 struct rte_bbdev_op_dec_ldpc_cb_params cb_params;
487 /** Struct which stores Transport Block specific parameters */
488 struct rte_bbdev_op_dec_ldpc_tb_params tb_params;
492 /** Turbo encode code block parameters */
493 struct rte_bbdev_op_enc_turbo_cb_params {
494 /** The K size of the input CB, in bits [40:6144], as specified in
496 * This size is inclusive of CRC24A, regardless whether it was
497 * pre-calculated by the application or not.
500 /** The E length of the CB rate matched output, in bits, as in
504 /** The Ncb soft buffer size of the CB rate matched output [K:3*Kpi],
505 * in bits, as specified in 3GPP TS 36.212.
510 /** Turbo encode transport block parameters */
511 struct rte_bbdev_op_enc_turbo_tb_params {
512 /** The K- size of the input CB, in bits [40:6144], that is in the
513 * Turbo operation when r < C-, as in 3GPP TS 36.212.
514 * This size is inclusive of CRC24B, regardless whether it was
515 * pre-calculated and appended by the application or not.
518 /** The K+ size of the input CB, in bits [40:6144], that is in the
519 * Turbo operation when r >= C-, as in 3GPP TS 36.212.
520 * This size is inclusive of CRC24B, regardless whether it was
521 * pre-calculated and appended by the application or not.
524 /** The number of CBs that have K- size, [0:63] */
526 /** The total number of CBs in the TB,
527 * [1:RTE_BBDEV_TURBO_MAX_CODE_BLOCKS]
530 /** The number of CBs that uses Ea before switching to Eb, [0:63] */
532 /** The E size of the CB rate matched output to use in the Turbo
533 * operation when r < cab
536 /** The E size of the CB rate matched output to use in the Turbo
537 * operation when r >= cab
540 /** The Ncb soft buffer size for the rate matched CB that is used in
541 * the Turbo operation when r < C-, [K:3*Kpi]
544 /** The Ncb soft buffer size for the rate matched CB that is used in
545 * the Turbo operation when r >= C-, [K:3*Kpi]
548 /**< The index of the first CB in the inbound mbuf data, default is 0 */
552 /** LDPC encode code block parameters */
553 struct rte_bbdev_op_enc_ldpc_cb_params {
554 /** E, length after rate matching in bits.
555 * [3GPP TS38.212, section 5.4.2.1]
560 /** LDPC encode transport block parameters */
561 struct rte_bbdev_op_enc_ldpc_tb_params {
562 /** Ea, length after rate matching in bits, r < cab.
563 * [3GPP TS38.212, section 5.4.2.1]
566 /** Eb, length after rate matching in bits, r >= cab.
567 * [3GPP TS38.212, section 5.4.2.1]
570 /** The total number of CBs in the TB or partial TB
571 * [1:RTE_BBDEV_LDPC_MAX_CODE_BLOCKS]
574 /** The index of the first CB in the inbound mbuf data, default is 0 */
576 /** The number of CBs that use Ea before switching to Eb, [0:63] */
580 /** Operation structure for Turbo encode.
581 * An operation can be performed on one CB at a time "CB-mode".
582 * An operation can pbe erformd on one or multiple CBs that logically
583 * belong to one TB "TB-mode".
585 * In CB-mode, CRC24A/B is an optional operation. K size parameter is not
586 * affected by CRC24A/B inclusion, this only affects the inbound mbuf data
587 * length. Not all BBDEV PMDs are capable of CRC24A/B calculation. Flags
588 * RTE_BBDEV_TURBO_CRC_24A_ATTACH and RTE_BBDEV_TURBO_CRC_24B_ATTACH informs
589 * the application with relevant capability. These flags can be set in the
590 * op_flags parameter to indicate BBDEV to calculate and append CRC24A to CB
591 * before going forward with Turbo encoding.
593 * In TB-mode, CRC24A is assumed to be pre-calculated and appended to the
594 * inbound TB mbuf data buffer.
596 * The output mbuf data structure is expected to be allocated by the
597 * application with enough room for the output data.
599 struct rte_bbdev_op_turbo_enc {
600 /** The input CB or TB data */
601 struct rte_bbdev_op_data input;
602 /** The rate matched CB or TB output buffer */
603 struct rte_bbdev_op_data output;
604 /** Flags from rte_bbdev_op_te_flag_bitmasks */
607 /** Rv index for rate matching [0:3] */
609 /** [0 - TB : 1 - CB] */
610 uint8_t code_block_mode;
612 /** Struct which stores Code Block specific parameters */
613 struct rte_bbdev_op_enc_turbo_cb_params cb_params;
614 /** Struct which stores Transport Block specific parameters */
615 struct rte_bbdev_op_enc_turbo_tb_params tb_params;
619 /** Operation structure for LDPC encode.
620 * An operation can be performed on one CB at a time "CB-mode".
621 * An operation can be performed on one or multiple CBs that logically
622 * belong to a TB "TB-mode".
624 * The input data is the CB or TB input to the decoder.
626 * The output data is the ratematched CB or TB data, or the output after
627 * bit-selection if RTE_BBDEV_LDPC_INTERLEAVER_BYPASS is set.
629 * The output mbuf data structure is expected to be allocated by the
630 * application with enough room for the output data.
632 struct rte_bbdev_op_ldpc_enc {
633 /** The input TB or CB data */
634 struct rte_bbdev_op_data input;
635 /** The rate matched TB or CB output buffer */
636 struct rte_bbdev_op_data output;
638 /** Flags from rte_bbdev_op_ldpcenc_flag_bitmasks */
641 /** Rate matching redundancy version */
643 /** 1: LDPC Base graph 1, 2: LDPC Base graph 2.
644 * [3GPP TS38.212, section 5.2.2]
647 /** Zc, LDPC lifting size.
648 * [3GPP TS38.212, section 5.2.2]
651 /** Ncb, length of the circular buffer in bits.
652 * [3GPP TS38.212, section 5.4.2.1]
655 /** Qm, modulation order {2,4,6,8,10}.
656 * [3GPP TS38.212, section 5.4.2.2]
659 /** Number of Filler bits, n_filler = K – K’
660 * [3GPP TS38.212 section 5.2.2]
663 /** [0 - TB : 1 - CB] */
664 uint8_t code_block_mode;
666 /** Struct which stores Code Block specific parameters */
667 struct rte_bbdev_op_enc_ldpc_cb_params cb_params;
668 /** Struct which stores Transport Block specific parameters */
669 struct rte_bbdev_op_enc_ldpc_tb_params tb_params;
673 /** List of the capabilities for the Turbo Decoder */
674 struct rte_bbdev_op_cap_turbo_dec {
675 /** Flags from rte_bbdev_op_td_flag_bitmasks */
676 uint32_t capability_flags;
677 /** Maximal LLR absolute value. Acceptable LLR values lie in range
678 * [-max_llr_modulus, max_llr_modulus].
680 int8_t max_llr_modulus;
681 /** Num input code block buffers */
682 uint8_t num_buffers_src; /**< Num input code block buffers */
683 /** Num hard output code block buffers */
684 uint8_t num_buffers_hard_out;
685 /** Num soft output code block buffers if supported by the driver */
686 uint8_t num_buffers_soft_out;
689 /** List of the capabilities for the Turbo Encoder */
690 struct rte_bbdev_op_cap_turbo_enc {
691 /** Flags from rte_bbdev_op_te_flag_bitmasks */
692 uint32_t capability_flags;
693 /** Num input code block buffers */
694 uint8_t num_buffers_src;
695 /** Num output code block buffers */
696 uint8_t num_buffers_dst;
699 /** List of the capabilities for the LDPC Decoder */
700 struct rte_bbdev_op_cap_ldpc_dec {
701 /** Flags from rte_bbdev_op_ldpcdec_flag_bitmasks */
702 uint32_t capability_flags;
703 /** LLR size in bits. LLR is a two’s complement number. */
705 /** LLR numbers of decimals bit for arithmetic representation */
707 /** Amount of memory for HARQ in external DDR in MB */
708 uint16_t harq_memory_size;
709 /** Num input code block buffers */
710 uint16_t num_buffers_src;
711 /** Num hard output code block buffers */
712 uint16_t num_buffers_hard_out;
713 /** Num soft output code block buffers if supported by the driver */
714 uint16_t num_buffers_soft_out;
717 /** List of the capabilities for the LDPC Encoder */
718 struct rte_bbdev_op_cap_ldpc_enc {
719 /** Flags from rte_bbdev_op_ldpcenc_flag_bitmasks */
720 uint32_t capability_flags;
721 /** Num input code block buffers */
722 uint16_t num_buffers_src;
723 /** Num output code block buffers */
724 uint16_t num_buffers_dst;
727 /** Different operation types supported by the device */
728 enum rte_bbdev_op_type {
729 RTE_BBDEV_OP_NONE, /**< Dummy operation that does nothing */
730 RTE_BBDEV_OP_TURBO_DEC, /**< Turbo decode */
731 RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */
732 RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */
733 RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */
734 RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */
737 /** Bit indexes of possible errors reported through status field */
740 RTE_BBDEV_DATA_ERROR,
742 RTE_BBDEV_SYNDROME_ERROR
745 /** Structure specifying a single encode operation */
746 struct rte_bbdev_enc_op {
747 /**< Status of operation that was performed */
749 /**< Mempool which op instance is in */
750 struct rte_mempool *mempool;
751 /**< Opaque pointer for user data */
754 /** Contains turbo decoder specific parameters */
755 struct rte_bbdev_op_turbo_enc turbo_enc;
756 /** Contains LDPC decoder specific parameters */
757 struct rte_bbdev_op_ldpc_enc ldpc_enc;
761 /** Structure specifying a single decode operation */
762 struct rte_bbdev_dec_op {
763 /** Status of operation that was performed */
765 /** Mempool which op instance is in */
766 struct rte_mempool *mempool;
767 /** Opaque pointer for user data */
770 /** Contains turbo decoder specific parameters */
771 struct rte_bbdev_op_turbo_dec turbo_dec;
772 /** Contains LDPC decoder specific parameters */
773 struct rte_bbdev_op_ldpc_dec ldpc_dec;
777 /** Operation capabilities supported by a device */
778 struct rte_bbdev_op_cap {
779 enum rte_bbdev_op_type type; /**< Type of operation */
781 struct rte_bbdev_op_cap_turbo_dec turbo_dec;
782 struct rte_bbdev_op_cap_turbo_enc turbo_enc;
783 struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
784 struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
785 } cap; /**< Operation-type specific capabilities */
788 /**< @internal Private data structure stored with operation pool. */
789 struct rte_bbdev_op_pool_private {
790 enum rte_bbdev_op_type type; /**< Type of operations in a pool */
794 * Converts queue operation type from enum to string
797 * Operation type as enum
800 * Operation type as string or NULL if op_type is invalid
805 rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type);
808 * Creates a bbdev operation mempool
813 * Operation type, use RTE_BBDEV_OP_NONE for a pool which supports all
815 * @param num_elements
816 * Number of elements in the pool.
818 * Number of elements to cache on an lcore, see rte_mempool_create() for
819 * further details about cache size.
821 * Socket to allocate memory on.
824 * - Pointer to a mempool on success,
825 * - NULL pointer on failure.
829 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
830 unsigned int num_elements, unsigned int cache_size,
834 * Bulk allocate encode operations from a mempool with parameter defaults reset.
837 * Operation mempool, created by rte_bbdev_op_pool_create().
839 * Output array to place allocated operations
841 * Number of operations to allocate
845 * - EINVAL if invalid mempool is provided
849 rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool,
850 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
852 struct rte_bbdev_op_pool_private *priv;
856 priv = (struct rte_bbdev_op_pool_private *)
857 rte_mempool_get_priv(mempool);
858 if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
859 (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
863 ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
864 if (unlikely(ret < 0))
871 * Bulk allocate decode operations from a mempool with parameter defaults reset.
874 * Operation mempool, created by rte_bbdev_op_pool_create().
876 * Output array to place allocated operations
878 * Number of operations to allocate
882 * - EINVAL if invalid mempool is provided
886 rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool,
887 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
889 struct rte_bbdev_op_pool_private *priv;
893 priv = (struct rte_bbdev_op_pool_private *)
894 rte_mempool_get_priv(mempool);
895 if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
896 (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
900 ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
901 if (unlikely(ret < 0))
908 * Free decode operation structures that were allocated by
909 * rte_bbdev_dec_op_alloc_bulk().
910 * All structures must belong to the same mempool.
913 * Operation structures
915 * Number of structures
919 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
922 rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
926 * Free encode operation structures that were allocated by
927 * rte_bbdev_enc_op_alloc_bulk().
928 * All structures must belong to the same mempool.
931 * Operation structures
933 * Number of structures
937 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
940 rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
947 #endif /* _RTE_BBDEV_OP_H_ */