DPDK 21.11.9
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#include <string.h>
30
31#include <rte_compat.h>
32#include <rte_bus.h>
33#include <rte_cpuflags.h>
34#include <rte_memory.h>
35
36#include "rte_bbdev_op.h"
37
38#ifndef RTE_BBDEV_MAX_DEVS
39#define RTE_BBDEV_MAX_DEVS 128
40#endif
41
44 RTE_BBDEV_UNUSED,
45 RTE_BBDEV_INITIALIZED
46};
47
54uint16_t
56
66bool
67rte_bbdev_is_valid(uint16_t dev_id);
68
79uint16_t
80rte_bbdev_find_next(uint16_t dev_id);
81
83#define RTE_BBDEV_FOREACH(i) for (i = rte_bbdev_find_next(-1); \
84 i < RTE_BBDEV_MAX_DEVS; \
85 i = rte_bbdev_find_next(i))
86
108int
109rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id);
110
125int
126rte_bbdev_intr_enable(uint16_t dev_id);
127
130 int socket;
131 uint32_t queue_size;
132 uint8_t priority;
135};
136
154int
155rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
156 const struct rte_bbdev_queue_conf *conf);
157
169int
170rte_bbdev_start(uint16_t dev_id);
171
182int
183rte_bbdev_stop(uint16_t dev_id);
184
195int
196rte_bbdev_close(uint16_t dev_id);
197
212int
213rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
214
227int
228rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
229
232 uint64_t enqueued_count;
233 uint64_t dequeued_count;
245};
246
260int
261rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);
262
271int
272rte_bbdev_stats_reset(uint16_t dev_id);
273
277 const char *driver_name;
278
280 unsigned int max_num_queues;
304 const enum rte_cpu_flag_t *cpu_flag_reqs;
305};
306
308#define RTE_BBDEV_END_OF_CAPABILITIES_LIST() \
309 { RTE_BBDEV_OP_NONE }
310
317 const char *dev_name;
318 const struct rte_device *device;
319 uint16_t num_queues;
320 bool started;
322};
323
337int
338rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info);
339
346};
347
363int
364rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id,
365 struct rte_bbdev_queue_info *queue_info);
366
368struct rte_bbdev_queue_data {
369 void *queue_private;
370 struct rte_bbdev_queue_conf conf;
371 struct rte_bbdev_stats queue_stats;
372 bool started;
373};
374
376typedef uint16_t (*rte_bbdev_enqueue_enc_ops_t)(
377 struct rte_bbdev_queue_data *q_data,
378 struct rte_bbdev_enc_op **ops,
379 uint16_t num);
380
382typedef uint16_t (*rte_bbdev_enqueue_dec_ops_t)(
383 struct rte_bbdev_queue_data *q_data,
384 struct rte_bbdev_dec_op **ops,
385 uint16_t num);
386
388typedef uint16_t (*rte_bbdev_dequeue_enc_ops_t)(
389 struct rte_bbdev_queue_data *q_data,
390 struct rte_bbdev_enc_op **ops, uint16_t num);
391
393typedef uint16_t (*rte_bbdev_dequeue_dec_ops_t)(
394 struct rte_bbdev_queue_data *q_data,
395 struct rte_bbdev_dec_op **ops, uint16_t num);
396
397#define RTE_BBDEV_NAME_MAX_LEN 64
405struct rte_bbdev_data {
406 char name[RTE_BBDEV_NAME_MAX_LEN];
407 void *dev_private;
408 uint16_t num_queues;
409 struct rte_bbdev_queue_data *queues;
410 uint16_t dev_id;
411 int socket_id;
412 bool started;
413 uint16_t process_cnt;
414};
415
416/* Forward declarations */
417struct rte_bbdev_ops;
418struct rte_bbdev_callback;
419struct rte_intr_handle;
420
422RTE_TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback);
423
428struct __rte_cache_aligned rte_bbdev {
430 rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops;
432 rte_bbdev_enqueue_dec_ops_t enqueue_dec_ops;
434 rte_bbdev_dequeue_enc_ops_t dequeue_enc_ops;
436 rte_bbdev_dequeue_dec_ops_t dequeue_dec_ops;
438 rte_bbdev_enqueue_enc_ops_t enqueue_ldpc_enc_ops;
440 rte_bbdev_enqueue_dec_ops_t enqueue_ldpc_dec_ops;
442 rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops;
444 rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops;
445 const struct rte_bbdev_ops *dev_ops;
446 struct rte_bbdev_data *data;
447 enum rte_bbdev_state state;
448 struct rte_device *device;
450 struct rte_bbdev_cb_list list_cbs;
451 struct rte_intr_handle *intr_handle;
452};
453
455extern struct rte_bbdev rte_bbdev_devices[];
456
478static inline uint16_t
479rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id,
480 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
481{
482 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
483 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
484 return dev->enqueue_enc_ops(q_data, ops, num_ops);
485}
486
508static inline uint16_t
509rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
510 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
511{
512 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
513 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
514 return dev->enqueue_dec_ops(q_data, ops, num_ops);
515}
516
538static inline uint16_t
539rte_bbdev_enqueue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
540 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
541{
542 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
543 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
544 return dev->enqueue_ldpc_enc_ops(q_data, ops, num_ops);
545}
546
568static inline uint16_t
569rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
570 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
571{
572 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
573 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
574 return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops);
575}
576
577
600static inline uint16_t
601rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id,
602 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
603{
604 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
605 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
606 return dev->dequeue_enc_ops(q_data, ops, num_ops);
607}
608
632static inline uint16_t
633rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id,
634 struct rte_bbdev_dec_op **ops, uint16_t num_ops)
635{
636 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
637 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
638 return dev->dequeue_dec_ops(q_data, ops, num_ops);
639}
640
641
663static inline uint16_t
664rte_bbdev_dequeue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
665 struct rte_bbdev_enc_op **ops, uint16_t num_ops)
666{
667 struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
668 struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
669 return dev->dequeue_ldpc_enc_ops(q_data, ops, num_ops);
670}
671
693static inline uint16_t
694rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
695 struct rte_bbdev_dec_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_ldpc_dec_ops(q_data, ops, num_ops);
700}
701
709
723typedef void (*rte_bbdev_cb_fn)(uint16_t dev_id,
724 enum rte_bbdev_event_type event, void *cb_arg,
725 void *ret_param);
726
744int
746 rte_bbdev_cb_fn cb_fn, void *cb_arg);
747
767int
769 rte_bbdev_cb_fn cb_fn, void *cb_arg);
770
787int
788rte_bbdev_queue_intr_enable(uint16_t dev_id, uint16_t queue_id);
789
803int
804rte_bbdev_queue_intr_disable(uint16_t dev_id, uint16_t queue_id);
805
830int
831rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
832 void *data);
833
834#ifdef __cplusplus
835}
836#endif
837
838#endif /* _RTE_BBDEV_H_ */
int rte_bbdev_start(uint16_t dev_id)
int rte_bbdev_queue_intr_enable(uint16_t dev_id, uint16_t queue_id)
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:43
uint16_t rte_bbdev_find_next(uint16_t dev_id)
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:694
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:479
rte_bbdev_event_type
Definition: rte_bbdev.h:703
@ RTE_BBDEV_EVENT_ERROR
Definition: rte_bbdev.h:705
@ RTE_BBDEV_EVENT_DEQUEUE
Definition: rte_bbdev.h:706
@ RTE_BBDEV_EVENT_UNKNOWN
Definition: rte_bbdev.h:704
@ RTE_BBDEV_EVENT_MAX
Definition: rte_bbdev.h:707
int rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id, const struct rte_bbdev_queue_conf *conf)
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:723
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:664
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:633
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:601
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:539
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:569
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:509
int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id)
#define RTE_BBDEV_NAME_MAX_LEN
Definition: rte_bbdev.h:397
rte_bbdev_op_type
Definition: rte_bbdev_op.h:745
#define __rte_cache_aligned
Definition: rte_common.h:420
void * dev_private
unsigned int max_num_queues
Definition: rte_bbdev.h:280
uint8_t max_dl_queue_priority
Definition: rte_bbdev.h:286
struct rte_bbdev_queue_conf default_queue_conf
Definition: rte_bbdev.h:300
uint16_t min_alignment
Definition: rte_bbdev.h:292
enum rte_cpu_flag_t * cpu_flag_reqs
Definition: rte_bbdev.h:304
uint32_t harq_buffer_size
Definition: rte_bbdev.h:294
const struct rte_bbdev_op_cap * capabilities
Definition: rte_bbdev.h:302
const char * driver_name
Definition: rte_bbdev.h:277
uint32_t queue_size_lim
Definition: rte_bbdev.h:282
uint8_t max_ul_queue_priority
Definition: rte_bbdev.h:288
struct rte_bbdev_driver_info drv
Definition: rte_bbdev.h:321
const char * dev_name
Definition: rte_bbdev.h:317
uint16_t num_queues
Definition: rte_bbdev.h:319
const struct rte_device * device
Definition: rte_bbdev.h:318
enum rte_bbdev_op_type op_type
Definition: rte_bbdev.h:134
struct rte_bbdev_queue_conf conf
Definition: rte_bbdev.h:343
uint64_t acc_offload_cycles
Definition: rte_bbdev.h:244
uint64_t enqueue_err_count
Definition: rte_bbdev.h:235
uint64_t enqueued_count
Definition: rte_bbdev.h:232
uint64_t dequeue_err_count
Definition: rte_bbdev.h:237
uint64_t dequeued_count
Definition: rte_bbdev.h:233