DPDK 25.03.0-rc0
rte_bbdev.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_H_
6#define _RTE_BBDEV_H_
7
23#include <stdint.h>
24#include <stdbool.h>
25
26#include <rte_compat.h>
27#include <rte_cpuflags.h>
28
29#include "rte_bbdev_op.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#ifndef RTE_BBDEV_MAX_DEVS
36#define RTE_BBDEV_MAX_DEVS 128
37#endif
38
39/*
40 * Maximum size to be used to manage the enum rte_bbdev_enqueue_status
41 * including padding for future enum insertion.
42 * The enum values must be explicitly kept smaller or equal to this padded maximum size.
43 */
44#define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6
45
48 RTE_BBDEV_UNUSED,
49 RTE_BBDEV_INITIALIZED
50};
51
58uint16_t
60
70bool
71rte_bbdev_is_valid(uint16_t dev_id);
72
83uint16_t
84rte_bbdev_find_next(uint16_t dev_id);
85
87#define RTE_BBDEV_FOREACH(i) for (i = rte_bbdev_find_next(-1); \
88 i < RTE_BBDEV_MAX_DEVS; \
89 i = rte_bbdev_find_next(i))
90
112int
113rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id);
114
129int
130rte_bbdev_intr_enable(uint16_t dev_id);
131
134 int socket;
135 uint32_t queue_size;
136 uint8_t priority;
139};
140
158int
159rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
160 const struct rte_bbdev_queue_conf *conf);
161
173int
174rte_bbdev_start(uint16_t dev_id);
175
186int
187rte_bbdev_stop(uint16_t dev_id);
188
199int
200rte_bbdev_close(uint16_t dev_id);
201
216int
217rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
218
231int
232rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
233
247 /* Note: RTE_BBDEV_ENQ_STATUS_SIZE_MAX must be larger or equal to maximum enum value. */
248};
249
263};
264
267 uint64_t enqueued_count;
268 uint64_t dequeued_count;
278 uint64_t enqueue_status_count[RTE_BBDEV_ENQ_STATUS_SIZE_MAX];
288};
289
303int
304rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);
305
314int
315rte_bbdev_stats_reset(uint16_t dev_id);
316
319/* Structure rte_bbdev_driver_info 8< */
322 const char *driver_name;
323
325 unsigned int max_num_queues;
327 unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX];
329 unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX];
355 const enum rte_cpu_flag_t *cpu_flag_reqs;
358};
359/* >8 End of structure rte_bbdev_driver_info. */
360
362#define RTE_BBDEV_END_OF_CAPABILITIES_LIST() \
363 { RTE_BBDEV_OP_NONE }
364
370/* Structure rte_bbdev_info 8< */
373 const char *dev_name;
374 const struct rte_device *device;
375 uint16_t num_queues;
376 bool started;
378};
379/* >8 End of structure rte_bbdev_info. */
380
394int
395rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info);
396
403};
404
420int
421rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id,
422 struct rte_bbdev_queue_info *queue_info);
423
425struct rte_bbdev_queue_data {
426 void *queue_private;
427 struct rte_bbdev_queue_conf conf;
428 struct rte_bbdev_stats queue_stats;
429 enum rte_bbdev_enqueue_status enqueue_status;
430 bool started;
431};
432
434typedef uint16_t (*rte_bbdev_enqueue_enc_ops_t)(
435 struct rte_bbdev_queue_data *q_data,
436 struct rte_bbdev_enc_op **ops,
437 uint16_t num);
438
440typedef uint16_t (*rte_bbdev_enqueue_dec_ops_t)(
441 struct rte_bbdev_queue_data *q_data,
442 struct rte_bbdev_dec_op **ops,
443 uint16_t num);
444
446typedef uint16_t (*rte_bbdev_enqueue_fft_ops_t)(
447 struct rte_bbdev_queue_data *q_data,
448 struct rte_bbdev_fft_op **ops,
449 uint16_t num);
450
452typedef uint16_t (*rte_bbdev_enqueue_mldts_ops_t)(
453 struct rte_bbdev_queue_data *q_data,
454 struct rte_bbdev_mldts_op **ops,
455 uint16_t num);
456
458typedef uint16_t (*rte_bbdev_dequeue_enc_ops_t)(
459 struct rte_bbdev_queue_data *q_data,
460 struct rte_bbdev_enc_op **ops, uint16_t num);
461
463typedef uint16_t (*rte_bbdev_dequeue_dec_ops_t)(
464 struct rte_bbdev_queue_data *q_data,
465 struct rte_bbdev_dec_op **ops, uint16_t num);
466
468typedef uint16_t (*rte_bbdev_dequeue_fft_ops_t)(
469 struct rte_bbdev_queue_data *q_data,
470 struct rte_bbdev_fft_op **ops, uint16_t num);
471
473typedef uint16_t (*rte_bbdev_dequeue_mldts_ops_t)(
474 struct rte_bbdev_queue_data *q_data,
475 struct rte_bbdev_mldts_op **ops, uint16_t num);
476
477#define RTE_BBDEV_NAME_MAX_LEN 64
485struct rte_bbdev_data {
486 char name[RTE_BBDEV_NAME_MAX_LEN];
487 void *dev_private;
488 uint16_t num_queues;
489 struct rte_bbdev_queue_data *queues;
490 uint16_t dev_id;
491 int socket_id;
492 bool started;
493 RTE_ATOMIC(uint16_t) process_cnt;
494};
495
496/* Forward declarations */
497struct rte_bbdev_ops;
498struct rte_bbdev_callback;
499struct rte_intr_handle;
500
502RTE_TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback);
503
508struct __rte_cache_aligned rte_bbdev {
510 rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops;
512 rte_bbdev_enqueue_dec_ops_t enqueue_dec_ops;
514 rte_bbdev_dequeue_enc_ops_t dequeue_enc_ops;
516 rte_bbdev_dequeue_dec_ops_t dequeue_dec_ops;
518 rte_bbdev_enqueue_enc_ops_t enqueue_ldpc_enc_ops;
520 rte_bbdev_enqueue_dec_ops_t enqueue_ldpc_dec_ops;
522 rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops;
524 rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops;
526 rte_bbdev_enqueue_fft_ops_t enqueue_fft_ops;
528 rte_bbdev_dequeue_fft_ops_t dequeue_fft_ops;
529 const struct rte_bbdev_ops *dev_ops;
530 struct rte_bbdev_data *data;
531 enum rte_bbdev_state state;
532 struct rte_device *device;
534 struct rte_bbdev_cb_list list_cbs;
535 struct rte_intr_handle *intr_handle;
537 rte_bbdev_enqueue_mldts_ops_t enqueue_mldts_ops;
539 rte_bbdev_dequeue_mldts_ops_t dequeue_mldts_ops;
540};
541
543extern struct rte_bbdev rte_bbdev_devices[];
544
566static inline uint16_t
567rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id,
568 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
569{
570 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
571 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
572 return dev->enqueue_enc_ops(q_data, ops, num_ops);
573}
574
596static inline uint16_t
597rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
598 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
599{
600 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
601 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
602 return dev->enqueue_dec_ops(q_data, ops, num_ops);
603}
604
626static inline uint16_t
627rte_bbdev_enqueue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
628 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
629{
630 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
631 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
632 return dev->enqueue_ldpc_enc_ops(q_data, ops, num_ops);
633}
634
656static inline uint16_t
657rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
658 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
659{
660 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
661 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
662 return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops);
663}
664
686static inline uint16_t
687rte_bbdev_enqueue_fft_ops(uint16_t dev_id, uint16_t queue_id,
688 struct rte_bbdev_fft_op **ops, uint16_t num_ops)
689{
690 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
691 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
692 return dev->enqueue_fft_ops(q_data, ops, num_ops);
693}
694
716static inline uint16_t
717rte_bbdev_enqueue_mldts_ops(uint16_t dev_id, uint16_t queue_id,
718 struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
719{
720 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
721 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
722 return dev->enqueue_mldts_ops(q_data, ops, num_ops);
723}
724
747static inline uint16_t
748rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id,
749 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
750{
751 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
752 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
753 return dev->dequeue_enc_ops(q_data, ops, num_ops);
754}
755
779static inline uint16_t
780rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id,
781 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
782{
783 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
784 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
785 return dev->dequeue_dec_ops(q_data, ops, num_ops);
786}
787
788
810static inline uint16_t
811rte_bbdev_dequeue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
812 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
813{
814 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
815 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
816 return dev->dequeue_ldpc_enc_ops(q_data, ops, num_ops);
817}
818
840static inline uint16_t
841rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
842 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
843{
844 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
845 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
846 return dev->dequeue_ldpc_dec_ops(q_data, ops, num_ops);
847}
848
870static inline uint16_t
871rte_bbdev_dequeue_fft_ops(uint16_t dev_id, uint16_t queue_id,
872 struct rte_bbdev_fft_op **ops, uint16_t num_ops)
873{
874 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
875 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
876 return dev->dequeue_fft_ops(q_data, ops, num_ops);
877}
878
900static inline uint16_t
901rte_bbdev_dequeue_mldts_ops(uint16_t dev_id, uint16_t queue_id,
902 struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
903{
904 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
905 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
906 return dev->dequeue_mldts_ops(q_data, ops, num_ops);
907}
908
916
930typedef void (*rte_bbdev_cb_fn)(uint16_t dev_id,
931 enum rte_bbdev_event_type event, void *cb_arg,
932 void *ret_param);
933
951int
953 rte_bbdev_cb_fn cb_fn, void *cb_arg);
954
974int
976 rte_bbdev_cb_fn cb_fn, void *cb_arg);
977
994int
995rte_bbdev_queue_intr_enable(uint16_t dev_id, uint16_t queue_id);
996
1010int
1011rte_bbdev_queue_intr_disable(uint16_t dev_id, uint16_t queue_id);
1012
1037int
1038rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
1039 void *data);
1040
1050const char*
1052
1062const char*
1064
1084__rte_experimental
1085int
1086rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_index, FILE *file);
1087
1088
1108__rte_experimental
1109char *
1110rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len);
1111
1112#ifdef __cplusplus
1113}
1114#endif
1115
1116#endif /* _RTE_BBDEV_H_ */
int rte_bbdev_start(uint16_t dev_id)
rte_bbdev_device_status
Definition: rte_bbdev.h:253
@ RTE_BBDEV_DEV_FATAL_ERR
Definition: rte_bbdev.h:259
@ RTE_BBDEV_DEV_CORRECT_ERR
Definition: rte_bbdev.h:262
@ RTE_BBDEV_DEV_NOT_SUPPORTED
Definition: rte_bbdev.h:255
@ RTE_BBDEV_DEV_RECONFIG_REQ
Definition: rte_bbdev.h:261
@ RTE_BBDEV_DEV_CONFIGURED
Definition: rte_bbdev.h:257
@ RTE_BBDEV_DEV_RESTART_REQ
Definition: rte_bbdev.h:260
@ RTE_BBDEV_DEV_RESET
Definition: rte_bbdev.h:256
@ RTE_BBDEV_DEV_ACTIVE
Definition: rte_bbdev.h:258
@ RTE_BBDEV_DEV_NOSTATUS
Definition: rte_bbdev.h:254
int rte_bbdev_queue_intr_enable(uint16_t dev_id, uint16_t queue_id)
rte_bbdev_enqueue_status
Definition: rte_bbdev.h:242
@ RTE_BBDEV_ENQ_STATUS_INVALID_OP
Definition: rte_bbdev.h:246
@ RTE_BBDEV_ENQ_STATUS_RING_FULL
Definition: rte_bbdev.h:245
@ RTE_BBDEV_ENQ_STATUS_QUEUE_FULL
Definition: rte_bbdev.h:244
@ RTE_BBDEV_ENQ_STATUS_NONE
Definition: rte_bbdev.h:243
int rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
__rte_experimental int rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_index, FILE *file)
RTE_TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback)
static uint16_t rte_bbdev_dequeue_fft_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_fft_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:871
int rte_bbdev_callback_register(uint16_t dev_id, enum rte_bbdev_event_type event, rte_bbdev_cb_fn cb_fn, void *cb_arg)
static uint16_t rte_bbdev_dequeue_mldts_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:901
int rte_bbdev_stop(uint16_t dev_id)
int rte_bbdev_close(uint16_t dev_id)
rte_bbdev_state
Definition: rte_bbdev.h:47
uint16_t rte_bbdev_find_next(uint16_t dev_id)
__rte_experimental char * rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len)
static uint16_t rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_dec_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:841
static uint16_t rte_bbdev_enqueue_mldts_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:717
int rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info)
uint16_t rte_bbdev_count(void)
int rte_bbdev_stats_reset(uint16_t dev_id)
static uint16_t rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_enc_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:567
rte_bbdev_event_type
Definition: rte_bbdev.h:910
@ RTE_BBDEV_EVENT_ERROR
Definition: rte_bbdev.h:912
@ RTE_BBDEV_EVENT_DEQUEUE
Definition: rte_bbdev.h:913
@ RTE_BBDEV_EVENT_UNKNOWN
Definition: rte_bbdev.h:911
@ RTE_BBDEV_EVENT_MAX
Definition: rte_bbdev.h:914
int rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id, const struct rte_bbdev_queue_conf *conf)
const char * rte_bbdev_device_status_str(enum rte_bbdev_device_status status)
static uint16_t rte_bbdev_enqueue_fft_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_fft_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:687
void(* rte_bbdev_cb_fn)(uint16_t dev_id, enum rte_bbdev_event_type event, void *cb_arg, void *ret_param)
Definition: rte_bbdev.h:930
static uint16_t rte_bbdev_dequeue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_enc_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:811
int rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_queue_info *queue_info)
static uint16_t rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_dec_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:780
static uint16_t rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_enc_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:748
static uint16_t rte_bbdev_enqueue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_enc_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:627
bool rte_bbdev_is_valid(uint16_t dev_id)
int rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id)
const char * rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
static uint16_t rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_dec_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:657
int rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats)
int rte_bbdev_callback_unregister(uint16_t dev_id, enum rte_bbdev_event_type event, rte_bbdev_cb_fn cb_fn, void *cb_arg)
int rte_bbdev_intr_enable(uint16_t dev_id)
int rte_bbdev_queue_intr_disable(uint16_t dev_id, uint16_t queue_id)
int rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op, void *data)
static uint16_t rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_dec_op **ops, uint16_t num_ops)
Definition: rte_bbdev.h:597
int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id)
#define RTE_BBDEV_NAME_MAX_LEN
Definition: rte_bbdev.h:477
rte_bbdev_op_type
Definition: rte_bbdev_op.h:930
#define __rte_cache_aligned
Definition: rte_common.h:627
unsigned int max_num_queues
Definition: rte_bbdev.h:325
uint8_t max_dl_queue_priority
Definition: rte_bbdev.h:335
struct rte_bbdev_queue_conf default_queue_conf
Definition: rte_bbdev.h:351
unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX]
Definition: rte_bbdev.h:327
uint16_t min_alignment
Definition: rte_bbdev.h:345
unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX]
Definition: rte_bbdev.h:329
enum rte_cpu_flag_t * cpu_flag_reqs
Definition: rte_bbdev.h:355
uint32_t harq_buffer_size
Definition: rte_bbdev.h:343
const struct rte_bbdev_op_cap * capabilities
Definition: rte_bbdev.h:353
const char * driver_name
Definition: rte_bbdev.h:322
uint32_t queue_size_lim
Definition: rte_bbdev.h:331
enum rte_bbdev_device_status device_status
Definition: rte_bbdev.h:341
uint8_t max_ul_queue_priority
Definition: rte_bbdev.h:337
uint16_t * fft_window_width
Definition: rte_bbdev.h:357
struct rte_bbdev_driver_info drv
Definition: rte_bbdev.h:377
const char * dev_name
Definition: rte_bbdev.h:373
uint16_t num_queues
Definition: rte_bbdev.h:375
const struct rte_device * device
Definition: rte_bbdev.h:374
enum rte_bbdev_op_type op_type
Definition: rte_bbdev.h:138
struct rte_bbdev_queue_conf conf
Definition: rte_bbdev.h:400
uint64_t enqueue_status_count[RTE_BBDEV_ENQ_STATUS_SIZE_MAX]
Definition: rte_bbdev.h:278
uint64_t acc_offload_cycles
Definition: rte_bbdev.h:285
uint64_t enqueue_err_count
Definition: rte_bbdev.h:270
uint64_t enqueued_count
Definition: rte_bbdev.h:267
uint64_t enqueue_warn_count
Definition: rte_bbdev.h:274
uint64_t dequeue_err_count
Definition: rte_bbdev.h:272
uint16_t enqueue_depth_avail
Definition: rte_bbdev.h:287
uint64_t dequeued_count
Definition: rte_bbdev.h:268
uint64_t dequeue_warn_count
Definition: rte_bbdev.h:276