DPDK  21.08.0
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_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)
44 /*
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
49  */
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)
53 
111  RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
118 };
119 
120 
135 };
136 
190 };
191 
210 };
211 
218 };
219 
251  struct rte_mbuf *data;
259  uint32_t offset;
272  uint32_t length;
273 };
274 
282  uint16_t k;
286  uint32_t e;
287 };
288 
294  uint32_t e;
295 };
296 
302  uint16_t k_neg;
306  uint16_t k_pos;
308  uint8_t c_neg;
312  uint8_t c;
314  uint8_t cab;
318  uint32_t ea;
322  uint32_t eb;
324  uint8_t r;
325 };
326 
332  uint32_t ea;
336  uint32_t eb;
340  uint8_t c;
342  uint8_t r;
344  uint8_t cab;
345 };
346 
377  struct rte_bbdev_op_data input;
381  struct rte_bbdev_op_data hard_output;
383  struct rte_bbdev_op_data soft_output;
384 
386  uint32_t op_flags;
387 
389  uint8_t rv_index;
393  uint8_t iter_min:4;
397  uint8_t iter_max:4;
401  uint8_t iter_count;
403  uint8_t ext_scale;
407  uint8_t num_maps;
408 
411  union {
416  };
417 };
418 
452  struct rte_bbdev_op_data input;
456  struct rte_bbdev_op_data hard_output;
458  struct rte_bbdev_op_data soft_output;
460  struct rte_bbdev_op_data harq_combined_input;
462  struct rte_bbdev_op_data harq_combined_output;
463 
465  uint32_t op_flags;
466 
470  uint8_t rv_index;
474  uint8_t iter_max;
478  uint8_t iter_count;
482  uint8_t basegraph;
486  uint16_t z_c;
490  uint16_t n_cb;
494  uint8_t q_m;
498  uint16_t n_filler;
501  union {
506  };
507 };
508 
516  uint16_t k;
520  uint32_t e;
524  uint16_t ncb;
525 };
526 
534  uint16_t k_neg;
540  uint16_t k_pos;
542  uint8_t c_neg;
546  uint8_t c;
548  uint8_t cab;
552  uint32_t ea;
556  uint32_t eb;
560  uint16_t ncb_neg;
564  uint16_t ncb_pos;
566  uint8_t r;
567 };
568 
574  uint32_t e;
575 };
576 
582  uint32_t ea;
586  uint32_t eb;
590  uint8_t c;
592  uint8_t r;
594  uint8_t cab;
595 };
596 
618  struct rte_bbdev_op_data input;
620  struct rte_bbdev_op_data output;
622  uint32_t op_flags;
623 
625  uint8_t rv_index;
628  union {
633  };
634 };
635 
651  struct rte_bbdev_op_data input;
653  struct rte_bbdev_op_data output;
654 
656  uint32_t op_flags;
657 
659  uint8_t rv_index;
663  uint8_t basegraph;
667  uint16_t z_c;
671  uint16_t n_cb;
675  uint8_t q_m;
679  uint16_t n_filler;
682  union {
687  };
688 };
689 
699  uint8_t num_buffers_src;
704 };
705 
714 };
715 
721  int8_t llr_size;
723  int8_t llr_decimals;
725  uint16_t num_buffers_src;
730 };
731 
737  uint16_t num_buffers_src;
739  uint16_t num_buffers_dst;
740 };
741 
750 };
751 
753 enum {
754  RTE_BBDEV_DRV_ERROR,
755  RTE_BBDEV_DATA_ERROR,
756  RTE_BBDEV_CRC_ERROR,
757  RTE_BBDEV_SYNDROME_ERROR
758 };
759 
763  int status;
767  void *opaque_data;
768  union {
770  struct rte_bbdev_op_turbo_enc turbo_enc;
772  struct rte_bbdev_op_ldpc_enc ldpc_enc;
773  };
774 };
775 
779  int status;
783  void *opaque_data;
784  union {
786  struct rte_bbdev_op_turbo_dec turbo_dec;
788  struct rte_bbdev_op_ldpc_dec ldpc_dec;
789  };
790 };
791 
794  enum rte_bbdev_op_type type;
795  union {
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;
801 };
802 
804 struct rte_bbdev_op_pool_private {
805  enum rte_bbdev_op_type type;
806 };
807 
818 __rte_experimental
819 const char*
821 
842 __rte_experimental
843 struct rte_mempool *
844 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
845  unsigned int num_elements, unsigned int cache_size,
846  int socket_id);
847 
862 __rte_experimental
863 static inline int
865  struct rte_bbdev_enc_op **ops, uint16_t num_ops)
866 {
867  struct rte_bbdev_op_pool_private *priv;
868  int ret;
869 
870  /* Check type */
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)))
875  return -EINVAL;
876 
877  /* Get elements */
878  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
879  if (unlikely(ret < 0))
880  return ret;
881 
882  return 0;
883 }
884 
899 __rte_experimental
900 static inline int
902  struct rte_bbdev_dec_op **ops, uint16_t num_ops)
903 {
904  struct rte_bbdev_op_pool_private *priv;
905  int ret;
906 
907  /* Check type */
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)))
912  return -EINVAL;
913 
914  /* Get elements */
915  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
916  if (unlikely(ret < 0))
917  return ret;
918 
919  return 0;
920 }
921 
932 __rte_experimental
933 static inline void
934 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
935 {
936  if (num_ops > 0)
937  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
938 }
939 
950 __rte_experimental
951 static inline void
952 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
953 {
954  if (num_ops > 0)
955  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
956 }
957 
958 #ifdef __cplusplus
959 }
960 #endif
961 
962 #endif /* _RTE_BBDEV_OP_H_ */
__rte_experimental 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_ldpcdec_flag_bitmasks
Definition: rte_bbdev_op.h:138
rte_bbdev_op_ldpcenc_flag_bitmasks
Definition: rte_bbdev_op.h:193
static __rte_always_inline void rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, unsigned int n)
Definition: rte_mempool.h:1372
rte_bbdev_op_type
Definition: rte_bbdev_op.h:743
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:55
uint32_t cache_size
Definition: rte_mempool.h:229
#define unlikely(x)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:781
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1530
static __rte_experimental void rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
Definition: rte_bbdev_op.h:952
rte_bbdev_op_te_flag_bitmasks
Definition: rte_bbdev_op.h:122
static __rte_experimental void rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
Definition: rte_bbdev_op.h:934
struct rte_mbuf * data
Definition: rte_bbdev_op.h:251
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:765
static __rte_experimental 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:864
static __rte_experimental 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:901
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1712
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_mempool.h:218
rte_bbdev_op_cb_mode
Definition: rte_bbdev_op.h:213
__rte_experimental const char * rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)