DPDK  19.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 (36.212, Table 5.1.3-3) */
37 #define RTE_BBDEV_TURBO_MIN_CB_SIZE (40)
38 /* Maximum size of circular buffer */
39 #define RTE_BBDEV_TURBO_MAX_KW (18528)
40 /*
41  * Turbo: Maximum number of Code Blocks in Transport Block. It is calculated
42  * based on maximum size of one Code Block and one Transport Block
43  * (considering CRC24A and CRC24B):
44  * (391656 + 24) / (6144 - 24) = 64
45  */
46 #define RTE_BBDEV_TURBO_MAX_CODE_BLOCKS (64)
47 /* LDPC: Maximum number of Code Blocks in Transport Block.*/
48 #define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
49 
107  RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
114 };
115 
116 
131 };
132 
181 };
182 
201 };
202 
234  struct rte_mbuf *data;
242  uint32_t offset;
255  uint32_t length;
256 };
257 
265  uint16_t k;
269  uint32_t e;
270 };
271 
277  uint32_t e;
278 };
279 
285  uint16_t k_neg;
289  uint16_t k_pos;
291  uint8_t c_neg;
295  uint8_t c;
297  uint8_t cab;
301  uint32_t ea;
305  uint32_t eb;
307  uint8_t r;
308 };
309 
315  uint32_t ea;
319  uint32_t eb;
323  uint8_t c;
325  uint8_t r;
327  uint8_t cab;
328 };
329 
360  struct rte_bbdev_op_data input;
364  struct rte_bbdev_op_data hard_output;
366  struct rte_bbdev_op_data soft_output;
367 
369  uint32_t op_flags;
370 
372  uint8_t rv_index;
376  uint8_t iter_min:4;
380  uint8_t iter_max:4;
384  uint8_t iter_count;
386  uint8_t ext_scale;
390  uint8_t num_maps;
391 
394  union {
399  };
400 };
401 
435  struct rte_bbdev_op_data input;
439  struct rte_bbdev_op_data hard_output;
441  struct rte_bbdev_op_data soft_output;
443  struct rte_bbdev_op_data harq_combined_input;
445  struct rte_bbdev_op_data harq_combined_output;
446 
448  uint32_t op_flags;
449 
453  uint8_t rv_index;
457  uint8_t iter_max;
461  uint8_t iter_count;
465  uint8_t basegraph;
469  uint16_t z_c;
473  uint16_t n_cb;
477  uint8_t q_m;
481  uint16_t n_filler;
484  union {
489  };
490 };
491 
499  uint16_t k;
503  uint32_t e;
507  uint16_t ncb;
508 };
509 
517  uint16_t k_neg;
523  uint16_t k_pos;
525  uint8_t c_neg;
529  uint8_t c;
531  uint8_t cab;
535  uint32_t ea;
539  uint32_t eb;
543  uint16_t ncb_neg;
547  uint16_t ncb_pos;
549  uint8_t r;
550 };
551 
557  uint32_t e;
558 };
559 
565  uint32_t ea;
569  uint32_t eb;
573  uint8_t c;
575  uint8_t r;
577  uint8_t cab;
578 };
579 
601  struct rte_bbdev_op_data input;
603  struct rte_bbdev_op_data output;
605  uint32_t op_flags;
606 
608  uint8_t rv_index;
611  union {
616  };
617 };
618 
634  struct rte_bbdev_op_data input;
636  struct rte_bbdev_op_data output;
637 
639  uint32_t op_flags;
640 
642  uint8_t rv_index;
646  uint8_t basegraph;
650  uint16_t z_c;
654  uint16_t n_cb;
658  uint8_t q_m;
662  uint16_t n_filler;
665  union {
670  };
671 };
672 
682  uint8_t num_buffers_src;
687 };
688 
697 };
698 
704  int8_t llr_size;
706  int8_t llr_decimals;
710  uint16_t num_buffers_src;
715 };
716 
722  uint16_t num_buffers_src;
724  uint16_t num_buffers_dst;
725 };
726 
735 };
736 
738 enum {
739  RTE_BBDEV_DRV_ERROR,
740  RTE_BBDEV_DATA_ERROR,
741  RTE_BBDEV_CRC_ERROR,
742  RTE_BBDEV_SYNDROME_ERROR
743 };
744 
748  int status;
752  void *opaque_data;
753  union {
755  struct rte_bbdev_op_turbo_enc turbo_enc;
757  struct rte_bbdev_op_ldpc_enc ldpc_enc;
758  };
759 };
760 
764  int status;
768  void *opaque_data;
769  union {
771  struct rte_bbdev_op_turbo_dec turbo_dec;
773  struct rte_bbdev_op_ldpc_dec ldpc_dec;
774  };
775 };
776 
779  enum rte_bbdev_op_type type;
780  union {
781  struct rte_bbdev_op_cap_turbo_dec turbo_dec;
782  struct rte_bbdev_op_cap_turbo_enc turbo_enc;
783  struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
784  struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
785  } cap;
786 };
787 
789 struct rte_bbdev_op_pool_private {
790  enum rte_bbdev_op_type type;
791 };
792 
803 __rte_experimental
804 const char*
806 
827 __rte_experimental
828 struct rte_mempool *
829 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
830  unsigned int num_elements, unsigned int cache_size,
831  int socket_id);
832 
847 __rte_experimental
848 static inline int
850  struct rte_bbdev_enc_op **ops, uint16_t num_ops)
851 {
852  struct rte_bbdev_op_pool_private *priv;
853  int ret;
854 
855  /* Check type */
856  priv = (struct rte_bbdev_op_pool_private *)
857  rte_mempool_get_priv(mempool);
858  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
859  (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
860  return -EINVAL;
861 
862  /* Get elements */
863  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
864  if (unlikely(ret < 0))
865  return ret;
866 
867  return 0;
868 }
869 
884 __rte_experimental
885 static inline int
887  struct rte_bbdev_dec_op **ops, uint16_t num_ops)
888 {
889  struct rte_bbdev_op_pool_private *priv;
890  int ret;
891 
892  /* Check type */
893  priv = (struct rte_bbdev_op_pool_private *)
894  rte_mempool_get_priv(mempool);
895  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
896  (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
897  return -EINVAL;
898 
899  /* Get elements */
900  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
901  if (unlikely(ret < 0))
902  return ret;
903 
904  return 0;
905 }
906 
917 __rte_experimental
918 static inline void
919 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
920 {
921  if (num_ops > 0)
922  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
923 }
924 
935 __rte_experimental
936 static inline void
937 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
938 {
939  if (num_ops > 0)
940  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
941 }
942 
943 #ifdef __cplusplus
944 }
945 #endif
946 
947 #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:134
rte_bbdev_op_ldpcenc_flag_bitmasks
Definition: rte_bbdev_op.h:184
static __rte_always_inline void rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, unsigned int n)
Definition: rte_mempool.h:1383
rte_bbdev_op_type
Definition: rte_bbdev_op.h:728
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:51
uint32_t cache_size
Definition: rte_mempool.h:233
#define unlikely(x)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:766
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1535
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:937
rte_bbdev_op_te_flag_bitmasks
Definition: rte_bbdev_op.h:118
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:919
struct rte_mbuf * data
Definition: rte_bbdev_op.h:234
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:750
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:849
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:886
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1717
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_mempool.h:222
__rte_experimental const char * rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)