DPDK  24.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 #define RTE_BBDEV_MAX_CS (12)
54 /* MLD-TS up to 4 layers */
55 #define RTE_BBDEV_MAX_MLD_LAYERS (4)
56 /* 12 SB per RB */
57 #define RTE_BBDEV_SCPERRB (12)
58 
59 /*
60  * Maximum size to be used to manage the enum rte_bbdev_op_type
61  * including padding for future enum insertion.
62  * The enum values must be explicitly kept smaller or equal to this padded maximum size.
63  */
64 #define RTE_BBDEV_OP_TYPE_SIZE_MAX 8
65 
123  RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
133 };
134 
135 
150 };
151 
209 };
210 
229 };
230 
234  RTE_BBDEV_FFT_WINDOWING = (1ULL << 0),
257 };
258 
262  RTE_BBDEV_MLDTS_REP = (1ULL << 0),
263 };
264 
271 };
272 
304  struct rte_mbuf *data;
312  uint32_t offset;
325  uint32_t length;
326 };
327 
335  uint16_t k;
339  uint32_t e;
340 };
341 
347  uint32_t e;
348 };
349 
355  uint16_t k_neg;
359  uint16_t k_pos;
361  uint8_t c_neg;
365  uint8_t c;
367  uint8_t cab;
371  uint32_t ea;
375  uint32_t eb;
377  uint8_t r;
378 };
379 
385  uint32_t ea;
389  uint32_t eb;
393  uint8_t c;
395  uint8_t r;
397  uint8_t cab;
398 };
399 
429 /* Structure rte_bbdev_op_turbo_dec 8< */
432  struct rte_bbdev_op_data input;
436  struct rte_bbdev_op_data hard_output;
438  struct rte_bbdev_op_data soft_output;
439 
441  uint32_t op_flags;
442 
444  uint8_t rv_index;
448  uint8_t iter_min:4;
452  uint8_t iter_max:4;
456  uint8_t iter_count;
458  uint8_t ext_scale;
462  uint8_t num_maps;
463 
466  union {
471  };
472 };
473 /* >8 End of structure rte_bbdev_op_turbo_dec. */
474 
505 /* Structure rte_bbdev_op_ldpc_dec 8< */
510  struct rte_bbdev_op_data input;
514  struct rte_bbdev_op_data hard_output;
516  struct rte_bbdev_op_data soft_output;
518  struct rte_bbdev_op_data harq_combined_input;
520  struct rte_bbdev_op_data harq_combined_output;
521 
523  uint32_t op_flags;
524 
528  uint8_t rv_index;
532  uint8_t iter_max;
536  uint8_t iter_count;
540  uint8_t basegraph;
544  uint16_t z_c;
548  uint16_t n_cb;
552  uint8_t q_m;
556  uint16_t n_filler;
559  union {
564  };
565 };
566 /* >8 End of structure rte_bbdev_op_ldpc_dec. */
567 
575  uint16_t k;
579  uint32_t e;
583  uint16_t ncb;
584 };
585 
593  uint16_t k_neg;
599  uint16_t k_pos;
601  uint8_t c_neg;
605  uint8_t c;
607  uint8_t cab;
611  uint32_t ea;
615  uint32_t eb;
619  uint16_t ncb_neg;
623  uint16_t ncb_pos;
625  uint8_t r;
626 };
627 
633  uint32_t e;
634 };
635 
641  uint32_t ea;
645  uint32_t eb;
649  uint8_t c;
651  uint8_t r;
653  uint8_t cab;
654 };
655 
676 /* Structure rte_bbdev_op_turbo_enc 8< */
679  struct rte_bbdev_op_data input;
681  struct rte_bbdev_op_data output;
683  uint32_t op_flags;
684 
686  uint8_t rv_index;
689  union {
694  };
695 };
696 /* >8 End of structure rte_bbdev_op_turbo_enc. */
697 
712 /* Structure rte_bbdev_op_ldpc_enc 8< */
715  struct rte_bbdev_op_data input;
717  struct rte_bbdev_op_data output;
718 
720  uint32_t op_flags;
721 
723  uint8_t rv_index;
727  uint8_t basegraph;
731  uint16_t z_c;
735  uint16_t n_cb;
739  uint8_t q_m;
743  uint16_t n_filler;
746  union {
751  };
752 };
753 /* >8 End of structure rte_bbdev_op_ldpc_enc. */
754 
764 /* Structure rte_bbdev_op_fft 8< */
767  struct rte_bbdev_op_data base_input;
769  struct rte_bbdev_op_data base_output;
771  struct rte_bbdev_op_data dewindowing_input;
773  struct rte_bbdev_op_data power_meas_output;
775  uint32_t op_flags;
785  uint8_t window_index[RTE_BBDEV_MAX_CS_2];
787  uint16_t cs_bitmap;
791  uint8_t idft_log2;
793  uint8_t dft_log2;
797  int8_t idft_shift;
799  int8_t dft_shift;
801  uint16_t ncs_reciprocal;
803  uint16_t power_shift;
805  uint16_t fp16_exp_adjust;
811  uint16_t cs_theta_0[RTE_BBDEV_MAX_CS];
813  uint32_t cs_theta_d[RTE_BBDEV_MAX_CS];
814  /* Time offset per CS of time domain samples. */
815  int8_t time_offset[RTE_BBDEV_MAX_CS];
816 };
817 /* >8 End of structure rte_bbdev_op_fft. */
818 
825 /* Structure rte_bbdev_op_mldts 8< */
828  struct rte_bbdev_op_data qhy_input;
830  struct rte_bbdev_op_data r_input;
832  struct rte_bbdev_op_data output;
834  uint32_t op_flags;
836  uint16_t num_rbs;
838  uint16_t num_layers;
840  uint8_t q_m[RTE_BBDEV_MAX_MLD_LAYERS];
842  uint8_t r_rep;
844  uint8_t c_rep;
845 };
846 /* >8 End of structure rte_bbdev_op_mldts. */
847 
857  uint8_t num_buffers_src;
862 };
863 
872 };
873 
879  int8_t llr_size;
881  int8_t llr_decimals;
883  uint16_t num_buffers_src;
888 };
889 
895  uint16_t num_buffers_src;
897  uint16_t num_buffers_dst;
898 };
899 
905  uint16_t num_buffers_src;
907  uint16_t num_buffers_dst;
909  uint16_t fft_windows_num;
910 };
911 
917  uint16_t num_buffers_src;
919  uint16_t num_buffers_dst;
920 };
921 
934  /* Note: RTE_BBDEV_OP_TYPE_SIZE_MAX must be larger or equal to maximum enum value */
935 };
936 
938 enum {
939  RTE_BBDEV_DRV_ERROR,
940  RTE_BBDEV_DATA_ERROR,
941  RTE_BBDEV_CRC_ERROR,
942  RTE_BBDEV_SYNDROME_ERROR,
943  RTE_BBDEV_ENGINE_ERROR
944 };
945 
949  int status;
953  void *opaque_data;
954  union {
956  struct rte_bbdev_op_turbo_enc turbo_enc;
958  struct rte_bbdev_op_ldpc_enc ldpc_enc;
959  };
960 };
961 
965  int status;
969  void *opaque_data;
970  union {
972  struct rte_bbdev_op_turbo_dec turbo_dec;
974  struct rte_bbdev_op_ldpc_dec ldpc_dec;
975  };
976 };
977 
981  int status;
985  void *opaque_data;
987  struct rte_bbdev_op_fft fft;
988 };
989 
993  int status;
997  void *opaque_data;
999  struct rte_bbdev_op_mldts mldts;
1000 };
1001 
1004  enum rte_bbdev_op_type type;
1005  union {
1006  struct rte_bbdev_op_cap_turbo_dec turbo_dec;
1007  struct rte_bbdev_op_cap_turbo_enc turbo_enc;
1008  struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
1009  struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
1010  struct rte_bbdev_op_cap_fft fft;
1011  struct rte_bbdev_op_cap_mld mld;
1012  } cap;
1013 };
1014 
1016 struct rte_bbdev_op_pool_private {
1017  enum rte_bbdev_op_type type;
1018 };
1019 
1029 const char*
1031 
1052 struct rte_mempool *
1053 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
1054  unsigned int num_elements, unsigned int cache_size,
1055  int socket_id);
1056 
1071 static inline int
1073  struct rte_bbdev_enc_op **ops, unsigned int num_ops)
1074 {
1075  struct rte_bbdev_op_pool_private *priv;
1076 
1077  /* Check type */
1078  priv = (struct rte_bbdev_op_pool_private *)
1079  rte_mempool_get_priv(mempool);
1080  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
1081  (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
1082  return -EINVAL;
1083 
1084  /* Get elements */
1085  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1086 }
1087 
1102 static inline int
1104  struct rte_bbdev_dec_op **ops, unsigned int num_ops)
1105 {
1106  struct rte_bbdev_op_pool_private *priv;
1107 
1108  /* Check type */
1109  priv = (struct rte_bbdev_op_pool_private *)
1110  rte_mempool_get_priv(mempool);
1111  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
1112  (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
1113  return -EINVAL;
1114 
1115  /* Get elements */
1116  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1117 }
1118 
1133 static inline int
1135  struct rte_bbdev_fft_op **ops, unsigned int num_ops)
1136 {
1137  struct rte_bbdev_op_pool_private *priv;
1138 
1139  /* Check type */
1140  priv = (struct rte_bbdev_op_pool_private *)rte_mempool_get_priv(mempool);
1141  if (unlikely(priv->type != RTE_BBDEV_OP_FFT))
1142  return -EINVAL;
1143 
1144  /* Get elements */
1145  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1146 }
1147 
1162 __rte_experimental
1163 static inline int
1165  struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
1166 {
1167  struct rte_bbdev_op_pool_private *priv;
1168 
1169  /* Check type */
1170  priv = (struct rte_bbdev_op_pool_private *)rte_mempool_get_priv(mempool);
1171  if (unlikely(priv->type != RTE_BBDEV_OP_MLDTS))
1172  return -EINVAL;
1173 
1174  /* Get elements */
1175  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1176 }
1177 
1188 static inline void
1189 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
1190 {
1191  if (num_ops > 0)
1192  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1193 }
1194 
1205 static inline void
1206 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
1207 {
1208  if (num_ops > 0)
1209  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1210 }
1211 
1222 static inline void
1223 rte_bbdev_fft_op_free_bulk(struct rte_bbdev_fft_op **ops, unsigned int num_ops)
1224 {
1225  if (num_ops > 0)
1226  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1227 }
1228 
1239 __rte_experimental
1240 static inline void
1241 rte_bbdev_mldts_op_free_bulk(struct rte_bbdev_mldts_op **ops, unsigned int num_ops)
1242 {
1243  if (num_ops > 0)
1244  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1245 }
1246 
1247 #ifdef __cplusplus
1248 }
1249 #endif
1250 
1251 #endif /* _RTE_BBDEV_OP_H_ */
int8_t cs_time_adjustment
Definition: rte_bbdev_op.h:795
uint16_t fp16_exp_adjust
Definition: rte_bbdev_op.h:805
uint16_t power_shift
Definition: rte_bbdev_op.h:803
static void rte_bbdev_fft_op_free_bulk(struct rte_bbdev_fft_op **ops, unsigned int num_ops)
rte_bbdev_op_ldpcdec_flag_bitmasks
Definition: rte_bbdev_op.h:153
static __rte_experimental void rte_bbdev_mldts_op_free_bulk(struct rte_bbdev_mldts_op **ops, unsigned int num_ops)
rte_bbdev_op_ldpcenc_flag_bitmasks
Definition: rte_bbdev_op.h:212
uint16_t input_sequence_size
Definition: rte_bbdev_op.h:777
static __rte_always_inline void rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, unsigned int n)
Definition: rte_mempool.h:1465
uint8_t num_antennas_log2
Definition: rte_bbdev_op.h:789
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:926
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:67
int8_t freq_resample_mode
Definition: rte_bbdev_op.h:807
uint16_t output_sequence_size
Definition: rte_bbdev_op.h:781
uint32_t cache_size
Definition: rte_mempool.h:241
char name[RTE_MEMPOOL_NAMESIZE]
Definition: rte_mempool.h:231
rte_bbdev_op_fft_flag_bitmasks
Definition: rte_bbdev_op.h:232
uint16_t input_leading_padding
Definition: rte_bbdev_op.h:779
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:983
#define unlikely(x)
static int rte_bbdev_fft_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_fft_op **ops, unsigned int num_ops)
static int rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_enc_op **ops, unsigned int num_ops)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:967
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1680
rte_bbdev_op_te_flag_bitmasks
Definition: rte_bbdev_op.h:137
struct rte_mbuf * data
Definition: rte_bbdev_op.h:304
static __rte_experimental int rte_bbdev_mldts_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:995
uint16_t cs_bitmap
Definition: rte_bbdev_op.h:787
static int rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_dec_op **ops, unsigned int num_ops)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:951
rte_bbdev_op_mldts_flag_bitmasks
Definition: rte_bbdev_op.h:260
const char * rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
uint16_t ncs_reciprocal
Definition: rte_bbdev_op.h:801
uint16_t output_leading_depadding
Definition: rte_bbdev_op.h:783
uint16_t output_depadded_size
Definition: rte_bbdev_op.h:809
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1862
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:266