DPDK  19.08.0-rc0
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_C_SUBBLOCK (32)
30 /* Maximum size of Transport Block (36.213, Table, Table 7.1.7.2.5-1) */
31 #define RTE_BBDEV_MAX_TB_SIZE (391656)
32 /* Maximum size of Code Block (36.212, Table 5.1.3-3) */
33 #define RTE_BBDEV_MAX_CB_SIZE (6144)
34 /* Minimum size of Code Block (36.212, Table 5.1.3-3) */
35 #define RTE_BBDEV_MIN_CB_SIZE (40)
36 /* Maximum size of circular buffer */
37 #define RTE_BBDEV_MAX_KW (18528)
38 /*
39  * Maximum number of Code Blocks in Transport Block. It is calculated based on
40  * maximum size of one Code Block and one Transport Block (considering CRC24A
41  * and CRC24B):
42  * (391656 + 24) / (6144 - 24) = 64
43  */
44 #define RTE_BBDEV_MAX_CODE_BLOCKS (64)
45 
103  RTE_BBDEV_TURBO_MAP_DEC = (1ULL << 14),
109  RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP = (1ULL << 16)
110 };
111 
125  RTE_BBDEV_TURBO_ENC_SCATTER_GATHER = (1ULL << 5)
126 };
127 
129 struct rte_bbdev_op_data {
159  struct rte_mbuf *data;
167  uint32_t offset;
180  uint32_t length;
181 };
182 
183 struct rte_bbdev_op_dec_cb_params {
189  uint16_t k;
193  uint32_t e;
194 };
195 
200  uint16_t k_neg;
204  uint16_t k_pos;
206  uint8_t c_neg;
208  uint8_t c;
210  uint8_t cab;
214  uint32_t ea;
218  uint32_t eb;
220  uint8_t r;
221 };
222 
251 struct rte_bbdev_op_turbo_dec {
253  struct rte_bbdev_op_data input;
257  struct rte_bbdev_op_data hard_output;
259  struct rte_bbdev_op_data soft_output;
260 
261  uint32_t op_flags;
262  uint8_t rv_index;
266  uint8_t iter_min:4;
270  uint8_t iter_max:4;
274  uint8_t iter_count;
276  uint8_t ext_scale;
280  uint8_t num_maps;
281 
282  uint8_t code_block_mode;
283  union {
285  struct rte_bbdev_op_dec_cb_params cb_params;
287  struct rte_bbdev_op_dec_tb_params tb_params;
288  };
289 };
290 
291 struct rte_bbdev_op_enc_cb_params {
297  uint16_t k;
301  uint32_t e;
305  uint16_t ncb;
306 };
307 
314  uint16_t k_neg;
320  uint16_t k_pos;
322  uint8_t c_neg;
324  uint8_t c;
326  uint8_t cab;
330  uint32_t ea;
334  uint32_t eb;
338  uint16_t ncb_neg;
342  uint16_t ncb_pos;
344  uint8_t r;
345 };
346 
368  struct rte_bbdev_op_data input;
370  struct rte_bbdev_op_data output;
371 
372  uint32_t op_flags;
373  uint8_t rv_index;
375  uint8_t code_block_mode;
376  union {
378  struct rte_bbdev_op_enc_cb_params cb_params;
380  struct rte_bbdev_op_enc_tb_params tb_params;
381  };
382 };
383 
392  uint8_t num_buffers_src;
396  uint8_t num_buffers_soft_out;
397 };
398 
400 struct rte_bbdev_op_cap_turbo_enc {
402  uint32_t capability_flags;
403  uint8_t num_buffers_src;
404  uint8_t num_buffers_dst;
405 };
406 
413 };
414 
416 enum {
417  RTE_BBDEV_DRV_ERROR,
418  RTE_BBDEV_DATA_ERROR,
419  RTE_BBDEV_CRC_ERROR,
420 };
421 
424  int status;
426  void *opaque_data;
428  struct rte_bbdev_op_turbo_enc turbo_enc;
429 };
430 
433  int status;
435  void *opaque_data;
437  struct rte_bbdev_op_turbo_dec turbo_dec;
438 };
439 
441 struct rte_bbdev_op_cap {
442  enum rte_bbdev_op_type type;
443  union {
444  struct rte_bbdev_op_cap_turbo_dec turbo_dec;
445  struct rte_bbdev_op_cap_turbo_enc turbo_enc;
446  } cap;
447 };
448 
450 struct rte_bbdev_op_pool_private {
451  enum rte_bbdev_op_type type;
452 };
453 
464 const char* __rte_experimental
466 
487 struct rte_mempool * __rte_experimental
488 rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
489  unsigned int num_elements, unsigned int cache_size,
490  int socket_id);
491 
506 static inline int __rte_experimental
508  struct rte_bbdev_enc_op **ops, uint16_t num_ops)
509 {
510  struct rte_bbdev_op_pool_private *priv;
511  int ret;
512 
513  /* Check type */
514  priv = (struct rte_bbdev_op_pool_private *)
515  rte_mempool_get_priv(mempool);
516  if (unlikely(priv->type != RTE_BBDEV_OP_TURBO_ENC))
517  return -EINVAL;
518 
519  /* Get elements */
520  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
521  if (unlikely(ret < 0))
522  return ret;
523 
524  return 0;
525 }
526 
541 static inline int __rte_experimental
543  struct rte_bbdev_dec_op **ops, uint16_t num_ops)
544 {
545  struct rte_bbdev_op_pool_private *priv;
546  int ret;
547 
548  /* Check type */
549  priv = (struct rte_bbdev_op_pool_private *)
550  rte_mempool_get_priv(mempool);
551  if (unlikely(priv->type != RTE_BBDEV_OP_TURBO_DEC))
552  return -EINVAL;
553 
554  /* Get elements */
555  ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops);
556  if (unlikely(ret < 0))
557  return ret;
558 
559  return 0;
560 }
561 
572 static inline void __rte_experimental
573 rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
574 {
575  if (num_ops > 0)
576  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
577 }
578 
589 static inline void __rte_experimental
590 rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
591 {
592  if (num_ops > 0)
593  rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops);
594 }
595 
596 #ifdef __cplusplus
597 }
598 #endif
599 
600 #endif /* _RTE_BBDEV_OP_H_ */
static void __rte_experimental rte_bbdev_dec_op_free_bulk(struct rte_bbdev_dec_op **ops, unsigned int num_ops)
Definition: rte_bbdev_op.h:573
struct rte_bbdev_op_enc_cb_params cb_params
Definition: rte_bbdev_op.h:378
static __rte_always_inline void rte_mempool_put_bulk(struct rte_mempool *mp, void *const *obj_table, unsigned int n)
Definition: rte_mempool.h:1302
rte_bbdev_op_type
Definition: rte_bbdev_op.h:408
rte_bbdev_op_td_flag_bitmasks
Definition: rte_bbdev_op.h:47
static void __rte_experimental rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops)
Definition: rte_bbdev_op.h:590
uint32_t cache_size
Definition: rte_mempool.h:230
#define unlikely(x)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:434
static __rte_always_inline int rte_mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned int n)
Definition: rte_mempool.h:1454
rte_bbdev_op_te_flag_bitmasks
Definition: rte_bbdev_op.h:113
const char *__rte_experimental rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
struct rte_mempool * mempool
Definition: rte_bbdev_op.h:425
static int __rte_experimental 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:507
struct rte_mempool *__rte_experimental 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)
static int __rte_experimental 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:542
static void * rte_mempool_get_priv(struct rte_mempool *mp)
Definition: rte_mempool.h:1636
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_mempool.h:219
struct rte_bbdev_op_data input
Definition: rte_bbdev_op.h:368