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 */
37 #define RTE_BBDEV_LDPC_MIN_CB_SIZE (40)
39 /* Minimum size of Code Block (36.212, Table 5.1.3-3) */
40 #define RTE_BBDEV_TURBO_MIN_CB_SIZE (40)
41 /* Maximum size of circular buffer */
42 #define RTE_BBDEV_TURBO_MAX_KW (18528)
44 * Turbo: Maximum number of Code Blocks in Transport Block. It is calculated
45 * based on maximum size of one Code Block and one Transport Block
46 * (considering CRC24A and CRC24B):
47 * (391656 + 24) / (6144 - 24) = 64
49 #define RTE_BBDEV_TURBO_MAX_CODE_BLOCKS (64)
50 /* LDPC: Maximum number of Code Blocks in Transport Block.*/
51 #define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
53 /** Flags for turbo decoder operation and capability structure */
54 enum rte_bbdev_op_td_flag_bitmasks {
55 /** If sub block de-interleaving is to be performed. */
56 RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE = (1ULL << 0),
57 /** To use CRC Type 24B (otherwise use CRC Type 24A). */
58 RTE_BBDEV_TURBO_CRC_TYPE_24B = (1ULL << 1),
59 /** If turbo equalization is to be performed. */
60 RTE_BBDEV_TURBO_EQUALIZER = (1ULL << 2),
61 /** If set, saturate soft output to +/-127 */
62 RTE_BBDEV_TURBO_SOFT_OUT_SATURATE = (1ULL << 3),
63 /** Set to 1 to start iteration from even, else odd; one iteration =
66 RTE_BBDEV_TURBO_HALF_ITERATION_EVEN = (1ULL << 4),
67 /** If 0, TD stops after CRC matches; else if 1, runs to end of next
68 * odd iteration after CRC matches
70 RTE_BBDEV_TURBO_CONTINUE_CRC_MATCH = (1ULL << 5),
71 /** Set if soft output is required to be output */
72 RTE_BBDEV_TURBO_SOFT_OUTPUT = (1ULL << 6),
73 /** Set to enable early termination mode */
74 RTE_BBDEV_TURBO_EARLY_TERMINATION = (1ULL << 7),
75 /** Set if a device supports decoder dequeue interrupts */
76 RTE_BBDEV_TURBO_DEC_INTERRUPTS = (1ULL << 9),
77 /** Set if positive LLR encoded input is supported. Positive LLR value
78 * represents the level of confidence for bit '1', and vice versa for
80 * This is mutually exclusive with RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN
81 * when used to formalize the input data format.
83 RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN = (1ULL << 10),
84 /** Set if negative LLR encoded input is supported. Negative LLR value
85 * represents the level of confidence for bit '1', and vice versa for
87 * This is mutually exclusive with RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN
88 * when used to formalize the input data format.
90 RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN = (1ULL << 11),
91 /** Set if positive LLR soft output is supported. Positive LLR value
92 * represents the level of confidence for bit '1', and vice versa for
94 * This is mutually exclusive with
95 * RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT when used to formalize
96 * the input data format.
98 RTE_BBDEV_TURBO_POS_LLR_1_BIT_SOFT_OUT = (1ULL << 12),
99 /** Set if negative LLR soft output is supported. Negative LLR value
100 * represents the level of confidence for bit '1', and vice versa for
102 * This is mutually exclusive with
103 * RTE_BBDEV_TURBO_POS_LLR_1_BIT_SOFT_OUT when used to formalize the
106 RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT = (1ULL << 13),
107 /** Set if driver supports flexible parallel MAP engine decoding. If
108 * not supported, num_maps (number of MAP engines) argument is unusable.
110 RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
111 /** Set if a device supports scatter-gather functionality */
112 RTE_BBDEV_TURBO_DEC_SCATTER_GATHER = (1ULL << 15),
113 /** Set to keep CRC24B bits appended while decoding. Only usable when
114 * decoding Transport Blocks (code_block_mode = 0).
116 RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP = (1ULL << 16)
120 /** Flags for turbo encoder operation and capability structure */
121 enum rte_bbdev_op_te_flag_bitmasks {
122 /** Ignore rv_index and set K0 = 0 */
123 RTE_BBDEV_TURBO_RV_INDEX_BYPASS = (1ULL << 0),
124 /** If rate matching is to be performed */
125 RTE_BBDEV_TURBO_RATE_MATCH = (1ULL << 1),
126 /** This bit must be set to enable CRC-24B generation */
127 RTE_BBDEV_TURBO_CRC_24B_ATTACH = (1ULL << 2),
128 /** This bit must be set to enable CRC-24A generation */
129 RTE_BBDEV_TURBO_CRC_24A_ATTACH = (1ULL << 3),
130 /** Set if a device supports encoder dequeue interrupts */
131 RTE_BBDEV_TURBO_ENC_INTERRUPTS = (1ULL << 4),
132 /** Set if a device supports scatter-gather functionality */
133 RTE_BBDEV_TURBO_ENC_SCATTER_GATHER = (1ULL << 5)
136 /** Flags for LDPC decoder operation and capability structure */
137 enum rte_bbdev_op_ldpcdec_flag_bitmasks {
138 /** Set for transport block CRC-24A checking */
139 RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK = (1ULL << 0),
140 /** Set for code block CRC-24B checking */
141 RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK = (1ULL << 1),
142 /** Set to drop the last CRC bits decoding output */
143 RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP = (1ULL << 2),
144 /** Set for bit-level de-interleaver bypass on Rx stream. */
145 RTE_BBDEV_LDPC_DEINTERLEAVER_BYPASS = (1ULL << 3),
146 /** Set for HARQ combined input stream enable. */
147 RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE = (1ULL << 4),
148 /** Set for HARQ combined output stream enable. */
149 RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE = (1ULL << 5),
150 /** Set for LDPC decoder bypass.
151 * RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE must be set.
153 RTE_BBDEV_LDPC_DECODE_BYPASS = (1ULL << 6),
154 /** Set for soft-output stream enable */
155 RTE_BBDEV_LDPC_SOFT_OUT_ENABLE = (1ULL << 7),
156 /** Set for Rate-Matching bypass on soft-out stream. */
157 RTE_BBDEV_LDPC_SOFT_OUT_RM_BYPASS = (1ULL << 8),
158 /** Set for bit-level de-interleaver bypass on soft-output stream. */
159 RTE_BBDEV_LDPC_SOFT_OUT_DEINTERLEAVER_BYPASS = (1ULL << 9),
160 /** Set for iteration stopping on successful decode condition
161 * i.e. a successful syndrome check.
163 RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE = (1ULL << 10),
164 /** Set if a device supports decoder dequeue interrupts. */
165 RTE_BBDEV_LDPC_DEC_INTERRUPTS = (1ULL << 11),
166 /** Set if a device supports scatter-gather functionality. */
167 RTE_BBDEV_LDPC_DEC_SCATTER_GATHER = (1ULL << 12),
168 /** Set if a device supports input/output HARQ compression. */
169 RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION = (1ULL << 13),
170 /** Set if a device supports input LLR compression. */
171 RTE_BBDEV_LDPC_LLR_COMPRESSION = (1ULL << 14),
172 /** Set if a device supports HARQ input from
173 * device's internal memory.
175 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE = (1ULL << 15),
176 /** Set if a device supports HARQ output to
177 * device's internal memory.
179 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE = (1ULL << 16),
180 /** Set if a device supports loop-back access to
181 * HARQ internal memory. Intended for troubleshooting.
183 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK = (1ULL << 17),
184 /** Set if a device includes LLR filler bits in the circular buffer
185 * for HARQ memory. If not set, it is assumed the filler bits are not
186 * in HARQ memory and handled directly by the LDPC decoder.
188 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18)
191 /** Flags for LDPC encoder operation and capability structure */
192 enum rte_bbdev_op_ldpcenc_flag_bitmasks {
193 /** Set for bit-level interleaver bypass on output stream. */
194 RTE_BBDEV_LDPC_INTERLEAVER_BYPASS = (1ULL << 0),
195 /** If rate matching is to be performed */
196 RTE_BBDEV_LDPC_RATE_MATCH = (1ULL << 1),
197 /** Set for transport block CRC-24A attach */
198 RTE_BBDEV_LDPC_CRC_24A_ATTACH = (1ULL << 2),
199 /** Set for code block CRC-24B attach */
200 RTE_BBDEV_LDPC_CRC_24B_ATTACH = (1ULL << 3),
201 /** Set for code block CRC-16 attach */
202 RTE_BBDEV_LDPC_CRC_16_ATTACH = (1ULL << 4),
203 /** Set if a device supports encoder dequeue interrupts. */
204 RTE_BBDEV_LDPC_ENC_INTERRUPTS = (1ULL << 5),
205 /** Set if a device supports scatter-gather functionality. */
206 RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
207 /** Set if a device supports concatenation of non byte aligned output */
208 RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
211 /** Data input and output buffer for BBDEV operations */
212 struct rte_bbdev_op_data {
213 /** The mbuf data structure representing the data for BBDEV operation.
215 * This mbuf pointer can point to one Code Block (CB) data buffer or
216 * multiple CBs contiguously located next to each other.
217 * A Transport Block (TB) represents a whole piece of data that is
218 * divided into one or more CBs. Maximum number of CBs can be contained
219 * in one TB is defined by RTE_BBDEV_(TURBO/LDPC)_MAX_CODE_BLOCKS.
221 * An mbuf data structure cannot represent more than one TB. The
222 * smallest piece of data that can be contained in one mbuf is one CB.
223 * An mbuf can include one contiguous CB, subset of contiguous CBs that
224 * are belonging to one TB, or all contiguous CBs that are belonging to
227 * If a BBDEV PMD supports the extended capability "Scatter-Gather",
228 * then it is capable of collecting (gathering) non-contiguous
229 * (scattered) data from multiple locations in the memory.
230 * This capability is reported by the capability flags:
231 * - RTE_BBDEV_(TURBO/LDPC)_ENC_SCATTER_GATHER and
232 * - RTE_BBDEV_(TURBO/LDPC)_DEC_SCATTER_GATHER.
233 * Only if a BBDEV PMD supports this feature, chained mbuf data
234 * structures are accepted. A chained mbuf can represent one
235 * non-contiguous CB or multiple non-contiguous CBs.
236 * If BBDEV PMD does not support this feature, it will assume inbound
237 * mbuf data contains one segment.
239 * The output mbuf data though is always one segment, even if the input
240 * was a chained mbuf.
242 struct rte_mbuf *data;
243 /** The starting point of the BBDEV (encode/decode) operation,
246 * BBDEV starts to read data past this offset.
247 * In case of chained mbuf, this offset applies only to the first mbuf
251 /** The total data length to be processed in one operation, in bytes.
253 * In case the mbuf data is representing one CB, this is the length of
254 * the CB undergoing the operation.
255 * If it's for multiple CBs, this is the total length of those CBs
256 * undergoing the operation.
257 * If it is for one TB, this is the total length of the TB under
260 * In case of chained mbuf, this data length includes the lengths of the
261 * "scattered" data segments undergoing the operation.
266 /** Turbo decode code block parameters */
267 struct rte_bbdev_op_dec_turbo_cb_params {
268 /** The K size of the input CB, in bits [40:6144], as specified in
270 * This size is inclusive of CRC bits, regardless whether it was
271 * pre-calculated by the application or not.
274 /** The E length of the CB rate matched LLR output, in bytes, as in
280 /** LDPC decode code block parameters */
281 struct rte_bbdev_op_dec_ldpc_cb_params {
282 /** Rate matching output sequence length in bits or LLRs.
283 * [3GPP TS38.212, section 5.4.2.1]
288 /** Turbo decode transport block parameters */
289 struct rte_bbdev_op_dec_turbo_tb_params {
290 /** The K- size of the input CB, in bits [40:6144], that is in the
291 * Turbo operation when r < C-, as in 3GPP TS 36.212.
294 /** The K+ size of the input CB, in bits [40:6144], that is in the
295 * Turbo operation when r >= C-, as in 3GPP TS 36.212.
298 /** The number of CBs that have K- size, [0:63] */
300 /** The total number of CBs in the TB,
301 * [1:RTE_BBDEV_TURBO_MAX_CODE_BLOCKS]
304 /** The number of CBs that uses Ea before switching to Eb, [0:63] */
306 /** The E size of the CB rate matched output to use in the Turbo
307 * operation when r < cab
310 /** The E size of the CB rate matched output to use in the Turbo
311 * operation when r >= cab
314 /** The index of the first CB in the inbound mbuf data, default is 0 */
318 /** LDPC decode transport block parameters */
319 struct rte_bbdev_op_dec_ldpc_tb_params {
320 /** Ea, length after rate matching in bits, r < cab.
321 * [3GPP TS38.212, section 5.4.2.1]
324 /** Eb, length after rate matching in bits, r >= cab.
325 * [3GPP TS38.212, section 5.4.2.1]
328 /** The total number of CBs in the TB or partial TB
329 * [1:RTE_BBDEV_LDPC_MAX_CODE_BLOCKS]
332 /** The index of the first CB in the inbound mbuf data, default is 0 */
334 /** The number of CBs that use Ea before switching to Eb, [0:63] */
338 /** Operation structure for Turbo decode.
339 * An operation can be performed on one CB at a time "CB-mode".
340 * An operation can be performed on one or multiple CBs that logically
341 * belong to one TB "TB-mode".
342 * The provided K size parameter of the CB is its size coming from the
344 * CRC24A/B check is requested by the application by setting the flag
345 * RTE_BBDEV_TURBO_CRC_TYPE_24B for CRC24B check or CRC24A otherwise.
346 * In TB-mode, BBDEV concatenates the decoded CBs one next to the other with
347 * relevant CRC24B in between.
349 * The input encoded CB data is the Virtual Circular Buffer data stream, wk,
350 * with the null padding included as described in 3GPP TS 36.212
351 * section 5.1.4.1.2 and shown in 3GPP TS 36.212 section 5.1.4.1 Figure 5.1.4-1.
352 * The size of the virtual circular buffer is 3*Kpi, where Kpi is the 32 byte
353 * aligned value of K, as specified in 3GPP TS 36.212 section 5.1.4.1.1.
355 * Each byte in the input circular buffer is the LLR value of each bit of the
358 * Hard output is a mandatory capability that all BBDEV PMDs support. This is
359 * the decoded CBs of K sizes (CRC24A/B is the last 24-bit in each decoded CB).
360 * Soft output is an optional capability for BBDEV PMDs. If supported, an LLR
361 * rate matched output is computed in the soft_output buffer structure.
363 * The output mbuf data structure is expected to be allocated by the
364 * application with enough room for the output data.
366 struct rte_bbdev_op_turbo_dec {
367 /** The Virtual Circular Buffer, wk, size 3*Kpi for each CB */
368 struct rte_bbdev_op_data input;
369 /** The hard decisions buffer for the decoded output,
372 struct rte_bbdev_op_data hard_output;
373 /** The soft LLR output buffer - optional */
374 struct rte_bbdev_op_data soft_output;
376 /** Flags from rte_bbdev_op_td_flag_bitmasks */
379 /** Rv index for rate matching [0:3] */
381 /** The minimum number of iterations to perform in decoding all CBs in
382 * this operation - input
385 /** The maximum number of iterations to perform in decoding all CBs in
386 * this operation - input
389 /** The maximum number of iterations that were performed in decoding
390 * all CBs in this decode operation - output
393 /** 5 bit extrinsic scale (scale factor on extrinsic info) */
395 /** Number of MAP engines to use in decode,
396 * must be power of 2 (or 0 to auto-select)
400 /**< [0 - TB : 1 - CB] */
401 uint8_t code_block_mode;
403 /**< Struct which stores Code Block specific parameters */
404 struct rte_bbdev_op_dec_turbo_cb_params cb_params;
405 /**< Struct which stores Transport Block specific parameters */
406 struct rte_bbdev_op_dec_turbo_tb_params tb_params;
410 /** Operation structure for LDPC decode.
412 * An operation can be performed on one CB at a time "CB-mode".
413 * An operation can also be performed on one or multiple CBs that logically
414 * belong to a TB "TB-mode" (Currently not supported).
416 * The input encoded CB data is the Virtual Circular Buffer data stream.
418 * Each byte in the input circular buffer is the LLR value of each bit of the
421 * Hard output is a mandatory capability that all BBDEV PMDs support. This is
422 * the decoded CBs (CRC24A/B is the last 24-bit in each decoded CB).
424 * Soft output is an optional capability for BBDEV PMDs. If supported, an LLR
425 * rate matched output is computed in the soft_output buffer structure.
426 * These are A Posteriori Probabilities (APP) LLR samples for coded bits.
428 * HARQ combined output is an optional capability for BBDEV PMDs.
429 * If supported, a LLR output is streamed to the harq_combined_output
432 * HARQ combined input is an optional capability for BBDEV PMDs.
433 * If supported, a LLR input is streamed from the harq_combined_input
436 * The output mbuf data structure is expected to be allocated by the
437 * application with enough room for the output data.
439 struct rte_bbdev_op_ldpc_dec {
440 /** The Virtual Circular Buffer for this code block, one LLR
441 * per bit of the original CB.
443 struct rte_bbdev_op_data input;
444 /** The hard decisions buffer for the decoded output,
447 struct rte_bbdev_op_data hard_output;
448 /** The soft LLR output LLR stream buffer - optional */
449 struct rte_bbdev_op_data soft_output;
450 /** The HARQ combined LLR stream input buffer - optional */
451 struct rte_bbdev_op_data harq_combined_input;
452 /** The HARQ combined LLR stream output buffer - optional */
453 struct rte_bbdev_op_data harq_combined_output;
455 /** Flags from rte_bbdev_op_ldpcdec_flag_bitmasks */
458 /** Rate matching redundancy version
459 * [3GPP TS38.212, section 5.4.2.1]
462 /** The maximum number of iterations to perform in decoding CB in
463 * this operation - input
466 /** The number of iterations that were performed in decoding
467 * CB in this decode operation - output
470 /** 1: LDPC Base graph 1, 2: LDPC Base graph 2.
471 * [3GPP TS38.212, section 5.2.2]
474 /** Zc, LDPC lifting size.
475 * [3GPP TS38.212, section 5.2.2]
478 /** Ncb, length of the circular buffer in bits.
479 * [3GPP TS38.212, section 5.4.2.1]
482 /** Qm, modulation order {1,2,4,6,8}.
483 * [3GPP TS38.212, section 5.4.2.2]
486 /** Number of Filler bits, n_filler = K – K’
487 * [3GPP TS38.212 section 5.2.2]
490 /** [0 - TB : 1 - CB] */
491 uint8_t code_block_mode;
493 /** Struct which stores Code Block specific parameters */
494 struct rte_bbdev_op_dec_ldpc_cb_params cb_params;
495 /** Struct which stores Transport Block specific parameters */
496 struct rte_bbdev_op_dec_ldpc_tb_params tb_params;
500 /** Turbo encode code block parameters */
501 struct rte_bbdev_op_enc_turbo_cb_params {
502 /** The K size of the input CB, in bits [40:6144], as specified in
504 * This size is inclusive of CRC24A, regardless whether it was
505 * pre-calculated by the application or not.
508 /** The E length of the CB rate matched output, in bits, as in
512 /** The Ncb soft buffer size of the CB rate matched output [K:3*Kpi],
513 * in bits, as specified in 3GPP TS 36.212.
518 /** Turbo encode transport block parameters */
519 struct rte_bbdev_op_enc_turbo_tb_params {
520 /** The K- size of the input CB, in bits [40:6144], that is in the
521 * Turbo operation when r < C-, as in 3GPP TS 36.212.
522 * This size is inclusive of CRC24B, regardless whether it was
523 * pre-calculated and appended by the application or not.
526 /** The K+ size of the input CB, in bits [40:6144], that is in the
527 * Turbo operation when r >= C-, as in 3GPP TS 36.212.
528 * This size is inclusive of CRC24B, regardless whether it was
529 * pre-calculated and appended by the application or not.
532 /** The number of CBs that have K- size, [0:63] */
534 /** The total number of CBs in the TB,
535 * [1:RTE_BBDEV_TURBO_MAX_CODE_BLOCKS]
538 /** The number of CBs that uses Ea before switching to Eb, [0:63] */
540 /** The E size of the CB rate matched output to use in the Turbo
541 * operation when r < cab
544 /** The E size of the CB rate matched output to use in the Turbo
545 * operation when r >= cab
548 /** The Ncb soft buffer size for the rate matched CB that is used in
549 * the Turbo operation when r < C-, [K:3*Kpi]
552 /** The Ncb soft buffer size for the rate matched CB that is used in
553 * the Turbo operation when r >= C-, [K:3*Kpi]
556 /**< The index of the first CB in the inbound mbuf data, default is 0 */
560 /** LDPC encode code block parameters */
561 struct rte_bbdev_op_enc_ldpc_cb_params {
562 /** E, length after rate matching in bits.
563 * [3GPP TS38.212, section 5.4.2.1]
568 /** LDPC encode transport block parameters */
569 struct rte_bbdev_op_enc_ldpc_tb_params {
570 /** Ea, length after rate matching in bits, r < cab.
571 * [3GPP TS38.212, section 5.4.2.1]
574 /** Eb, length after rate matching in bits, r >= cab.
575 * [3GPP TS38.212, section 5.4.2.1]
578 /** The total number of CBs in the TB or partial TB
579 * [1:RTE_BBDEV_LDPC_MAX_CODE_BLOCKS]
582 /** The index of the first CB in the inbound mbuf data, default is 0 */
584 /** The number of CBs that use Ea before switching to Eb, [0:63] */
588 /** Operation structure for Turbo encode.
589 * An operation can be performed on one CB at a time "CB-mode".
590 * An operation can pbe erformd on one or multiple CBs that logically
591 * belong to one TB "TB-mode".
593 * In CB-mode, CRC24A/B is an optional operation. K size parameter is not
594 * affected by CRC24A/B inclusion, this only affects the inbound mbuf data
595 * length. Not all BBDEV PMDs are capable of CRC24A/B calculation. Flags
596 * RTE_BBDEV_TURBO_CRC_24A_ATTACH and RTE_BBDEV_TURBO_CRC_24B_ATTACH informs
597 * the application with relevant capability. These flags can be set in the
598 * op_flags parameter to indicate BBDEV to calculate and append CRC24A to CB
599 * before going forward with Turbo encoding.
601 * In TB-mode, CRC24A is assumed to be pre-calculated and appended to the
602 * inbound TB mbuf data buffer.
604 * The output mbuf data structure is expected to be allocated by the
605 * application with enough room for the output data.
607 struct rte_bbdev_op_turbo_enc {
608 /** The input CB or TB data */
609 struct rte_bbdev_op_data input;
610 /** The rate matched CB or TB output buffer */
611 struct rte_bbdev_op_data output;
612 /** Flags from rte_bbdev_op_te_flag_bitmasks */
615 /** Rv index for rate matching [0:3] */
617 /** [0 - TB : 1 - CB] */
618 uint8_t code_block_mode;
620 /** Struct which stores Code Block specific parameters */
621 struct rte_bbdev_op_enc_turbo_cb_params cb_params;
622 /** Struct which stores Transport Block specific parameters */
623 struct rte_bbdev_op_enc_turbo_tb_params tb_params;
627 /** Operation structure for LDPC encode.
628 * An operation can be performed on one CB at a time "CB-mode".
629 * An operation can be performed on one or multiple CBs that logically
630 * belong to a TB "TB-mode".
632 * The input data is the CB or TB input to the decoder.
634 * The output data is the ratematched CB or TB data, or the output after
635 * bit-selection if RTE_BBDEV_LDPC_INTERLEAVER_BYPASS is set.
637 * The output mbuf data structure is expected to be allocated by the
638 * application with enough room for the output data.
640 struct rte_bbdev_op_ldpc_enc {
641 /** The input TB or CB data */
642 struct rte_bbdev_op_data input;
643 /** The rate matched TB or CB output buffer */
644 struct rte_bbdev_op_data output;
646 /** Flags from rte_bbdev_op_ldpcenc_flag_bitmasks */
649 /** Rate matching redundancy version */
651 /** 1: LDPC Base graph 1, 2: LDPC Base graph 2.
652 * [3GPP TS38.212, section 5.2.2]
655 /** Zc, LDPC lifting size.
656 * [3GPP TS38.212, section 5.2.2]
659 /** Ncb, length of the circular buffer in bits.
660 * [3GPP TS38.212, section 5.4.2.1]
663 /** Qm, modulation order {2,4,6,8,10}.
664 * [3GPP TS38.212, section 5.4.2.2]
667 /** Number of Filler bits, n_filler = K – K’
668 * [3GPP TS38.212 section 5.2.2]
671 /** [0 - TB : 1 - CB] */
672 uint8_t code_block_mode;
674 /** Struct which stores Code Block specific parameters */
675 struct rte_bbdev_op_enc_ldpc_cb_params cb_params;
676 /** Struct which stores Transport Block specific parameters */
677 struct rte_bbdev_op_enc_ldpc_tb_params tb_params;
681 /** List of the capabilities for the Turbo Decoder */
682 struct rte_bbdev_op_cap_turbo_dec {
683 /** Flags from rte_bbdev_op_td_flag_bitmasks */
684 uint32_t capability_flags;
685 /** Maximal LLR absolute value. Acceptable LLR values lie in range
686 * [-max_llr_modulus, max_llr_modulus].
688 int8_t max_llr_modulus;
689 /** Num input code block buffers */
690 uint8_t num_buffers_src; /**< Num input code block buffers */
691 /** Num hard output code block buffers */
692 uint8_t num_buffers_hard_out;
693 /** Num soft output code block buffers if supported by the driver */
694 uint8_t num_buffers_soft_out;
697 /** List of the capabilities for the Turbo Encoder */
698 struct rte_bbdev_op_cap_turbo_enc {
699 /** Flags from rte_bbdev_op_te_flag_bitmasks */
700 uint32_t capability_flags;
701 /** Num input code block buffers */
702 uint8_t num_buffers_src;
703 /** Num output code block buffers */
704 uint8_t num_buffers_dst;
707 /** List of the capabilities for the LDPC Decoder */
708 struct rte_bbdev_op_cap_ldpc_dec {
709 /** Flags from rte_bbdev_op_ldpcdec_flag_bitmasks */
710 uint32_t capability_flags;
711 /** LLR size in bits. LLR is a two’s complement number. */
713 /** LLR numbers of decimals bit for arithmetic representation */
715 /** Num input code block buffers */
716 uint16_t num_buffers_src;
717 /** Num hard output code block buffers */
718 uint16_t num_buffers_hard_out;
719 /** Num soft output code block buffers if supported by the driver */
720 uint16_t num_buffers_soft_out;
723 /** List of the capabilities for the LDPC Encoder */
724 struct rte_bbdev_op_cap_ldpc_enc {
725 /** Flags from rte_bbdev_op_ldpcenc_flag_bitmasks */
726 uint32_t capability_flags;
727 /** Num input code block buffers */
728 uint16_t num_buffers_src;
729 /** Num output code block buffers */
730 uint16_t num_buffers_dst;
733 /** Different operation types supported by the device */
734 enum rte_bbdev_op_type {
735 RTE_BBDEV_OP_NONE, /**< Dummy operation that does nothing */
736 RTE_BBDEV_OP_TURBO_DEC, /**< Turbo decode */
737 RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */
738 RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */
739 RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */
740 RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */
743 /** Bit indexes of possible errors reported through status field */
746 RTE_BBDEV_DATA_ERROR,
748 RTE_BBDEV_SYNDROME_ERROR
751 /** Structure specifying a single encode operation */
752 struct rte_bbdev_enc_op {
753 /**< Status of operation that was performed */
755 /**< Mempool which op instance is in */
756 struct rte_mempool *mempool;
757 /**< Opaque pointer for user data */
760 /** Contains turbo decoder specific parameters */
761 struct rte_bbdev_op_turbo_enc turbo_enc;
762 /** Contains LDPC decoder specific parameters */
763 struct rte_bbdev_op_ldpc_enc ldpc_enc;
767 /** Structure specifying a single decode operation */
768 struct rte_bbdev_dec_op {
769 /** Status of operation that was performed */
771 /** Mempool which op instance is in */
772 struct rte_mempool *mempool;
773 /** Opaque pointer for user data */
776 /** Contains turbo decoder specific parameters */
777 struct rte_bbdev_op_turbo_dec turbo_dec;
778 /** Contains LDPC decoder specific parameters */
779 struct rte_bbdev_op_ldpc_dec ldpc_dec;
783 /** Operation capabilities supported by a device */
784 struct rte_bbdev_op_cap {
785 enum rte_bbdev_op_type type; /**< Type of operation */
787 struct rte_bbdev_op_cap_turbo_dec turbo_dec;
788 struct rte_bbdev_op_cap_turbo_enc turbo_enc;
789 struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
790 struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
791 } cap; /**< Operation-type specific capabilities */
794 /**< @internal Private data structure stored with operation pool. */
795 struct rte_bbdev_op_pool_private {
796 enum rte_bbdev_op_type type; /**< Type of operations in a pool */
800 * Converts queue operation type from enum to string
803 * Operation type as enum
806 * Operation type as string or NULL if op_type is invalid
811 rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type);
814 * Creates a bbdev operation mempool
819 * Operation type, use RTE_BBDEV_OP_NONE for a pool which supports all
821 * @param num_elements
822 * Number of elements in the pool.
824 * Number of elements to cache on an lcore, see rte_mempool_create() for
825 * further details about cache size.
827 * Socket to allocate memory on.
830 * - Pointer to a mempool on success,
831 * - NULL pointer on failure.
835 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
836 unsigned int num_elements, unsigned int cache_size,
840 * Bulk allocate encode operations from a mempool with parameter defaults reset.
843 * Operation mempool, created by rte_bbdev_op_pool_create().
845 * Output array to place allocated operations
847 * Number of operations to allocate
851 * - EINVAL if invalid mempool is provided
855 rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool,
856 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
858 struct rte_bbdev_op_pool_private *priv;
862 priv = (struct rte_bbdev_op_pool_private *)
863 rte_mempool_get_priv(mempool);
864 if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
865 (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
869 ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
870 if (unlikely(ret < 0))
877 * Bulk allocate decode operations from a mempool with parameter defaults reset.
880 * Operation mempool, created by rte_bbdev_op_pool_create().
882 * Output array to place allocated operations
884 * Number of operations to allocate
888 * - EINVAL if invalid mempool is provided
892 rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool,
893 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
895 struct rte_bbdev_op_pool_private *priv;
899 priv = (struct rte_bbdev_op_pool_private *)
900 rte_mempool_get_priv(mempool);
901 if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
902 (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
906 ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
907 if (unlikely(ret < 0))
914 * Free decode operation structures that were allocated by
915 * rte_bbdev_dec_op_alloc_bulk().
916 * All structures must belong to the same mempool.
919 * Operation structures
921 * Number of structures
925 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
928 rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
932 * Free encode operation structures that were allocated by
933 * rte_bbdev_enc_op_alloc_bulk().
934 * All structures must belong to the same mempool.
937 * Operation structures
939 * Number of structures
943 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
946 rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
953 #endif /* _RTE_BBDEV_OP_H_ */