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)
38 /* Maximum E size we can manage with default mbuf */
39 #define RTE_BBDEV_LDPC_E_MAX_MBUF (64000)
40 /* Minimum size of Code Block (36.212, Table 5.1.3-3) */
41 #define RTE_BBDEV_TURBO_MIN_CB_SIZE (40)
42 /* Maximum size of circular buffer */
43 #define RTE_BBDEV_TURBO_MAX_KW (18528)
45 * Turbo: Maximum number of Code Blocks in Transport Block. It is calculated
46 * based on maximum size of one Code Block and one Transport Block
47 * (considering CRC24A and CRC24B):
48 * (391656 + 24) / (6144 - 24) = 64
50 #define RTE_BBDEV_TURBO_MAX_CODE_BLOCKS (64)
51 /* LDPC: Maximum number of Code Blocks in Transport Block.*/
52 #define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
54 /** Flags for turbo decoder operation and capability structure */
55 enum rte_bbdev_op_td_flag_bitmasks {
56 /** If sub block de-interleaving is to be performed. */
57 RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE = (1ULL << 0),
58 /** To use CRC Type 24B (otherwise use CRC Type 24A). */
59 RTE_BBDEV_TURBO_CRC_TYPE_24B = (1ULL << 1),
60 /** If turbo equalization is to be performed. */
61 RTE_BBDEV_TURBO_EQUALIZER = (1ULL << 2),
62 /** If set, saturate soft output to +/-127 */
63 RTE_BBDEV_TURBO_SOFT_OUT_SATURATE = (1ULL << 3),
64 /** Set to 1 to start iteration from even, else odd; one iteration =
67 RTE_BBDEV_TURBO_HALF_ITERATION_EVEN = (1ULL << 4),
68 /** If 0, TD stops after CRC matches; else if 1, runs to end of next
69 * odd iteration after CRC matches
71 RTE_BBDEV_TURBO_CONTINUE_CRC_MATCH = (1ULL << 5),
72 /** Set if soft output is required to be output */
73 RTE_BBDEV_TURBO_SOFT_OUTPUT = (1ULL << 6),
74 /** Set to enable early termination mode */
75 RTE_BBDEV_TURBO_EARLY_TERMINATION = (1ULL << 7),
76 /** Set if a device supports decoder dequeue interrupts */
77 RTE_BBDEV_TURBO_DEC_INTERRUPTS = (1ULL << 9),
78 /** Set if positive LLR encoded input is supported. Positive LLR value
79 * represents the level of confidence for bit '1', and vice versa for
81 * This is mutually exclusive with RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN
82 * when used to formalize the input data format.
84 RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN = (1ULL << 10),
85 /** Set if negative LLR encoded input is supported. Negative LLR value
86 * represents the level of confidence for bit '1', and vice versa for
88 * This is mutually exclusive with RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN
89 * when used to formalize the input data format.
91 RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN = (1ULL << 11),
92 /** Set if positive LLR soft output is supported. Positive LLR value
93 * represents the level of confidence for bit '1', and vice versa for
95 * This is mutually exclusive with
96 * RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT when used to formalize
97 * the input data format.
99 RTE_BBDEV_TURBO_POS_LLR_1_BIT_SOFT_OUT = (1ULL << 12),
100 /** Set if negative LLR soft output is supported. Negative LLR value
101 * represents the level of confidence for bit '1', and vice versa for
103 * This is mutually exclusive with
104 * RTE_BBDEV_TURBO_POS_LLR_1_BIT_SOFT_OUT when used to formalize the
107 RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT = (1ULL << 13),
108 /** Set if driver supports flexible parallel MAP engine decoding. If
109 * not supported, num_maps (number of MAP engines) argument is unusable.
111 RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
112 /** Set if a device supports scatter-gather functionality */
113 RTE_BBDEV_TURBO_DEC_SCATTER_GATHER = (1ULL << 15),
114 /** Set to keep CRC24B bits appended while decoding. Only usable when
115 * decoding Transport Block mode.
117 RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP = (1ULL << 16),
118 /** Set to drop CRC24B bits not to be appended while decoding.
120 RTE_BBDEV_TURBO_DEC_CRC_24B_DROP = (1ULL << 17)
124 /** Flags for turbo encoder operation and capability structure */
125 enum rte_bbdev_op_te_flag_bitmasks {
126 /** Ignore rv_index and set K0 = 0 */
127 RTE_BBDEV_TURBO_RV_INDEX_BYPASS = (1ULL << 0),
128 /** If rate matching is to be performed */
129 RTE_BBDEV_TURBO_RATE_MATCH = (1ULL << 1),
130 /** This bit must be set to enable CRC-24B generation */
131 RTE_BBDEV_TURBO_CRC_24B_ATTACH = (1ULL << 2),
132 /** This bit must be set to enable CRC-24A generation */
133 RTE_BBDEV_TURBO_CRC_24A_ATTACH = (1ULL << 3),
134 /** Set if a device supports encoder dequeue interrupts */
135 RTE_BBDEV_TURBO_ENC_INTERRUPTS = (1ULL << 4),
136 /** Set if a device supports scatter-gather functionality */
137 RTE_BBDEV_TURBO_ENC_SCATTER_GATHER = (1ULL << 5)
140 /** Flags for LDPC decoder operation and capability structure */
141 enum rte_bbdev_op_ldpcdec_flag_bitmasks {
142 /** Set for transport block CRC-24A checking */
143 RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK = (1ULL << 0),
144 /** Set for code block CRC-24B checking */
145 RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK = (1ULL << 1),
146 /** Set to drop the last CRC bits decoding output */
147 RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP = (1ULL << 2),
148 /** Set for transport block CRC-16 checking */
149 RTE_BBDEV_LDPC_CRC_TYPE_16_CHECK = (1ULL << 3),
150 /** Set for bit-level de-interleaver bypass on Rx stream. */
151 RTE_BBDEV_LDPC_DEINTERLEAVER_BYPASS = (1ULL << 4),
152 /** Set for HARQ combined input stream enable. */
153 RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE = (1ULL << 5),
154 /** Set for HARQ combined output stream enable. */
155 RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE = (1ULL << 6),
156 /** Set for LDPC decoder bypass.
157 * RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE must be set.
159 RTE_BBDEV_LDPC_DECODE_BYPASS = (1ULL << 7),
160 /** Set for soft-output stream enable */
161 RTE_BBDEV_LDPC_SOFT_OUT_ENABLE = (1ULL << 8),
162 /** Set for Rate-Matching bypass on soft-out stream. */
163 RTE_BBDEV_LDPC_SOFT_OUT_RM_BYPASS = (1ULL << 9),
164 /** Set for bit-level de-interleaver bypass on soft-output stream. */
165 RTE_BBDEV_LDPC_SOFT_OUT_DEINTERLEAVER_BYPASS = (1ULL << 10),
166 /** Set for iteration stopping on successful decode condition
167 * i.e. a successful syndrome check.
169 RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE = (1ULL << 11),
170 /** Set if a device supports decoder dequeue interrupts. */
171 RTE_BBDEV_LDPC_DEC_INTERRUPTS = (1ULL << 12),
172 /** Set if a device supports scatter-gather functionality. */
173 RTE_BBDEV_LDPC_DEC_SCATTER_GATHER = (1ULL << 13),
174 /** Set if a device supports input/output HARQ compression. */
175 RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION = (1ULL << 14),
176 /** Set if a device supports input LLR compression. */
177 RTE_BBDEV_LDPC_LLR_COMPRESSION = (1ULL << 15),
178 /** Set if a device supports HARQ input from
179 * device's internal memory.
181 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE = (1ULL << 16),
182 /** Set if a device supports HARQ output to
183 * device's internal memory.
185 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE = (1ULL << 17),
186 /** Set if a device supports loop-back access to
187 * HARQ internal memory. Intended for troubleshooting.
189 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK = (1ULL << 18),
190 /** Set if a device includes LLR filler bits in the circular buffer
191 * for HARQ memory. If not set, it is assumed the filler bits are not
192 * in HARQ memory and handled directly by the LDPC decoder.
194 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 19)
197 /** Flags for LDPC encoder operation and capability structure */
198 enum rte_bbdev_op_ldpcenc_flag_bitmasks {
199 /** Set for bit-level interleaver bypass on output stream. */
200 RTE_BBDEV_LDPC_INTERLEAVER_BYPASS = (1ULL << 0),
201 /** If rate matching is to be performed */
202 RTE_BBDEV_LDPC_RATE_MATCH = (1ULL << 1),
203 /** Set for transport block CRC-24A attach */
204 RTE_BBDEV_LDPC_CRC_24A_ATTACH = (1ULL << 2),
205 /** Set for code block CRC-24B attach */
206 RTE_BBDEV_LDPC_CRC_24B_ATTACH = (1ULL << 3),
207 /** Set for code block CRC-16 attach */
208 RTE_BBDEV_LDPC_CRC_16_ATTACH = (1ULL << 4),
209 /** Set if a device supports encoder dequeue interrupts. */
210 RTE_BBDEV_LDPC_ENC_INTERRUPTS = (1ULL << 5),
211 /** Set if a device supports scatter-gather functionality. */
212 RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
213 /** Set if a device supports concatenation of non byte aligned output */
214 RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
217 /** Flags for the Code Block/Transport block mode */
218 enum rte_bbdev_op_cb_mode {
219 /** One operation is one or fraction of one transport block */
220 RTE_BBDEV_TRANSPORT_BLOCK = 0,
221 /** One operation is one code block mode */
222 RTE_BBDEV_CODE_BLOCK = 1,
225 /** Data input and output buffer for BBDEV operations */
226 struct rte_bbdev_op_data {
227 /** The mbuf data structure representing the data for BBDEV operation.
229 * This mbuf pointer can point to one Code Block (CB) data buffer or
230 * multiple CBs contiguously located next to each other.
231 * A Transport Block (TB) represents a whole piece of data that is
232 * divided into one or more CBs. Maximum number of CBs can be contained
233 * in one TB is defined by RTE_BBDEV_(TURBO/LDPC)_MAX_CODE_BLOCKS.
235 * An mbuf data structure cannot represent more than one TB. The
236 * smallest piece of data that can be contained in one mbuf is one CB.
237 * An mbuf can include one contiguous CB, subset of contiguous CBs that
238 * are belonging to one TB, or all contiguous CBs that are belonging to
241 * If a BBDEV PMD supports the extended capability "Scatter-Gather",
242 * then it is capable of collecting (gathering) non-contiguous
243 * (scattered) data from multiple locations in the memory.
244 * This capability is reported by the capability flags:
245 * - RTE_BBDEV_(TURBO/LDPC)_ENC_SCATTER_GATHER and
246 * - RTE_BBDEV_(TURBO/LDPC)_DEC_SCATTER_GATHER.
247 * Only if a BBDEV PMD supports this feature, chained mbuf data
248 * structures are accepted. A chained mbuf can represent one
249 * non-contiguous CB or multiple non-contiguous CBs.
250 * If BBDEV PMD does not support this feature, it will assume inbound
251 * mbuf data contains one segment.
253 * The output mbuf data though is always one segment, even if the input
254 * was a chained mbuf.
256 struct rte_mbuf *data;
257 /** The starting point of the BBDEV (encode/decode) operation,
260 * BBDEV starts to read data past this offset.
261 * In case of chained mbuf, this offset applies only to the first mbuf
265 /** The total data length to be processed in one operation, in bytes.
267 * In case the mbuf data is representing one CB, this is the length of
268 * the CB undergoing the operation.
269 * If it's for multiple CBs, this is the total length of those CBs
270 * undergoing the operation.
271 * If it is for one TB, this is the total length of the TB under
274 * In case of chained mbuf, this data length includes the lengths of the
275 * "scattered" data segments undergoing the operation.
280 /** Turbo decode code block parameters */
281 struct rte_bbdev_op_dec_turbo_cb_params {
282 /** The K size of the input CB, in bits [40:6144], as specified in
284 * This size is inclusive of CRC bits, regardless whether it was
285 * pre-calculated by the application or not.
288 /** The E length of the CB rate matched LLR output, in bytes, as in
294 /** LDPC decode code block parameters */
295 struct rte_bbdev_op_dec_ldpc_cb_params {
296 /** Rate matching output sequence length in bits or LLRs.
297 * [3GPP TS38.212, section 5.4.2.1]
302 /** Turbo decode transport block parameters */
303 struct rte_bbdev_op_dec_turbo_tb_params {
304 /** The K- size of the input CB, in bits [40:6144], that is in the
305 * Turbo operation when r < C-, as in 3GPP TS 36.212.
308 /** The K+ size of the input CB, in bits [40:6144], that is in the
309 * Turbo operation when r >= C-, as in 3GPP TS 36.212.
312 /** The number of CBs that have K- size, [0:63] */
314 /** The total number of CBs in the TB,
315 * [1:RTE_BBDEV_TURBO_MAX_CODE_BLOCKS]
318 /** The number of CBs that uses Ea before switching to Eb, [0:63] */
320 /** The E size of the CB rate matched output to use in the Turbo
321 * operation when r < cab
324 /** The E size of the CB rate matched output to use in the Turbo
325 * operation when r >= cab
328 /** The index of the first CB in the inbound mbuf data, default is 0 */
332 /** LDPC decode transport block parameters */
333 struct rte_bbdev_op_dec_ldpc_tb_params {
334 /** Ea, length after rate matching in bits, r < cab.
335 * [3GPP TS38.212, section 5.4.2.1]
338 /** Eb, length after rate matching in bits, r >= cab.
339 * [3GPP TS38.212, section 5.4.2.1]
342 /** The total number of CBs in the TB or partial TB
343 * [1:RTE_BBDEV_LDPC_MAX_CODE_BLOCKS]
346 /** The index of the first CB in the inbound mbuf data, default is 0 */
348 /** The number of CBs that use Ea before switching to Eb, [0:63] */
352 /** Operation structure for Turbo decode.
353 * An operation can be performed on one CB at a time "CB-mode".
354 * An operation can be performed on one or multiple CBs that logically
355 * belong to one TB "TB-mode".
356 * The provided K size parameter of the CB is its size coming from the
358 * CRC24A/B check is requested by the application by setting the flag
359 * RTE_BBDEV_TURBO_CRC_TYPE_24B for CRC24B check or CRC24A otherwise.
360 * In TB-mode, BBDEV concatenates the decoded CBs one next to the other with
361 * relevant CRC24B in between.
363 * The input encoded CB data is the Virtual Circular Buffer data stream, wk,
364 * with the null padding included as described in 3GPP TS 36.212
365 * section 5.1.4.1.2 and shown in 3GPP TS 36.212 section 5.1.4.1 Figure 5.1.4-1.
366 * The size of the virtual circular buffer is 3*Kpi, where Kpi is the 32 byte
367 * aligned value of K, as specified in 3GPP TS 36.212 section 5.1.4.1.1.
369 * Each byte in the input circular buffer is the LLR value of each bit of the
372 * Hard output is a mandatory capability that all BBDEV PMDs support. This is
373 * the decoded CBs of K sizes (CRC24A/B is the last 24-bit in each decoded CB).
374 * Soft output is an optional capability for BBDEV PMDs. If supported, an LLR
375 * rate matched output is computed in the soft_output buffer structure.
377 * The output mbuf data structure is expected to be allocated by the
378 * application with enough room for the output data.
380 struct rte_bbdev_op_turbo_dec {
381 /** The Virtual Circular Buffer, wk, size 3*Kpi for each CB */
382 struct rte_bbdev_op_data input;
383 /** The hard decisions buffer for the decoded output,
386 struct rte_bbdev_op_data hard_output;
387 /** The soft LLR output buffer - optional */
388 struct rte_bbdev_op_data soft_output;
390 /** Flags from rte_bbdev_op_td_flag_bitmasks */
393 /** Rv index for rate matching [0:3] */
395 /** The minimum number of iterations to perform in decoding all CBs in
396 * this operation - input
399 /** The maximum number of iterations to perform in decoding all CBs in
400 * this operation - input
403 /** The maximum number of iterations that were performed in decoding
404 * all CBs in this decode operation - output
407 /** 5 bit extrinsic scale (scale factor on extrinsic info) */
409 /** Number of MAP engines to use in decode,
410 * must be power of 2 (or 0 to auto-select)
414 /** [0 - TB : 1 - CB] */
415 uint8_t code_block_mode;
417 /** Struct which stores Code Block specific parameters */
418 struct rte_bbdev_op_dec_turbo_cb_params cb_params;
419 /** Struct which stores Transport Block specific parameters */
420 struct rte_bbdev_op_dec_turbo_tb_params tb_params;
424 /** Operation structure for LDPC decode.
426 * An operation can be performed on one CB at a time "CB-mode".
427 * An operation can also be performed on one or multiple CBs that logically
428 * belong to a TB "TB-mode" (Currently not supported).
430 * The input encoded CB data is the Virtual Circular Buffer data stream.
432 * Each byte in the input circular buffer is the LLR value of each bit of the
435 * Hard output is a mandatory capability that all BBDEV PMDs support. This is
436 * the decoded CBs (CRC24A/B is the last 24-bit in each decoded CB).
438 * Soft output is an optional capability for BBDEV PMDs. If supported, an LLR
439 * rate matched output is computed in the soft_output buffer structure.
440 * These are A Posteriori Probabilities (APP) LLR samples for coded bits.
442 * HARQ combined output is an optional capability for BBDEV PMDs.
443 * If supported, a LLR output is streamed to the harq_combined_output
446 * HARQ combined input is an optional capability for BBDEV PMDs.
447 * If supported, a LLR input is streamed from the harq_combined_input
450 * The output mbuf data structure is expected to be allocated by the
451 * application with enough room for the output data.
453 struct rte_bbdev_op_ldpc_dec {
454 /** The Virtual Circular Buffer for this code block, one LLR
455 * per bit of the original CB.
457 struct rte_bbdev_op_data input;
458 /** The hard decisions buffer for the decoded output,
461 struct rte_bbdev_op_data hard_output;
462 /** The soft LLR output LLR stream buffer - optional */
463 struct rte_bbdev_op_data soft_output;
464 /** The HARQ combined LLR stream input buffer - optional */
465 struct rte_bbdev_op_data harq_combined_input;
466 /** The HARQ combined LLR stream output buffer - optional */
467 struct rte_bbdev_op_data harq_combined_output;
469 /** Flags from rte_bbdev_op_ldpcdec_flag_bitmasks */
472 /** Rate matching redundancy version
473 * [3GPP TS38.212, section 5.4.2.1]
476 /** The maximum number of iterations to perform in decoding CB in
477 * this operation - input
480 /** The number of iterations that were performed in decoding
481 * CB in this decode operation - output
484 /** 1: LDPC Base graph 1, 2: LDPC Base graph 2.
485 * [3GPP TS38.212, section 5.2.2]
488 /** Zc, LDPC lifting size.
489 * [3GPP TS38.212, section 5.2.2]
492 /** Ncb, length of the circular buffer in bits.
493 * [3GPP TS38.212, section 5.4.2.1]
496 /** Qm, modulation order {1,2,4,6,8}.
497 * [3GPP TS38.212, section 5.4.2.2]
500 /** Number of Filler bits, n_filler = K – K’
501 * [3GPP TS38.212 section 5.2.2]
504 /** [0 - TB : 1 - CB] */
505 uint8_t code_block_mode;
507 /** Struct which stores Code Block specific parameters */
508 struct rte_bbdev_op_dec_ldpc_cb_params cb_params;
509 /** Struct which stores Transport Block specific parameters */
510 struct rte_bbdev_op_dec_ldpc_tb_params tb_params;
514 /** Turbo encode code block parameters */
515 struct rte_bbdev_op_enc_turbo_cb_params {
516 /** The K size of the input CB, in bits [40:6144], as specified in
518 * This size is inclusive of CRC24A, regardless whether it was
519 * pre-calculated by the application or not.
522 /** The E length of the CB rate matched output, in bits, as in
526 /** The Ncb soft buffer size of the CB rate matched output [K:3*Kpi],
527 * in bits, as specified in 3GPP TS 36.212.
532 /** Turbo encode transport block parameters */
533 struct rte_bbdev_op_enc_turbo_tb_params {
534 /** The K- size of the input CB, in bits [40:6144], that is in the
535 * Turbo operation when r < C-, as in 3GPP TS 36.212.
536 * This size is inclusive of CRC24B, regardless whether it was
537 * pre-calculated and appended by the application or not.
540 /** The K+ size of the input CB, in bits [40:6144], that is in the
541 * Turbo operation when r >= C-, as in 3GPP TS 36.212.
542 * This size is inclusive of CRC24B, regardless whether it was
543 * pre-calculated and appended by the application or not.
546 /** The number of CBs that have K- size, [0:63] */
548 /** The total number of CBs in the TB,
549 * [1:RTE_BBDEV_TURBO_MAX_CODE_BLOCKS]
552 /** The number of CBs that uses Ea before switching to Eb, [0:63] */
554 /** The E size of the CB rate matched output to use in the Turbo
555 * operation when r < cab
558 /** The E size of the CB rate matched output to use in the Turbo
559 * operation when r >= cab
562 /** The Ncb soft buffer size for the rate matched CB that is used in
563 * the Turbo operation when r < C-, [K:3*Kpi]
566 /** The Ncb soft buffer size for the rate matched CB that is used in
567 * the Turbo operation when r >= C-, [K:3*Kpi]
570 /** The index of the first CB in the inbound mbuf data, default is 0 */
574 /** LDPC encode code block parameters */
575 struct rte_bbdev_op_enc_ldpc_cb_params {
576 /** E, length after rate matching in bits.
577 * [3GPP TS38.212, section 5.4.2.1]
582 /** LDPC encode transport block parameters */
583 struct rte_bbdev_op_enc_ldpc_tb_params {
584 /** Ea, length after rate matching in bits, r < cab.
585 * [3GPP TS38.212, section 5.4.2.1]
588 /** Eb, length after rate matching in bits, r >= cab.
589 * [3GPP TS38.212, section 5.4.2.1]
592 /** The total number of CBs in the TB or partial TB
593 * [1:RTE_BBDEV_LDPC_MAX_CODE_BLOCKS]
596 /** The index of the first CB in the inbound mbuf data, default is 0 */
598 /** The number of CBs that use Ea before switching to Eb, [0:63] */
602 /** Operation structure for Turbo encode.
603 * An operation can be performed on one CB at a time "CB-mode".
604 * An operation can pbe erformd on one or multiple CBs that logically
605 * belong to one TB "TB-mode".
607 * In CB-mode, CRC24A/B is an optional operation. K size parameter is not
608 * affected by CRC24A/B inclusion, this only affects the inbound mbuf data
609 * length. Not all BBDEV PMDs are capable of CRC24A/B calculation. Flags
610 * RTE_BBDEV_TURBO_CRC_24A_ATTACH and RTE_BBDEV_TURBO_CRC_24B_ATTACH informs
611 * the application with relevant capability. These flags can be set in the
612 * op_flags parameter to indicate BBDEV to calculate and append CRC24A to CB
613 * before going forward with Turbo encoding.
615 * In TB-mode, CRC24A is assumed to be pre-calculated and appended to the
616 * inbound TB mbuf data buffer.
618 * The output mbuf data structure is expected to be allocated by the
619 * application with enough room for the output data.
621 struct rte_bbdev_op_turbo_enc {
622 /** The input CB or TB data */
623 struct rte_bbdev_op_data input;
624 /** The rate matched CB or TB output buffer */
625 struct rte_bbdev_op_data output;
626 /** Flags from rte_bbdev_op_te_flag_bitmasks */
629 /** Rv index for rate matching [0:3] */
631 /** [0 - TB : 1 - CB] */
632 uint8_t code_block_mode;
634 /** Struct which stores Code Block specific parameters */
635 struct rte_bbdev_op_enc_turbo_cb_params cb_params;
636 /** Struct which stores Transport Block specific parameters */
637 struct rte_bbdev_op_enc_turbo_tb_params tb_params;
641 /** Operation structure for LDPC encode.
642 * An operation can be performed on one CB at a time "CB-mode".
643 * An operation can be performed on one or multiple CBs that logically
644 * belong to a TB "TB-mode".
646 * The input data is the CB or TB input to the decoder.
648 * The output data is the ratematched CB or TB data, or the output after
649 * bit-selection if RTE_BBDEV_LDPC_INTERLEAVER_BYPASS is set.
651 * The output mbuf data structure is expected to be allocated by the
652 * application with enough room for the output data.
654 struct rte_bbdev_op_ldpc_enc {
655 /** The input TB or CB data */
656 struct rte_bbdev_op_data input;
657 /** The rate matched TB or CB output buffer */
658 struct rte_bbdev_op_data output;
660 /** Flags from rte_bbdev_op_ldpcenc_flag_bitmasks */
663 /** Rate matching redundancy version */
665 /** 1: LDPC Base graph 1, 2: LDPC Base graph 2.
666 * [3GPP TS38.212, section 5.2.2]
669 /** Zc, LDPC lifting size.
670 * [3GPP TS38.212, section 5.2.2]
673 /** Ncb, length of the circular buffer in bits.
674 * [3GPP TS38.212, section 5.4.2.1]
677 /** Qm, modulation order {2,4,6,8,10}.
678 * [3GPP TS38.212, section 5.4.2.2]
681 /** Number of Filler bits, n_filler = K – K’
682 * [3GPP TS38.212 section 5.2.2]
685 /** [0 - TB : 1 - CB] */
686 uint8_t code_block_mode;
688 /** Struct which stores Code Block specific parameters */
689 struct rte_bbdev_op_enc_ldpc_cb_params cb_params;
690 /** Struct which stores Transport Block specific parameters */
691 struct rte_bbdev_op_enc_ldpc_tb_params tb_params;
695 /** List of the capabilities for the Turbo Decoder */
696 struct rte_bbdev_op_cap_turbo_dec {
697 /** Flags from rte_bbdev_op_td_flag_bitmasks */
698 uint32_t capability_flags;
699 /** Maximal LLR absolute value. Acceptable LLR values lie in range
700 * [-max_llr_modulus, max_llr_modulus].
702 int8_t max_llr_modulus;
703 /** Num input code block buffers */
704 uint8_t num_buffers_src; /**< Num input code block buffers */
705 /** Num hard output code block buffers */
706 uint8_t num_buffers_hard_out;
707 /** Num soft output code block buffers if supported by the driver */
708 uint8_t num_buffers_soft_out;
711 /** List of the capabilities for the Turbo Encoder */
712 struct rte_bbdev_op_cap_turbo_enc {
713 /** Flags from rte_bbdev_op_te_flag_bitmasks */
714 uint32_t capability_flags;
715 /** Num input code block buffers */
716 uint8_t num_buffers_src;
717 /** Num output code block buffers */
718 uint8_t num_buffers_dst;
721 /** List of the capabilities for the LDPC Decoder */
722 struct rte_bbdev_op_cap_ldpc_dec {
723 /** Flags from rte_bbdev_op_ldpcdec_flag_bitmasks */
724 uint32_t capability_flags;
725 /** LLR size in bits. LLR is a two’s complement number. */
727 /** LLR numbers of decimals bit for arithmetic representation */
729 /** Num input code block buffers */
730 uint16_t num_buffers_src;
731 /** Num hard output code block buffers */
732 uint16_t num_buffers_hard_out;
733 /** Num soft output code block buffers if supported by the driver */
734 uint16_t num_buffers_soft_out;
737 /** List of the capabilities for the LDPC Encoder */
738 struct rte_bbdev_op_cap_ldpc_enc {
739 /** Flags from rte_bbdev_op_ldpcenc_flag_bitmasks */
740 uint32_t capability_flags;
741 /** Num input code block buffers */
742 uint16_t num_buffers_src;
743 /** Num output code block buffers */
744 uint16_t num_buffers_dst;
747 /** Different operation types supported by the device */
748 enum rte_bbdev_op_type {
749 RTE_BBDEV_OP_NONE, /**< Dummy operation that does nothing */
750 RTE_BBDEV_OP_TURBO_DEC, /**< Turbo decode */
751 RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */
752 RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */
753 RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */
754 RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */
757 /** Bit indexes of possible errors reported through status field */
760 RTE_BBDEV_DATA_ERROR,
762 RTE_BBDEV_SYNDROME_ERROR
765 /** Structure specifying a single encode operation */
766 struct rte_bbdev_enc_op {
767 /** Status of operation that was performed */
769 /** Mempool which op instance is in */
770 struct rte_mempool *mempool;
771 /** Opaque pointer for user data */
774 /** Contains turbo decoder specific parameters */
775 struct rte_bbdev_op_turbo_enc turbo_enc;
776 /** Contains LDPC decoder specific parameters */
777 struct rte_bbdev_op_ldpc_enc ldpc_enc;
781 /** Structure specifying a single decode operation */
782 struct rte_bbdev_dec_op {
783 /** Status of operation that was performed */
785 /** Mempool which op instance is in */
786 struct rte_mempool *mempool;
787 /** Opaque pointer for user data */
790 /** Contains turbo decoder specific parameters */
791 struct rte_bbdev_op_turbo_dec turbo_dec;
792 /** Contains LDPC decoder specific parameters */
793 struct rte_bbdev_op_ldpc_dec ldpc_dec;
797 /** Operation capabilities supported by a device */
798 struct rte_bbdev_op_cap {
799 enum rte_bbdev_op_type type; /**< Type of operation */
801 struct rte_bbdev_op_cap_turbo_dec turbo_dec;
802 struct rte_bbdev_op_cap_turbo_enc turbo_enc;
803 struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
804 struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
805 } cap; /**< Operation-type specific capabilities */
808 /** @internal Private data structure stored with operation pool. */
809 struct rte_bbdev_op_pool_private {
810 enum rte_bbdev_op_type type; /**< Type of operations in a pool */
814 * Converts queue operation type from enum to string
817 * Operation type as enum
820 * Operation type as string or NULL if op_type is invalid
825 rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type);
828 * Creates a bbdev operation mempool
833 * Operation type, use RTE_BBDEV_OP_NONE for a pool which supports all
835 * @param num_elements
836 * Number of elements in the pool.
838 * Number of elements to cache on an lcore, see rte_mempool_create() for
839 * further details about cache size.
841 * Socket to allocate memory on.
844 * - Pointer to a mempool on success,
845 * - NULL pointer on failure.
849 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
850 unsigned int num_elements, unsigned int cache_size,
854 * Bulk allocate encode operations from a mempool with parameter defaults reset.
857 * Operation mempool, created by rte_bbdev_op_pool_create().
859 * Output array to place allocated operations
861 * Number of operations to allocate
865 * - EINVAL if invalid mempool is provided
869 rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool,
870 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
872 struct rte_bbdev_op_pool_private *priv;
876 priv = (struct rte_bbdev_op_pool_private *)
877 rte_mempool_get_priv(mempool);
878 if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
879 (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
883 ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
884 if (unlikely(ret < 0))
891 * Bulk allocate decode operations from a mempool with parameter defaults reset.
894 * Operation mempool, created by rte_bbdev_op_pool_create().
896 * Output array to place allocated operations
898 * Number of operations to allocate
902 * - EINVAL if invalid mempool is provided
906 rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool,
907 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
909 struct rte_bbdev_op_pool_private *priv;
913 priv = (struct rte_bbdev_op_pool_private *)
914 rte_mempool_get_priv(mempool);
915 if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
916 (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
920 ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
921 if (unlikely(ret < 0))
928 * Free decode operation structures that were allocated by
929 * rte_bbdev_dec_op_alloc_bulk().
930 * All structures must belong to the same mempool.
933 * Operation structures
935 * Number of structures
939 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
942 rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
946 * Free encode operation structures that were allocated by
947 * rte_bbdev_enc_op_alloc_bulk().
948 * All structures must belong to the same mempool.
951 * Operation structures
953 * Number of structures
957 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
960 rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
967 #endif /* _RTE_BBDEV_OP_H_ */