DPDK  23.03.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 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <stdint.h>
19 
20 #include <rte_compat.h>
21 #include <rte_common.h>
22 #include <rte_mbuf.h>
23 #include <rte_memory.h>
24 #include <rte_mempool.h>
25 
26 /* Number of columns in sub-block interleaver (36.212, section 5.1.4.1.1) */
27 #define RTE_BBDEV_TURBO_C_SUBBLOCK (32)
28 /* Maximum size of Transport Block (36.213, Table, Table 7.1.7.2.5-1) */
29 #define RTE_BBDEV_TURBO_MAX_TB_SIZE (391656)
30 /* Maximum size of Code Block (36.212, Table 5.1.3-3) */
31 #define RTE_BBDEV_TURBO_MAX_CB_SIZE (6144)
32 /* Maximum size of Code Block */
33 #define RTE_BBDEV_LDPC_MAX_CB_SIZE (8448)
34 /* Minimum size of Code Block */
35 #define RTE_BBDEV_LDPC_MIN_CB_SIZE (40)
36 /* Maximum E size we can manage with default mbuf */
37 #define RTE_BBDEV_LDPC_E_MAX_MBUF (64000)
38 /* Minimum size of Code Block (36.212, Table 5.1.3-3) */
39 #define RTE_BBDEV_TURBO_MIN_CB_SIZE (40)
40 /* Maximum size of circular buffer */
41 #define RTE_BBDEV_TURBO_MAX_KW (18528)
42 /*
43  * Turbo: Maximum number of Code Blocks in Transport Block. It is calculated
44  * based on maximum size of one Code Block and one Transport Block
45  * (considering CRC24A and CRC24B):
46  * (391656 + 24) / (6144 - 24) = 64
47  */
48 #define RTE_BBDEV_TURBO_MAX_CODE_BLOCKS (64)
49 /* LDPC: Maximum number of Code Blocks in Transport Block.*/
50 #define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256)
51 /* 12 CS maximum */
52 #define RTE_BBDEV_MAX_CS_2 (6)
53 
54 /*
55  * Maximum size to be used to manage the enum rte_bbdev_op_type
56  * including padding for future enum insertion.
57  * The enum values must be explicitly kept smaller or equal to this padded maximum size.
58  */
59 #define RTE_BBDEV_OP_TYPE_SIZE_MAX 8
60 
118  RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
128 };
129 
130 
145 };
146 
202 };
203 
222 };
223 
227  RTE_BBDEV_FFT_WINDOWING = (1ULL << 0),
242 };
243 
250 };
251 
283  struct rte_mbuf *data;
291  uint32_t offset;
304  uint32_t length;
305 };
306 
314  uint16_t k;
318  uint32_t e;
319 };
320 
326  uint32_t e;
327 };
328 
334  uint16_t k_neg;
338  uint16_t k_pos;
340  uint8_t c_neg;
344  uint8_t c;
346  uint8_t cab;
350  uint32_t ea;
354  uint32_t eb;
356  uint8_t r;
357 };
358 
364  uint32_t ea;
368  uint32_t eb;
372  uint8_t c;
374  uint8_t r;
376  uint8_t cab;
377 };
378 
408 /* Structure rte_bbdev_op_turbo_dec 8< */
411  struct rte_bbdev_op_data input;
415  struct rte_bbdev_op_data hard_output;
417  struct rte_bbdev_op_data soft_output;
418 
420  uint32_t op_flags;
421 
423  uint8_t rv_index;
427  uint8_t iter_min:4;
431  uint8_t iter_max:4;
435  uint8_t iter_count;
437  uint8_t ext_scale;
441  uint8_t num_maps;
442 
445  union {
450  };
451 };
452 /* >8 End of structure rte_bbdev_op_turbo_dec. */
453 
484 /* Structure rte_bbdev_op_ldpc_dec 8< */
489  struct rte_bbdev_op_data input;
493  struct rte_bbdev_op_data hard_output;
495  struct rte_bbdev_op_data soft_output;
497  struct rte_bbdev_op_data harq_combined_input;
499  struct rte_bbdev_op_data harq_combined_output;
500 
502  uint32_t op_flags;
503 
507  uint8_t rv_index;
511  uint8_t iter_max;
515  uint8_t iter_count;
519  uint8_t basegraph;
523  uint16_t z_c;
527  uint16_t n_cb;
531  uint8_t q_m;
535  uint16_t n_filler;
538  union {
543  };
544 };
545 /* >8 End of structure rte_bbdev_op_ldpc_dec. */
546 
554  uint16_t k;
558  uint32_t e;
562  uint16_t ncb;
563 };
564 
572  uint16_t k_neg;
578  uint16_t k_pos;
580  uint8_t c_neg;
584  uint8_t c;
586  uint8_t cab;
590  uint32_t ea;
594  uint32_t eb;
598  uint16_t ncb_neg;
602  uint16_t ncb_pos;
604  uint8_t r;
605 };
606 
612  uint32_t e;
613 };
614 
620  uint32_t ea;
624  uint32_t eb;
628  uint8_t c;
630  uint8_t r;
632  uint8_t cab;
633 };
634 
655 /* Structure rte_bbdev_op_turbo_enc 8< */
658  struct rte_bbdev_op_data input;
660  struct rte_bbdev_op_data output;
662  uint32_t op_flags;
663 
665  uint8_t rv_index;
668  union {
673  };
674 };
675 /* >8 End of structure rte_bbdev_op_turbo_enc. */
676 
691 /* Structure rte_bbdev_op_ldpc_enc 8< */
694  struct rte_bbdev_op_data input;
696  struct rte_bbdev_op_data output;
697 
699  uint32_t op_flags;
700 
702  uint8_t rv_index;
706  uint8_t basegraph;
710  uint16_t z_c;
714  uint16_t n_cb;
718  uint8_t q_m;
722  uint16_t n_filler;
725  union {
730  };
731 };
732 /* >8 End of structure rte_bbdev_op_ldpc_enc. */
733 
743 /* Structure rte_bbdev_op_fft 8< */
746  struct rte_bbdev_op_data base_input;
748  struct rte_bbdev_op_data base_output;
750  struct rte_bbdev_op_data power_meas_output;
752  uint32_t op_flags;
762  uint8_t window_index[RTE_BBDEV_MAX_CS_2];
764  uint16_t cs_bitmap;
768  uint8_t idft_log2;
770  uint8_t dft_log2;
774  int8_t idft_shift;
776  int8_t dft_shift;
778  uint16_t ncs_reciprocal;
780  uint16_t power_shift;
782  uint16_t fp16_exp_adjust;
783 };
784 /* >8 End of structure rte_bbdev_op_fft. */
785 
795  uint8_t num_buffers_src;
800 };
801 
810 };
811 
817  int8_t llr_size;
819  int8_t llr_decimals;
821  uint16_t num_buffers_src;
826 };
827 
833  uint16_t num_buffers_src;
835  uint16_t num_buffers_dst;
836 };
837 
843  uint16_t num_buffers_src;
845  uint16_t num_buffers_dst;
846 };
847 
859  /* Note: RTE_BBDEV_OP_TYPE_SIZE_MAX must be larger or equal to maximum enum value */
860 };
861 
863 enum {
864  RTE_BBDEV_DRV_ERROR,
865  RTE_BBDEV_DATA_ERROR,
866  RTE_BBDEV_CRC_ERROR,
867  RTE_BBDEV_SYNDROME_ERROR
868 };
869 
873  int status;
877  void *opaque_data;
878  union {
880  struct rte_bbdev_op_turbo_enc turbo_enc;
882  struct rte_bbdev_op_ldpc_enc ldpc_enc;
883  };
884 };
885 
889  int status;
893  void *opaque_data;
894  union {
896  struct rte_bbdev_op_turbo_dec turbo_dec;
898  struct rte_bbdev_op_ldpc_dec ldpc_dec;
899  };
900 };
901 
905  int status;
909  void *opaque_data;
911  struct rte_bbdev_op_fft fft;
912 };
913 
916  enum rte_bbdev_op_type type;
917  union {
918  struct rte_bbdev_op_cap_turbo_dec turbo_dec;
919  struct rte_bbdev_op_cap_turbo_enc turbo_enc;
920  struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
921  struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
922  struct rte_bbdev_op_cap_fft fft;
923  } cap;
924 };
925 
927 struct rte_bbdev_op_pool_private {
928  enum rte_bbdev_op_type type;
929 };
930 
941 const char*
943 
964 struct rte_mempool *
965 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
966  unsigned int num_elements, unsigned int cache_size,
967  int socket_id);
968 
983 static inline int
985  struct rte_bbdev_enc_op **ops, uint16_t num_ops)
986 {
987  struct rte_bbdev_op_pool_private *priv;
988 
989  /* Check type */
990  priv = (struct rte_bbdev_op_pool_private *)
991  rte_mempool_get_priv(mempool);
992  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
993  (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
994  return -EINVAL;
995 
996  /* Get elements */
997  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
998 }
999 
1014 static inline int
1016  struct rte_bbdev_dec_op **ops, uint16_t num_ops)
1017 {
1018  struct rte_bbdev_op_pool_private *priv;
1019 
1020  /* Check type */
1021  priv = (struct rte_bbdev_op_pool_private *)
1022  rte_mempool_get_priv(mempool);
1023  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
1024  (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
1025  return -EINVAL;
1026 
1027  /* Get elements */
1028  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1029 }
1030 
1045 __rte_experimental
1046 static inline int
1048  struct rte_bbdev_fft_op **ops, uint16_t num_ops)
1049 {
1050  struct rte_bbdev_op_pool_private *priv;
1051 
1052  /* Check type */
1053  priv = (struct rte_bbdev_op_pool_private *)rte_mempool_get_priv(mempool);
1054  if (unlikely(priv->type != RTE_BBDEV_OP_FFT))
1055  return -EINVAL;
1056 
1057  /* Get elements */
1058  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1059 }
1060 
1071 static inline void
1072 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
1073 {
1074  if (num_ops > 0)
1075  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1076 }
1077 
1088 static inline void
1089 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
1090 {
1091  if (num_ops > 0)
1092  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1093 }
1094 
1105 __rte_experimental
1106 static inline void
1107 rte_bbdev_fft_op_free_bulk(struct rte_bbdev_fft_op **ops, unsigned int num_ops)
1108 {
1109  if (num_ops > 0)
1110  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1111 }
1112 
1113 #ifdef __cplusplus
1114 }
1115 #endif
1116 
1117 #endif /* _RTE_BBDEV_OP_H_ */
int8_t cs_time_adjustment
Definition: rte_bbdev_op.h:772
uint16_t fp16_exp_adjust
Definition: rte_bbdev_op.h:782
uint16_t power_shift
Definition: rte_bbdev_op.h:780
rte_bbdev_op_ldpcdec_flag_bitmasks
Definition: rte_bbdev_op.h:148
rte_bbdev_op_ldpcenc_flag_bitmasks
Definition: rte_bbdev_op.h:205
uint16_t input_sequence_size
Definition: rte_bbdev_op.h:754
static __rte_always_inline void rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, unsigned int n)
Definition: rte_mempool.h:1449
uint8_t num_antennas_log2
Definition: rte_bbdev_op.h:766
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:852
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:62
uint16_t output_sequence_size
Definition: rte_bbdev_op.h:758
uint32_t cache_size
Definition: rte_mempool.h:231
char name[RTE_MEMPOOL_NAMESIZE]
Definition: rte_mempool.h:220
rte_bbdev_op_fft_flag_bitmasks
Definition: rte_bbdev_op.h:225
uint16_t input_leading_padding
Definition: rte_bbdev_op.h:756
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:907
#define unlikely(x)
static __rte_experimental void rte_bbdev_fft_op_free_bulk(struct rte_bbdev_fft_op **ops, unsigned int num_ops)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:891
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1634
rte_bbdev_op_te_flag_bitmasks
Definition: rte_bbdev_op.h:132
static int rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_dec_op **ops, uint16_t num_ops)
struct rte_mbuf * data
Definition: rte_bbdev_op.h:283
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:984
uint16_t cs_bitmap
Definition: rte_bbdev_op.h:764
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:875
const char * rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
static __rte_experimental int rte_bbdev_fft_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_fft_op **ops, uint16_t num_ops)
uint16_t ncs_reciprocal
Definition: rte_bbdev_op.h:778
uint16_t output_leading_depadding
Definition: rte_bbdev_op.h:760
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1816
static void rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
static void rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
rte_bbdev_op_cb_mode
Definition: rte_bbdev_op.h:245