DPDK  18.11.6
rte_bbdev_op.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4 
5 #ifndef _RTE_BBDEV_OP_H_
6 #define _RTE_BBDEV_OP_H_
7 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <stdint.h>
22 
23 #include <rte_common.h>
24 #include <rte_mbuf.h>
25 #include <rte_memory.h>
26 #include <rte_mempool.h>
27 
28 /* Number of columns in sub-block interleaver (36.212, section 5.1.4.1.1) */
29 #define RTE_BBDEV_C_SUBBLOCK (32)
30 /* Maximum size of Transport Block (36.213, Table, Table 7.1.7.2.5-1) */
31 #define RTE_BBDEV_MAX_TB_SIZE (391656)
32 /* Maximum size of Code Block (36.212, Table 5.1.3-3) */
33 #define RTE_BBDEV_MAX_CB_SIZE (6144)
34 /* Minimum size of Code Block (36.212, Table 5.1.3-3) */
35 #define RTE_BBDEV_MIN_CB_SIZE (40)
36 /* Maximum size of circular buffer */
37 #define RTE_BBDEV_MAX_KW (18528)
38 /*
39  * Maximum number of Code Blocks in Transport Block. It is calculated based on
40  * maximum size of one Code Block and one Transport Block (considering CRC24A
41  * and CRC24B):
42  * (391656 + 24) / (6144 - 24) = 64
43  */
44 #define RTE_BBDEV_MAX_CODE_BLOCKS (64)
45 
103  RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
109  RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP = (1ULL << 16)
110 };
111 
125  RTE_BBDEV_TURBO_ENC_SCATTER_GATHER = (1ULL << 5)
126 };
127 
129 struct rte_bbdev_op_data {
159  struct rte_mbuf *data;
167  uint32_t offset;
180  uint32_t length;
181 };
182 
183 struct rte_bbdev_op_dec_cb_params {
189  uint16_t k;
193  uint32_t e;
194 };
195 
196 struct rte_bbdev_op_dec_tb_params {
200  uint16_t k_neg;
204  uint16_t k_pos;
206  uint8_t c_neg;
208  uint8_t c;
210  uint8_t cab;
214  uint32_t ea;
218  uint32_t eb;
219 };
220 
249 struct rte_bbdev_op_turbo_dec {
251  struct rte_bbdev_op_data input;
255  struct rte_bbdev_op_data hard_output;
257  struct rte_bbdev_op_data soft_output;
258 
259  uint32_t op_flags;
260  uint8_t rv_index;
264  uint8_t iter_min:4;
268  uint8_t iter_max:4;
272  uint8_t iter_count;
274  uint8_t ext_scale;
278  uint8_t num_maps;
279 
280  uint8_t code_block_mode;
281  union {
283  struct rte_bbdev_op_dec_cb_params cb_params;
285  struct rte_bbdev_op_dec_tb_params tb_params;
286  };
287 };
288 
289 struct rte_bbdev_op_enc_cb_params {
295  uint16_t k;
299  uint32_t e;
303  uint16_t ncb;
304 };
305 
306 struct rte_bbdev_op_enc_tb_params {
312  uint16_t k_neg;
318  uint16_t k_pos;
320  uint8_t c_neg;
322  uint8_t c;
324  uint8_t cab;
328  uint32_t ea;
332  uint32_t eb;
336  uint16_t ncb_neg;
340  uint16_t ncb_pos;
342  uint8_t r;
343 };
344 
364 struct rte_bbdev_op_turbo_enc {
366  struct rte_bbdev_op_data input;
368  struct rte_bbdev_op_data output;
369 
370  uint32_t op_flags;
371  uint8_t rv_index;
373  uint8_t code_block_mode;
374  union {
376  struct rte_bbdev_op_enc_cb_params cb_params;
378  struct rte_bbdev_op_enc_tb_params tb_params;
379  };
380 };
381 
383 struct rte_bbdev_op_cap_turbo_dec {
385  uint32_t capability_flags;
389  int8_t max_llr_modulus;
390  uint8_t num_buffers_src;
392  uint8_t num_buffers_hard_out;
394  uint8_t num_buffers_soft_out;
395 };
396 
398 struct rte_bbdev_op_cap_turbo_enc {
400  uint32_t capability_flags;
401  uint8_t num_buffers_src;
402  uint8_t num_buffers_dst;
403 };
404 
411 };
412 
414 enum {
415  RTE_BBDEV_DRV_ERROR,
416  RTE_BBDEV_DATA_ERROR,
417  RTE_BBDEV_CRC_ERROR,
418 };
419 
421 struct rte_bbdev_enc_op {
422  int status;
423  struct rte_mempool *mempool;
424  void *opaque_data;
426  struct rte_bbdev_op_turbo_enc turbo_enc;
427 };
428 
430 struct rte_bbdev_dec_op {
431  int status;
432  struct rte_mempool *mempool;
433  void *opaque_data;
435  struct rte_bbdev_op_turbo_dec turbo_dec;
436 };
437 
439 struct rte_bbdev_op_cap {
440  enum rte_bbdev_op_type type;
441  union {
442  struct rte_bbdev_op_cap_turbo_dec turbo_dec;
443  struct rte_bbdev_op_cap_turbo_enc turbo_enc;
444  } cap;
445 };
446 
448 struct rte_bbdev_op_pool_private {
449  enum rte_bbdev_op_type type;
450 };
451 
462 const char*
464 
485 struct rte_mempool *
486 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
487  unsigned int num_elements, unsigned int cache_size,
488  int socket_id);
489 
504 static inline int
506  struct rte_bbdev_enc_op **ops, uint16_t num_ops)
507 {
508  struct rte_bbdev_op_pool_private *priv;
509  int ret;
510 
511  /* Check type */
512  priv = (struct rte_bbdev_op_pool_private *)
513  rte_mempool_get_priv(mempool);
514  if (unlikely(priv->type != RTE_BBDEV_OP_TURBO_ENC))
515  return -EINVAL;
516 
517  /* Get elements */
518  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
519  if (unlikely(ret < 0))
520  return ret;
521 
522  return 0;
523 }
524 
539 static inline int
541  struct rte_bbdev_dec_op **ops, uint16_t num_ops)
542 {
543  struct rte_bbdev_op_pool_private *priv;
544  int ret;
545 
546  /* Check type */
547  priv = (struct rte_bbdev_op_pool_private *)
548  rte_mempool_get_priv(mempool);
549  if (unlikely(priv->type != RTE_BBDEV_OP_TURBO_DEC))
550  return -EINVAL;
551 
552  /* Get elements */
553  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
554  if (unlikely(ret < 0))
555  return ret;
556 
557  return 0;
558 }
559 
570 static inline void
571 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
572 {
573  if (num_ops > 0)
574  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
575 }
576 
587 static inline void
588 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
589 {
590  if (num_ops > 0)
591  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
592 }
593 
594 #ifdef __cplusplus
595 }
596 #endif
597 
598 #endif /* _RTE_BBDEV_OP_H_ */
rte_bbdev_dec_op_free_bulk
static void rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
Definition: rte_bbdev_op.h:571
RTE_BBDEV_TURBO_SOFT_OUT_SATURATE
@ RTE_BBDEV_TURBO_SOFT_OUT_SATURATE
Definition: rte_bbdev_op.h:55
RTE_BBDEV_TURBO_CRC_24B_ATTACH
@ RTE_BBDEV_TURBO_CRC_24B_ATTACH
Definition: rte_bbdev_op.h:119
RTE_BBDEV_OP_NONE
@ RTE_BBDEV_OP_NONE
Definition: rte_bbdev_op.h:407
RTE_BBDEV_TURBO_POS_LLR_1_BIT_SOFT_OUT
@ RTE_BBDEV_TURBO_POS_LLR_1_BIT_SOFT_OUT
Definition: rte_bbdev_op.h:91
rte_mempool_get_priv
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1637
rte_memory.h
unlikely
#define unlikely(x)
Definition: rte_branch_prediction.h:38
RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE
@ RTE_BBDEV_TURBO_SUBBLOCK_DEINTERLEAVE
Definition: rte_bbdev_op.h:49
RTE_BBDEV_OP_TURBO_DEC
@ RTE_BBDEV_OP_TURBO_DEC
Definition: rte_bbdev_op.h:408
rte_mempool::name
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_mempool.h:219
rte_bbdev_dec_op_alloc_bulk
static int rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_dec_op **ops, uint16_t num_ops)
Definition: rte_bbdev_op.h:540
RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT
@ RTE_BBDEV_TURBO_NEG_LLR_1_BIT_SOFT_OUT
Definition: rte_bbdev_op.h:99
RTE_BBDEV_OP_TYPE_COUNT
@ RTE_BBDEV_OP_TYPE_COUNT
Definition: rte_bbdev_op.h:410
RTE_BBDEV_TURBO_MAP_DEC
@ RTE_BBDEV_TURBO_MAP_DEC
Definition: rte_bbdev_op.h:103
RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN
@ RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN
Definition: rte_bbdev_op.h:76
rte_bbdev_op_te_flag_bitmasks
rte_bbdev_op_te_flag_bitmasks
Definition: rte_bbdev_op.h:113
rte_mbuf
Definition: rte_mbuf.h:478
RTE_BBDEV_TURBO_ENC_INTERRUPTS
@ RTE_BBDEV_TURBO_ENC_INTERRUPTS
Definition: rte_bbdev_op.h:123
rte_bbdev_op_type
rte_bbdev_op_type
Definition: rte_bbdev_op.h:406
rte_bbdev_enc_op_free_bulk
static void rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
Definition: rte_bbdev_op.h:588
RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN
@ RTE_BBDEV_TURBO_NEG_LLR_1_BIT_IN
Definition: rte_bbdev_op.h:83
rte_common.h
RTE_BBDEV_TURBO_EQUALIZER
@ RTE_BBDEV_TURBO_EQUALIZER
Definition: rte_bbdev_op.h:53
RTE_BBDEV_TURBO_EARLY_TERMINATION
@ RTE_BBDEV_TURBO_EARLY_TERMINATION
Definition: rte_bbdev_op.h:67
RTE_BBDEV_TURBO_DEC_SCATTER_GATHER
@ RTE_BBDEV_TURBO_DEC_SCATTER_GATHER
Definition: rte_bbdev_op.h:105
RTE_BBDEV_TURBO_SOFT_OUTPUT
@ RTE_BBDEV_TURBO_SOFT_OUTPUT
Definition: rte_bbdev_op.h:65
rte_bbdev_enc_op_alloc_bulk
static int rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_enc_op **ops, uint16_t num_ops)
Definition: rte_bbdev_op.h:505
rte_mempool
Definition: rte_mempool.h:213
RTE_BBDEV_TURBO_CRC_24A_ATTACH
@ RTE_BBDEV_TURBO_CRC_24A_ATTACH
Definition: rte_bbdev_op.h:121
rte_mempool_get_bulk
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1455
rte_bbdev_op_type_str
const char * rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
RTE_BBDEV_TURBO_CONTINUE_CRC_MATCH
@ RTE_BBDEV_TURBO_CONTINUE_CRC_MATCH
Definition: rte_bbdev_op.h:63
rte_mempool.h
RTE_BBDEV_TURBO_RV_INDEX_BYPASS
@ RTE_BBDEV_TURBO_RV_INDEX_BYPASS
Definition: rte_bbdev_op.h:115
rte_mempool_put_bulk
static __rte_always_inline void rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, unsigned int n)
Definition: rte_mempool.h:1303
rte_bbdev_op_td_flag_bitmasks
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:47
rte_mbuf.h
rte_bbdev_op_pool_create
struct rte_mempool * rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type, unsigned int num_elements, unsigned int cache_size, int socket_id)
RTE_BBDEV_OP_TURBO_ENC
@ RTE_BBDEV_OP_TURBO_ENC
Definition: rte_bbdev_op.h:409
rte_mempool::cache_size
uint32_t cache_size
Definition: rte_mempool.h:230
RTE_BBDEV_TURBO_HALF_ITERATION_EVEN
@ RTE_BBDEV_TURBO_HALF_ITERATION_EVEN
Definition: rte_bbdev_op.h:59
RTE_BBDEV_TURBO_DEC_INTERRUPTS
@ RTE_BBDEV_TURBO_DEC_INTERRUPTS
Definition: rte_bbdev_op.h:69
rte_mempool::socket_id
int socket_id
Definition: rte_mempool.h:228
RTE_BBDEV_TURBO_RATE_MATCH
@ RTE_BBDEV_TURBO_RATE_MATCH
Definition: rte_bbdev_op.h:117
RTE_BBDEV_TURBO_CRC_TYPE_24B
@ RTE_BBDEV_TURBO_CRC_TYPE_24B
Definition: rte_bbdev_op.h:51