DPDK  24.11.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 #include <stdint.h>
15 
16 #include <rte_compat.h>
17 #include <rte_common.h>
18 #include <rte_mbuf.h>
19 #include <rte_memory.h>
20 #include <rte_mempool.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
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  };
568  uint16_t k0;
569 };
570 /* >8 End of structure rte_bbdev_op_ldpc_dec. */
571 
579  uint16_t k;
583  uint32_t e;
587  uint16_t ncb;
588 };
589 
597  uint16_t k_neg;
603  uint16_t k_pos;
605  uint8_t c_neg;
609  uint8_t c;
611  uint8_t cab;
615  uint32_t ea;
619  uint32_t eb;
623  uint16_t ncb_neg;
627  uint16_t ncb_pos;
629  uint8_t r;
630 };
631 
637  uint32_t e;
638 };
639 
645  uint32_t ea;
649  uint32_t eb;
653  uint8_t c;
655  uint8_t r;
657  uint8_t cab;
658 };
659 
680 /* Structure rte_bbdev_op_turbo_enc 8< */
683  struct rte_bbdev_op_data input;
685  struct rte_bbdev_op_data output;
687  uint32_t op_flags;
688 
690  uint8_t rv_index;
693  union {
698  };
699 };
700 /* >8 End of structure rte_bbdev_op_turbo_enc. */
701 
716 /* Structure rte_bbdev_op_ldpc_enc 8< */
719  struct rte_bbdev_op_data input;
721  struct rte_bbdev_op_data output;
722 
724  uint32_t op_flags;
725 
727  uint8_t rv_index;
731  uint8_t basegraph;
735  uint16_t z_c;
739  uint16_t n_cb;
743  uint8_t q_m;
747  uint16_t n_filler;
750  union {
755  };
756 };
757 /* >8 End of structure rte_bbdev_op_ldpc_enc. */
758 
768 /* Structure rte_bbdev_op_fft 8< */
771  struct rte_bbdev_op_data base_input;
773  struct rte_bbdev_op_data base_output;
775  struct rte_bbdev_op_data dewindowing_input;
777  struct rte_bbdev_op_data power_meas_output;
779  uint32_t op_flags;
789  uint8_t window_index[RTE_BBDEV_MAX_CS_2];
791  uint16_t cs_bitmap;
795  uint8_t idft_log2;
797  uint8_t dft_log2;
801  int8_t idft_shift;
803  int8_t dft_shift;
805  uint16_t ncs_reciprocal;
807  uint16_t power_shift;
809  uint16_t fp16_exp_adjust;
815  uint16_t cs_theta_0[RTE_BBDEV_MAX_CS];
817  uint32_t cs_theta_d[RTE_BBDEV_MAX_CS];
818  /* Time offset per CS of time domain samples. */
819  int8_t time_offset[RTE_BBDEV_MAX_CS];
820 };
821 /* >8 End of structure rte_bbdev_op_fft. */
822 
829 /* Structure rte_bbdev_op_mldts 8< */
832  struct rte_bbdev_op_data qhy_input;
834  struct rte_bbdev_op_data r_input;
836  struct rte_bbdev_op_data output;
838  uint32_t op_flags;
840  uint16_t num_rbs;
842  uint16_t num_layers;
844  uint8_t q_m[RTE_BBDEV_MAX_MLD_LAYERS];
846  uint8_t r_rep;
848  uint8_t c_rep;
849 };
850 /* >8 End of structure rte_bbdev_op_mldts. */
851 
861  uint8_t num_buffers_src;
866 };
867 
876 };
877 
883  int8_t llr_size;
885  int8_t llr_decimals;
887  uint16_t num_buffers_src;
892 };
893 
899  uint16_t num_buffers_src;
901  uint16_t num_buffers_dst;
902 };
903 
909  uint16_t num_buffers_src;
911  uint16_t num_buffers_dst;
913  uint16_t fft_windows_num;
914 };
915 
921  uint16_t num_buffers_src;
923  uint16_t num_buffers_dst;
924 };
925 
938  /* Note: RTE_BBDEV_OP_TYPE_SIZE_MAX must be larger or equal to maximum enum value */
939 };
940 
942 enum {
943  RTE_BBDEV_DRV_ERROR,
944  RTE_BBDEV_DATA_ERROR,
945  RTE_BBDEV_CRC_ERROR,
946  RTE_BBDEV_SYNDROME_ERROR,
947  RTE_BBDEV_ENGINE_ERROR
948 };
949 
953  int status;
957  void *opaque_data;
958  union {
960  struct rte_bbdev_op_turbo_enc turbo_enc;
962  struct rte_bbdev_op_ldpc_enc ldpc_enc;
963  };
964 };
965 
969  int status;
973  void *opaque_data;
974  union {
976  struct rte_bbdev_op_turbo_dec turbo_dec;
978  struct rte_bbdev_op_ldpc_dec ldpc_dec;
979  };
980 };
981 
985  int status;
989  void *opaque_data;
991  struct rte_bbdev_op_fft fft;
992 };
993 
997  int status;
1003  struct rte_bbdev_op_mldts mldts;
1004 };
1005 
1008  enum rte_bbdev_op_type type;
1009  union {
1010  struct rte_bbdev_op_cap_turbo_dec turbo_dec;
1011  struct rte_bbdev_op_cap_turbo_enc turbo_enc;
1012  struct rte_bbdev_op_cap_ldpc_dec ldpc_dec;
1013  struct rte_bbdev_op_cap_ldpc_enc ldpc_enc;
1014  struct rte_bbdev_op_cap_fft fft;
1015  struct rte_bbdev_op_cap_mld mld;
1016  } cap;
1017 };
1018 
1020 struct rte_bbdev_op_pool_private {
1021  enum rte_bbdev_op_type type;
1022 };
1023 
1033 const char*
1035 
1056 struct rte_mempool *
1057 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
1058  unsigned int num_elements, unsigned int cache_size,
1059  int socket_id);
1060 
1075 static inline int
1077  struct rte_bbdev_enc_op **ops, unsigned int num_ops)
1078 {
1079  struct rte_bbdev_op_pool_private *priv;
1080 
1081  /* Check type */
1082  priv = (struct rte_bbdev_op_pool_private *)
1083  rte_mempool_get_priv(mempool);
1084  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_ENC) &&
1085  (priv->type != RTE_BBDEV_OP_LDPC_ENC)))
1086  return -EINVAL;
1087 
1088  /* Get elements */
1089  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1090 }
1091 
1106 static inline int
1108  struct rte_bbdev_dec_op **ops, unsigned int num_ops)
1109 {
1110  struct rte_bbdev_op_pool_private *priv;
1111 
1112  /* Check type */
1113  priv = (struct rte_bbdev_op_pool_private *)
1114  rte_mempool_get_priv(mempool);
1115  if (unlikely((priv->type != RTE_BBDEV_OP_TURBO_DEC) &&
1116  (priv->type != RTE_BBDEV_OP_LDPC_DEC)))
1117  return -EINVAL;
1118 
1119  /* Get elements */
1120  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1121 }
1122 
1137 static inline int
1139  struct rte_bbdev_fft_op **ops, unsigned int num_ops)
1140 {
1141  struct rte_bbdev_op_pool_private *priv;
1142 
1143  /* Check type */
1144  priv = (struct rte_bbdev_op_pool_private *)rte_mempool_get_priv(mempool);
1145  if (unlikely(priv->type != RTE_BBDEV_OP_FFT))
1146  return -EINVAL;
1147 
1148  /* Get elements */
1149  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1150 }
1151 
1166 static inline int
1168  struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
1169 {
1170  struct rte_bbdev_op_pool_private *priv;
1171 
1172  /* Check type */
1173  priv = (struct rte_bbdev_op_pool_private *)rte_mempool_get_priv(mempool);
1174  if (unlikely(priv->type != RTE_BBDEV_OP_MLDTS))
1175  return -EINVAL;
1176 
1177  /* Get elements */
1178  return rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
1179 }
1180 
1191 static inline void
1192 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
1193 {
1194  if (num_ops > 0)
1195  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1196 }
1197 
1208 static inline void
1209 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
1210 {
1211  if (num_ops > 0)
1212  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1213 }
1214 
1225 static inline void
1226 rte_bbdev_fft_op_free_bulk(struct rte_bbdev_fft_op **ops, unsigned int num_ops)
1227 {
1228  if (num_ops > 0)
1229  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1230 }
1231 
1242 static inline void
1243 rte_bbdev_mldts_op_free_bulk(struct rte_bbdev_mldts_op **ops, unsigned int num_ops)
1244 {
1245  if (num_ops > 0)
1246  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
1247 }
1248 
1249 #ifdef __cplusplus
1250 }
1251 #endif
1252 
1253 #endif /* _RTE_BBDEV_OP_H_ */
int8_t cs_time_adjustment
Definition: rte_bbdev_op.h:799
uint16_t fp16_exp_adjust
Definition: rte_bbdev_op.h:809
uint16_t power_shift
Definition: rte_bbdev_op.h:807
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
rte_bbdev_op_ldpcenc_flag_bitmasks
Definition: rte_bbdev_op.h:212
static int rte_bbdev_mldts_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
uint16_t input_sequence_size
Definition: rte_bbdev_op.h:781
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:793
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:930
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:67
int8_t freq_resample_mode
Definition: rte_bbdev_op.h:811
static void rte_bbdev_mldts_op_free_bulk(struct rte_bbdev_mldts_op **ops, unsigned int num_ops)
uint16_t output_sequence_size
Definition: rte_bbdev_op.h:785
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:783
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:987
#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:971
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1679
rte_bbdev_op_te_flag_bitmasks
Definition: rte_bbdev_op.h:137
struct rte_mbuf * data
Definition: rte_bbdev_op.h:304
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:999
uint16_t cs_bitmap
Definition: rte_bbdev_op.h:791
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:955
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:805
uint16_t output_leading_depadding
Definition: rte_bbdev_op.h:787
uint16_t output_depadded_size
Definition: rte_bbdev_op.h:813
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1861
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