DPDK  20.11.10
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 
243  struct rte_mbuf *data;
251  uint32_t offset;
264  uint32_t length;
265 };
266 
274  uint16_t k;
278  uint32_t e;
279 };
280 
286  uint32_t e;
287 };
288 
294  uint16_t k_neg;
298  uint16_t k_pos;
300  uint8_t c_neg;
304  uint8_t c;
306  uint8_t cab;
310  uint32_t ea;
314  uint32_t eb;
316  uint8_t r;
317 };
318 
324  uint32_t ea;
328  uint32_t eb;
332  uint8_t c;
334  uint8_t r;
336  uint8_t cab;
337 };
338 
369  struct rte_bbdev_op_data input;
373  struct rte_bbdev_op_data hard_output;
375  struct rte_bbdev_op_data soft_output;
376 
378  uint32_t op_flags;
379 
381  uint8_t rv_index;
385  uint8_t iter_min:4;
389  uint8_t iter_max:4;
393  uint8_t iter_count;
395  uint8_t ext_scale;
399  uint8_t num_maps;
400 
403  union {
408  };
409 };
410 
444  struct rte_bbdev_op_data input;
448  struct rte_bbdev_op_data hard_output;
450  struct rte_bbdev_op_data soft_output;
452  struct rte_bbdev_op_data harq_combined_input;
454  struct rte_bbdev_op_data harq_combined_output;
455 
457  uint32_t op_flags;
458 
462  uint8_t rv_index;
466  uint8_t iter_max;
470  uint8_t iter_count;
474  uint8_t basegraph;
478  uint16_t z_c;
482  uint16_t n_cb;
486  uint8_t q_m;
490  uint16_t n_filler;
493  union {
498  };
499 };
500 
508  uint16_t k;
512  uint32_t e;
516  uint16_t ncb;
517 };
518 
526  uint16_t k_neg;
532  uint16_t k_pos;
534  uint8_t c_neg;
538  uint8_t c;
540  uint8_t cab;
544  uint32_t ea;
548  uint32_t eb;
552  uint16_t ncb_neg;
556  uint16_t ncb_pos;
558  uint8_t r;
559 };
560 
566  uint32_t e;
567 };
568 
574  uint32_t ea;
578  uint32_t eb;
582  uint8_t c;
584  uint8_t r;
586  uint8_t cab;
587 };
588 
610  struct rte_bbdev_op_data input;
612  struct rte_bbdev_op_data output;
614  uint32_t op_flags;
615 
617  uint8_t rv_index;
620  union {
625  };
626 };
627 
643  struct rte_bbdev_op_data input;
645  struct rte_bbdev_op_data output;
646 
648  uint32_t op_flags;
649 
651  uint8_t rv_index;
655  uint8_t basegraph;
659  uint16_t z_c;
663  uint16_t n_cb;
667  uint8_t q_m;
671  uint16_t n_filler;
674  union {
679  };
680 };
681 
691  uint8_t num_buffers_src;
696 };
697 
706 };
707 
713  int8_t llr_size;
715  int8_t llr_decimals;
717  uint16_t num_buffers_src;
722 };
723 
729  uint16_t num_buffers_src;
731  uint16_t num_buffers_dst;
732 };
733 
742 };
743 
745 enum {
746  RTE_BBDEV_DRV_ERROR,
747  RTE_BBDEV_DATA_ERROR,
748  RTE_BBDEV_CRC_ERROR,
749  RTE_BBDEV_SYNDROME_ERROR
750 };
751 
755  int status;
759  void *opaque_data;
760  union {
762  struct rte_bbdev_op_turbo_enc turbo_enc;
764  struct rte_bbdev_op_ldpc_enc ldpc_enc;
765  };
766 };
767 
771  int status;
775  void *opaque_data;
776  union {
778  struct rte_bbdev_op_turbo_dec turbo_dec;
780  struct rte_bbdev_op_ldpc_dec ldpc_dec;
781  };
782 };
783 
786  enum rte_bbdev_op_type type;
787  union {
788  struct rte_bbdev_op_cap_turbo_dec turbo_dec;
789  struct rte_bbdev_op_cap_turbo_enc turbo_enc;
790  struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
791  struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
792  } cap;
793 };
794 
796 struct rte_bbdev_op_pool_private {
797  enum rte_bbdev_op_type type;
798 };
799 
810 __rte_experimental
811 const char*
813 
834 __rte_experimental
835 struct rte_mempool *
836 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
837  unsigned int num_elements, unsigned int cache_size,
838  int socket_id);
839 
854 __rte_experimental
855 static inline int
857  struct rte_bbdev_enc_op **ops, uint16_t num_ops)
858 {
859  struct rte_bbdev_op_pool_private *priv;
860  int ret;
861 
862  /* Check type */
863  priv = (struct rte_bbdev_op_pool_private *)
864  rte_mempool_get_priv(mempool);
865  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
866  (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
867  return -EINVAL;
868 
869  /* Get elements */
870  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
871  if (unlikely(ret < 0))
872  return ret;
873 
874  return 0;
875 }
876 
891 __rte_experimental
892 static inline int
894  struct rte_bbdev_dec_op **ops, uint16_t num_ops)
895 {
896  struct rte_bbdev_op_pool_private *priv;
897  int ret;
898 
899  /* Check type */
900  priv = (struct rte_bbdev_op_pool_private *)
901  rte_mempool_get_priv(mempool);
902  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
903  (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
904  return -EINVAL;
905 
906  /* Get elements */
907  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
908  if (unlikely(ret < 0))
909  return ret;
910 
911  return 0;
912 }
913 
924 __rte_experimental
925 static inline void
926 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
927 {
928  if (num_ops > 0)
929  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
930 }
931 
942 __rte_experimental
943 static inline void
944 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
945 {
946  if (num_ops > 0)
947  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
948 }
949 
950 #ifdef __cplusplus
951 }
952 #endif
953 
954 #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:1373
rte_bbdev_op_type
Definition: rte_bbdev_op.h:735
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:55
uint32_t cache_size
Definition: rte_mempool.h:225
#define unlikely(x)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:773
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1548
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:944
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:926
struct rte_mbuf * data
Definition: rte_bbdev_op.h:243
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:757
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:856
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:893
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1728
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_mempool.h:214
__rte_experimental const char * rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)