DPDK  21.11.8
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 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <stdint.h>
19 
20 #include <rte_common.h>
21 #include <rte_mbuf.h>
22 #include <rte_memory.h>
23 #include <rte_mempool.h>
24 
25 /* Number of columns in sub-block interleaver (36.212, section 5.1.4.1.1) */
26 #define RTE_BBDEV_TURBO_C_SUBBLOCK (32)
27 /* Maximum size of Transport Block (36.213, Table, Table 7.1.7.2.5-1) */
28 #define RTE_BBDEV_TURBO_MAX_TB_SIZE (391656)
29 /* Maximum size of Code Block (36.212, Table 5.1.3-3) */
30 #define RTE_BBDEV_TURBO_MAX_CB_SIZE (6144)
31 /* Maximum size of Code Block */
32 #define RTE_BBDEV_LDPC_MAX_CB_SIZE (8448)
33 /* Minimum size of Code Block */
34 #define RTE_BBDEV_LDPC_MIN_CB_SIZE (40)
35 /* Maximum E size we can manage with default mbuf */
36 #define RTE_BBDEV_LDPC_E_MAX_MBUF (64000)
37 /* Minimum size of Code Block (36.212, Table 5.1.3-3) */
38 #define RTE_BBDEV_TURBO_MIN_CB_SIZE (40)
39 /* Maximum size of circular buffer */
40 #define RTE_BBDEV_TURBO_MAX_KW (18528)
41 /*
42  * Turbo: Maximum number of Code Blocks in Transport Block. It is calculated
43  * based on maximum size of one Code Block and one Transport Block
44  * (considering CRC24A and CRC24B):
45  * (391656 + 24) / (6144 - 24) = 64
46  */
47 #define RTE_BBDEV_TURBO_MAX_CODE_BLOCKS (64)
48 /* LDPC: Maximum number of Code Blocks in Transport Block.*/
49 #define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
50 
108  RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
118 };
119 
120 
135 };
136 
192 };
193 
212 };
213 
220 };
221 
253  struct rte_mbuf *data;
261  uint32_t offset;
274  uint32_t length;
275 };
276 
284  uint16_t k;
288  uint32_t e;
289 };
290 
296  uint32_t e;
297 };
298 
304  uint16_t k_neg;
308  uint16_t k_pos;
310  uint8_t c_neg;
314  uint8_t c;
316  uint8_t cab;
320  uint32_t ea;
324  uint32_t eb;
326  uint8_t r;
327 };
328 
334  uint32_t ea;
338  uint32_t eb;
342  uint8_t c;
344  uint8_t r;
346  uint8_t cab;
347 };
348 
379  struct rte_bbdev_op_data input;
383  struct rte_bbdev_op_data hard_output;
385  struct rte_bbdev_op_data soft_output;
386 
388  uint32_t op_flags;
389 
391  uint8_t rv_index;
395  uint8_t iter_min:4;
399  uint8_t iter_max:4;
403  uint8_t iter_count;
405  uint8_t ext_scale;
409  uint8_t num_maps;
410 
413  union {
418  };
419 };
420 
454  struct rte_bbdev_op_data input;
458  struct rte_bbdev_op_data hard_output;
460  struct rte_bbdev_op_data soft_output;
462  struct rte_bbdev_op_data harq_combined_input;
464  struct rte_bbdev_op_data harq_combined_output;
465 
467  uint32_t op_flags;
468 
472  uint8_t rv_index;
476  uint8_t iter_max;
480  uint8_t iter_count;
484  uint8_t basegraph;
488  uint16_t z_c;
492  uint16_t n_cb;
496  uint8_t q_m;
500  uint16_t n_filler;
503  union {
508  };
509 };
510 
518  uint16_t k;
522  uint32_t e;
526  uint16_t ncb;
527 };
528 
536  uint16_t k_neg;
542  uint16_t k_pos;
544  uint8_t c_neg;
548  uint8_t c;
550  uint8_t cab;
554  uint32_t ea;
558  uint32_t eb;
562  uint16_t ncb_neg;
566  uint16_t ncb_pos;
568  uint8_t r;
569 };
570 
576  uint32_t e;
577 };
578 
584  uint32_t ea;
588  uint32_t eb;
592  uint8_t c;
594  uint8_t r;
596  uint8_t cab;
597 };
598 
620  struct rte_bbdev_op_data input;
622  struct rte_bbdev_op_data output;
624  uint32_t op_flags;
625 
627  uint8_t rv_index;
630  union {
635  };
636 };
637 
653  struct rte_bbdev_op_data input;
655  struct rte_bbdev_op_data output;
656 
658  uint32_t op_flags;
659 
661  uint8_t rv_index;
665  uint8_t basegraph;
669  uint16_t z_c;
673  uint16_t n_cb;
677  uint8_t q_m;
681  uint16_t n_filler;
684  union {
689  };
690 };
691 
701  uint8_t num_buffers_src;
706 };
707 
716 };
717 
723  int8_t llr_size;
725  int8_t llr_decimals;
727  uint16_t num_buffers_src;
732 };
733 
739  uint16_t num_buffers_src;
741  uint16_t num_buffers_dst;
742 };
743 
752 };
753 
755 enum {
756  RTE_BBDEV_DRV_ERROR,
757  RTE_BBDEV_DATA_ERROR,
758  RTE_BBDEV_CRC_ERROR,
759  RTE_BBDEV_SYNDROME_ERROR
760 };
761 
765  int status;
769  void *opaque_data;
770  union {
772  struct rte_bbdev_op_turbo_enc turbo_enc;
774  struct rte_bbdev_op_ldpc_enc ldpc_enc;
775  };
776 };
777 
781  int status;
785  void *opaque_data;
786  union {
788  struct rte_bbdev_op_turbo_dec turbo_dec;
790  struct rte_bbdev_op_ldpc_dec ldpc_dec;
791  };
792 };
793 
796  enum rte_bbdev_op_type type;
797  union {
798  struct rte_bbdev_op_cap_turbo_dec turbo_dec;
799  struct rte_bbdev_op_cap_turbo_enc turbo_enc;
800  struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
801  struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
802  } cap;
803 };
804 
806 struct rte_bbdev_op_pool_private {
807  enum rte_bbdev_op_type type;
808 };
809 
820 const char*
822 
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 static inline int
864  struct rte_bbdev_enc_op **ops, uint16_t num_ops)
865 {
866  struct rte_bbdev_op_pool_private *priv;
867  int ret;
868 
869  /* Check type */
870  priv = (struct rte_bbdev_op_pool_private *)
871  rte_mempool_get_priv(mempool);
872  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
873  (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
874  return -EINVAL;
875 
876  /* Get elements */
877  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
878  if (unlikely(ret < 0))
879  return ret;
880 
881  return 0;
882 }
883 
898 static inline int
900  struct rte_bbdev_dec_op **ops, uint16_t num_ops)
901 {
902  struct rte_bbdev_op_pool_private *priv;
903  int ret;
904 
905  /* Check type */
906  priv = (struct rte_bbdev_op_pool_private *)
907  rte_mempool_get_priv(mempool);
908  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
909  (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
910  return -EINVAL;
911 
912  /* Get elements */
913  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
914  if (unlikely(ret < 0))
915  return ret;
916 
917  return 0;
918 }
919 
930 static inline void
931 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
932 {
933  if (num_ops > 0)
934  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
935 }
936 
947 static inline void
948 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
949 {
950  if (num_ops > 0)
951  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
952 }
953 
954 #ifdef __cplusplus
955 }
956 #endif
957 
958 #endif /* _RTE_BBDEV_OP_H_ */
rte_bbdev_op_ldpcdec_flag_bitmasks
Definition: rte_bbdev_op.h:138
rte_bbdev_op_ldpcenc_flag_bitmasks
Definition: rte_bbdev_op.h:195
static __rte_always_inline void rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, unsigned int n)
Definition: rte_mempool.h:1422
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_type
Definition: rte_bbdev_op.h:745
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:52
uint32_t cache_size
Definition: rte_mempool.h:224
char name[RTE_MEMPOOL_NAMESIZE]
Definition: rte_mempool.h:213
#define unlikely(x)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:783
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1580
rte_bbdev_op_te_flag_bitmasks
Definition: rte_bbdev_op.h:122
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:899
struct rte_mbuf * data
Definition: rte_bbdev_op.h:253
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:863
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:767
const char * rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1762
static void rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
Definition: rte_bbdev_op.h:948
static void rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
Definition: rte_bbdev_op.h:931
rte_bbdev_op_cb_mode
Definition: rte_bbdev_op.h:215