Branch data Line data Source code
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 : :
8 : : /**
9 : : * @file rte_bbdev.h
10 : : *
11 : : * Wireless base band device abstraction APIs.
12 : : *
13 : : * This API allows an application to discover, configure and use a device to
14 : : * process operations. An asynchronous API (enqueue, followed by later dequeue)
15 : : * is used for processing operations.
16 : : *
17 : : * The functions in this API are not thread-safe when called on the same
18 : : * target object (a device, or a queue on a device), with the exception that
19 : : * one thread can enqueue operations to a queue while another thread dequeues
20 : : * from the same queue.
21 : : */
22 : :
23 : : #include <stdint.h>
24 : : #include <stdbool.h>
25 : :
26 : : #include <rte_compat.h>
27 : : #include <rte_cpuflags.h>
28 : :
29 : : #include "rte_bbdev_op.h"
30 : :
31 : : #ifdef __cplusplus
32 : : extern "C" {
33 : : #endif
34 : :
35 : : #include "rte_bbdev_trace_fp.h"
36 : :
37 : : #ifndef RTE_BBDEV_MAX_DEVS
38 : : #define RTE_BBDEV_MAX_DEVS 128 /**< Max number of devices */
39 : : #endif
40 : :
41 : : /*
42 : : * Maximum size to be used to manage the enum rte_bbdev_enqueue_status
43 : : * including padding for future enum insertion.
44 : : * The enum values must be explicitly kept smaller or equal to this padded maximum size.
45 : : */
46 : : #define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6
47 : :
48 : : /** Flags indicate current state of BBDEV device */
49 : : enum rte_bbdev_state {
50 : : RTE_BBDEV_UNUSED,
51 : : RTE_BBDEV_INITIALIZED
52 : : };
53 : :
54 : : /**
55 : : * Get the total number of devices that have been successfully initialised.
56 : : *
57 : : * @return
58 : : * The total number of usable devices.
59 : : */
60 : : uint16_t
61 : : rte_bbdev_count(void);
62 : :
63 : : /**
64 : : * Check if a device is valid.
65 : : *
66 : : * @param dev_id
67 : : * The identifier of the device.
68 : : *
69 : : * @return
70 : : * true if device ID is valid and device is attached, false otherwise.
71 : : */
72 : : bool
73 : : rte_bbdev_is_valid(uint16_t dev_id);
74 : :
75 : : /**
76 : : * Get the next enabled device.
77 : : *
78 : : * @param dev_id
79 : : * The current device
80 : : *
81 : : * @return
82 : : * - The next device, or
83 : : * - RTE_BBDEV_MAX_DEVS if none found
84 : : */
85 : : uint16_t
86 : : rte_bbdev_find_next(uint16_t dev_id);
87 : :
88 : : /** Iterate through all enabled devices */
89 : : #define RTE_BBDEV_FOREACH(i) for (i = rte_bbdev_find_next(-1); \
90 : : i < RTE_BBDEV_MAX_DEVS; \
91 : : i = rte_bbdev_find_next(i))
92 : :
93 : : /**
94 : : * Setup up device queues.
95 : : * This function must be called on a device before setting up the queues and
96 : : * starting the device. It can also be called when a device is in the stopped
97 : : * state. If any device queues have been configured their configuration will be
98 : : * cleared by a call to this function.
99 : : *
100 : : * @param dev_id
101 : : * The identifier of the device.
102 : : * @param num_queues
103 : : * Number of queues to configure on device.
104 : : * @param socket_id
105 : : * ID of a socket which will be used to allocate memory.
106 : : *
107 : : * @return
108 : : * - 0 on success
109 : : * - -ENODEV if dev_id is invalid or the device is corrupted
110 : : * - -EINVAL if num_queues is invalid, 0 or greater than maximum
111 : : * - -EBUSY if the identified device has already started
112 : : * - -ENOMEM if unable to allocate memory
113 : : */
114 : : int
115 : : rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id);
116 : :
117 : : /**
118 : : * Enable interrupts.
119 : : * This function may be called before starting the device to enable the
120 : : * interrupts if they are available.
121 : : *
122 : : * @param dev_id
123 : : * The identifier of the device.
124 : : *
125 : : * @return
126 : : * - 0 on success
127 : : * - -ENODEV if dev_id is invalid or the device is corrupted
128 : : * - -EBUSY if the identified device has already started
129 : : * - -ENOTSUP if the interrupts are not supported by the device
130 : : */
131 : : int
132 : : rte_bbdev_intr_enable(uint16_t dev_id);
133 : :
134 : : /** Device queue configuration structure */
135 : : struct rte_bbdev_queue_conf {
136 : : int socket; /**< NUMA socket used for memory allocation */
137 : : uint32_t queue_size; /**< Size of queue */
138 : : uint8_t priority; /**< Queue priority */
139 : : bool deferred_start; /**< Do not start queue when device is started. */
140 : : enum rte_bbdev_op_type op_type; /**< Operation type */
141 : : };
142 : :
143 : : /**
144 : : * Configure a queue on a device.
145 : : * This function can be called after device configuration, and before starting.
146 : : * It can also be called when the device or the queue is in the stopped state.
147 : : *
148 : : * @param dev_id
149 : : * The identifier of the device.
150 : : * @param queue_id
151 : : * The index of the queue.
152 : : * @param conf
153 : : * The queue configuration. If NULL, a default configuration will be used.
154 : : *
155 : : * @return
156 : : * - 0 on success
157 : : * - EINVAL if the identified queue size or priority are invalid
158 : : * - EBUSY if the identified queue or its device have already started
159 : : */
160 : : int
161 : : rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
162 : : const struct rte_bbdev_queue_conf *conf);
163 : :
164 : : /**
165 : : * Start a device.
166 : : * This is the last step needed before enqueueing operations is possible.
167 : : *
168 : : * @param dev_id
169 : : * The identifier of the device.
170 : : *
171 : : * @return
172 : : * - 0 on success
173 : : * - negative value on failure - as returned from PMD
174 : : */
175 : : int
176 : : rte_bbdev_start(uint16_t dev_id);
177 : :
178 : : /**
179 : : * Stop a device.
180 : : * The device can be reconfigured, and restarted after being stopped.
181 : : *
182 : : * @param dev_id
183 : : * The identifier of the device.
184 : : *
185 : : * @return
186 : : * - 0 on success
187 : : */
188 : : int
189 : : rte_bbdev_stop(uint16_t dev_id);
190 : :
191 : : /**
192 : : * Close a device.
193 : : * The device cannot be restarted without reconfiguration!
194 : : *
195 : : * @param dev_id
196 : : * The identifier of the device.
197 : : *
198 : : * @return
199 : : * - 0 on success
200 : : */
201 : : int
202 : : rte_bbdev_close(uint16_t dev_id);
203 : :
204 : : /**
205 : : * Start a specified queue on a device.
206 : : * This is only needed if the queue has been stopped, or if the deferred_start
207 : : * flag has been set when configuring the queue.
208 : : *
209 : : * @param dev_id
210 : : * The identifier of the device.
211 : : * @param queue_id
212 : : * The index of the queue.
213 : : *
214 : : * @return
215 : : * - 0 on success
216 : : * - negative value on failure - as returned from PMD
217 : : */
218 : : int
219 : : rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id);
220 : :
221 : : /**
222 : : * Stop a specified queue on a device, to allow re configuration.
223 : : *
224 : : * @param dev_id
225 : : * The identifier of the device.
226 : : * @param queue_id
227 : : * The index of the queue.
228 : : *
229 : : * @return
230 : : * - 0 on success
231 : : * - negative value on failure - as returned from PMD
232 : : */
233 : : int
234 : : rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
235 : :
236 : : /**
237 : : * Flags to indicate the reason why a previous enqueue may not have
238 : : * consumed all requested operations.
239 : : * In case of multiple reasons the latter supersedes a previous one.
240 : : * The related macro RTE_BBDEV_ENQ_STATUS_SIZE_MAX can be used
241 : : * as an absolute maximum for notably sizing array
242 : : * while allowing for future enumeration insertion.
243 : : */
244 : : enum rte_bbdev_enqueue_status {
245 : : RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report. */
246 : : RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room in queue. */
247 : : RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room in ring. */
248 : : RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was rejected as invalid. */
249 : : /* Note: RTE_BBDEV_ENQ_STATUS_SIZE_MAX must be larger or equal to maximum enum value. */
250 : : };
251 : :
252 : : /**
253 : : * Flags to indicate the status of the device.
254 : : */
255 : : enum rte_bbdev_device_status {
256 : : RTE_BBDEV_DEV_NOSTATUS, /**< Nothing being reported. */
257 : : RTE_BBDEV_DEV_NOT_SUPPORTED, /**< Device status is not supported on the PMD. */
258 : : RTE_BBDEV_DEV_RESET, /**< Device in reset and un-configured state. */
259 : : RTE_BBDEV_DEV_CONFIGURED, /**< Device is configured and ready to use. */
260 : : RTE_BBDEV_DEV_ACTIVE, /**< Device is configured and VF is being used. */
261 : : RTE_BBDEV_DEV_FATAL_ERR, /**< Device has hit a fatal uncorrectable error. */
262 : : RTE_BBDEV_DEV_RESTART_REQ, /**< Device requires application to restart. */
263 : : RTE_BBDEV_DEV_RECONFIG_REQ, /**< Device requires application to reconfigure queues. */
264 : : RTE_BBDEV_DEV_CORRECT_ERR, /**< Warning of a correctable error event happened. */
265 : : };
266 : :
267 : : /** Device statistics. */
268 : : struct rte_bbdev_stats {
269 : : uint64_t enqueued_count; /**< Count of all operations enqueued */
270 : : uint64_t dequeued_count; /**< Count of all operations dequeued */
271 : : /** Total error count on operations enqueued */
272 : : uint64_t enqueue_err_count;
273 : : /** Total error count on operations dequeued */
274 : : uint64_t dequeue_err_count;
275 : : /** Total warning count on operations enqueued. */
276 : : uint64_t enqueue_warn_count;
277 : : /** Total warning count on operations dequeued. */
278 : : uint64_t dequeue_warn_count;
279 : : /** Total enqueue status count based on *rte_bbdev_enqueue_status* enum. */
280 : : uint64_t enqueue_status_count[RTE_BBDEV_ENQ_STATUS_SIZE_MAX];
281 : : /** CPU cycles consumed by the (HW/SW) accelerator device to offload
282 : : * the enqueue request to its internal queues.
283 : : * - For a HW device this is the cycles consumed in MMIO write
284 : : * - For a SW (vdev) device, this is the processing time of the
285 : : * bbdev operation
286 : : */
287 : : uint64_t acc_offload_cycles;
288 : : /** Available number of enqueue batch on that queue. */
289 : : uint16_t enqueue_depth_avail;
290 : : };
291 : :
292 : : /**
293 : : * Retrieve the general I/O statistics of a device.
294 : : *
295 : : * @param dev_id
296 : : * The identifier of the device.
297 : : * @param stats
298 : : * Pointer to structure to where statistics will be copied. On error, this
299 : : * location may or may not have been modified.
300 : : *
301 : : * @return
302 : : * - 0 on success
303 : : * - EINVAL if invalid parameter pointer is provided
304 : : */
305 : : int
306 : : rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);
307 : :
308 : : /**
309 : : * Reset the statistics of a device.
310 : : *
311 : : * @param dev_id
312 : : * The identifier of the device.
313 : : * @return
314 : : * - 0 on success
315 : : */
316 : : int
317 : : rte_bbdev_stats_reset(uint16_t dev_id);
318 : :
319 : : /**
320 : : * Retrieve the statistics of a specific queue.
321 : : *
322 : : * @param dev_id
323 : : * The identifier of the device.
324 : : * @param queue_id
325 : : * The index of the queue.
326 : : * @param stats
327 : : * Pointer to structure to where statistics will be copied. On error, this
328 : : * location may or may not have been modified.
329 : : *
330 : : * @return
331 : : * - 0 on success
332 : : * - -ENODEV if dev_id is invalid
333 : : * - -EINVAL if stats is NULL
334 : : * - -ERANGE if queue_id is out of range
335 : : */
336 : : __rte_experimental
337 : : int rte_bbdev_queue_stats_get(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_stats *stats);
338 : :
339 : : /** Device information supplied by the device's driver */
340 : :
341 : : /* Structure rte_bbdev_driver_info 8< */
342 : : struct rte_bbdev_driver_info {
343 : : /** Driver name */
344 : : const char *driver_name;
345 : :
346 : : /** Maximum number of queues supported by the device */
347 : : unsigned int max_num_queues;
348 : : /** Maximum number of queues supported per operation type */
349 : : unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX];
350 : : /** Priority level supported per operation type */
351 : : unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX];
352 : : /** Queue size limit (queue size must also be power of 2) */
353 : : uint32_t queue_size_lim;
354 : : /** Set if device off-loads operation to hardware */
355 : : bool hardware_accelerated;
356 : : /** Max value supported by queue priority for DL */
357 : : uint8_t max_dl_queue_priority;
358 : : /** Max value supported by queue priority for UL */
359 : : uint8_t max_ul_queue_priority;
360 : : /** Set if device supports per-queue interrupts */
361 : : bool queue_intr_supported;
362 : : /** Device Status */
363 : : enum rte_bbdev_device_status device_status;
364 : : /** HARQ memory available in kB */
365 : : uint32_t harq_buffer_size;
366 : : /** Minimum alignment of buffers, in bytes */
367 : : uint16_t min_alignment;
368 : : /** Byte endianness (RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN) supported
369 : : * for input/output data
370 : : */
371 : : uint8_t data_endianness;
372 : : /** Default queue configuration used if none is supplied */
373 : : struct rte_bbdev_queue_conf default_queue_conf;
374 : : /** Device operation capabilities */
375 : : const struct rte_bbdev_op_cap *capabilities;
376 : : /** Device cpu_flag requirements */
377 : : const enum rte_cpu_flag_t *cpu_flag_reqs;
378 : : /** FFT windowing width for 2048 FFT - size defined in capability. */
379 : : uint16_t *fft_window_width;
380 : : };
381 : : /* >8 End of structure rte_bbdev_driver_info. */
382 : :
383 : : /** Macro used at end of bbdev PMD list */
384 : : #define RTE_BBDEV_END_OF_CAPABILITIES_LIST() \
385 : : { RTE_BBDEV_OP_NONE }
386 : :
387 : : /**
388 : : * Device information structure used by an application to discover a devices
389 : : * capabilities and current configuration
390 : : */
391 : :
392 : : /* Structure rte_bbdev_info 8< */
393 : : struct rte_bbdev_info {
394 : : int socket_id; /**< NUMA socket that device is on */
395 : : const char *dev_name; /**< Unique device name */
396 : : const struct rte_device *device; /**< Device Information */
397 : : uint16_t num_queues; /**< Number of queues currently configured */
398 : : bool started; /**< Set if device is currently started */
399 : : struct rte_bbdev_driver_info drv; /**< Info from device driver */
400 : : };
401 : : /* >8 End of structure rte_bbdev_info. */
402 : :
403 : : /**
404 : : * Retrieve information about a device.
405 : : *
406 : : * @param dev_id
407 : : * The identifier of the device.
408 : : * @param dev_info
409 : : * Pointer to structure to where information will be copied. On error, this
410 : : * location may or may not have been modified.
411 : : *
412 : : * @return
413 : : * - 0 on success
414 : : * - EINVAL if invalid parameter pointer is provided
415 : : */
416 : : int
417 : : rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info);
418 : :
419 : : /** Queue information */
420 : : struct rte_bbdev_queue_info {
421 : : /** Current device configuration */
422 : : struct rte_bbdev_queue_conf conf;
423 : : /** Set if queue is currently started */
424 : : bool started;
425 : : };
426 : :
427 : : /**
428 : : * Retrieve information about a specific queue on a device.
429 : : *
430 : : * @param dev_id
431 : : * The identifier of the device.
432 : : * @param queue_id
433 : : * The index of the queue.
434 : : * @param queue_info
435 : : * Pointer to structure to where information will be copied. On error, this
436 : : * location may or may not have been modified.
437 : : *
438 : : * @return
439 : : * - 0 on success
440 : : * - EINVAL if invalid parameter pointer is provided
441 : : */
442 : : int
443 : : rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id,
444 : : struct rte_bbdev_queue_info *queue_info);
445 : :
446 : : /** @internal The data structure associated with each queue of a device. */
447 : : struct rte_bbdev_queue_data {
448 : : void *queue_private; /**< Driver-specific per-queue data */
449 : : struct rte_bbdev_queue_conf conf; /**< Current configuration */
450 : : struct rte_bbdev_stats queue_stats; /**< Queue statistics */
451 : : enum rte_bbdev_enqueue_status enqueue_status; /**< Enqueue status when op is rejected */
452 : : bool started; /**< Queue state */
453 : : };
454 : :
455 : : /** @internal Enqueue encode operations for processing on queue of a device. */
456 : : typedef uint16_t (*rte_bbdev_enqueue_enc_ops_t)(
457 : : struct rte_bbdev_queue_data *q_data,
458 : : struct rte_bbdev_enc_op **ops,
459 : : uint16_t num);
460 : :
461 : : /** @internal Enqueue decode operations for processing on queue of a device. */
462 : : typedef uint16_t (*rte_bbdev_enqueue_dec_ops_t)(
463 : : struct rte_bbdev_queue_data *q_data,
464 : : struct rte_bbdev_dec_op **ops,
465 : : uint16_t num);
466 : :
467 : : /** @internal Enqueue FFT operations for processing on queue of a device. */
468 : : typedef uint16_t (*rte_bbdev_enqueue_fft_ops_t)(
469 : : struct rte_bbdev_queue_data *q_data,
470 : : struct rte_bbdev_fft_op **ops,
471 : : uint16_t num);
472 : :
473 : : /** @internal Enqueue MLD-TS operations for processing on queue of a device. */
474 : : typedef uint16_t (*rte_bbdev_enqueue_mldts_ops_t)(
475 : : struct rte_bbdev_queue_data *q_data,
476 : : struct rte_bbdev_mldts_op **ops,
477 : : uint16_t num);
478 : :
479 : : /** @internal Dequeue encode operations from a queue of a device. */
480 : : typedef uint16_t (*rte_bbdev_dequeue_enc_ops_t)(
481 : : struct rte_bbdev_queue_data *q_data,
482 : : struct rte_bbdev_enc_op **ops, uint16_t num);
483 : :
484 : : /** @internal Dequeue decode operations from a queue of a device. */
485 : : typedef uint16_t (*rte_bbdev_dequeue_dec_ops_t)(
486 : : struct rte_bbdev_queue_data *q_data,
487 : : struct rte_bbdev_dec_op **ops, uint16_t num);
488 : :
489 : : /** @internal Dequeue FFT operations from a queue of a device. */
490 : : typedef uint16_t (*rte_bbdev_dequeue_fft_ops_t)(
491 : : struct rte_bbdev_queue_data *q_data,
492 : : struct rte_bbdev_fft_op **ops, uint16_t num);
493 : :
494 : : /** @internal Dequeue MLDTS operations from a queue of a device. */
495 : : typedef uint16_t (*rte_bbdev_dequeue_mldts_ops_t)(
496 : : struct rte_bbdev_queue_data *q_data,
497 : : struct rte_bbdev_mldts_op **ops, uint16_t num);
498 : :
499 : : #define RTE_BBDEV_NAME_MAX_LEN 64 /**< Max length of device name */
500 : :
501 : : /**
502 : : * @internal The data associated with a device, with no function pointers.
503 : : * This structure is safe to place in shared memory to be common among
504 : : * different processes in a multi-process configuration. Drivers can access
505 : : * these fields, but should never write to them!
506 : : */
507 : : struct rte_bbdev_data {
508 : : char name[RTE_BBDEV_NAME_MAX_LEN]; /**< Unique identifier name */
509 : : void *dev_private; /**< Driver-specific private data */
510 : : uint16_t num_queues; /**< Number of currently configured queues */
511 : : struct rte_bbdev_queue_data *queues; /**< Queue structures */
512 : : uint16_t dev_id; /**< Device ID */
513 : : int socket_id; /**< NUMA socket that device is on */
514 : : bool started; /**< Device run-time state */
515 : : RTE_ATOMIC(uint16_t) process_cnt; /** Counter of processes using the device */
516 : : };
517 : :
518 : : /* Forward declarations */
519 : : struct rte_bbdev_ops;
520 : : struct rte_bbdev_callback;
521 : : struct rte_intr_handle;
522 : :
523 : : /** Structure to keep track of registered callbacks */
524 : : RTE_TAILQ_HEAD(rte_bbdev_cb_list, rte_bbdev_callback);
525 : :
526 : : /**
527 : : * @internal The data structure associated with a device. Drivers can access
528 : : * these fields, but should only write to the *_ops fields.
529 : : */
530 : : struct __rte_cache_aligned rte_bbdev {
531 : : /** Enqueue encode function */
532 : : rte_bbdev_enqueue_enc_ops_t enqueue_enc_ops;
533 : : /** Enqueue decode function */
534 : : rte_bbdev_enqueue_dec_ops_t enqueue_dec_ops;
535 : : /** Dequeue encode function */
536 : : rte_bbdev_dequeue_enc_ops_t dequeue_enc_ops;
537 : : /** Dequeue decode function */
538 : : rte_bbdev_dequeue_dec_ops_t dequeue_dec_ops;
539 : : /** Enqueue encode function */
540 : : rte_bbdev_enqueue_enc_ops_t enqueue_ldpc_enc_ops;
541 : : /** Enqueue decode function */
542 : : rte_bbdev_enqueue_dec_ops_t enqueue_ldpc_dec_ops;
543 : : /** Dequeue encode function */
544 : : rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops;
545 : : /** Dequeue decode function */
546 : : rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops;
547 : : /** Enqueue FFT function */
548 : : rte_bbdev_enqueue_fft_ops_t enqueue_fft_ops;
549 : : /** Dequeue FFT function */
550 : : rte_bbdev_dequeue_fft_ops_t dequeue_fft_ops;
551 : : const struct rte_bbdev_ops *dev_ops; /**< Functions exported by PMD */
552 : : struct rte_bbdev_data *data; /**< Pointer to device data */
553 : : enum rte_bbdev_state state; /**< If device is currently used or not */
554 : : struct rte_device *device; /**< Backing device */
555 : : /** User application callback for interrupts if present */
556 : : struct rte_bbdev_cb_list list_cbs;
557 : : struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
558 : : /** Enqueue MLD-TS function */
559 : : rte_bbdev_enqueue_mldts_ops_t enqueue_mldts_ops;
560 : : /** Dequeue MLD-TS function */
561 : : rte_bbdev_dequeue_mldts_ops_t dequeue_mldts_ops;
562 : : };
563 : :
564 : : /** @internal array of all devices */
565 : : extern struct rte_bbdev rte_bbdev_devices[];
566 : :
567 : : /**
568 : : * Enqueue a burst of processed encode operations to a queue of the device.
569 : : * This functions only enqueues as many operations as currently possible and
570 : : * does not block until @p num_ops entries in the queue are available.
571 : : * This function does not provide any error notification to avoid the
572 : : * corresponding overhead.
573 : : *
574 : : * @param dev_id
575 : : * The identifier of the device.
576 : : * @param queue_id
577 : : * The index of the queue.
578 : : * @param ops
579 : : * Pointer array containing operations to be enqueued Must have at least
580 : : * @p num_ops entries
581 : : * @param num_ops
582 : : * The maximum number of operations to enqueue.
583 : : *
584 : : * @return
585 : : * The number of operations actually enqueued (this is the number of processed
586 : : * entries in the @p ops array).
587 : : */
588 : : static inline uint16_t
589 : 0 : rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id,
590 : : struct rte_bbdev_enc_op **ops, uint16_t num_ops)
591 : : {
592 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
593 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
594 : 0 : rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
595 : : rte_bbdev_op_type_str(RTE_BBDEV_OP_TURBO_DEC));
596 : 0 : return dev->enqueue_enc_ops(q_data, ops, num_ops);
597 : : }
598 : :
599 : : /**
600 : : * Enqueue a burst of processed decode operations to a queue of the device.
601 : : * This functions only enqueues as many operations as currently possible and
602 : : * does not block until @p num_ops entries in the queue are available.
603 : : * This function does not provide any error notification to avoid the
604 : : * corresponding overhead.
605 : : *
606 : : * @param dev_id
607 : : * The identifier of the device.
608 : : * @param queue_id
609 : : * The index of the queue.
610 : : * @param ops
611 : : * Pointer array containing operations to be enqueued Must have at least
612 : : * @p num_ops entries
613 : : * @param num_ops
614 : : * The maximum number of operations to enqueue.
615 : : *
616 : : * @return
617 : : * The number of operations actually enqueued (this is the number of processed
618 : : * entries in the @p ops array).
619 : : */
620 : : static inline uint16_t
621 : 0 : rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
622 : : struct rte_bbdev_dec_op **ops, uint16_t num_ops)
623 : : {
624 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
625 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
626 : 0 : rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
627 : : rte_bbdev_op_type_str(RTE_BBDEV_OP_TURBO_ENC));
628 : 0 : return dev->enqueue_dec_ops(q_data, ops, num_ops);
629 : : }
630 : :
631 : : /**
632 : : * Enqueue a burst of processed encode operations to a queue of the device.
633 : : * This functions only enqueues as many operations as currently possible and
634 : : * does not block until @p num_ops entries in the queue are available.
635 : : * This function does not provide any error notification to avoid the
636 : : * corresponding overhead.
637 : : *
638 : : * @param dev_id
639 : : * The identifier of the device.
640 : : * @param queue_id
641 : : * The index of the queue.
642 : : * @param ops
643 : : * Pointer array containing operations to be enqueued Must have at least
644 : : * @p num_ops entries
645 : : * @param num_ops
646 : : * The maximum number of operations to enqueue.
647 : : *
648 : : * @return
649 : : * The number of operations actually enqueued (this is the number of processed
650 : : * entries in the @p ops array).
651 : : */
652 : : static inline uint16_t
653 : 0 : rte_bbdev_enqueue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
654 : : struct rte_bbdev_enc_op **ops, uint16_t num_ops)
655 : : {
656 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
657 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
658 : 0 : rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
659 : : rte_bbdev_op_type_str(RTE_BBDEV_OP_LDPC_ENC));
660 : 0 : return dev->enqueue_ldpc_enc_ops(q_data, ops, num_ops);
661 : : }
662 : :
663 : : /**
664 : : * Enqueue a burst of processed decode operations to a queue of the device.
665 : : * This functions only enqueues as many operations as currently possible and
666 : : * does not block until @p num_ops entries in the queue are available.
667 : : * This function does not provide any error notification to avoid the
668 : : * corresponding overhead.
669 : : *
670 : : * @param dev_id
671 : : * The identifier of the device.
672 : : * @param queue_id
673 : : * The index of the queue.
674 : : * @param ops
675 : : * Pointer array containing operations to be enqueued Must have at least
676 : : * @p num_ops entries
677 : : * @param num_ops
678 : : * The maximum number of operations to enqueue.
679 : : *
680 : : * @return
681 : : * The number of operations actually enqueued (this is the number of processed
682 : : * entries in the @p ops array).
683 : : */
684 : : static inline uint16_t
685 : 0 : rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
686 : : struct rte_bbdev_dec_op **ops, uint16_t num_ops)
687 : : {
688 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
689 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
690 : 0 : rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
691 : : rte_bbdev_op_type_str(RTE_BBDEV_OP_LDPC_DEC));
692 : 0 : return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops);
693 : : }
694 : :
695 : : /**
696 : : * Enqueue a burst of FFT operations to a queue of the device.
697 : : * This functions only enqueues as many operations as currently possible and
698 : : * does not block until @p num_ops entries in the queue are available.
699 : : * This function does not provide any error notification to avoid the
700 : : * corresponding overhead.
701 : : *
702 : : * @param dev_id
703 : : * The identifier of the device.
704 : : * @param queue_id
705 : : * The index of the queue.
706 : : * @param ops
707 : : * Pointer array containing operations to be enqueued.
708 : : * Must have at least @p num_ops entries.
709 : : * @param num_ops
710 : : * The maximum number of operations to enqueue.
711 : : *
712 : : * @return
713 : : * The number of operations actually enqueued.
714 : : * (This is the number of processed entries in the @p ops array.)
715 : : */
716 : : static inline uint16_t
717 : 0 : rte_bbdev_enqueue_fft_ops(uint16_t dev_id, uint16_t queue_id,
718 : : struct rte_bbdev_fft_op **ops, uint16_t num_ops)
719 : : {
720 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
721 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
722 : 0 : rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
723 : : rte_bbdev_op_type_str(RTE_BBDEV_OP_FFT));
724 : 0 : return dev->enqueue_fft_ops(q_data, ops, num_ops);
725 : : }
726 : :
727 : : /**
728 : : * Enqueue a burst of MLDTS operations to a queue of the device.
729 : : * This functions only enqueues as many operations as currently possible and
730 : : * does not block until @p num_ops entries in the queue are available.
731 : : * This function does not provide any error notification to avoid the
732 : : * corresponding overhead.
733 : : *
734 : : * @param dev_id
735 : : * The identifier of the device.
736 : : * @param queue_id
737 : : * The index of the queue.
738 : : * @param ops
739 : : * Pointer array containing operations to be enqueued Must have at least
740 : : * @p num_ops entries
741 : : * @param num_ops
742 : : * The maximum number of operations to enqueue.
743 : : *
744 : : * @return
745 : : * The number of operations actually enqueued (this is the number of processed
746 : : * entries in the @p ops array).
747 : : */
748 : : static inline uint16_t
749 : 0 : rte_bbdev_enqueue_mldts_ops(uint16_t dev_id, uint16_t queue_id,
750 : : struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
751 : : {
752 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
753 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
754 : 0 : rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
755 : : rte_bbdev_op_type_str(RTE_BBDEV_OP_MLDTS));
756 : 0 : return dev->enqueue_mldts_ops(q_data, ops, num_ops);
757 : : }
758 : :
759 : : /**
760 : : * Dequeue a burst of processed encode operations from a queue of the device.
761 : : * This functions returns only the current contents of the queue,
762 : : * and does not block until @ num_ops is available.
763 : : * This function does not provide any error notification to avoid the
764 : : * corresponding overhead.
765 : : *
766 : : * @param dev_id
767 : : * The identifier of the device.
768 : : * @param queue_id
769 : : * The index of the queue.
770 : : * @param ops
771 : : * Pointer array where operations will be dequeued to.
772 : : * Must have at least @p num_ops entries, i.e.
773 : : * a pointer to a table of void * pointers (ops) that will be filled.
774 : : * @param num_ops
775 : : * The maximum number of operations to dequeue.
776 : : *
777 : : * @return
778 : : * The number of operations actually dequeued.
779 : : * (This is the number of entries copied into the @p ops array.)
780 : : */
781 : : static inline uint16_t
782 : 0 : rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id,
783 : : struct rte_bbdev_enc_op **ops, uint16_t num_ops)
784 : : {
785 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
786 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
787 : 0 : uint16_t num_ops_dequeued = dev->dequeue_enc_ops(q_data, ops, num_ops);
788 : 0 : if (num_ops_dequeued > 0)
789 : 0 : rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
790 : : num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_TURBO_ENC));
791 : 0 : return num_ops_dequeued;
792 : : }
793 : :
794 : : /**
795 : : * Dequeue a burst of processed decode operations from a queue of the device.
796 : : * This functions returns only the current contents of the queue, and does not
797 : : * block until @ num_ops is available.
798 : : * This function does not provide any error notification to avoid the
799 : : * corresponding overhead.
800 : : *
801 : : * @param dev_id
802 : : * The identifier of the device.
803 : : * @param queue_id
804 : : * The index of the queue.
805 : : * @param ops
806 : : * Pointer array where operations will be dequeued to. Must have at least
807 : : * @p num_ops entries
808 : : * ie. A pointer to a table of void * pointers (ops) that will be filled.
809 : : * @param num_ops
810 : : * The maximum number of operations to dequeue.
811 : : *
812 : : * @return
813 : : * The number of operations actually dequeued (this is the number of entries
814 : : * copied into the @p ops array).
815 : : */
816 : :
817 : : static inline uint16_t
818 : 0 : rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id,
819 : : struct rte_bbdev_dec_op **ops, uint16_t num_ops)
820 : : {
821 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
822 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
823 : 0 : uint16_t num_ops_dequeued = dev->dequeue_dec_ops(q_data, ops, num_ops);
824 : 0 : if (num_ops_dequeued > 0)
825 : 0 : rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
826 : : num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_TURBO_DEC));
827 : 0 : return num_ops_dequeued;
828 : : }
829 : :
830 : :
831 : : /**
832 : : * Dequeue a burst of processed encode operations from a queue of the device.
833 : : * This functions returns only the current contents of the queue, and does not
834 : : * block until @ num_ops is available.
835 : : * This function does not provide any error notification to avoid the
836 : : * corresponding overhead.
837 : : *
838 : : * @param dev_id
839 : : * The identifier of the device.
840 : : * @param queue_id
841 : : * The index of the queue.
842 : : * @param ops
843 : : * Pointer array where operations will be dequeued to. Must have at least
844 : : * @p num_ops entries
845 : : * @param num_ops
846 : : * The maximum number of operations to dequeue.
847 : : *
848 : : * @return
849 : : * The number of operations actually dequeued (this is the number of entries
850 : : * copied into the @p ops array).
851 : : */
852 : : static inline uint16_t
853 : 0 : rte_bbdev_dequeue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
854 : : struct rte_bbdev_enc_op **ops, uint16_t num_ops)
855 : : {
856 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
857 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
858 : 0 : uint16_t num_ops_dequeued = dev->dequeue_ldpc_enc_ops(q_data, ops, num_ops);
859 : 0 : if (num_ops_dequeued > 0)
860 : 0 : rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
861 : : num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_LDPC_ENC));
862 : 0 : return num_ops_dequeued;
863 : : }
864 : :
865 : : /**
866 : : * Dequeue a burst of processed decode operations from a queue of the device.
867 : : * This functions returns only the current contents of the queue, and does not
868 : : * block until @ num_ops is available.
869 : : * This function does not provide any error notification to avoid the
870 : : * corresponding overhead.
871 : : *
872 : : * @param dev_id
873 : : * The identifier of the device.
874 : : * @param queue_id
875 : : * The index of the queue.
876 : : * @param ops
877 : : * Pointer array where operations will be dequeued to. Must have at least
878 : : * @p num_ops entries
879 : : * @param num_ops
880 : : * The maximum number of operations to dequeue.
881 : : *
882 : : * @return
883 : : * The number of operations actually dequeued (this is the number of entries
884 : : * copied into the @p ops array).
885 : : */
886 : : static inline uint16_t
887 : 0 : rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
888 : : struct rte_bbdev_dec_op **ops, uint16_t num_ops)
889 : : {
890 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
891 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
892 : 0 : uint16_t num_ops_dequeued = dev->dequeue_ldpc_dec_ops(q_data, ops, num_ops);
893 : 0 : if (num_ops_dequeued > 0)
894 : 0 : rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
895 : : num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_LDPC_DEC));
896 : 0 : return num_ops_dequeued;
897 : : }
898 : :
899 : : /**
900 : : * Dequeue a burst of FFT operations from a queue of the device.
901 : : * This functions returns only the current contents of the queue, and does not
902 : : * block until @ num_ops is available.
903 : : * This function does not provide any error notification to avoid the
904 : : * corresponding overhead.
905 : : *
906 : : * @param dev_id
907 : : * The identifier of the device.
908 : : * @param queue_id
909 : : * The index of the queue.
910 : : * @param ops
911 : : * Pointer array where operations will be dequeued to. Must have at least
912 : : * @p num_ops entries
913 : : * @param num_ops
914 : : * The maximum number of operations to dequeue.
915 : : *
916 : : * @return
917 : : * The number of operations actually dequeued (this is the number of entries
918 : : * copied into the @p ops array).
919 : : */
920 : : static inline uint16_t
921 : 0 : rte_bbdev_dequeue_fft_ops(uint16_t dev_id, uint16_t queue_id,
922 : : struct rte_bbdev_fft_op **ops, uint16_t num_ops)
923 : : {
924 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
925 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
926 : 0 : uint16_t num_ops_dequeued = dev->dequeue_fft_ops(q_data, ops, num_ops);
927 : 0 : if (num_ops_dequeued > 0)
928 : 0 : rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
929 : : num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_FFT));
930 : 0 : return num_ops_dequeued;
931 : : }
932 : :
933 : : /**
934 : : * Dequeue a burst of MLDTS operations from a queue of the device.
935 : : * This functions returns only the current contents of the queue, and does not
936 : : * block until @p num_ops is available.
937 : : * This function does not provide any error notification to avoid the
938 : : * corresponding overhead.
939 : : *
940 : : * @param dev_id
941 : : * The identifier of the device.
942 : : * @param queue_id
943 : : * The index of the queue.
944 : : * @param ops
945 : : * Pointer array where operations will be dequeued to. Must have at least
946 : : * @p num_ops entries
947 : : * @param num_ops
948 : : * The maximum number of operations to dequeue.
949 : : *
950 : : * @return
951 : : * The number of operations actually dequeued (this is the number of entries
952 : : * copied into the @p ops array).
953 : : */
954 : : static inline uint16_t
955 : 0 : rte_bbdev_dequeue_mldts_ops(uint16_t dev_id, uint16_t queue_id,
956 : : struct rte_bbdev_mldts_op **ops, uint16_t num_ops)
957 : : {
958 : 0 : struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
959 : 0 : struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
960 : 0 : uint16_t num_ops_dequeued = dev->dequeue_mldts_ops(q_data, ops, num_ops);
961 : 0 : if (num_ops_dequeued > 0)
962 : 0 : rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
963 : : num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_MLDTS));
964 : 0 : return num_ops_dequeued;
965 : : }
966 : :
967 : : /** Definitions of device event types */
968 : : enum rte_bbdev_event_type {
969 : : RTE_BBDEV_EVENT_UNKNOWN, /**< unknown event type */
970 : : RTE_BBDEV_EVENT_ERROR, /**< error interrupt event */
971 : : RTE_BBDEV_EVENT_DEQUEUE, /**< dequeue event */
972 : : RTE_BBDEV_EVENT_MAX /**< max value of this enum */
973 : : };
974 : :
975 : : /**
976 : : * Typedef for application callback function registered by application
977 : : * software for notification of device events
978 : : *
979 : : * @param dev_id
980 : : * Device identifier
981 : : * @param event
982 : : * Device event to register for notification of.
983 : : * @param cb_arg
984 : : * User specified parameter to be passed to user's callback function.
985 : : * @param ret_param
986 : : * To pass data back to user application.
987 : : */
988 : : typedef void (*rte_bbdev_cb_fn)(uint16_t dev_id,
989 : : enum rte_bbdev_event_type event, void *cb_arg,
990 : : void *ret_param);
991 : :
992 : : /**
993 : : * Register a callback function for specific device id. Multiple callbacks can
994 : : * be added and will be called in the order they are added when an event is
995 : : * triggered. Callbacks are called in a separate thread created by the DPDK EAL.
996 : : *
997 : : * @param dev_id
998 : : * Device id.
999 : : * @param event
1000 : : * The event that the callback will be registered for.
1001 : : * @param cb_fn
1002 : : * User supplied callback function to be called.
1003 : : * @param cb_arg
1004 : : * Pointer to parameter that will be passed to the callback.
1005 : : *
1006 : : * @return
1007 : : * Zero on success, negative value on failure.
1008 : : */
1009 : : int
1010 : : rte_bbdev_callback_register(uint16_t dev_id, enum rte_bbdev_event_type event,
1011 : : rte_bbdev_cb_fn cb_fn, void *cb_arg);
1012 : :
1013 : : /**
1014 : : * Unregister a callback function for specific device id.
1015 : : *
1016 : : * @param dev_id
1017 : : * The device identifier.
1018 : : * @param event
1019 : : * The event that the callback will be unregistered for.
1020 : : * @param cb_fn
1021 : : * User supplied callback function to be unregistered.
1022 : : * @param cb_arg
1023 : : * Pointer to the parameter supplied when registering the callback.
1024 : : * (void *)-1 means to remove all registered callbacks with the specified
1025 : : * function address.
1026 : : *
1027 : : * @return
1028 : : * - 0 on success
1029 : : * - EINVAL if invalid parameter pointer is provided
1030 : : * - EAGAIN if the provided callback pointer does not exist
1031 : : */
1032 : : int
1033 : : rte_bbdev_callback_unregister(uint16_t dev_id, enum rte_bbdev_event_type event,
1034 : : rte_bbdev_cb_fn cb_fn, void *cb_arg);
1035 : :
1036 : : /**
1037 : : * Enable a one-shot interrupt on the next operation enqueued to a particular
1038 : : * queue. The interrupt will be triggered when the operation is ready to be
1039 : : * dequeued. To handle the interrupt, an epoll file descriptor must be
1040 : : * registered using rte_bbdev_queue_intr_ctl(), and then an application
1041 : : * thread/lcore can wait for the interrupt using rte_epoll_wait().
1042 : : *
1043 : : * @param dev_id
1044 : : * The device identifier.
1045 : : * @param queue_id
1046 : : * The index of the queue.
1047 : : *
1048 : : * @return
1049 : : * - 0 on success
1050 : : * - negative value on failure - as returned from PMD
1051 : : */
1052 : : int
1053 : : rte_bbdev_queue_intr_enable(uint16_t dev_id, uint16_t queue_id);
1054 : :
1055 : : /**
1056 : : * Disable a one-shot interrupt on the next operation enqueued to a particular
1057 : : * queue (if it has been enabled).
1058 : : *
1059 : : * @param dev_id
1060 : : * The device identifier.
1061 : : * @param queue_id
1062 : : * The index of the queue.
1063 : : *
1064 : : * @return
1065 : : * - 0 on success
1066 : : * - negative value on failure - as returned from PMD
1067 : : */
1068 : : int
1069 : : rte_bbdev_queue_intr_disable(uint16_t dev_id, uint16_t queue_id);
1070 : :
1071 : : /**
1072 : : * Control interface for per-queue interrupts.
1073 : : *
1074 : : * @param dev_id
1075 : : * The device identifier.
1076 : : * @param queue_id
1077 : : * The index of the queue.
1078 : : * @param epfd
1079 : : * Epoll file descriptor that will be associated with the interrupt source.
1080 : : * If the special value RTE_EPOLL_PER_THREAD is provided, a per thread epoll
1081 : : * file descriptor created by the EAL is used (RTE_EPOLL_PER_THREAD can also
1082 : : * be used when calling rte_epoll_wait()).
1083 : : * @param op
1084 : : * The operation be performed for the vector.RTE_INTR_EVENT_ADD or
1085 : : * RTE_INTR_EVENT_DEL.
1086 : : * @param data
1087 : : * User context, that will be returned in the epdata.data field of the
1088 : : * rte_epoll_event structure filled in by rte_epoll_wait().
1089 : : *
1090 : : * @return
1091 : : * - 0 on success
1092 : : * - ENOTSUP if interrupts are not supported by the identified device
1093 : : * - negative value on failure - as returned from PMD
1094 : : */
1095 : : int
1096 : : rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
1097 : : void *data);
1098 : :
1099 : : /**
1100 : : * Convert device status from enum to string.
1101 : : *
1102 : : * @param status
1103 : : * Device status as enum.
1104 : : *
1105 : : * @returns
1106 : : * Device status as string or NULL if invalid.
1107 : : */
1108 : : const char*
1109 : : rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
1110 : :
1111 : : /**
1112 : : * Convert queue status from enum to string.
1113 : : *
1114 : : * @param status
1115 : : * Queue status as enum.
1116 : : *
1117 : : * @returns
1118 : : * Queue status as string or NULL if op_type is invalid.
1119 : : */
1120 : : const char*
1121 : : rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status);
1122 : :
1123 : : /**
1124 : : * Dump operations info from device to a file.
1125 : : * This API is used for debugging provided input operations, not a dataplane API.
1126 : : *
1127 : : * @param dev_id
1128 : : * The device identifier.
1129 : : *
1130 : : * @param queue_index
1131 : : * Index of queue.
1132 : : *
1133 : : * @param file
1134 : : * A pointer to a file for output.
1135 : : *
1136 : : * @returns
1137 : : * - 0 on success
1138 : : * - ENOTSUP if interrupts are not supported by the identified device
1139 : : * - negative value on failure - as returned from PMD
1140 : : */
1141 : : __rte_experimental
1142 : : int
1143 : : rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_index, FILE *file);
1144 : :
1145 : :
1146 : : /**
1147 : : * String of parameters related to the parameters of an operation of a given type.
1148 : : *
1149 : : * @param op
1150 : : * Pointer to an operation.
1151 : : *
1152 : : * @param op_type
1153 : : * Operation type enum.
1154 : : *
1155 : : * @param str
1156 : : * String being describing the operations.
1157 : : *
1158 : : * @param len
1159 : : * Size of the string buffer.
1160 : : *
1161 : : * @returns
1162 : : * String describing the provided operation.
1163 : : */
1164 : : __rte_experimental
1165 : : char *
1166 : : rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len);
1167 : :
1168 : : /**
1169 : : * Add a trace with detail of operation.
1170 : : *
1171 : : * @param op
1172 : : * Pointer to an operation.
1173 : : *
1174 : : * @param op_type
1175 : : * Operation type enum.
1176 : : */
1177 : : __rte_experimental
1178 : : void
1179 : : rte_bbdev_ops_trace(void *op, enum rte_bbdev_op_type op_type);
1180 : :
1181 : : #ifdef __cplusplus
1182 : : }
1183 : : #endif
1184 : :
1185 : : #endif /* _RTE_BBDEV_H_ */
|