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)
121 /** Flags for turbo encoder operation and capability structure */
122 enum rte_bbdev_op_te_flag_bitmasks {
123 /** Ignore rv_index and set K0 = 0 */
124 RTE_BBDEV_TURBO_RV_INDEX_BYPASS = (1ULL << 0),
125 /** If rate matching is to be performed */
126 RTE_BBDEV_TURBO_RATE_MATCH = (1ULL << 1),
127 /** This bit must be set to enable CRC-24B generation */
128 RTE_BBDEV_TURBO_CRC_24B_ATTACH = (1ULL << 2),
129 /** This bit must be set to enable CRC-24A generation */
130 RTE_BBDEV_TURBO_CRC_24A_ATTACH = (1ULL << 3),
131 /** Set if a device supports encoder dequeue interrupts */
132 RTE_BBDEV_TURBO_ENC_INTERRUPTS = (1ULL << 4),
133 /** Set if a device supports scatter-gather functionality */
134 RTE_BBDEV_TURBO_ENC_SCATTER_GATHER = (1ULL << 5)
137 /** Flags for LDPC decoder operation and capability structure */
138 enum rte_bbdev_op_ldpcdec_flag_bitmasks {
139 /** Set for transport block CRC-24A checking */
140 RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK = (1ULL << 0),
141 /** Set for code block CRC-24B checking */
142 RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK = (1ULL << 1),
143 /** Set to drop the last CRC bits decoding output */
144 RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP = (1ULL << 2),
145 /** Set for bit-level de-interleaver bypass on Rx stream. */
146 RTE_BBDEV_LDPC_DEINTERLEAVER_BYPASS = (1ULL << 3),
147 /** Set for HARQ combined input stream enable. */
148 RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE = (1ULL << 4),
149 /** Set for HARQ combined output stream enable. */
150 RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE = (1ULL << 5),
151 /** Set for LDPC decoder bypass.
152 * RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE must be set.
154 RTE_BBDEV_LDPC_DECODE_BYPASS = (1ULL << 6),
155 /** Set for soft-output stream enable */
156 RTE_BBDEV_LDPC_SOFT_OUT_ENABLE = (1ULL << 7),
157 /** Set for Rate-Matching bypass on soft-out stream. */
158 RTE_BBDEV_LDPC_SOFT_OUT_RM_BYPASS = (1ULL << 8),
159 /** Set for bit-level de-interleaver bypass on soft-output stream. */
160 RTE_BBDEV_LDPC_SOFT_OUT_DEINTERLEAVER_BYPASS = (1ULL << 9),
161 /** Set for iteration stopping on successful decode condition
162 * i.e. a successful syndrome check.
164 RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE = (1ULL << 10),
165 /** Set if a device supports decoder dequeue interrupts. */
166 RTE_BBDEV_LDPC_DEC_INTERRUPTS = (1ULL << 11),
167 /** Set if a device supports scatter-gather functionality. */
168 RTE_BBDEV_LDPC_DEC_SCATTER_GATHER = (1ULL << 12),
169 /** Set if a device supports input/output HARQ compression. */
170 RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION = (1ULL << 13),
171 /** Set if a device supports input LLR compression. */
172 RTE_BBDEV_LDPC_LLR_COMPRESSION = (1ULL << 14),
173 /** Set if a device supports HARQ input from
174 * device's internal memory.
176 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_IN_ENABLE = (1ULL << 15),
177 /** Set if a device supports HARQ output to
178 * device's internal memory.
180 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_OUT_ENABLE = (1ULL << 16),
181 /** Set if a device supports loop-back access to
182 * HARQ internal memory. Intended for troubleshooting.
184 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_LOOPBACK = (1ULL << 17),
185 /** Set if a device includes LLR filler bits in the circular buffer
186 * for HARQ memory. If not set, it is assumed the filler bits are not
187 * in HARQ memory and handled directly by the LDPC decoder.
189 RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS = (1ULL << 18)
192 /** Flags for LDPC encoder operation and capability structure */
193 enum rte_bbdev_op_ldpcenc_flag_bitmasks {
194 /** Set for bit-level interleaver bypass on output stream. */
195 RTE_BBDEV_LDPC_INTERLEAVER_BYPASS = (1ULL << 0),
196 /** If rate matching is to be performed */
197 RTE_BBDEV_LDPC_RATE_MATCH = (1ULL << 1),
198 /** Set for transport block CRC-24A attach */
199 RTE_BBDEV_LDPC_CRC_24A_ATTACH = (1ULL << 2),
200 /** Set for code block CRC-24B attach */
201 RTE_BBDEV_LDPC_CRC_24B_ATTACH = (1ULL << 3),
202 /** Set for code block CRC-16 attach */
203 RTE_BBDEV_LDPC_CRC_16_ATTACH = (1ULL << 4),
204 /** Set if a device supports encoder dequeue interrupts. */
205 RTE_BBDEV_LDPC_ENC_INTERRUPTS = (1ULL << 5),
206 /** Set if a device supports scatter-gather functionality. */
207 RTE_BBDEV_LDPC_ENC_SCATTER_GATHER = (1ULL << 6),
208 /** Set if a device supports concatenation of non byte aligned output */
209 RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)
212 /** Flags for the Code Block/Transport block mode */
213 enum rte_bbdev_op_cb_mode {
214 /** One operation is one or fraction of one transport block */
215 RTE_BBDEV_TRANSPORT_BLOCK = 0,
216 /** One operation is one code block mode */
217 RTE_BBDEV_CODE_BLOCK = 1,
220 /** Data input and output buffer for BBDEV operations */
221 struct rte_bbdev_op_data {
222 /** The mbuf data structure representing the data for BBDEV operation.
224 * This mbuf pointer can point to one Code Block (CB) data buffer or
225 * multiple CBs contiguously located next to each other.
226 * A Transport Block (TB) represents a whole piece of data that is
227 * divided into one or more CBs. Maximum number of CBs can be contained
228 * in one TB is defined by RTE_BBDEV_(TURBO/LDPC)_MAX_CODE_BLOCKS.
230 * An mbuf data structure cannot represent more than one TB. The
231 * smallest piece of data that can be contained in one mbuf is one CB.
232 * An mbuf can include one contiguous CB, subset of contiguous CBs that
233 * are belonging to one TB, or all contiguous CBs that are belonging to
236 * If a BBDEV PMD supports the extended capability "Scatter-Gather",
237 * then it is capable of collecting (gathering) non-contiguous
238 * (scattered) data from multiple locations in the memory.
239 * This capability is reported by the capability flags:
240 * - RTE_BBDEV_(TURBO/LDPC)_ENC_SCATTER_GATHER and
241 * - RTE_BBDEV_(TURBO/LDPC)_DEC_SCATTER_GATHER.
242 * Only if a BBDEV PMD supports this feature, chained mbuf data
243 * structures are accepted. A chained mbuf can represent one
244 * non-contiguous CB or multiple non-contiguous CBs.
245 * If BBDEV PMD does not support this feature, it will assume inbound
246 * mbuf data contains one segment.
248 * The output mbuf data though is always one segment, even if the input
249 * was a chained mbuf.
251 struct rte_mbuf *data;
252 /** The starting point of the BBDEV (encode/decode) operation,
255 * BBDEV starts to read data past this offset.
256 * In case of chained mbuf, this offset applies only to the first mbuf
260 /** The total data length to be processed in one operation, in bytes.
262 * In case the mbuf data is representing one CB, this is the length of
263 * the CB undergoing the operation.
264 * If it's for multiple CBs, this is the total length of those CBs
265 * undergoing the operation.
266 * If it is for one TB, this is the total length of the TB under
269 * In case of chained mbuf, this data length includes the lengths of the
270 * "scattered" data segments undergoing the operation.
275 /** Turbo decode code block parameters */
276 struct rte_bbdev_op_dec_turbo_cb_params {
277 /** The K size of the input CB, in bits [40:6144], as specified in
279 * This size is inclusive of CRC bits, regardless whether it was
280 * pre-calculated by the application or not.
283 /** The E length of the CB rate matched LLR output, in bytes, as in
289 /** LDPC decode code block parameters */
290 struct rte_bbdev_op_dec_ldpc_cb_params {
291 /** Rate matching output sequence length in bits or LLRs.
292 * [3GPP TS38.212, section 5.4.2.1]
297 /** Turbo decode transport block parameters */
298 struct rte_bbdev_op_dec_turbo_tb_params {
299 /** The K- size of the input CB, in bits [40:6144], that is in the
300 * Turbo operation when r < C-, as in 3GPP TS 36.212.
303 /** The K+ size of the input CB, in bits [40:6144], that is in the
304 * Turbo operation when r >= C-, as in 3GPP TS 36.212.
307 /** The number of CBs that have K- size, [0:63] */
309 /** The total number of CBs in the TB,
310 * [1:RTE_BBDEV_TURBO_MAX_CODE_BLOCKS]
313 /** The number of CBs that uses Ea before switching to Eb, [0:63] */
315 /** The E size of the CB rate matched output to use in the Turbo
316 * operation when r < cab
319 /** The E size of the CB rate matched output to use in the Turbo
320 * operation when r >= cab
323 /** The index of the first CB in the inbound mbuf data, default is 0 */
327 /** LDPC decode transport block parameters */
328 struct rte_bbdev_op_dec_ldpc_tb_params {
329 /** Ea, length after rate matching in bits, r < cab.
330 * [3GPP TS38.212, section 5.4.2.1]
333 /** Eb, length after rate matching in bits, r >= cab.
334 * [3GPP TS38.212, section 5.4.2.1]
337 /** The total number of CBs in the TB or partial TB
338 * [1:RTE_BBDEV_LDPC_MAX_CODE_BLOCKS]
341 /** The index of the first CB in the inbound mbuf data, default is 0 */
343 /** The number of CBs that use Ea before switching to Eb, [0:63] */
347 /** Operation structure for Turbo decode.
348 * An operation can be performed on one CB at a time "CB-mode".
349 * An operation can be performed on one or multiple CBs that logically
350 * belong to one TB "TB-mode".
351 * The provided K size parameter of the CB is its size coming from the
353 * CRC24A/B check is requested by the application by setting the flag
354 * RTE_BBDEV_TURBO_CRC_TYPE_24B for CRC24B check or CRC24A otherwise.
355 * In TB-mode, BBDEV concatenates the decoded CBs one next to the other with
356 * relevant CRC24B in between.
358 * The input encoded CB data is the Virtual Circular Buffer data stream, wk,
359 * with the null padding included as described in 3GPP TS 36.212
360 * section 5.1.4.1.2 and shown in 3GPP TS 36.212 section 5.1.4.1 Figure 5.1.4-1.
361 * The size of the virtual circular buffer is 3*Kpi, where Kpi is the 32 byte
362 * aligned value of K, as specified in 3GPP TS 36.212 section 5.1.4.1.1.
364 * Each byte in the input circular buffer is the LLR value of each bit of the
367 * Hard output is a mandatory capability that all BBDEV PMDs support. This is
368 * the decoded CBs of K sizes (CRC24A/B is the last 24-bit in each decoded CB).
369 * Soft output is an optional capability for BBDEV PMDs. If supported, an LLR
370 * rate matched output is computed in the soft_output buffer structure.
372 * The output mbuf data structure is expected to be allocated by the
373 * application with enough room for the output data.
375 struct rte_bbdev_op_turbo_dec {
376 /** The Virtual Circular Buffer, wk, size 3*Kpi for each CB */
377 struct rte_bbdev_op_data input;
378 /** The hard decisions buffer for the decoded output,
381 struct rte_bbdev_op_data hard_output;
382 /** The soft LLR output buffer - optional */
383 struct rte_bbdev_op_data soft_output;
385 /** Flags from rte_bbdev_op_td_flag_bitmasks */
388 /** Rv index for rate matching [0:3] */
390 /** The minimum number of iterations to perform in decoding all CBs in
391 * this operation - input
394 /** The maximum number of iterations to perform in decoding all CBs in
395 * this operation - input
398 /** The maximum number of iterations that were performed in decoding
399 * all CBs in this decode operation - output
402 /** 5 bit extrinsic scale (scale factor on extrinsic info) */
404 /** Number of MAP engines to use in decode,
405 * must be power of 2 (or 0 to auto-select)
409 /** [0 - TB : 1 - CB] */
410 uint8_t code_block_mode;
412 /** Struct which stores Code Block specific parameters */
413 struct rte_bbdev_op_dec_turbo_cb_params cb_params;
414 /** Struct which stores Transport Block specific parameters */
415 struct rte_bbdev_op_dec_turbo_tb_params tb_params;
419 /** Operation structure for LDPC decode.
421 * An operation can be performed on one CB at a time "CB-mode".
422 * An operation can also be performed on one or multiple CBs that logically
423 * belong to a TB "TB-mode" (Currently not supported).
425 * The input encoded CB data is the Virtual Circular Buffer data stream.
427 * Each byte in the input circular buffer is the LLR value of each bit of the
430 * Hard output is a mandatory capability that all BBDEV PMDs support. This is
431 * the decoded CBs (CRC24A/B is the last 24-bit in each decoded CB).
433 * Soft output is an optional capability for BBDEV PMDs. If supported, an LLR
434 * rate matched output is computed in the soft_output buffer structure.
435 * These are A Posteriori Probabilities (APP) LLR samples for coded bits.
437 * HARQ combined output is an optional capability for BBDEV PMDs.
438 * If supported, a LLR output is streamed to the harq_combined_output
441 * HARQ combined input is an optional capability for BBDEV PMDs.
442 * If supported, a LLR input is streamed from the harq_combined_input
445 * The output mbuf data structure is expected to be allocated by the
446 * application with enough room for the output data.
448 struct rte_bbdev_op_ldpc_dec {
449 /** The Virtual Circular Buffer for this code block, one LLR
450 * per bit of the original CB.
452 struct rte_bbdev_op_data input;
453 /** The hard decisions buffer for the decoded output,
456 struct rte_bbdev_op_data hard_output;
457 /** The soft LLR output LLR stream buffer - optional */
458 struct rte_bbdev_op_data soft_output;
459 /** The HARQ combined LLR stream input buffer - optional */
460 struct rte_bbdev_op_data harq_combined_input;
461 /** The HARQ combined LLR stream output buffer - optional */
462 struct rte_bbdev_op_data harq_combined_output;
464 /** Flags from rte_bbdev_op_ldpcdec_flag_bitmasks */
467 /** Rate matching redundancy version
468 * [3GPP TS38.212, section 5.4.2.1]
471 /** The maximum number of iterations to perform in decoding CB in
472 * this operation - input
475 /** The number of iterations that were performed in decoding
476 * CB in this decode operation - output
479 /** 1: LDPC Base graph 1, 2: LDPC Base graph 2.
480 * [3GPP TS38.212, section 5.2.2]
483 /** Zc, LDPC lifting size.
484 * [3GPP TS38.212, section 5.2.2]
487 /** Ncb, length of the circular buffer in bits.
488 * [3GPP TS38.212, section 5.4.2.1]
491 /** Qm, modulation order {1,2,4,6,8}.
492 * [3GPP TS38.212, section 5.4.2.2]
495 /** Number of Filler bits, n_filler = K – K’
496 * [3GPP TS38.212 section 5.2.2]
499 /** [0 - TB : 1 - CB] */
500 uint8_t code_block_mode;
502 /** Struct which stores Code Block specific parameters */
503 struct rte_bbdev_op_dec_ldpc_cb_params cb_params;
504 /** Struct which stores Transport Block specific parameters */
505 struct rte_bbdev_op_dec_ldpc_tb_params tb_params;
509 /** Turbo encode code block parameters */
510 struct rte_bbdev_op_enc_turbo_cb_params {
511 /** The K size of the input CB, in bits [40:6144], as specified in
513 * This size is inclusive of CRC24A, regardless whether it was
514 * pre-calculated by the application or not.
517 /** The E length of the CB rate matched output, in bits, as in
521 /** The Ncb soft buffer size of the CB rate matched output [K:3*Kpi],
522 * in bits, as specified in 3GPP TS 36.212.
527 /** Turbo encode transport block parameters */
528 struct rte_bbdev_op_enc_turbo_tb_params {
529 /** The K- size of the input CB, in bits [40:6144], that is in the
530 * Turbo operation when r < C-, as in 3GPP TS 36.212.
531 * This size is inclusive of CRC24B, regardless whether it was
532 * pre-calculated and appended by the application or not.
535 /** The K+ size of the input CB, in bits [40:6144], that is in the
536 * Turbo operation when r >= C-, as in 3GPP TS 36.212.
537 * This size is inclusive of CRC24B, regardless whether it was
538 * pre-calculated and appended by the application or not.
541 /** The number of CBs that have K- size, [0:63] */
543 /** The total number of CBs in the TB,
544 * [1:RTE_BBDEV_TURBO_MAX_CODE_BLOCKS]
547 /** The number of CBs that uses Ea before switching to Eb, [0:63] */
549 /** The E size of the CB rate matched output to use in the Turbo
550 * operation when r < cab
553 /** The E size of the CB rate matched output to use in the Turbo
554 * operation when r >= cab
557 /** The Ncb soft buffer size for the rate matched CB that is used in
558 * the Turbo operation when r < C-, [K:3*Kpi]
561 /** The Ncb soft buffer size for the rate matched CB that is used in
562 * the Turbo operation when r >= C-, [K:3*Kpi]
565 /** The index of the first CB in the inbound mbuf data, default is 0 */
569 /** LDPC encode code block parameters */
570 struct rte_bbdev_op_enc_ldpc_cb_params {
571 /** E, length after rate matching in bits.
572 * [3GPP TS38.212, section 5.4.2.1]
577 /** LDPC encode transport block parameters */
578 struct rte_bbdev_op_enc_ldpc_tb_params {
579 /** Ea, length after rate matching in bits, r < cab.
580 * [3GPP TS38.212, section 5.4.2.1]
583 /** Eb, length after rate matching in bits, r >= cab.
584 * [3GPP TS38.212, section 5.4.2.1]
587 /** The total number of CBs in the TB or partial TB
588 * [1:RTE_BBDEV_LDPC_MAX_CODE_BLOCKS]
591 /** The index of the first CB in the inbound mbuf data, default is 0 */
593 /** The number of CBs that use Ea before switching to Eb, [0:63] */
597 /** Operation structure for Turbo encode.
598 * An operation can be performed on one CB at a time "CB-mode".
599 * An operation can pbe erformd on one or multiple CBs that logically
600 * belong to one TB "TB-mode".
602 * In CB-mode, CRC24A/B is an optional operation. K size parameter is not
603 * affected by CRC24A/B inclusion, this only affects the inbound mbuf data
604 * length. Not all BBDEV PMDs are capable of CRC24A/B calculation. Flags
605 * RTE_BBDEV_TURBO_CRC_24A_ATTACH and RTE_BBDEV_TURBO_CRC_24B_ATTACH informs
606 * the application with relevant capability. These flags can be set in the
607 * op_flags parameter to indicate BBDEV to calculate and append CRC24A to CB
608 * before going forward with Turbo encoding.
610 * In TB-mode, CRC24A is assumed to be pre-calculated and appended to the
611 * inbound TB mbuf data buffer.
613 * The output mbuf data structure is expected to be allocated by the
614 * application with enough room for the output data.
616 struct rte_bbdev_op_turbo_enc {
617 /** The input CB or TB data */
618 struct rte_bbdev_op_data input;
619 /** The rate matched CB or TB output buffer */
620 struct rte_bbdev_op_data output;
621 /** Flags from rte_bbdev_op_te_flag_bitmasks */
624 /** Rv index for rate matching [0:3] */
626 /** [0 - TB : 1 - CB] */
627 uint8_t code_block_mode;
629 /** Struct which stores Code Block specific parameters */
630 struct rte_bbdev_op_enc_turbo_cb_params cb_params;
631 /** Struct which stores Transport Block specific parameters */
632 struct rte_bbdev_op_enc_turbo_tb_params tb_params;
636 /** Operation structure for LDPC encode.
637 * An operation can be performed on one CB at a time "CB-mode".
638 * An operation can be performed on one or multiple CBs that logically
639 * belong to a TB "TB-mode".
641 * The input data is the CB or TB input to the decoder.
643 * The output data is the ratematched CB or TB data, or the output after
644 * bit-selection if RTE_BBDEV_LDPC_INTERLEAVER_BYPASS is set.
646 * The output mbuf data structure is expected to be allocated by the
647 * application with enough room for the output data.
649 struct rte_bbdev_op_ldpc_enc {
650 /** The input TB or CB data */
651 struct rte_bbdev_op_data input;
652 /** The rate matched TB or CB output buffer */
653 struct rte_bbdev_op_data output;
655 /** Flags from rte_bbdev_op_ldpcenc_flag_bitmasks */
658 /** Rate matching redundancy version */
660 /** 1: LDPC Base graph 1, 2: LDPC Base graph 2.
661 * [3GPP TS38.212, section 5.2.2]
664 /** Zc, LDPC lifting size.
665 * [3GPP TS38.212, section 5.2.2]
668 /** Ncb, length of the circular buffer in bits.
669 * [3GPP TS38.212, section 5.4.2.1]
672 /** Qm, modulation order {2,4,6,8,10}.
673 * [3GPP TS38.212, section 5.4.2.2]
676 /** Number of Filler bits, n_filler = K – K’
677 * [3GPP TS38.212 section 5.2.2]
680 /** [0 - TB : 1 - CB] */
681 uint8_t code_block_mode;
683 /** Struct which stores Code Block specific parameters */
684 struct rte_bbdev_op_enc_ldpc_cb_params cb_params;
685 /** Struct which stores Transport Block specific parameters */
686 struct rte_bbdev_op_enc_ldpc_tb_params tb_params;
690 /** List of the capabilities for the Turbo Decoder */
691 struct rte_bbdev_op_cap_turbo_dec {
692 /** Flags from rte_bbdev_op_td_flag_bitmasks */
693 uint32_t capability_flags;
694 /** Maximal LLR absolute value. Acceptable LLR values lie in range
695 * [-max_llr_modulus, max_llr_modulus].
697 int8_t max_llr_modulus;
698 /** Num input code block buffers */
699 uint8_t num_buffers_src; /**< Num input code block buffers */
700 /** Num hard output code block buffers */
701 uint8_t num_buffers_hard_out;
702 /** Num soft output code block buffers if supported by the driver */
703 uint8_t num_buffers_soft_out;
706 /** List of the capabilities for the Turbo Encoder */
707 struct rte_bbdev_op_cap_turbo_enc {
708 /** Flags from rte_bbdev_op_te_flag_bitmasks */
709 uint32_t capability_flags;
710 /** Num input code block buffers */
711 uint8_t num_buffers_src;
712 /** Num output code block buffers */
713 uint8_t num_buffers_dst;
716 /** List of the capabilities for the LDPC Decoder */
717 struct rte_bbdev_op_cap_ldpc_dec {
718 /** Flags from rte_bbdev_op_ldpcdec_flag_bitmasks */
719 uint32_t capability_flags;
720 /** LLR size in bits. LLR is a two’s complement number. */
722 /** LLR numbers of decimals bit for arithmetic representation */
724 /** Num input code block buffers */
725 uint16_t num_buffers_src;
726 /** Num hard output code block buffers */
727 uint16_t num_buffers_hard_out;
728 /** Num soft output code block buffers if supported by the driver */
729 uint16_t num_buffers_soft_out;
732 /** List of the capabilities for the LDPC Encoder */
733 struct rte_bbdev_op_cap_ldpc_enc {
734 /** Flags from rte_bbdev_op_ldpcenc_flag_bitmasks */
735 uint32_t capability_flags;
736 /** Num input code block buffers */
737 uint16_t num_buffers_src;
738 /** Num output code block buffers */
739 uint16_t num_buffers_dst;
742 /** Different operation types supported by the device */
743 enum rte_bbdev_op_type {
744 RTE_BBDEV_OP_NONE, /**< Dummy operation that does nothing */
745 RTE_BBDEV_OP_TURBO_DEC, /**< Turbo decode */
746 RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */
747 RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */
748 RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */
749 RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */
752 /** Bit indexes of possible errors reported through status field */
755 RTE_BBDEV_DATA_ERROR,
757 RTE_BBDEV_SYNDROME_ERROR
760 /** Structure specifying a single encode operation */
761 struct rte_bbdev_enc_op {
762 /** Status of operation that was performed */
764 /** Mempool which op instance is in */
765 struct rte_mempool *mempool;
766 /** Opaque pointer for user data */
769 /** Contains turbo decoder specific parameters */
770 struct rte_bbdev_op_turbo_enc turbo_enc;
771 /** Contains LDPC decoder specific parameters */
772 struct rte_bbdev_op_ldpc_enc ldpc_enc;
776 /** Structure specifying a single decode operation */
777 struct rte_bbdev_dec_op {
778 /** Status of operation that was performed */
780 /** Mempool which op instance is in */
781 struct rte_mempool *mempool;
782 /** Opaque pointer for user data */
785 /** Contains turbo decoder specific parameters */
786 struct rte_bbdev_op_turbo_dec turbo_dec;
787 /** Contains LDPC decoder specific parameters */
788 struct rte_bbdev_op_ldpc_dec ldpc_dec;
792 /** Operation capabilities supported by a device */
793 struct rte_bbdev_op_cap {
794 enum rte_bbdev_op_type type; /**< Type of operation */
796 struct rte_bbdev_op_cap_turbo_dec turbo_dec;
797 struct rte_bbdev_op_cap_turbo_enc turbo_enc;
798 struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
799 struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
800 } cap; /**< Operation-type specific capabilities */
803 /** @internal Private data structure stored with operation pool. */
804 struct rte_bbdev_op_pool_private {
805 enum rte_bbdev_op_type type; /**< Type of operations in a pool */
809 * Converts queue operation type from enum to string
812 * Operation type as enum
815 * Operation type as string or NULL if op_type is invalid
820 rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type);
823 * Creates a bbdev operation mempool
828 * Operation type, use RTE_BBDEV_OP_NONE for a pool which supports all
830 * @param num_elements
831 * Number of elements in the pool.
833 * Number of elements to cache on an lcore, see rte_mempool_create() for
834 * further details about cache size.
836 * Socket to allocate memory on.
839 * - Pointer to a mempool on success,
840 * - NULL pointer on failure.
844 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
845 unsigned int num_elements, unsigned int cache_size,
849 * Bulk allocate encode operations from a mempool with parameter defaults reset.
852 * Operation mempool, created by rte_bbdev_op_pool_create().
854 * Output array to place allocated operations
856 * Number of operations to allocate
860 * - EINVAL if invalid mempool is provided
864 rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool,
865 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
867 struct rte_bbdev_op_pool_private *priv;
871 priv = (struct rte_bbdev_op_pool_private *)
872 rte_mempool_get_priv(mempool);
873 if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
874 (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
878 ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
879 if (unlikely(ret < 0))
886 * Bulk allocate decode operations from a mempool with parameter defaults reset.
889 * Operation mempool, created by rte_bbdev_op_pool_create().
891 * Output array to place allocated operations
893 * Number of operations to allocate
897 * - EINVAL if invalid mempool is provided
901 rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool,
902 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
904 struct rte_bbdev_op_pool_private *priv;
908 priv = (struct rte_bbdev_op_pool_private *)
909 rte_mempool_get_priv(mempool);
910 if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
911 (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
915 ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
916 if (unlikely(ret < 0))
923 * Free decode operation structures that were allocated by
924 * rte_bbdev_dec_op_alloc_bulk().
925 * All structures must belong to the same mempool.
928 * Operation structures
930 * Number of structures
934 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
937 rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
941 * Free encode operation structures that were allocated by
942 * rte_bbdev_enc_op_alloc_bulk().
943 * All structures must belong to the same mempool.
946 * Operation structures
948 * Number of structures
952 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
955 rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
962 #endif /* _RTE_BBDEV_OP_H_ */