xref: /dpdk/lib/bbdev/rte_bbdev.h (revision 353e3639d458f5cdaf3d938aade25579fa490b1b)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 2017 Intel Corporation
399a2dd95SBruce Richardson  */
499a2dd95SBruce Richardson 
599a2dd95SBruce Richardson #ifndef _RTE_BBDEV_H_
699a2dd95SBruce Richardson #define _RTE_BBDEV_H_
799a2dd95SBruce Richardson 
899a2dd95SBruce Richardson /**
999a2dd95SBruce Richardson  * @file rte_bbdev.h
1099a2dd95SBruce Richardson  *
1199a2dd95SBruce Richardson  * Wireless base band device abstraction APIs.
1299a2dd95SBruce Richardson  *
1399a2dd95SBruce Richardson  * This API allows an application to discover, configure and use a device to
1499a2dd95SBruce Richardson  * process operations. An asynchronous API (enqueue, followed by later dequeue)
1599a2dd95SBruce Richardson  * is used for processing operations.
1699a2dd95SBruce Richardson  *
1799a2dd95SBruce Richardson  * The functions in this API are not thread-safe when called on the same
1899a2dd95SBruce Richardson  * target object (a device, or a queue on a device), with the exception that
1999a2dd95SBruce Richardson  * one thread can enqueue operations to a queue while another thread dequeues
2099a2dd95SBruce Richardson  * from the same queue.
2199a2dd95SBruce Richardson  */
2299a2dd95SBruce Richardson 
2399a2dd95SBruce Richardson #include <stdint.h>
2499a2dd95SBruce Richardson #include <stdbool.h>
2599a2dd95SBruce Richardson 
261094dd94SDavid Marchand #include <rte_compat.h>
2799a2dd95SBruce Richardson #include <rte_cpuflags.h>
2899a2dd95SBruce Richardson 
2999a2dd95SBruce Richardson #include "rte_bbdev_op.h"
3099a2dd95SBruce Richardson 
31719834a6SMattias Rönnblom #ifdef __cplusplus
32719834a6SMattias Rönnblom extern "C" {
33719834a6SMattias Rönnblom #endif
34719834a6SMattias Rönnblom 
3599a2dd95SBruce Richardson #ifndef RTE_BBDEV_MAX_DEVS
3699a2dd95SBruce Richardson #define RTE_BBDEV_MAX_DEVS 128  /**< Max number of devices */
3799a2dd95SBruce Richardson #endif
3899a2dd95SBruce Richardson 
394f08028cSNicolas Chautru /*
404f08028cSNicolas Chautru  * Maximum size to be used to manage the enum rte_bbdev_enqueue_status
414f08028cSNicolas Chautru  * including padding for future enum insertion.
424f08028cSNicolas Chautru  * The enum values must be explicitly kept smaller or equal to this padded maximum size.
434f08028cSNicolas Chautru  */
444f08028cSNicolas Chautru #define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6
454f08028cSNicolas Chautru 
4699a2dd95SBruce Richardson /** Flags indicate current state of BBDEV device */
4799a2dd95SBruce Richardson enum rte_bbdev_state {
4899a2dd95SBruce Richardson 	RTE_BBDEV_UNUSED,
4999a2dd95SBruce Richardson 	RTE_BBDEV_INITIALIZED
5099a2dd95SBruce Richardson };
5199a2dd95SBruce Richardson 
5299a2dd95SBruce Richardson /**
5399a2dd95SBruce Richardson  * Get the total number of devices that have been successfully initialised.
5499a2dd95SBruce Richardson  *
5599a2dd95SBruce Richardson  * @return
5699a2dd95SBruce Richardson  *   The total number of usable devices.
5799a2dd95SBruce Richardson  */
5899a2dd95SBruce Richardson uint16_t
5999a2dd95SBruce Richardson rte_bbdev_count(void);
6099a2dd95SBruce Richardson 
6199a2dd95SBruce Richardson /**
6299a2dd95SBruce Richardson  * Check if a device is valid.
6399a2dd95SBruce Richardson  *
6499a2dd95SBruce Richardson  * @param dev_id
6599a2dd95SBruce Richardson  *   The identifier of the device.
6699a2dd95SBruce Richardson  *
6799a2dd95SBruce Richardson  * @return
6899a2dd95SBruce Richardson  *   true if device ID is valid and device is attached, false otherwise.
6999a2dd95SBruce Richardson  */
7099a2dd95SBruce Richardson bool
7199a2dd95SBruce Richardson rte_bbdev_is_valid(uint16_t dev_id);
7299a2dd95SBruce Richardson 
7399a2dd95SBruce Richardson /**
7499a2dd95SBruce Richardson  * Get the next enabled device.
7599a2dd95SBruce Richardson  *
7699a2dd95SBruce Richardson  * @param dev_id
7799a2dd95SBruce Richardson  *   The current device
7899a2dd95SBruce Richardson  *
7999a2dd95SBruce Richardson  * @return
8099a2dd95SBruce Richardson  *   - The next device, or
8199a2dd95SBruce Richardson  *   - RTE_BBDEV_MAX_DEVS if none found
8299a2dd95SBruce Richardson  */
8399a2dd95SBruce Richardson uint16_t
8499a2dd95SBruce Richardson rte_bbdev_find_next(uint16_t dev_id);
8599a2dd95SBruce Richardson 
8699a2dd95SBruce Richardson /** Iterate through all enabled devices */
8799a2dd95SBruce Richardson #define RTE_BBDEV_FOREACH(i) for (i = rte_bbdev_find_next(-1); \
8899a2dd95SBruce Richardson 		i < RTE_BBDEV_MAX_DEVS; \
8999a2dd95SBruce Richardson 		i = rte_bbdev_find_next(i))
9099a2dd95SBruce Richardson 
9199a2dd95SBruce Richardson /**
9299a2dd95SBruce Richardson  * Setup up device queues.
9399a2dd95SBruce Richardson  * This function must be called on a device before setting up the queues and
9499a2dd95SBruce Richardson  * starting the device. It can also be called when a device is in the stopped
9599a2dd95SBruce Richardson  * state. If any device queues have been configured their configuration will be
9699a2dd95SBruce Richardson  * cleared by a call to this function.
9799a2dd95SBruce Richardson  *
9899a2dd95SBruce Richardson  * @param dev_id
9999a2dd95SBruce Richardson  *   The identifier of the device.
10099a2dd95SBruce Richardson  * @param num_queues
10199a2dd95SBruce Richardson  *   Number of queues to configure on device.
10299a2dd95SBruce Richardson  * @param socket_id
10399a2dd95SBruce Richardson  *   ID of a socket which will be used to allocate memory.
10499a2dd95SBruce Richardson  *
10599a2dd95SBruce Richardson  * @return
10699a2dd95SBruce Richardson  *   - 0 on success
10799a2dd95SBruce Richardson  *   - -ENODEV if dev_id is invalid or the device is corrupted
10899a2dd95SBruce Richardson  *   - -EINVAL if num_queues is invalid, 0 or greater than maximum
10999a2dd95SBruce Richardson  *   - -EBUSY if the identified device has already started
11099a2dd95SBruce Richardson  *   - -ENOMEM if unable to allocate memory
11199a2dd95SBruce Richardson  */
11299a2dd95SBruce Richardson int
11399a2dd95SBruce Richardson rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id);
11499a2dd95SBruce Richardson 
11599a2dd95SBruce Richardson /**
11699a2dd95SBruce Richardson  * Enable interrupts.
11799a2dd95SBruce Richardson  * This function may be called before starting the device to enable the
11899a2dd95SBruce Richardson  * interrupts if they are available.
11999a2dd95SBruce Richardson  *
12099a2dd95SBruce Richardson  * @param dev_id
12199a2dd95SBruce Richardson  *   The identifier of the device.
12299a2dd95SBruce Richardson  *
12399a2dd95SBruce Richardson  * @return
12499a2dd95SBruce Richardson  *   - 0 on success
12599a2dd95SBruce Richardson  *   - -ENODEV if dev_id is invalid or the device is corrupted
12699a2dd95SBruce Richardson  *   - -EBUSY if the identified device has already started
12799a2dd95SBruce Richardson  *   - -ENOTSUP if the interrupts are not supported by the device
12899a2dd95SBruce Richardson  */
12999a2dd95SBruce Richardson int
13099a2dd95SBruce Richardson rte_bbdev_intr_enable(uint16_t dev_id);
13199a2dd95SBruce Richardson 
13299a2dd95SBruce Richardson /** Device queue configuration structure */
13399a2dd95SBruce Richardson struct rte_bbdev_queue_conf {
13499a2dd95SBruce Richardson 	int socket;  /**< NUMA socket used for memory allocation */
13599a2dd95SBruce Richardson 	uint32_t queue_size;  /**< Size of queue */
13699a2dd95SBruce Richardson 	uint8_t priority;  /**< Queue priority */
13799a2dd95SBruce Richardson 	bool deferred_start; /**< Do not start queue when device is started. */
13899a2dd95SBruce Richardson 	enum rte_bbdev_op_type op_type; /**< Operation type */
13999a2dd95SBruce Richardson };
14099a2dd95SBruce Richardson 
14199a2dd95SBruce Richardson /**
14299a2dd95SBruce Richardson  * Configure a queue on a device.
14399a2dd95SBruce Richardson  * This function can be called after device configuration, and before starting.
14499a2dd95SBruce Richardson  * It can also be called when the device or the queue is in the stopped state.
14599a2dd95SBruce Richardson  *
14699a2dd95SBruce Richardson  * @param dev_id
14799a2dd95SBruce Richardson  *   The identifier of the device.
14899a2dd95SBruce Richardson  * @param queue_id
14999a2dd95SBruce Richardson  *   The index of the queue.
15099a2dd95SBruce Richardson  * @param conf
15199a2dd95SBruce Richardson  *   The queue configuration. If NULL, a default configuration will be used.
15299a2dd95SBruce Richardson  *
15399a2dd95SBruce Richardson  * @return
15499a2dd95SBruce Richardson  *   - 0 on success
15599a2dd95SBruce Richardson  *   - EINVAL if the identified queue size or priority are invalid
15699a2dd95SBruce Richardson  *   - EBUSY if the identified queue or its device have already started
15799a2dd95SBruce Richardson  */
15899a2dd95SBruce Richardson int
15999a2dd95SBruce Richardson rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
16099a2dd95SBruce Richardson 		const struct rte_bbdev_queue_conf *conf);
16199a2dd95SBruce Richardson 
16299a2dd95SBruce Richardson /**
16399a2dd95SBruce Richardson  * Start a device.
16499a2dd95SBruce Richardson  * This is the last step needed before enqueueing operations is possible.
16599a2dd95SBruce Richardson  *
16699a2dd95SBruce Richardson  * @param dev_id
16799a2dd95SBruce Richardson  *   The identifier of the device.
16899a2dd95SBruce Richardson  *
16999a2dd95SBruce Richardson  * @return
17099a2dd95SBruce Richardson  *   - 0 on success
171f8dbaebbSSean Morrissey  *   - negative value on failure - as returned from PMD
17299a2dd95SBruce Richardson  */
17399a2dd95SBruce Richardson int
17499a2dd95SBruce Richardson rte_bbdev_start(uint16_t dev_id);
17599a2dd95SBruce Richardson 
17699a2dd95SBruce Richardson /**
17799a2dd95SBruce Richardson  * Stop a device.
17899a2dd95SBruce Richardson  * The device can be reconfigured, and restarted after being stopped.
17999a2dd95SBruce Richardson  *
18099a2dd95SBruce Richardson  * @param dev_id
18199a2dd95SBruce Richardson  *   The identifier of the device.
18299a2dd95SBruce Richardson  *
18399a2dd95SBruce Richardson  * @return
18499a2dd95SBruce Richardson  *   - 0 on success
18599a2dd95SBruce Richardson  */
18699a2dd95SBruce Richardson int
18799a2dd95SBruce Richardson rte_bbdev_stop(uint16_t dev_id);
18899a2dd95SBruce Richardson 
18999a2dd95SBruce Richardson /**
19099a2dd95SBruce Richardson  * Close a device.
19199a2dd95SBruce Richardson  * The device cannot be restarted without reconfiguration!
19299a2dd95SBruce Richardson  *
19399a2dd95SBruce Richardson  * @param dev_id
19499a2dd95SBruce Richardson  *   The identifier of the device.
19599a2dd95SBruce Richardson  *
19699a2dd95SBruce Richardson  * @return
19799a2dd95SBruce Richardson  *   - 0 on success
19899a2dd95SBruce Richardson  */
19999a2dd95SBruce Richardson int
20099a2dd95SBruce Richardson rte_bbdev_close(uint16_t dev_id);
20199a2dd95SBruce Richardson 
20299a2dd95SBruce Richardson /**
20399a2dd95SBruce Richardson  * Start a specified queue on a device.
20499a2dd95SBruce Richardson  * This is only needed if the queue has been stopped, or if the deferred_start
20599a2dd95SBruce Richardson  * flag has been set when configuring the queue.
20699a2dd95SBruce Richardson  *
20799a2dd95SBruce Richardson  * @param dev_id
20899a2dd95SBruce Richardson  *   The identifier of the device.
20999a2dd95SBruce Richardson  * @param queue_id
21099a2dd95SBruce Richardson  *   The index of the queue.
21199a2dd95SBruce Richardson  *
21299a2dd95SBruce Richardson  * @return
21399a2dd95SBruce Richardson  *   - 0 on success
214f8dbaebbSSean Morrissey  *   - negative value on failure - as returned from PMD
21599a2dd95SBruce Richardson  */
21699a2dd95SBruce Richardson int
21799a2dd95SBruce Richardson rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
21899a2dd95SBruce Richardson 
21999a2dd95SBruce Richardson /**
22099a2dd95SBruce Richardson  * Stop a specified queue on a device, to allow re configuration.
22199a2dd95SBruce Richardson  *
22299a2dd95SBruce Richardson  * @param dev_id
22399a2dd95SBruce Richardson  *   The identifier of the device.
22499a2dd95SBruce Richardson  * @param queue_id
22599a2dd95SBruce Richardson  *   The index of the queue.
22699a2dd95SBruce Richardson  *
22799a2dd95SBruce Richardson  * @return
22899a2dd95SBruce Richardson  *   - 0 on success
229f8dbaebbSSean Morrissey  *   - negative value on failure - as returned from PMD
23099a2dd95SBruce Richardson  */
23199a2dd95SBruce Richardson int
23299a2dd95SBruce Richardson rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
23399a2dd95SBruce Richardson 
2341be86f2eSNicolas Chautru /**
2354f08028cSNicolas Chautru  * Flags to indicate the reason why a previous enqueue may not have
2364f08028cSNicolas Chautru  * consumed all requested operations.
2374f08028cSNicolas Chautru  * In case of multiple reasons the latter supersedes a previous one.
2384f08028cSNicolas Chautru  * The related macro RTE_BBDEV_ENQ_STATUS_SIZE_MAX can be used
2394f08028cSNicolas Chautru  * as an absolute maximum for notably sizing array
2404f08028cSNicolas Chautru  * while allowing for future enumeration insertion.
2414f08028cSNicolas Chautru  */
2424f08028cSNicolas Chautru enum rte_bbdev_enqueue_status {
2434f08028cSNicolas Chautru 	RTE_BBDEV_ENQ_STATUS_NONE,             /**< Nothing to report. */
2444f08028cSNicolas Chautru 	RTE_BBDEV_ENQ_STATUS_QUEUE_FULL,       /**< Not enough room in queue. */
2454f08028cSNicolas Chautru 	RTE_BBDEV_ENQ_STATUS_RING_FULL,        /**< Not enough room in ring. */
2464f08028cSNicolas Chautru 	RTE_BBDEV_ENQ_STATUS_INVALID_OP,       /**< Operation was rejected as invalid. */
2474f08028cSNicolas Chautru 	/* Note: RTE_BBDEV_ENQ_STATUS_SIZE_MAX must be larger or equal to maximum enum value. */
2484f08028cSNicolas Chautru };
2494f08028cSNicolas Chautru 
2504f08028cSNicolas Chautru /**
2511be86f2eSNicolas Chautru  * Flags to indicate the status of the device.
2521be86f2eSNicolas Chautru  */
2531be86f2eSNicolas Chautru enum rte_bbdev_device_status {
2541be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_NOSTATUS,        /**< Nothing being reported. */
2551be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_NOT_SUPPORTED,   /**< Device status is not supported on the PMD. */
2561be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_RESET,           /**< Device in reset and un-configured state. */
2571be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_CONFIGURED,      /**< Device is configured and ready to use. */
2581be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_ACTIVE,          /**< Device is configured and VF is being used. */
2591be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_FATAL_ERR,       /**< Device has hit a fatal uncorrectable error. */
2601be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_RESTART_REQ,     /**< Device requires application to restart. */
2611be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_RECONFIG_REQ,    /**< Device requires application to reconfigure queues. */
2621be86f2eSNicolas Chautru 	RTE_BBDEV_DEV_CORRECT_ERR,     /**< Warning of a correctable error event happened. */
2631be86f2eSNicolas Chautru };
2641be86f2eSNicolas Chautru 
26599a2dd95SBruce Richardson /** Device statistics. */
26699a2dd95SBruce Richardson struct rte_bbdev_stats {
26799a2dd95SBruce Richardson 	uint64_t enqueued_count;  /**< Count of all operations enqueued */
26899a2dd95SBruce Richardson 	uint64_t dequeued_count;  /**< Count of all operations dequeued */
26999a2dd95SBruce Richardson 	/** Total error count on operations enqueued */
27099a2dd95SBruce Richardson 	uint64_t enqueue_err_count;
27199a2dd95SBruce Richardson 	/** Total error count on operations dequeued */
27299a2dd95SBruce Richardson 	uint64_t dequeue_err_count;
2734f08028cSNicolas Chautru 	/** Total warning count on operations enqueued. */
2744f08028cSNicolas Chautru 	uint64_t enqueue_warn_count;
2754f08028cSNicolas Chautru 	/** Total warning count on operations dequeued. */
2764f08028cSNicolas Chautru 	uint64_t dequeue_warn_count;
2774f08028cSNicolas Chautru 	/** Total enqueue status count based on *rte_bbdev_enqueue_status* enum. */
2784f08028cSNicolas Chautru 	uint64_t enqueue_status_count[RTE_BBDEV_ENQ_STATUS_SIZE_MAX];
27999a2dd95SBruce Richardson 	/** CPU cycles consumed by the (HW/SW) accelerator device to offload
28099a2dd95SBruce Richardson 	 *  the enqueue request to its internal queues.
28199a2dd95SBruce Richardson 	 *  - For a HW device this is the cycles consumed in MMIO write
28299a2dd95SBruce Richardson 	 *  - For a SW (vdev) device, this is the processing time of the
28399a2dd95SBruce Richardson 	 *     bbdev operation
28499a2dd95SBruce Richardson 	 */
28599a2dd95SBruce Richardson 	uint64_t acc_offload_cycles;
286f8d8fa0eSNicolas Chautru 	/** Available number of enqueue batch on that queue. */
287f8d8fa0eSNicolas Chautru 	uint16_t enqueue_depth_avail;
28899a2dd95SBruce Richardson };
28999a2dd95SBruce Richardson 
29099a2dd95SBruce Richardson /**
29199a2dd95SBruce Richardson  * Retrieve the general I/O statistics of a device.
29299a2dd95SBruce Richardson  *
29399a2dd95SBruce Richardson  * @param dev_id
29499a2dd95SBruce Richardson  *   The identifier of the device.
29599a2dd95SBruce Richardson  * @param stats
29699a2dd95SBruce Richardson  *   Pointer to structure to where statistics will be copied. On error, this
29799a2dd95SBruce Richardson  *   location may or may not have been modified.
29899a2dd95SBruce Richardson  *
29999a2dd95SBruce Richardson  * @return
30099a2dd95SBruce Richardson  *   - 0 on success
30199a2dd95SBruce Richardson  *   - EINVAL if invalid parameter pointer is provided
30299a2dd95SBruce Richardson  */
30399a2dd95SBruce Richardson int
30499a2dd95SBruce Richardson rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);
30599a2dd95SBruce Richardson 
30699a2dd95SBruce Richardson /**
30799a2dd95SBruce Richardson  * Reset the statistics of a device.
30899a2dd95SBruce Richardson  *
30999a2dd95SBruce Richardson  * @param dev_id
31099a2dd95SBruce Richardson  *   The identifier of the device.
31199a2dd95SBruce Richardson  * @return
31299a2dd95SBruce Richardson  *   - 0 on success
31399a2dd95SBruce Richardson  */
31499a2dd95SBruce Richardson int
31599a2dd95SBruce Richardson rte_bbdev_stats_reset(uint16_t dev_id);
31699a2dd95SBruce Richardson 
31799a2dd95SBruce Richardson /** Device information supplied by the device's driver */
3186d69a1a6SNicolas Chautru 
3196d69a1a6SNicolas Chautru /* Structure rte_bbdev_driver_info 8< */
32099a2dd95SBruce Richardson struct rte_bbdev_driver_info {
32199a2dd95SBruce Richardson 	/** Driver name */
32299a2dd95SBruce Richardson 	const char *driver_name;
32399a2dd95SBruce Richardson 
32499a2dd95SBruce Richardson 	/** Maximum number of queues supported by the device */
32599a2dd95SBruce Richardson 	unsigned int max_num_queues;
32653115a4eSNicolas Chautru 	/** Maximum number of queues supported per operation type */
32753115a4eSNicolas Chautru 	unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX];
32853115a4eSNicolas Chautru 	/** Priority level supported per operation type */
32953115a4eSNicolas Chautru 	unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX];
33099a2dd95SBruce Richardson 	/** Queue size limit (queue size must also be power of 2) */
33199a2dd95SBruce Richardson 	uint32_t queue_size_lim;
33299a2dd95SBruce Richardson 	/** Set if device off-loads operation to hardware  */
33399a2dd95SBruce Richardson 	bool hardware_accelerated;
33499a2dd95SBruce Richardson 	/** Max value supported by queue priority for DL */
33599a2dd95SBruce Richardson 	uint8_t max_dl_queue_priority;
33699a2dd95SBruce Richardson 	/** Max value supported by queue priority for UL */
33799a2dd95SBruce Richardson 	uint8_t max_ul_queue_priority;
33899a2dd95SBruce Richardson 	/** Set if device supports per-queue interrupts */
33999a2dd95SBruce Richardson 	bool queue_intr_supported;
3401be86f2eSNicolas Chautru 	/** Device Status */
3411be86f2eSNicolas Chautru 	enum rte_bbdev_device_status device_status;
34299a2dd95SBruce Richardson 	/** HARQ memory available in kB */
34399a2dd95SBruce Richardson 	uint32_t harq_buffer_size;
3441be86f2eSNicolas Chautru 	/** Minimum alignment of buffers, in bytes */
3451be86f2eSNicolas Chautru 	uint16_t min_alignment;
346ab4e1909SNicolas Chautru 	/** Byte endianness (RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN) supported
347ab4e1909SNicolas Chautru 	 *  for input/output data
348ab4e1909SNicolas Chautru 	 */
349ab4e1909SNicolas Chautru 	uint8_t data_endianness;
35099a2dd95SBruce Richardson 	/** Default queue configuration used if none is supplied  */
35199a2dd95SBruce Richardson 	struct rte_bbdev_queue_conf default_queue_conf;
35299a2dd95SBruce Richardson 	/** Device operation capabilities */
35399a2dd95SBruce Richardson 	const struct rte_bbdev_op_cap *capabilities;
35499a2dd95SBruce Richardson 	/** Device cpu_flag requirements */
35599a2dd95SBruce Richardson 	const enum rte_cpu_flag_t *cpu_flag_reqs;
356d921348cSNicolas Chautru 	/** FFT windowing width for 2048 FFT - size defined in capability. */
357d921348cSNicolas Chautru 	uint16_t *fft_window_width;
35899a2dd95SBruce Richardson };
3596d69a1a6SNicolas Chautru /* >8 End of structure rte_bbdev_driver_info. */
36099a2dd95SBruce Richardson 
36199a2dd95SBruce Richardson /** Macro used at end of bbdev PMD list */
36299a2dd95SBruce Richardson #define RTE_BBDEV_END_OF_CAPABILITIES_LIST() \
36399a2dd95SBruce Richardson 	{ RTE_BBDEV_OP_NONE }
36499a2dd95SBruce Richardson 
36599a2dd95SBruce Richardson /**
36699a2dd95SBruce Richardson  * Device information structure used by an application to discover a devices
36799a2dd95SBruce Richardson  * capabilities and current configuration
36899a2dd95SBruce Richardson  */
3696d69a1a6SNicolas Chautru 
3706d69a1a6SNicolas Chautru /* Structure rte_bbdev_info 8< */
37199a2dd95SBruce Richardson struct rte_bbdev_info {
37299a2dd95SBruce Richardson 	int socket_id;  /**< NUMA socket that device is on */
37399a2dd95SBruce Richardson 	const char *dev_name;  /**< Unique device name */
37499a2dd95SBruce Richardson 	const struct rte_device *device; /**< Device Information */
37599a2dd95SBruce Richardson 	uint16_t num_queues;  /**< Number of queues currently configured */
37699a2dd95SBruce Richardson 	bool started;  /**< Set if device is currently started */
37799a2dd95SBruce Richardson 	struct rte_bbdev_driver_info drv;  /**< Info from device driver */
37899a2dd95SBruce Richardson };
3796d69a1a6SNicolas Chautru /* >8 End of structure rte_bbdev_info. */
38099a2dd95SBruce Richardson 
38199a2dd95SBruce Richardson /**
38299a2dd95SBruce Richardson  * Retrieve information about a device.
38399a2dd95SBruce Richardson  *
38499a2dd95SBruce Richardson  * @param dev_id
38599a2dd95SBruce Richardson  *   The identifier of the device.
38699a2dd95SBruce Richardson  * @param dev_info
38799a2dd95SBruce Richardson  *   Pointer to structure to where information will be copied. On error, this
38899a2dd95SBruce Richardson  *   location may or may not have been modified.
38999a2dd95SBruce Richardson  *
39099a2dd95SBruce Richardson  * @return
39199a2dd95SBruce Richardson  *   - 0 on success
39299a2dd95SBruce Richardson  *   - EINVAL if invalid parameter pointer is provided
39399a2dd95SBruce Richardson  */
39499a2dd95SBruce Richardson int
39599a2dd95SBruce Richardson rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info);
39699a2dd95SBruce Richardson 
39799a2dd95SBruce Richardson /** Queue information */
39899a2dd95SBruce Richardson struct rte_bbdev_queue_info {
39999a2dd95SBruce Richardson 	/** Current device configuration */
40099a2dd95SBruce Richardson 	struct rte_bbdev_queue_conf conf;
40199a2dd95SBruce Richardson 	/** Set if queue is currently started */
40299a2dd95SBruce Richardson 	bool started;
40399a2dd95SBruce Richardson };
40499a2dd95SBruce Richardson 
40599a2dd95SBruce Richardson /**
40699a2dd95SBruce Richardson  * Retrieve information about a specific queue on a device.
40799a2dd95SBruce Richardson  *
40899a2dd95SBruce Richardson  * @param dev_id
40999a2dd95SBruce Richardson  *   The identifier of the device.
41099a2dd95SBruce Richardson  * @param queue_id
41199a2dd95SBruce Richardson  *   The index of the queue.
41299a2dd95SBruce Richardson  * @param queue_info
41399a2dd95SBruce Richardson  *   Pointer to structure to where information will be copied. On error, this
41499a2dd95SBruce Richardson  *   location may or may not have been modified.
41599a2dd95SBruce Richardson  *
41699a2dd95SBruce Richardson  * @return
41799a2dd95SBruce Richardson  *   - 0 on success
41899a2dd95SBruce Richardson  *   - EINVAL if invalid parameter pointer is provided
41999a2dd95SBruce Richardson  */
42099a2dd95SBruce Richardson int
42199a2dd95SBruce Richardson rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id,
42299a2dd95SBruce Richardson 		struct rte_bbdev_queue_info *queue_info);
42399a2dd95SBruce Richardson 
42499a2dd95SBruce Richardson /** @internal The data structure associated with each queue of a device. */
42599a2dd95SBruce Richardson struct rte_bbdev_queue_data {
42699a2dd95SBruce Richardson 	void *queue_private;  /**< Driver-specific per-queue data */
42799a2dd95SBruce Richardson 	struct rte_bbdev_queue_conf conf;  /**< Current configuration */
42899a2dd95SBruce Richardson 	struct rte_bbdev_stats queue_stats;  /**< Queue statistics */
4294f08028cSNicolas Chautru 	enum rte_bbdev_enqueue_status enqueue_status; /**< Enqueue status when op is rejected */
43099a2dd95SBruce Richardson 	bool started;  /**< Queue state */
43199a2dd95SBruce Richardson };
43299a2dd95SBruce Richardson 
43399a2dd95SBruce Richardson /** @internal Enqueue encode operations for processing on queue of a device. */
43499a2dd95SBruce Richardson typedef uint16_t (*rte_bbdev_enqueue_enc_ops_t)(
43599a2dd95SBruce Richardson 		struct rte_bbdev_queue_data *q_data,
43699a2dd95SBruce Richardson 		struct rte_bbdev_enc_op **ops,
43799a2dd95SBruce Richardson 		uint16_t num);
43899a2dd95SBruce Richardson 
43999a2dd95SBruce Richardson /** @internal Enqueue decode operations for processing on queue of a device. */
44099a2dd95SBruce Richardson typedef uint16_t (*rte_bbdev_enqueue_dec_ops_t)(
44199a2dd95SBruce Richardson 		struct rte_bbdev_queue_data *q_data,
44299a2dd95SBruce Richardson 		struct rte_bbdev_dec_op **ops,
44399a2dd95SBruce Richardson 		uint16_t num);
44499a2dd95SBruce Richardson 
4459d393325SNicolas Chautru /** @internal Enqueue FFT operations for processing on queue of a device. */
4469d393325SNicolas Chautru typedef uint16_t (*rte_bbdev_enqueue_fft_ops_t)(
4479d393325SNicolas Chautru 		struct rte_bbdev_queue_data *q_data,
4489d393325SNicolas Chautru 		struct rte_bbdev_fft_op **ops,
4499d393325SNicolas Chautru 		uint16_t num);
4509d393325SNicolas Chautru 
451089148fcSNicolas Chautru /** @internal Enqueue MLD-TS operations for processing on queue of a device. */
452089148fcSNicolas Chautru typedef uint16_t (*rte_bbdev_enqueue_mldts_ops_t)(
453089148fcSNicolas Chautru 		struct rte_bbdev_queue_data *q_data,
454089148fcSNicolas Chautru 		struct rte_bbdev_mldts_op **ops,
455089148fcSNicolas Chautru 		uint16_t num);
456089148fcSNicolas Chautru 
45799a2dd95SBruce Richardson /** @internal Dequeue encode operations from a queue of a device. */
45899a2dd95SBruce Richardson typedef uint16_t (*rte_bbdev_dequeue_enc_ops_t)(
45999a2dd95SBruce Richardson 		struct rte_bbdev_queue_data *q_data,
46099a2dd95SBruce Richardson 		struct rte_bbdev_enc_op **ops, uint16_t num);
46199a2dd95SBruce Richardson 
46299a2dd95SBruce Richardson /** @internal Dequeue decode operations from a queue of a device. */
46399a2dd95SBruce Richardson typedef uint16_t (*rte_bbdev_dequeue_dec_ops_t)(
46499a2dd95SBruce Richardson 		struct rte_bbdev_queue_data *q_data,
46599a2dd95SBruce Richardson 		struct rte_bbdev_dec_op **ops, uint16_t num);
46699a2dd95SBruce Richardson 
4679d393325SNicolas Chautru /** @internal Dequeue FFT operations from a queue of a device. */
4689d393325SNicolas Chautru typedef uint16_t (*rte_bbdev_dequeue_fft_ops_t)(
4699d393325SNicolas Chautru 		struct rte_bbdev_queue_data *q_data,
4709d393325SNicolas Chautru 		struct rte_bbdev_fft_op **ops, uint16_t num);
4719d393325SNicolas Chautru 
472089148fcSNicolas Chautru /** @internal Dequeue MLDTS operations from a queue of a device. */
473089148fcSNicolas Chautru typedef uint16_t (*rte_bbdev_dequeue_mldts_ops_t)(
474089148fcSNicolas Chautru 		struct rte_bbdev_queue_data *q_data,
475089148fcSNicolas Chautru 		struct rte_bbdev_mldts_op **ops, uint16_t num);
476089148fcSNicolas Chautru 
47799a2dd95SBruce Richardson #define RTE_BBDEV_NAME_MAX_LEN  64  /**< Max length of device name */
47899a2dd95SBruce Richardson 
47999a2dd95SBruce Richardson /**
48099a2dd95SBruce Richardson  * @internal The data associated with a device, with no function pointers.
48199a2dd95SBruce Richardson  * This structure is safe to place in shared memory to be common among
48299a2dd95SBruce Richardson  * different processes in a multi-process configuration. Drivers can access
48399a2dd95SBruce Richardson  * these fields, but should never write to them!
48499a2dd95SBruce Richardson  */
48599a2dd95SBruce Richardson struct rte_bbdev_data {
48699a2dd95SBruce Richardson 	char name[RTE_BBDEV_NAME_MAX_LEN]; /**< Unique identifier name */
48799a2dd95SBruce Richardson 	void *dev_private;  /**< Driver-specific private data */
48899a2dd95SBruce Richardson 	uint16_t num_queues;  /**< Number of currently configured queues */
48999a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *queues;  /**< Queue structures */
49099a2dd95SBruce Richardson 	uint16_t dev_id;  /**< Device ID */
49199a2dd95SBruce Richardson 	int socket_id;  /**< NUMA socket that device is on */
49299a2dd95SBruce Richardson 	bool started;  /**< Device run-time state */
493ece492b4STyler Retzlaff 	RTE_ATOMIC(uint16_t) process_cnt;  /** Counter of processes using the device */
49499a2dd95SBruce Richardson };
49599a2dd95SBruce Richardson 
49699a2dd95SBruce Richardson /* Forward declarations */
49799a2dd95SBruce Richardson struct rte_bbdev_ops;
49899a2dd95SBruce Richardson struct rte_bbdev_callback;
49999a2dd95SBruce Richardson struct rte_intr_handle;
50099a2dd95SBruce Richardson 
50199a2dd95SBruce Richardson /** Structure to keep track of registered callbacks */
502f1f6ebc0SWilliam Tu RTE_TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback);
50399a2dd95SBruce Richardson 
50499a2dd95SBruce Richardson /**
50599a2dd95SBruce Richardson  * @internal The data structure associated with a device. Drivers can access
50699a2dd95SBruce Richardson  * these fields, but should only write to the *_ops fields.
50799a2dd95SBruce Richardson  */
50899a2dd95SBruce Richardson struct __rte_cache_aligned rte_bbdev {
50999a2dd95SBruce Richardson 	/** Enqueue encode function */
51099a2dd95SBruce Richardson 	rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops;
51199a2dd95SBruce Richardson 	/** Enqueue decode function */
51299a2dd95SBruce Richardson 	rte_bbdev_enqueue_dec_ops_t enqueue_dec_ops;
51399a2dd95SBruce Richardson 	/** Dequeue encode function */
51499a2dd95SBruce Richardson 	rte_bbdev_dequeue_enc_ops_t dequeue_enc_ops;
51599a2dd95SBruce Richardson 	/** Dequeue decode function */
51699a2dd95SBruce Richardson 	rte_bbdev_dequeue_dec_ops_t dequeue_dec_ops;
51799a2dd95SBruce Richardson 	/** Enqueue encode function */
51899a2dd95SBruce Richardson 	rte_bbdev_enqueue_enc_ops_t enqueue_ldpc_enc_ops;
51999a2dd95SBruce Richardson 	/** Enqueue decode function */
52099a2dd95SBruce Richardson 	rte_bbdev_enqueue_dec_ops_t enqueue_ldpc_dec_ops;
52199a2dd95SBruce Richardson 	/** Dequeue encode function */
52299a2dd95SBruce Richardson 	rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops;
52399a2dd95SBruce Richardson 	/** Dequeue decode function */
52499a2dd95SBruce Richardson 	rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops;
5259d393325SNicolas Chautru 	/** Enqueue FFT function */
5269d393325SNicolas Chautru 	rte_bbdev_enqueue_fft_ops_t enqueue_fft_ops;
5279d393325SNicolas Chautru 	/** Dequeue FFT function */
5289d393325SNicolas Chautru 	rte_bbdev_dequeue_fft_ops_t dequeue_fft_ops;
52999a2dd95SBruce Richardson 	const struct rte_bbdev_ops *dev_ops;  /**< Functions exported by PMD */
53099a2dd95SBruce Richardson 	struct rte_bbdev_data *data;  /**< Pointer to device data */
53199a2dd95SBruce Richardson 	enum rte_bbdev_state state;  /**< If device is currently used or not */
53299a2dd95SBruce Richardson 	struct rte_device *device; /**< Backing device */
53399a2dd95SBruce Richardson 	/** User application callback for interrupts if present */
53499a2dd95SBruce Richardson 	struct rte_bbdev_cb_list list_cbs;
53599a2dd95SBruce Richardson 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
536089148fcSNicolas Chautru 	/** Enqueue MLD-TS function */
537089148fcSNicolas Chautru 	rte_bbdev_enqueue_mldts_ops_t enqueue_mldts_ops;
538089148fcSNicolas Chautru 	/** Dequeue MLD-TS function */
539089148fcSNicolas Chautru 	rte_bbdev_dequeue_mldts_ops_t dequeue_mldts_ops;
54099a2dd95SBruce Richardson };
54199a2dd95SBruce Richardson 
54299a2dd95SBruce Richardson /** @internal array of all devices */
54399a2dd95SBruce Richardson extern struct rte_bbdev rte_bbdev_devices[];
54499a2dd95SBruce Richardson 
54599a2dd95SBruce Richardson /**
54699a2dd95SBruce Richardson  * Enqueue a burst of processed encode operations to a queue of the device.
54799a2dd95SBruce Richardson  * This functions only enqueues as many operations as currently possible and
54899a2dd95SBruce Richardson  * does not block until @p num_ops entries in the queue are available.
54999a2dd95SBruce Richardson  * This function does not provide any error notification to avoid the
55099a2dd95SBruce Richardson  * corresponding overhead.
55199a2dd95SBruce Richardson  *
55299a2dd95SBruce Richardson  * @param dev_id
55399a2dd95SBruce Richardson  *   The identifier of the device.
55499a2dd95SBruce Richardson  * @param queue_id
55599a2dd95SBruce Richardson  *   The index of the queue.
55699a2dd95SBruce Richardson  * @param ops
55799a2dd95SBruce Richardson  *   Pointer array containing operations to be enqueued Must have at least
55899a2dd95SBruce Richardson  *   @p num_ops entries
55999a2dd95SBruce Richardson  * @param num_ops
56099a2dd95SBruce Richardson  *   The maximum number of operations to enqueue.
56199a2dd95SBruce Richardson  *
56299a2dd95SBruce Richardson  * @return
56399a2dd95SBruce Richardson  *   The number of operations actually enqueued (this is the number of processed
56499a2dd95SBruce Richardson  *   entries in the @p ops array).
56599a2dd95SBruce Richardson  */
56699a2dd95SBruce Richardson static inline uint16_t
56799a2dd95SBruce Richardson rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id,
56899a2dd95SBruce Richardson 		struct rte_bbdev_enc_op **ops, uint16_t num_ops)
56999a2dd95SBruce Richardson {
57099a2dd95SBruce Richardson 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
57199a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
57299a2dd95SBruce Richardson 	return dev->enqueue_enc_ops(q_data, ops, num_ops);
57399a2dd95SBruce Richardson }
57499a2dd95SBruce Richardson 
57599a2dd95SBruce Richardson /**
57699a2dd95SBruce Richardson  * Enqueue a burst of processed decode operations to a queue of the device.
57799a2dd95SBruce Richardson  * This functions only enqueues as many operations as currently possible and
57899a2dd95SBruce Richardson  * does not block until @p num_ops entries in the queue are available.
57999a2dd95SBruce Richardson  * This function does not provide any error notification to avoid the
58099a2dd95SBruce Richardson  * corresponding overhead.
58199a2dd95SBruce Richardson  *
58299a2dd95SBruce Richardson  * @param dev_id
58399a2dd95SBruce Richardson  *   The identifier of the device.
58499a2dd95SBruce Richardson  * @param queue_id
58599a2dd95SBruce Richardson  *   The index of the queue.
58699a2dd95SBruce Richardson  * @param ops
58799a2dd95SBruce Richardson  *   Pointer array containing operations to be enqueued Must have at least
58899a2dd95SBruce Richardson  *   @p num_ops entries
58999a2dd95SBruce Richardson  * @param num_ops
59099a2dd95SBruce Richardson  *   The maximum number of operations to enqueue.
59199a2dd95SBruce Richardson  *
59299a2dd95SBruce Richardson  * @return
59399a2dd95SBruce Richardson  *   The number of operations actually enqueued (this is the number of processed
59499a2dd95SBruce Richardson  *   entries in the @p ops array).
59599a2dd95SBruce Richardson  */
59699a2dd95SBruce Richardson static inline uint16_t
59799a2dd95SBruce Richardson rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
59899a2dd95SBruce Richardson 		struct rte_bbdev_dec_op **ops, uint16_t num_ops)
59999a2dd95SBruce Richardson {
60099a2dd95SBruce Richardson 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
60199a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
60299a2dd95SBruce Richardson 	return dev->enqueue_dec_ops(q_data, ops, num_ops);
60399a2dd95SBruce Richardson }
60499a2dd95SBruce Richardson 
60599a2dd95SBruce Richardson /**
60699a2dd95SBruce Richardson  * Enqueue a burst of processed encode operations to a queue of the device.
60799a2dd95SBruce Richardson  * This functions only enqueues as many operations as currently possible and
60899a2dd95SBruce Richardson  * does not block until @p num_ops entries in the queue are available.
60999a2dd95SBruce Richardson  * This function does not provide any error notification to avoid the
61099a2dd95SBruce Richardson  * corresponding overhead.
61199a2dd95SBruce Richardson  *
61299a2dd95SBruce Richardson  * @param dev_id
61399a2dd95SBruce Richardson  *   The identifier of the device.
61499a2dd95SBruce Richardson  * @param queue_id
61599a2dd95SBruce Richardson  *   The index of the queue.
61699a2dd95SBruce Richardson  * @param ops
61799a2dd95SBruce Richardson  *   Pointer array containing operations to be enqueued Must have at least
61899a2dd95SBruce Richardson  *   @p num_ops entries
61999a2dd95SBruce Richardson  * @param num_ops
62099a2dd95SBruce Richardson  *   The maximum number of operations to enqueue.
62199a2dd95SBruce Richardson  *
62299a2dd95SBruce Richardson  * @return
62399a2dd95SBruce Richardson  *   The number of operations actually enqueued (this is the number of processed
62499a2dd95SBruce Richardson  *   entries in the @p ops array).
62599a2dd95SBruce Richardson  */
62699a2dd95SBruce Richardson static inline uint16_t
62799a2dd95SBruce Richardson rte_bbdev_enqueue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
62899a2dd95SBruce Richardson 		struct rte_bbdev_enc_op **ops, uint16_t num_ops)
62999a2dd95SBruce Richardson {
63099a2dd95SBruce Richardson 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
63199a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
63299a2dd95SBruce Richardson 	return dev->enqueue_ldpc_enc_ops(q_data, ops, num_ops);
63399a2dd95SBruce Richardson }
63499a2dd95SBruce Richardson 
63599a2dd95SBruce Richardson /**
63699a2dd95SBruce Richardson  * Enqueue a burst of processed decode operations to a queue of the device.
63799a2dd95SBruce Richardson  * This functions only enqueues as many operations as currently possible and
63899a2dd95SBruce Richardson  * does not block until @p num_ops entries in the queue are available.
63999a2dd95SBruce Richardson  * This function does not provide any error notification to avoid the
64099a2dd95SBruce Richardson  * corresponding overhead.
64199a2dd95SBruce Richardson  *
64299a2dd95SBruce Richardson  * @param dev_id
64399a2dd95SBruce Richardson  *   The identifier of the device.
64499a2dd95SBruce Richardson  * @param queue_id
64599a2dd95SBruce Richardson  *   The index of the queue.
64699a2dd95SBruce Richardson  * @param ops
64799a2dd95SBruce Richardson  *   Pointer array containing operations to be enqueued Must have at least
64899a2dd95SBruce Richardson  *   @p num_ops entries
64999a2dd95SBruce Richardson  * @param num_ops
65099a2dd95SBruce Richardson  *   The maximum number of operations to enqueue.
65199a2dd95SBruce Richardson  *
65299a2dd95SBruce Richardson  * @return
65399a2dd95SBruce Richardson  *   The number of operations actually enqueued (this is the number of processed
65499a2dd95SBruce Richardson  *   entries in the @p ops array).
65599a2dd95SBruce Richardson  */
65699a2dd95SBruce Richardson static inline uint16_t
65799a2dd95SBruce Richardson rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
65899a2dd95SBruce Richardson 		struct rte_bbdev_dec_op **ops, uint16_t num_ops)
65999a2dd95SBruce Richardson {
66099a2dd95SBruce Richardson 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
66199a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
66299a2dd95SBruce Richardson 	return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops);
66399a2dd95SBruce Richardson }
66499a2dd95SBruce Richardson 
66599a2dd95SBruce Richardson /**
6669d393325SNicolas Chautru  * Enqueue a burst of FFT operations to a queue of the device.
6679d393325SNicolas Chautru  * This functions only enqueues as many operations as currently possible and
6689d393325SNicolas Chautru  * does not block until @p num_ops entries in the queue are available.
66999a2dd95SBruce Richardson  * This function does not provide any error notification to avoid the
67099a2dd95SBruce Richardson  * corresponding overhead.
67199a2dd95SBruce Richardson  *
67299a2dd95SBruce Richardson  * @param dev_id
67399a2dd95SBruce Richardson  *   The identifier of the device.
67499a2dd95SBruce Richardson  * @param queue_id
67599a2dd95SBruce Richardson  *   The index of the queue.
67699a2dd95SBruce Richardson  * @param ops
6779d393325SNicolas Chautru  *   Pointer array containing operations to be enqueued.
6789d393325SNicolas Chautru  *   Must have at least @p num_ops entries.
6799d393325SNicolas Chautru  * @param num_ops
6809d393325SNicolas Chautru  *   The maximum number of operations to enqueue.
6819d393325SNicolas Chautru  *
6829d393325SNicolas Chautru  * @return
6839d393325SNicolas Chautru  *   The number of operations actually enqueued.
6849d393325SNicolas Chautru  *   (This is the number of processed entries in the @p ops array.)
6859d393325SNicolas Chautru  */
6869d393325SNicolas Chautru static inline uint16_t
6879d393325SNicolas Chautru rte_bbdev_enqueue_fft_ops(uint16_t dev_id, uint16_t queue_id,
6889d393325SNicolas Chautru 		struct rte_bbdev_fft_op **ops, uint16_t num_ops)
6899d393325SNicolas Chautru {
6909d393325SNicolas Chautru 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
6919d393325SNicolas Chautru 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
6929d393325SNicolas Chautru 	return dev->enqueue_fft_ops(q_data, ops, num_ops);
6939d393325SNicolas Chautru }
6949d393325SNicolas Chautru 
6959d393325SNicolas Chautru /**
696089148fcSNicolas Chautru  * Enqueue a burst of MLDTS operations to a queue of the device.
697089148fcSNicolas Chautru  * This functions only enqueues as many operations as currently possible and
698089148fcSNicolas Chautru  * does not block until @p num_ops entries in the queue are available.
699089148fcSNicolas Chautru  * This function does not provide any error notification to avoid the
700089148fcSNicolas Chautru  * corresponding overhead.
701089148fcSNicolas Chautru  *
702089148fcSNicolas Chautru  * @param dev_id
703089148fcSNicolas Chautru  *   The identifier of the device.
704089148fcSNicolas Chautru  * @param queue_id
705089148fcSNicolas Chautru  *   The index of the queue.
706089148fcSNicolas Chautru  * @param ops
707089148fcSNicolas Chautru  *   Pointer array containing operations to be enqueued Must have at least
708089148fcSNicolas Chautru  *   @p num_ops entries
709089148fcSNicolas Chautru  * @param num_ops
710089148fcSNicolas Chautru  *   The maximum number of operations to enqueue.
711089148fcSNicolas Chautru  *
712089148fcSNicolas Chautru  * @return
713089148fcSNicolas Chautru  *   The number of operations actually enqueued (this is the number of processed
714089148fcSNicolas Chautru  *   entries in the @p ops array).
715089148fcSNicolas Chautru  */
716089148fcSNicolas Chautru static inline uint16_t
717089148fcSNicolas Chautru rte_bbdev_enqueue_mldts_ops(uint16_t dev_id, uint16_t queue_id,
718089148fcSNicolas Chautru 		struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
719089148fcSNicolas Chautru {
720089148fcSNicolas Chautru 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
721089148fcSNicolas Chautru 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
722089148fcSNicolas Chautru 	return dev->enqueue_mldts_ops(q_data, ops, num_ops);
723089148fcSNicolas Chautru }
724089148fcSNicolas Chautru 
725089148fcSNicolas Chautru /**
7269d393325SNicolas Chautru  * Dequeue a burst of processed encode operations from a queue of the device.
7279d393325SNicolas Chautru  * This functions returns only the current contents of the queue,
7289d393325SNicolas Chautru  * and does not block until @ num_ops is available.
7299d393325SNicolas Chautru  * This function does not provide any error notification to avoid the
7309d393325SNicolas Chautru  * corresponding overhead.
7319d393325SNicolas Chautru  *
7329d393325SNicolas Chautru  * @param dev_id
7339d393325SNicolas Chautru  *   The identifier of the device.
7349d393325SNicolas Chautru  * @param queue_id
7359d393325SNicolas Chautru  *   The index of the queue.
7369d393325SNicolas Chautru  * @param ops
7379d393325SNicolas Chautru  *   Pointer array where operations will be dequeued to.
7389d393325SNicolas Chautru  *   Must have at least @p num_ops entries, i.e.
7399d393325SNicolas Chautru  *   a pointer to a table of void * pointers (ops) that will be filled.
74099a2dd95SBruce Richardson  * @param num_ops
74199a2dd95SBruce Richardson  *   The maximum number of operations to dequeue.
74299a2dd95SBruce Richardson  *
74399a2dd95SBruce Richardson  * @return
7449d393325SNicolas Chautru  *   The number of operations actually dequeued.
7459d393325SNicolas Chautru  *   (This is the number of entries copied into the @p ops array.)
74699a2dd95SBruce Richardson  */
74799a2dd95SBruce Richardson static inline uint16_t
74899a2dd95SBruce Richardson rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id,
74999a2dd95SBruce Richardson 		struct rte_bbdev_enc_op **ops, uint16_t num_ops)
75099a2dd95SBruce Richardson {
75199a2dd95SBruce Richardson 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
75299a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
75399a2dd95SBruce Richardson 	return dev->dequeue_enc_ops(q_data, ops, num_ops);
75499a2dd95SBruce Richardson }
75599a2dd95SBruce Richardson 
75699a2dd95SBruce Richardson /**
75799a2dd95SBruce Richardson  * Dequeue a burst of processed decode operations from a queue of the device.
75899a2dd95SBruce Richardson  * This functions returns only the current contents of the queue, and does not
75999a2dd95SBruce Richardson  * block until @ num_ops is available.
76099a2dd95SBruce Richardson  * This function does not provide any error notification to avoid the
76199a2dd95SBruce Richardson  * corresponding overhead.
76299a2dd95SBruce Richardson  *
76399a2dd95SBruce Richardson  * @param dev_id
76499a2dd95SBruce Richardson  *   The identifier of the device.
76599a2dd95SBruce Richardson  * @param queue_id
76699a2dd95SBruce Richardson  *   The index of the queue.
76799a2dd95SBruce Richardson  * @param ops
76899a2dd95SBruce Richardson  *   Pointer array where operations will be dequeued to. Must have at least
76999a2dd95SBruce Richardson  *   @p num_ops entries
77099a2dd95SBruce Richardson  *   ie. A pointer to a table of void * pointers (ops) that will be filled.
77199a2dd95SBruce Richardson  * @param num_ops
77299a2dd95SBruce Richardson  *   The maximum number of operations to dequeue.
77399a2dd95SBruce Richardson  *
77499a2dd95SBruce Richardson  * @return
77599a2dd95SBruce Richardson  *   The number of operations actually dequeued (this is the number of entries
77699a2dd95SBruce Richardson  *   copied into the @p ops array).
77799a2dd95SBruce Richardson  */
77899a2dd95SBruce Richardson 
77999a2dd95SBruce Richardson static inline uint16_t
78099a2dd95SBruce Richardson rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id,
78199a2dd95SBruce Richardson 		struct rte_bbdev_dec_op **ops, uint16_t num_ops)
78299a2dd95SBruce Richardson {
78399a2dd95SBruce Richardson 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
78499a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
78599a2dd95SBruce Richardson 	return dev->dequeue_dec_ops(q_data, ops, num_ops);
78699a2dd95SBruce Richardson }
78799a2dd95SBruce Richardson 
78899a2dd95SBruce Richardson 
78999a2dd95SBruce Richardson /**
79099a2dd95SBruce Richardson  * Dequeue a burst of processed encode operations from a queue of the device.
79199a2dd95SBruce Richardson  * This functions returns only the current contents of the queue, and does not
79299a2dd95SBruce Richardson  * block until @ num_ops is available.
79399a2dd95SBruce Richardson  * This function does not provide any error notification to avoid the
79499a2dd95SBruce Richardson  * corresponding overhead.
79599a2dd95SBruce Richardson  *
79699a2dd95SBruce Richardson  * @param dev_id
79799a2dd95SBruce Richardson  *   The identifier of the device.
79899a2dd95SBruce Richardson  * @param queue_id
79999a2dd95SBruce Richardson  *   The index of the queue.
80099a2dd95SBruce Richardson  * @param ops
80199a2dd95SBruce Richardson  *   Pointer array where operations will be dequeued to. Must have at least
80299a2dd95SBruce Richardson  *   @p num_ops entries
80399a2dd95SBruce Richardson  * @param num_ops
80499a2dd95SBruce Richardson  *   The maximum number of operations to dequeue.
80599a2dd95SBruce Richardson  *
80699a2dd95SBruce Richardson  * @return
80799a2dd95SBruce Richardson  *   The number of operations actually dequeued (this is the number of entries
80899a2dd95SBruce Richardson  *   copied into the @p ops array).
80999a2dd95SBruce Richardson  */
81099a2dd95SBruce Richardson static inline uint16_t
81199a2dd95SBruce Richardson rte_bbdev_dequeue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
81299a2dd95SBruce Richardson 		struct rte_bbdev_enc_op **ops, uint16_t num_ops)
81399a2dd95SBruce Richardson {
81499a2dd95SBruce Richardson 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
81599a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
81699a2dd95SBruce Richardson 	return dev->dequeue_ldpc_enc_ops(q_data, ops, num_ops);
81799a2dd95SBruce Richardson }
81899a2dd95SBruce Richardson 
81999a2dd95SBruce Richardson /**
82099a2dd95SBruce Richardson  * Dequeue a burst of processed decode operations from a queue of the device.
82199a2dd95SBruce Richardson  * This functions returns only the current contents of the queue, and does not
82299a2dd95SBruce Richardson  * block until @ num_ops is available.
82399a2dd95SBruce Richardson  * This function does not provide any error notification to avoid the
82499a2dd95SBruce Richardson  * corresponding overhead.
82599a2dd95SBruce Richardson  *
82699a2dd95SBruce Richardson  * @param dev_id
82799a2dd95SBruce Richardson  *   The identifier of the device.
82899a2dd95SBruce Richardson  * @param queue_id
82999a2dd95SBruce Richardson  *   The index of the queue.
83099a2dd95SBruce Richardson  * @param ops
83199a2dd95SBruce Richardson  *   Pointer array where operations will be dequeued to. Must have at least
83299a2dd95SBruce Richardson  *   @p num_ops entries
83399a2dd95SBruce Richardson  * @param num_ops
83499a2dd95SBruce Richardson  *   The maximum number of operations to dequeue.
83599a2dd95SBruce Richardson  *
83699a2dd95SBruce Richardson  * @return
83799a2dd95SBruce Richardson  *   The number of operations actually dequeued (this is the number of entries
83899a2dd95SBruce Richardson  *   copied into the @p ops array).
83999a2dd95SBruce Richardson  */
84099a2dd95SBruce Richardson static inline uint16_t
84199a2dd95SBruce Richardson rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
84299a2dd95SBruce Richardson 		struct rte_bbdev_dec_op **ops, uint16_t num_ops)
84399a2dd95SBruce Richardson {
84499a2dd95SBruce Richardson 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
84599a2dd95SBruce Richardson 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
84699a2dd95SBruce Richardson 	return dev->dequeue_ldpc_dec_ops(q_data, ops, num_ops);
84799a2dd95SBruce Richardson }
84899a2dd95SBruce Richardson 
8499d393325SNicolas Chautru /**
8509d393325SNicolas Chautru  * Dequeue a burst of FFT operations from a queue of the device.
8519d393325SNicolas Chautru  * This functions returns only the current contents of the queue, and does not
8529d393325SNicolas Chautru  * block until @ num_ops is available.
8539d393325SNicolas Chautru  * This function does not provide any error notification to avoid the
8549d393325SNicolas Chautru  * corresponding overhead.
8559d393325SNicolas Chautru  *
8569d393325SNicolas Chautru  * @param dev_id
8579d393325SNicolas Chautru  *   The identifier of the device.
8589d393325SNicolas Chautru  * @param queue_id
8599d393325SNicolas Chautru  *   The index of the queue.
8609d393325SNicolas Chautru  * @param ops
8619d393325SNicolas Chautru  *   Pointer array where operations will be dequeued to. Must have at least
8629d393325SNicolas Chautru  *   @p num_ops entries
8639d393325SNicolas Chautru  * @param num_ops
8649d393325SNicolas Chautru  *   The maximum number of operations to dequeue.
8659d393325SNicolas Chautru  *
8669d393325SNicolas Chautru  * @return
8679d393325SNicolas Chautru  *   The number of operations actually dequeued (this is the number of entries
8689d393325SNicolas Chautru  *   copied into the @p ops array).
8699d393325SNicolas Chautru  */
8709d393325SNicolas Chautru static inline uint16_t
8719d393325SNicolas Chautru rte_bbdev_dequeue_fft_ops(uint16_t dev_id, uint16_t queue_id,
8729d393325SNicolas Chautru 		struct rte_bbdev_fft_op **ops, uint16_t num_ops)
8739d393325SNicolas Chautru {
8749d393325SNicolas Chautru 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
8759d393325SNicolas Chautru 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
8769d393325SNicolas Chautru 	return dev->dequeue_fft_ops(q_data, ops, num_ops);
8779d393325SNicolas Chautru }
8789d393325SNicolas Chautru 
879089148fcSNicolas Chautru /**
880089148fcSNicolas Chautru  * Dequeue a burst of MLDTS operations from a queue of the device.
881089148fcSNicolas Chautru  * This functions returns only the current contents of the queue, and does not
882089148fcSNicolas Chautru  * block until @p num_ops is available.
883089148fcSNicolas Chautru  * This function does not provide any error notification to avoid the
884089148fcSNicolas Chautru  * corresponding overhead.
885089148fcSNicolas Chautru  *
886089148fcSNicolas Chautru  * @param dev_id
887089148fcSNicolas Chautru  *   The identifier of the device.
888089148fcSNicolas Chautru  * @param queue_id
889089148fcSNicolas Chautru  *   The index of the queue.
890089148fcSNicolas Chautru  * @param ops
891089148fcSNicolas Chautru  *   Pointer array where operations will be dequeued to. Must have at least
892089148fcSNicolas Chautru  *   @p num_ops entries
893089148fcSNicolas Chautru  * @param num_ops
894089148fcSNicolas Chautru  *   The maximum number of operations to dequeue.
895089148fcSNicolas Chautru  *
896089148fcSNicolas Chautru  * @return
897089148fcSNicolas Chautru  *   The number of operations actually dequeued (this is the number of entries
898089148fcSNicolas Chautru  *   copied into the @p ops array).
899089148fcSNicolas Chautru  */
900089148fcSNicolas Chautru static inline uint16_t
901089148fcSNicolas Chautru rte_bbdev_dequeue_mldts_ops(uint16_t dev_id, uint16_t queue_id,
902089148fcSNicolas Chautru 		struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
903089148fcSNicolas Chautru {
904089148fcSNicolas Chautru 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
905089148fcSNicolas Chautru 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
906089148fcSNicolas Chautru 	return dev->dequeue_mldts_ops(q_data, ops, num_ops);
907089148fcSNicolas Chautru }
908089148fcSNicolas Chautru 
90999a2dd95SBruce Richardson /** Definitions of device event types */
91099a2dd95SBruce Richardson enum rte_bbdev_event_type {
91199a2dd95SBruce Richardson 	RTE_BBDEV_EVENT_UNKNOWN,  /**< unknown event type */
91299a2dd95SBruce Richardson 	RTE_BBDEV_EVENT_ERROR,  /**< error interrupt event */
91399a2dd95SBruce Richardson 	RTE_BBDEV_EVENT_DEQUEUE,  /**< dequeue event */
91499a2dd95SBruce Richardson 	RTE_BBDEV_EVENT_MAX  /**< max value of this enum */
91599a2dd95SBruce Richardson };
91699a2dd95SBruce Richardson 
91799a2dd95SBruce Richardson /**
91899a2dd95SBruce Richardson  * Typedef for application callback function registered by application
91999a2dd95SBruce Richardson  * software for notification of device events
92099a2dd95SBruce Richardson  *
92199a2dd95SBruce Richardson  * @param dev_id
92299a2dd95SBruce Richardson  *   Device identifier
92399a2dd95SBruce Richardson  * @param event
92499a2dd95SBruce Richardson  *   Device event to register for notification of.
92599a2dd95SBruce Richardson  * @param cb_arg
92699a2dd95SBruce Richardson  *   User specified parameter to be passed to user's callback function.
92799a2dd95SBruce Richardson  * @param ret_param
92899a2dd95SBruce Richardson  *   To pass data back to user application.
92999a2dd95SBruce Richardson  */
93099a2dd95SBruce Richardson typedef void (*rte_bbdev_cb_fn)(uint16_t dev_id,
93199a2dd95SBruce Richardson 		enum rte_bbdev_event_type event, void *cb_arg,
93299a2dd95SBruce Richardson 		void *ret_param);
93399a2dd95SBruce Richardson 
93499a2dd95SBruce Richardson /**
93599a2dd95SBruce Richardson  * Register a callback function for specific device id. Multiple callbacks can
93699a2dd95SBruce Richardson  * be added and will be called in the order they are added when an event is
93799a2dd95SBruce Richardson  * triggered. Callbacks are called in a separate thread created by the DPDK EAL.
93899a2dd95SBruce Richardson  *
93999a2dd95SBruce Richardson  * @param dev_id
94099a2dd95SBruce Richardson  *   Device id.
94199a2dd95SBruce Richardson  * @param event
94299a2dd95SBruce Richardson  *   The event that the callback will be registered for.
94399a2dd95SBruce Richardson  * @param cb_fn
94499a2dd95SBruce Richardson  *   User supplied callback function to be called.
94599a2dd95SBruce Richardson  * @param cb_arg
94699a2dd95SBruce Richardson  *   Pointer to parameter that will be passed to the callback.
94799a2dd95SBruce Richardson  *
94899a2dd95SBruce Richardson  * @return
94999a2dd95SBruce Richardson  *   Zero on success, negative value on failure.
95099a2dd95SBruce Richardson  */
95199a2dd95SBruce Richardson int
95299a2dd95SBruce Richardson rte_bbdev_callback_register(uint16_t dev_id, enum rte_bbdev_event_type event,
95399a2dd95SBruce Richardson 		rte_bbdev_cb_fn cb_fn, void *cb_arg);
95499a2dd95SBruce Richardson 
95599a2dd95SBruce Richardson /**
95699a2dd95SBruce Richardson  * Unregister a callback function for specific device id.
95799a2dd95SBruce Richardson  *
95899a2dd95SBruce Richardson  * @param dev_id
95999a2dd95SBruce Richardson  *   The device identifier.
96099a2dd95SBruce Richardson  * @param event
96199a2dd95SBruce Richardson  *   The event that the callback will be unregistered for.
96299a2dd95SBruce Richardson  * @param cb_fn
96399a2dd95SBruce Richardson  *   User supplied callback function to be unregistered.
96499a2dd95SBruce Richardson  * @param cb_arg
96599a2dd95SBruce Richardson  *   Pointer to the parameter supplied when registering the callback.
96699a2dd95SBruce Richardson  *   (void *)-1 means to remove all registered callbacks with the specified
96799a2dd95SBruce Richardson  *   function address.
96899a2dd95SBruce Richardson  *
96999a2dd95SBruce Richardson  * @return
97099a2dd95SBruce Richardson  *   - 0 on success
97199a2dd95SBruce Richardson  *   - EINVAL if invalid parameter pointer is provided
97299a2dd95SBruce Richardson  *   - EAGAIN if the provided callback pointer does not exist
97399a2dd95SBruce Richardson  */
97499a2dd95SBruce Richardson int
97599a2dd95SBruce Richardson rte_bbdev_callback_unregister(uint16_t dev_id, enum rte_bbdev_event_type event,
97699a2dd95SBruce Richardson 		rte_bbdev_cb_fn cb_fn, void *cb_arg);
97799a2dd95SBruce Richardson 
97899a2dd95SBruce Richardson /**
97999a2dd95SBruce Richardson  * Enable a one-shot interrupt on the next operation enqueued to a particular
98099a2dd95SBruce Richardson  * queue. The interrupt will be triggered when the operation is ready to be
98199a2dd95SBruce Richardson  * dequeued. To handle the interrupt, an epoll file descriptor must be
98299a2dd95SBruce Richardson  * registered using rte_bbdev_queue_intr_ctl(), and then an application
98399a2dd95SBruce Richardson  * thread/lcore can wait for the interrupt using rte_epoll_wait().
98499a2dd95SBruce Richardson  *
98599a2dd95SBruce Richardson  * @param dev_id
98699a2dd95SBruce Richardson  *   The device identifier.
98799a2dd95SBruce Richardson  * @param queue_id
98899a2dd95SBruce Richardson  *   The index of the queue.
98999a2dd95SBruce Richardson  *
99099a2dd95SBruce Richardson  * @return
99199a2dd95SBruce Richardson  *   - 0 on success
992f8dbaebbSSean Morrissey  *   - negative value on failure - as returned from PMD
99399a2dd95SBruce Richardson  */
99499a2dd95SBruce Richardson int
99599a2dd95SBruce Richardson rte_bbdev_queue_intr_enable(uint16_t dev_id, uint16_t queue_id);
99699a2dd95SBruce Richardson 
99799a2dd95SBruce Richardson /**
99899a2dd95SBruce Richardson  * Disable a one-shot interrupt on the next operation enqueued to a particular
99999a2dd95SBruce Richardson  * queue (if it has been enabled).
100099a2dd95SBruce Richardson  *
100199a2dd95SBruce Richardson  * @param dev_id
100299a2dd95SBruce Richardson  *   The device identifier.
100399a2dd95SBruce Richardson  * @param queue_id
100499a2dd95SBruce Richardson  *   The index of the queue.
100599a2dd95SBruce Richardson  *
100699a2dd95SBruce Richardson  * @return
100799a2dd95SBruce Richardson  *   - 0 on success
1008f8dbaebbSSean Morrissey  *   - negative value on failure - as returned from PMD
100999a2dd95SBruce Richardson  */
101099a2dd95SBruce Richardson int
101199a2dd95SBruce Richardson rte_bbdev_queue_intr_disable(uint16_t dev_id, uint16_t queue_id);
101299a2dd95SBruce Richardson 
101399a2dd95SBruce Richardson /**
101499a2dd95SBruce Richardson  * Control interface for per-queue interrupts.
101599a2dd95SBruce Richardson  *
101699a2dd95SBruce Richardson  * @param dev_id
101799a2dd95SBruce Richardson  *   The device identifier.
101899a2dd95SBruce Richardson  * @param queue_id
101999a2dd95SBruce Richardson  *   The index of the queue.
102099a2dd95SBruce Richardson  * @param epfd
102199a2dd95SBruce Richardson  *   Epoll file descriptor that will be associated with the interrupt source.
102299a2dd95SBruce Richardson  *   If the special value RTE_EPOLL_PER_THREAD is provided, a per thread epoll
102399a2dd95SBruce Richardson  *   file descriptor created by the EAL is used (RTE_EPOLL_PER_THREAD can also
102499a2dd95SBruce Richardson  *   be used when calling rte_epoll_wait()).
102599a2dd95SBruce Richardson  * @param op
102699a2dd95SBruce Richardson  *   The operation be performed for the vector.RTE_INTR_EVENT_ADD or
102799a2dd95SBruce Richardson  *   RTE_INTR_EVENT_DEL.
102899a2dd95SBruce Richardson  * @param data
102999a2dd95SBruce Richardson  *   User context, that will be returned in the epdata.data field of the
103099a2dd95SBruce Richardson  *   rte_epoll_event structure filled in by rte_epoll_wait().
103199a2dd95SBruce Richardson  *
103299a2dd95SBruce Richardson  * @return
103399a2dd95SBruce Richardson  *   - 0 on success
103499a2dd95SBruce Richardson  *   - ENOTSUP if interrupts are not supported by the identified device
1035f8dbaebbSSean Morrissey  *   - negative value on failure - as returned from PMD
103699a2dd95SBruce Richardson  */
103799a2dd95SBruce Richardson int
103899a2dd95SBruce Richardson rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
103999a2dd95SBruce Richardson 		void *data);
104099a2dd95SBruce Richardson 
10411be86f2eSNicolas Chautru /**
10421be86f2eSNicolas Chautru  * Convert device status from enum to string.
10431be86f2eSNicolas Chautru  *
10441be86f2eSNicolas Chautru  * @param status
10451be86f2eSNicolas Chautru  *   Device status as enum.
10461be86f2eSNicolas Chautru  *
10471be86f2eSNicolas Chautru  * @returns
10481be86f2eSNicolas Chautru  *   Device status as string or NULL if invalid.
10491be86f2eSNicolas Chautru  */
10501be86f2eSNicolas Chautru const char*
10511be86f2eSNicolas Chautru rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
10521be86f2eSNicolas Chautru 
10534f08028cSNicolas Chautru /**
10544f08028cSNicolas Chautru  * Convert queue status from enum to string.
10554f08028cSNicolas Chautru  *
10564f08028cSNicolas Chautru  * @param status
10574f08028cSNicolas Chautru  *   Queue status as enum.
10584f08028cSNicolas Chautru  *
10594f08028cSNicolas Chautru  * @returns
10604f08028cSNicolas Chautru  *   Queue status as string or NULL if op_type is invalid.
10614f08028cSNicolas Chautru  */
10624f08028cSNicolas Chautru const char*
10634f08028cSNicolas Chautru rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status);
10644f08028cSNicolas Chautru 
1065*353e3639SNicolas Chautru /**
1066*353e3639SNicolas Chautru  * Dump operations info from device to a file.
1067*353e3639SNicolas Chautru  * This API is used for debugging provided input operations, not a dataplane API.
1068*353e3639SNicolas Chautru  *
1069*353e3639SNicolas Chautru  *  @param dev_id
1070*353e3639SNicolas Chautru  *    The device identifier.
1071*353e3639SNicolas Chautru  *
1072*353e3639SNicolas Chautru  *  @param queue_index
1073*353e3639SNicolas Chautru  *    Index of queue.
1074*353e3639SNicolas Chautru  *
1075*353e3639SNicolas Chautru  *  @param file
1076*353e3639SNicolas Chautru  *    A pointer to a file for output.
1077*353e3639SNicolas Chautru  *
1078*353e3639SNicolas Chautru  * @returns
1079*353e3639SNicolas Chautru  *   - 0 on success
1080*353e3639SNicolas Chautru  *   - ENOTSUP if interrupts are not supported by the identified device
1081*353e3639SNicolas Chautru  *   - negative value on failure - as returned from PMD
1082*353e3639SNicolas Chautru  *
1083*353e3639SNicolas Chautru  */
1084*353e3639SNicolas Chautru __rte_experimental
1085*353e3639SNicolas Chautru int
1086*353e3639SNicolas Chautru rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_index, FILE *file);
1087*353e3639SNicolas Chautru 
1088*353e3639SNicolas Chautru 
1089*353e3639SNicolas Chautru /**
1090*353e3639SNicolas Chautru  * String of parameters related to the parameters of an operation of a given type.
1091*353e3639SNicolas Chautru  *
1092*353e3639SNicolas Chautru  *  @param op
1093*353e3639SNicolas Chautru  *    Pointer to an operation.
1094*353e3639SNicolas Chautru  *
1095*353e3639SNicolas Chautru  *  @param op_type
1096*353e3639SNicolas Chautru  *    Operation type enum.
1097*353e3639SNicolas Chautru  *
1098*353e3639SNicolas Chautru  *  @param str
1099*353e3639SNicolas Chautru  *    String being describing the operations.
1100*353e3639SNicolas Chautru  *
1101*353e3639SNicolas Chautru  *  @param len
1102*353e3639SNicolas Chautru  *    Size of the string buffer.
1103*353e3639SNicolas Chautru  *
1104*353e3639SNicolas Chautru  * @returns
1105*353e3639SNicolas Chautru  *   String describing the provided operation.
1106*353e3639SNicolas Chautru  *
1107*353e3639SNicolas Chautru  */
1108*353e3639SNicolas Chautru __rte_experimental
1109*353e3639SNicolas Chautru char *
1110*353e3639SNicolas Chautru rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len);
1111*353e3639SNicolas Chautru 
111299a2dd95SBruce Richardson #ifdef __cplusplus
111399a2dd95SBruce Richardson }
111499a2dd95SBruce Richardson #endif
111599a2dd95SBruce Richardson 
111699a2dd95SBruce Richardson #endif /* _RTE_BBDEV_H_ */
1117