DPDK 22.11.7
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#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include <stdint.h>
28#include <stdbool.h>
29
30#include <rte_compat.h>
31#include <rte_cpuflags.h>
32
33#include "rte_bbdev_op.h"
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];
286};
287
301int
302rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);
303
312int
313rte_bbdev_stats_reset(uint16_t dev_id);
314
318 const char *driver_name;
319
321 unsigned int max_num_queues;
323 unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX];
325 unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX];
351 const enum rte_cpu_flag_t *cpu_flag_reqs;
352};
353
355#define RTE_BBDEV_END_OF_CAPABILITIES_LIST() \
356 { RTE_BBDEV_OP_NONE }
357
364 const char *dev_name;
365 const struct rte_device *device;
366 uint16_t num_queues;
367 bool started;
369};
370
384int
385rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info);
386
393};
394
410int
411rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id,
412 struct rte_bbdev_queue_info *queue_info);
413
415struct rte_bbdev_queue_data {
416 void *queue_private;
417 struct rte_bbdev_queue_conf conf;
418 struct rte_bbdev_stats queue_stats;
419 enum rte_bbdev_enqueue_status enqueue_status;
420 bool started;
421};
422
424typedef uint16_t (*rte_bbdev_enqueue_enc_ops_t)(
425 struct rte_bbdev_queue_data *q_data,
426 struct rte_bbdev_enc_op **ops,
427 uint16_t num);
428
430typedef uint16_t (*rte_bbdev_enqueue_dec_ops_t)(
431 struct rte_bbdev_queue_data *q_data,
432 struct rte_bbdev_dec_op **ops,
433 uint16_t num);
434
436typedef uint16_t (*rte_bbdev_enqueue_fft_ops_t)(
437 struct rte_bbdev_queue_data *q_data,
438 struct rte_bbdev_fft_op **ops,
439 uint16_t num);
440
442typedef uint16_t (*rte_bbdev_dequeue_enc_ops_t)(
443 struct rte_bbdev_queue_data *q_data,
444 struct rte_bbdev_enc_op **ops, uint16_t num);
445
447typedef uint16_t (*rte_bbdev_dequeue_dec_ops_t)(
448 struct rte_bbdev_queue_data *q_data,
449 struct rte_bbdev_dec_op **ops, uint16_t num);
450
452typedef uint16_t (*rte_bbdev_dequeue_fft_ops_t)(
453 struct rte_bbdev_queue_data *q_data,
454 struct rte_bbdev_fft_op **ops, uint16_t num);
455
456#define RTE_BBDEV_NAME_MAX_LEN 64
464struct rte_bbdev_data {
465 char name[RTE_BBDEV_NAME_MAX_LEN];
466 void *dev_private;
467 uint16_t num_queues;
468 struct rte_bbdev_queue_data *queues;
469 uint16_t dev_id;
470 int socket_id;
471 bool started;
472 uint16_t process_cnt;
473};
474
475/* Forward declarations */
476struct rte_bbdev_ops;
477struct rte_bbdev_callback;
478struct rte_intr_handle;
479
481RTE_TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback);
482
487struct __rte_cache_aligned rte_bbdev {
489 rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops;
491 rte_bbdev_enqueue_dec_ops_t enqueue_dec_ops;
493 rte_bbdev_dequeue_enc_ops_t dequeue_enc_ops;
495 rte_bbdev_dequeue_dec_ops_t dequeue_dec_ops;
497 rte_bbdev_enqueue_enc_ops_t enqueue_ldpc_enc_ops;
499 rte_bbdev_enqueue_dec_ops_t enqueue_ldpc_dec_ops;
501 rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops;
503 rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops;
505 rte_bbdev_enqueue_fft_ops_t enqueue_fft_ops;
507 rte_bbdev_dequeue_fft_ops_t dequeue_fft_ops;
508 const struct rte_bbdev_ops *dev_ops;
509 struct rte_bbdev_data *data;
510 enum rte_bbdev_state state;
511 struct rte_device *device;
513 struct rte_bbdev_cb_list list_cbs;
514 struct rte_intr_handle *intr_handle;
515};
516
518extern struct rte_bbdev rte_bbdev_devices[];
519
541static inline uint16_t
542rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id,
543 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
544{
545 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
546 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
547 return dev->enqueue_enc_ops(q_data, ops, num_ops);
548}
549
571static inline uint16_t
572rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
573 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
574{
575 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
576 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
577 return dev->enqueue_dec_ops(q_data, ops, num_ops);
578}
579
601static inline uint16_t
602rte_bbdev_enqueue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
603 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
604{
605 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
606 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
607 return dev->enqueue_ldpc_enc_ops(q_data, ops, num_ops);
608}
609
631static inline uint16_t
632rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
633 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
634{
635 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
636 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
637 return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops);
638}
639
661__rte_experimental
662static inline uint16_t
663rte_bbdev_enqueue_fft_ops(uint16_t dev_id, uint16_t queue_id,
664 struct rte_bbdev_fft_op **ops, uint16_t num_ops)
665{
666 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
667 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
668 return dev->enqueue_fft_ops(q_data, ops, num_ops);
669}
670
693static inline uint16_t
694rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id,
695 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
696{
697 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
698 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
699 return dev->dequeue_enc_ops(q_data, ops, num_ops);
700}
701
725static inline uint16_t
726rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id,
727 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
728{
729 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
730 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
731 return dev->dequeue_dec_ops(q_data, ops, num_ops);
732}
733
734
756static inline uint16_t
757rte_bbdev_dequeue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
758 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
759{
760 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
761 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
762 return dev->dequeue_ldpc_enc_ops(q_data, ops, num_ops);
763}
764
786static inline uint16_t
787rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
788 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
789{
790 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
791 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
792 return dev->dequeue_ldpc_dec_ops(q_data, ops, num_ops);
793}
794
816__rte_experimental
817static inline uint16_t
818rte_bbdev_dequeue_fft_ops(uint16_t dev_id, uint16_t queue_id,
819 struct rte_bbdev_fft_op **ops, uint16_t num_ops)
820{
821 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
822 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
823 return dev->dequeue_fft_ops(q_data, ops, num_ops);
824}
825
833
847typedef void (*rte_bbdev_cb_fn)(uint16_t dev_id,
848 enum rte_bbdev_event_type event, void *cb_arg,
849 void *ret_param);
850
868int
870 rte_bbdev_cb_fn cb_fn, void *cb_arg);
871
891int
893 rte_bbdev_cb_fn cb_fn, void *cb_arg);
894
911int
912rte_bbdev_queue_intr_enable(uint16_t dev_id, uint16_t queue_id);
913
927int
928rte_bbdev_queue_intr_disable(uint16_t dev_id, uint16_t queue_id);
929
954int
955rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
956 void *data);
957
968__rte_experimental
969const char*
971
982__rte_experimental
983const char*
985
986#ifdef __cplusplus
987}
988#endif
989
990#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
static __rte_experimental 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:818
int rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
RTE_TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback)
int rte_bbdev_callback_register(uint16_t dev_id, enum rte_bbdev_event_type event, rte_bbdev_cb_fn cb_fn, void *cb_arg)
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 const char * rte_bbdev_device_status_str(enum rte_bbdev_device_status status)
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:787
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:542
rte_bbdev_event_type
Definition: rte_bbdev.h:827
@ RTE_BBDEV_EVENT_ERROR
Definition: rte_bbdev.h:829
@ RTE_BBDEV_EVENT_DEQUEUE
Definition: rte_bbdev.h:830
@ RTE_BBDEV_EVENT_UNKNOWN
Definition: rte_bbdev.h:828
@ RTE_BBDEV_EVENT_MAX
Definition: rte_bbdev.h:831
int rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id, const struct rte_bbdev_queue_conf *conf)
__rte_experimental const char * rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
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:847
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:757
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:726
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:694
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:602
bool rte_bbdev_is_valid(uint16_t dev_id)
int rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id)
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:632
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)
static __rte_experimental 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:663
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:572
int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id)
#define RTE_BBDEV_NAME_MAX_LEN
Definition: rte_bbdev.h:456
rte_bbdev_op_type
Definition: rte_bbdev_op.h:852
#define __rte_cache_aligned
Definition: rte_common.h:440
void * dev_private
unsigned int max_num_queues
Definition: rte_bbdev.h:321
uint8_t max_dl_queue_priority
Definition: rte_bbdev.h:331
struct rte_bbdev_queue_conf default_queue_conf
Definition: rte_bbdev.h:347
unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX]
Definition: rte_bbdev.h:323
uint16_t min_alignment
Definition: rte_bbdev.h:341
unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX]
Definition: rte_bbdev.h:325
enum rte_cpu_flag_t * cpu_flag_reqs
Definition: rte_bbdev.h:351
uint32_t harq_buffer_size
Definition: rte_bbdev.h:339
const struct rte_bbdev_op_cap * capabilities
Definition: rte_bbdev.h:349
const char * driver_name
Definition: rte_bbdev.h:318
uint32_t queue_size_lim
Definition: rte_bbdev.h:327
enum rte_bbdev_device_status device_status
Definition: rte_bbdev.h:337
uint8_t max_ul_queue_priority
Definition: rte_bbdev.h:333
struct rte_bbdev_driver_info drv
Definition: rte_bbdev.h:368
const char * dev_name
Definition: rte_bbdev.h:364
uint16_t num_queues
Definition: rte_bbdev.h:366
const struct rte_device * device
Definition: rte_bbdev.h:365
enum rte_bbdev_op_type op_type
Definition: rte_bbdev.h:138
struct rte_bbdev_queue_conf conf
Definition: rte_bbdev.h:390
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
uint64_t dequeued_count
Definition: rte_bbdev.h:268
uint64_t dequeue_warn_count
Definition: rte_bbdev.h:276