Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(c) 2017 Intel Corporation
3 : : */
4 : :
5 : : #include <stdint.h>
6 : : #include <string.h>
7 : : #include <stdbool.h>
8 : : #include <sys/queue.h>
9 : :
10 : : #include <eal_export.h>
11 : : #include <rte_common.h>
12 : : #include <rte_errno.h>
13 : : #include <rte_log.h>
14 : : #include <rte_eal.h>
15 : : #include <rte_malloc.h>
16 : : #include <rte_mempool.h>
17 : : #include <rte_memzone.h>
18 : : #include <rte_lcore.h>
19 : : #include <rte_spinlock.h>
20 : : #include <rte_interrupts.h>
21 : :
22 : : #include "rte_bbdev_op.h"
23 : : #include "rte_bbdev.h"
24 : : #include "rte_bbdev_pmd.h"
25 : : #include "bbdev_trace.h"
26 : :
27 : : #define DEV_NAME "BBDEV"
28 : :
29 : : /* Number of supported operation types in *rte_bbdev_op_type*. */
30 : : #define BBDEV_OP_TYPE_COUNT 7
31 : :
32 : : /* BBDev library logging ID */
33 [ - + ]: 252 : RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE);
34 : : #define RTE_LOGTYPE_BBDEV bbdev_logtype
35 : :
36 : : /* Helper macro for logging */
37 : : #define rte_bbdev_log(level, ...) \
38 : : RTE_LOG_LINE(level, BBDEV, "" __VA_ARGS__)
39 : :
40 : : #define rte_bbdev_log_debug(fmt, ...) \
41 : : rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \
42 : : ##__VA_ARGS__)
43 : :
44 : : /* Helper macro to check dev_id is valid */
45 : : #define VALID_DEV_OR_RET_ERR(dev, dev_id) do { \
46 : : if (dev == NULL) { \
47 : : rte_bbdev_log(ERR, "device %u is invalid", dev_id); \
48 : : return -ENODEV; \
49 : : } \
50 : : } while (0)
51 : :
52 : : /* Helper macro to check dev_ops is valid */
53 : : #define VALID_DEV_OPS_OR_RET_ERR(dev, dev_id) do { \
54 : : if (dev->dev_ops == NULL) { \
55 : : rte_bbdev_log(ERR, "NULL dev_ops structure in device %u", \
56 : : dev_id); \
57 : : return -ENODEV; \
58 : : } \
59 : : } while (0)
60 : :
61 : : /* Helper macro to check that driver implements required function pointer */
62 : : #define VALID_FUNC_OR_RET_ERR(func, dev_id) do { \
63 : : if (func == NULL) { \
64 : : rte_bbdev_log(ERR, "device %u does not support %s", \
65 : : dev_id, #func); \
66 : : return -ENOTSUP; \
67 : : } \
68 : : } while (0)
69 : :
70 : : /* Helper macro to check that queue is valid */
71 : : #define VALID_QUEUE_OR_RET_ERR(queue_id, dev) do { \
72 : : if (queue_id >= dev->data->num_queues) { \
73 : : rte_bbdev_log(ERR, "Invalid queue_id %u for device %u", \
74 : : queue_id, dev->data->dev_id); \
75 : : return -ERANGE; \
76 : : } \
77 : : } while (0)
78 : :
79 : : /* List of callback functions registered by an application */
80 : : struct rte_bbdev_callback {
81 : : TAILQ_ENTRY(rte_bbdev_callback) next; /* Callbacks list */
82 : : rte_bbdev_cb_fn cb_fn; /* Callback address */
83 : : void *cb_arg; /* Parameter for callback */
84 : : void *ret_param; /* Return parameter */
85 : : enum rte_bbdev_event_type event; /* Interrupt event type */
86 : : uint32_t active; /* Callback is executing */
87 : : };
88 : :
89 : : /* spinlock for bbdev device callbacks */
90 : : static rte_spinlock_t rte_bbdev_cb_lock = RTE_SPINLOCK_INITIALIZER;
91 : :
92 : : /*
93 : : * Global array of all devices. This is not static because it's used by the
94 : : * inline enqueue and dequeue functions
95 : : */
96 : : RTE_EXPORT_SYMBOL(rte_bbdev_devices)
97 : : struct rte_bbdev rte_bbdev_devices[RTE_BBDEV_MAX_DEVS];
98 : :
99 : : /* Global array with rte_bbdev_data structures */
100 : : static struct rte_bbdev_data *rte_bbdev_data;
101 : :
102 : : /* Memzone name for global bbdev data pool */
103 : : static const char *MZ_RTE_BBDEV_DATA = "rte_bbdev_data";
104 : :
105 : : /* Number of currently valid devices */
106 : : static uint16_t num_devs;
107 : :
108 : : /* Return pointer to device structure, with validity check */
109 : : static struct rte_bbdev *
110 : : get_dev(uint16_t dev_id)
111 : : {
112 [ # # # # : 0 : if (rte_bbdev_is_valid(dev_id))
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # ]
113 : 0 : return &rte_bbdev_devices[dev_id];
114 : : return NULL;
115 : : }
116 : :
117 : : /* Allocate global data array */
118 : : static int
119 : 0 : rte_bbdev_data_alloc(void)
120 : : {
121 : : const unsigned int flags = 0;
122 : : const struct rte_memzone *mz;
123 : :
124 [ # # ]: 0 : if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
125 : 0 : mz = rte_memzone_reserve(MZ_RTE_BBDEV_DATA,
126 : : RTE_BBDEV_MAX_DEVS * sizeof(*rte_bbdev_data),
127 : 0 : rte_socket_id(), flags);
128 : : } else
129 : 0 : mz = rte_memzone_lookup(MZ_RTE_BBDEV_DATA);
130 [ # # ]: 0 : if (mz == NULL) {
131 : 0 : rte_bbdev_log(CRIT,
132 : : "Cannot allocate memzone for bbdev port data");
133 : 0 : return -ENOMEM;
134 : : }
135 : :
136 : 0 : rte_bbdev_data = mz->addr;
137 [ # # ]: 0 : if (rte_eal_process_type() == RTE_PROC_PRIMARY)
138 : 0 : memset(rte_bbdev_data, 0,
139 : : RTE_BBDEV_MAX_DEVS * sizeof(*rte_bbdev_data));
140 : : return 0;
141 : : }
142 : :
143 : : /*
144 : : * Find data allocated for the device or if not found return first unused bbdev
145 : : * data. If all structures are in use and none is used by the device return
146 : : * NULL.
147 : : */
148 : : static struct rte_bbdev_data *
149 : 0 : find_bbdev_data(const char *name)
150 : : {
151 : : uint16_t data_id;
152 : :
153 [ # # ]: 0 : for (data_id = 0; data_id < RTE_BBDEV_MAX_DEVS; ++data_id) {
154 [ # # ]: 0 : if (strlen(rte_bbdev_data[data_id].name) == 0) {
155 : : memset(&rte_bbdev_data[data_id], 0,
156 : : sizeof(struct rte_bbdev_data));
157 : 0 : return &rte_bbdev_data[data_id];
158 [ # # ]: 0 : } else if (strncmp(rte_bbdev_data[data_id].name, name,
159 : : RTE_BBDEV_NAME_MAX_LEN) == 0)
160 : 0 : return &rte_bbdev_data[data_id];
161 : : }
162 : :
163 : : return NULL;
164 : : }
165 : :
166 : : /* Find lowest device id with no attached device */
167 : : static uint16_t
168 : : find_free_dev_id(void)
169 : : {
170 : : uint16_t i;
171 [ # # ]: 0 : for (i = 0; i < RTE_BBDEV_MAX_DEVS; i++) {
172 [ # # ]: 0 : if (rte_bbdev_devices[i].state == RTE_BBDEV_UNUSED)
173 : : return i;
174 : : }
175 : : return RTE_BBDEV_MAX_DEVS;
176 : : }
177 : :
178 : : RTE_EXPORT_SYMBOL(rte_bbdev_allocate)
179 : : struct rte_bbdev *
180 : 0 : rte_bbdev_allocate(const char *name)
181 : : {
182 : : int ret;
183 : : struct rte_bbdev *bbdev;
184 : : uint16_t dev_id;
185 : :
186 [ # # ]: 0 : if (name == NULL) {
187 : 0 : rte_bbdev_log(ERR, "Invalid null device name");
188 : 0 : return NULL;
189 : : }
190 : :
191 [ # # ]: 0 : if (rte_bbdev_get_named_dev(name) != NULL) {
192 : 0 : rte_bbdev_log(ERR, "Device \"%s\" is already allocated", name);
193 : 0 : return NULL;
194 : : }
195 : :
196 : : dev_id = find_free_dev_id();
197 [ # # ]: 0 : if (dev_id == RTE_BBDEV_MAX_DEVS) {
198 : 0 : rte_bbdev_log(ERR, "Reached maximum number of devices");
199 : 0 : return NULL;
200 : : }
201 : :
202 : 0 : bbdev = &rte_bbdev_devices[dev_id];
203 : :
204 [ # # ]: 0 : if (rte_bbdev_data == NULL) {
205 : 0 : ret = rte_bbdev_data_alloc();
206 [ # # ]: 0 : if (ret != 0)
207 : : return NULL;
208 : : }
209 : :
210 : 0 : bbdev->data = find_bbdev_data(name);
211 [ # # ]: 0 : if (bbdev->data == NULL) {
212 : 0 : rte_bbdev_log(ERR,
213 : : "Max BBDevs already allocated in multi-process environment!");
214 : 0 : return NULL;
215 : : }
216 : :
217 : 0 : rte_atomic_fetch_add_explicit(&bbdev->data->process_cnt, 1, rte_memory_order_relaxed);
218 : 0 : bbdev->data->dev_id = dev_id;
219 : 0 : bbdev->state = RTE_BBDEV_INITIALIZED;
220 : :
221 [ # # ]: 0 : ret = snprintf(bbdev->data->name, RTE_BBDEV_NAME_MAX_LEN, "%s", name);
222 [ # # ]: 0 : if ((ret < 0) || (ret >= RTE_BBDEV_NAME_MAX_LEN)) {
223 : 0 : rte_bbdev_log(ERR, "Copying device name \"%s\" failed", name);
224 : 0 : return NULL;
225 : : }
226 : :
227 : : /* init user callbacks */
228 : 0 : TAILQ_INIT(&(bbdev->list_cbs));
229 : :
230 : 0 : num_devs++;
231 : :
232 : 0 : rte_bbdev_log_debug("Initialised device %s (id = %u). Num devices = %u",
233 : : name, dev_id, num_devs);
234 : :
235 : 0 : return bbdev;
236 : : }
237 : :
238 : : RTE_EXPORT_SYMBOL(rte_bbdev_release)
239 : : int
240 : 0 : rte_bbdev_release(struct rte_bbdev *bbdev)
241 : : {
242 : : uint16_t dev_id;
243 : : struct rte_bbdev_callback *cb, *next;
244 : :
245 [ # # ]: 0 : if (bbdev == NULL) {
246 : 0 : rte_bbdev_log(ERR, "NULL bbdev");
247 : 0 : return -ENODEV;
248 : : }
249 : 0 : dev_id = bbdev->data->dev_id;
250 : :
251 : : /* free all callbacks from the device's list */
252 [ # # ]: 0 : for (cb = TAILQ_FIRST(&bbdev->list_cbs); cb != NULL; cb = next) {
253 : :
254 : 0 : next = TAILQ_NEXT(cb, next);
255 [ # # ]: 0 : TAILQ_REMOVE(&(bbdev->list_cbs), cb, next);
256 : 0 : rte_free(cb);
257 : : }
258 : :
259 : : /* clear shared BBDev Data if no process is using the device anymore */
260 [ # # ]: 0 : if (rte_atomic_fetch_sub_explicit(&bbdev->data->process_cnt, 1,
261 : : rte_memory_order_relaxed) - 1 == 0)
262 : 0 : memset(bbdev->data, 0, sizeof(*bbdev->data));
263 : :
264 : : memset(bbdev, 0, sizeof(*bbdev));
265 : 0 : num_devs--;
266 : : bbdev->state = RTE_BBDEV_UNUSED;
267 : :
268 : 0 : rte_bbdev_log_debug(
269 : : "Un-initialised device id = %u. Num devices = %u",
270 : : dev_id, num_devs);
271 : 0 : return 0;
272 : : }
273 : :
274 : : RTE_EXPORT_SYMBOL(rte_bbdev_get_named_dev)
275 : : struct rte_bbdev *
276 : 0 : rte_bbdev_get_named_dev(const char *name)
277 : : {
278 : : unsigned int i;
279 : :
280 [ # # ]: 0 : if (name == NULL) {
281 : 0 : rte_bbdev_log(ERR, "NULL driver name");
282 : 0 : return NULL;
283 : : }
284 : :
285 [ # # ]: 0 : for (i = 0; i < RTE_BBDEV_MAX_DEVS; i++) {
286 : 0 : struct rte_bbdev *dev = get_dev(i);
287 [ # # ]: 0 : if (dev && (strncmp(dev->data->name,
288 : : name, RTE_BBDEV_NAME_MAX_LEN) == 0))
289 : 0 : return dev;
290 : : }
291 : :
292 : : return NULL;
293 : : }
294 : :
295 : : RTE_EXPORT_SYMBOL(rte_bbdev_count)
296 : : uint16_t
297 : 0 : rte_bbdev_count(void)
298 : : {
299 : 0 : return num_devs;
300 : : }
301 : :
302 : : RTE_EXPORT_SYMBOL(rte_bbdev_is_valid)
303 : : bool
304 : 0 : rte_bbdev_is_valid(uint16_t dev_id)
305 : : {
306 [ # # ]: 0 : if ((dev_id < RTE_BBDEV_MAX_DEVS) &&
307 [ # # ]: 0 : rte_bbdev_devices[dev_id].state == RTE_BBDEV_INITIALIZED)
308 : 0 : return true;
309 : : return false;
310 : : }
311 : :
312 : : RTE_EXPORT_SYMBOL(rte_bbdev_find_next)
313 : : uint16_t
314 : 0 : rte_bbdev_find_next(uint16_t dev_id)
315 : : {
316 : 0 : dev_id++;
317 [ # # ]: 0 : for (; dev_id < RTE_BBDEV_MAX_DEVS; dev_id++)
318 [ # # ]: 0 : if (rte_bbdev_is_valid(dev_id))
319 : : break;
320 : 0 : return dev_id;
321 : : }
322 : :
323 : : RTE_EXPORT_SYMBOL(rte_bbdev_setup_queues)
324 : : int
325 : 0 : rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
326 : : {
327 : : unsigned int i;
328 : : int ret;
329 : : struct rte_bbdev_driver_info dev_info;
330 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
331 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
332 : :
333 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
334 : :
335 [ # # ]: 0 : rte_bbdev_trace_setup_queues(dev_id, num_queues, socket_id);
336 : :
337 [ # # ]: 0 : if (dev->data->started) {
338 : 0 : rte_bbdev_log(ERR,
339 : : "Device %u cannot be configured when started",
340 : : dev_id);
341 : 0 : return -EBUSY;
342 : : }
343 : :
344 : : /* Get device driver information to get max number of queues */
345 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->info_get, dev_id);
346 : : memset(&dev_info, 0, sizeof(dev_info));
347 : 0 : dev->dev_ops->info_get(dev, &dev_info);
348 : :
349 [ # # # # ]: 0 : if ((num_queues == 0) || (num_queues > dev_info.max_num_queues)) {
350 : 0 : rte_bbdev_log(ERR,
351 : : "Device %u supports 0 < N <= %u queues, not %u",
352 : : dev_id, dev_info.max_num_queues, num_queues);
353 : 0 : return -EINVAL;
354 : : }
355 : :
356 : : /* If re-configuration, get driver to free existing internal memory */
357 [ # # ]: 0 : if (dev->data->queues != NULL) {
358 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_release, dev_id);
359 [ # # ]: 0 : for (i = 0; i < dev->data->num_queues; i++) {
360 : 0 : int ret = dev->dev_ops->queue_release(dev, i);
361 [ # # ]: 0 : if (ret < 0) {
362 : 0 : rte_bbdev_log(ERR,
363 : : "Device %u queue %u release failed",
364 : : dev_id, i);
365 : 0 : return ret;
366 : : }
367 : : }
368 : : /* Call optional device close */
369 [ # # ]: 0 : if (dev->dev_ops->close) {
370 : 0 : ret = dev->dev_ops->close(dev);
371 [ # # ]: 0 : if (ret < 0) {
372 : 0 : rte_bbdev_log(ERR,
373 : : "Device %u couldn't be closed",
374 : : dev_id);
375 : 0 : return ret;
376 : : }
377 : : }
378 : 0 : rte_free(dev->data->queues);
379 : : }
380 : :
381 : : /* Allocate queue pointers */
382 : 0 : dev->data->queues = rte_calloc_socket(DEV_NAME, num_queues,
383 : : sizeof(dev->data->queues[0]), RTE_CACHE_LINE_SIZE,
384 : 0 : dev->data->socket_id);
385 [ # # ]: 0 : if (dev->data->queues == NULL) {
386 : 0 : rte_bbdev_log(ERR,
387 : : "calloc of %u queues for device %u on socket %i failed",
388 : : num_queues, dev_id, dev->data->socket_id);
389 : 0 : return -ENOMEM;
390 : : }
391 : :
392 : 0 : dev->data->num_queues = num_queues;
393 : :
394 : : /* Call optional device configuration */
395 [ # # ]: 0 : if (dev->dev_ops->setup_queues) {
396 : 0 : ret = dev->dev_ops->setup_queues(dev, num_queues, socket_id);
397 [ # # ]: 0 : if (ret < 0) {
398 : 0 : rte_bbdev_log(ERR,
399 : : "Device %u memory configuration failed",
400 : : dev_id);
401 : 0 : goto error;
402 : : }
403 : : }
404 : :
405 : 0 : rte_bbdev_log_debug("Device %u set up with %u queues", dev_id,
406 : : num_queues);
407 : 0 : return 0;
408 : :
409 : : error:
410 : 0 : dev->data->num_queues = 0;
411 : 0 : rte_free(dev->data->queues);
412 : 0 : dev->data->queues = NULL;
413 : 0 : return ret;
414 : : }
415 : :
416 : : RTE_EXPORT_SYMBOL(rte_bbdev_intr_enable)
417 : : int
418 : 0 : rte_bbdev_intr_enable(uint16_t dev_id)
419 : : {
420 : : int ret;
421 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
422 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
423 : :
424 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
425 : :
426 [ # # ]: 0 : if (dev->data->started) {
427 : 0 : rte_bbdev_log(ERR,
428 : : "Device %u cannot be configured when started",
429 : : dev_id);
430 : 0 : return -EBUSY;
431 : : }
432 : :
433 [ # # ]: 0 : if (dev->dev_ops->intr_enable) {
434 : 0 : ret = dev->dev_ops->intr_enable(dev);
435 [ # # ]: 0 : if (ret < 0) {
436 : 0 : rte_bbdev_log(ERR,
437 : : "Device %u interrupts configuration failed",
438 : : dev_id);
439 : 0 : return ret;
440 : : }
441 : 0 : rte_bbdev_log_debug("Enabled interrupts for dev %u", dev_id);
442 : 0 : return 0;
443 : : }
444 : :
445 : 0 : rte_bbdev_log(ERR, "Device %u doesn't support interrupts", dev_id);
446 : 0 : return -ENOTSUP;
447 : : }
448 : :
449 : : RTE_EXPORT_SYMBOL(rte_bbdev_queue_configure)
450 : : int
451 : 0 : rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
452 : : const struct rte_bbdev_queue_conf *conf)
453 : : {
454 : : int ret = 0;
455 : : struct rte_bbdev_driver_info dev_info;
456 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
457 : : const struct rte_bbdev_op_cap *p;
458 : : struct rte_bbdev_queue_conf *stored_conf;
459 : : const char *op_type_str;
460 : : unsigned int max_priority;
461 : :
462 [ # # # # : 0 : rte_bbdev_trace_queue_configure(dev_id, queue_id,
# # ]
463 : 0 : conf != NULL ? rte_bbdev_op_type_str(conf->op_type) : NULL,
464 : 0 : conf != NULL ? conf->priority : 0);
465 : :
466 [ # # ]: 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
467 : :
468 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
469 : :
470 [ # # ]: 0 : VALID_QUEUE_OR_RET_ERR(queue_id, dev);
471 : :
472 [ # # # # ]: 0 : if (dev->data->queues[queue_id].started || dev->data->started) {
473 : 0 : rte_bbdev_log(ERR,
474 : : "Queue %u of device %u cannot be configured when started",
475 : : queue_id, dev_id);
476 : 0 : return -EBUSY;
477 : : }
478 : :
479 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_release, dev_id);
480 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_setup, dev_id);
481 : :
482 : : /* Get device driver information to verify config is valid */
483 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->info_get, dev_id);
484 : : memset(&dev_info, 0, sizeof(dev_info));
485 : 0 : dev->dev_ops->info_get(dev, &dev_info);
486 : :
487 : : /* Check configuration is valid */
488 [ # # ]: 0 : if (conf != NULL) {
489 [ # # ]: 0 : if ((conf->op_type == RTE_BBDEV_OP_NONE) &&
490 [ # # ]: 0 : (dev_info.capabilities[0].type ==
491 : : RTE_BBDEV_OP_NONE)) {
492 : : ret = 1;
493 : : } else {
494 : 0 : for (p = dev_info.capabilities;
495 [ # # ]: 0 : p->type != RTE_BBDEV_OP_NONE; p++) {
496 [ # # ]: 0 : if (conf->op_type == p->type) {
497 : : ret = 1;
498 : : break;
499 : : }
500 : : }
501 : : }
502 [ # # ]: 0 : if (ret == 0) {
503 : 0 : rte_bbdev_log(ERR, "Invalid operation type");
504 : 0 : return -EINVAL;
505 : : }
506 [ # # ]: 0 : if (conf->queue_size > dev_info.queue_size_lim) {
507 : 0 : rte_bbdev_log(ERR,
508 : : "Size (%u) of queue %u of device %u must be: <= %u",
509 : : conf->queue_size, queue_id, dev_id,
510 : : dev_info.queue_size_lim);
511 : 0 : return -EINVAL;
512 : : }
513 : : if (!rte_is_power_of_2(conf->queue_size)) {
514 : 0 : rte_bbdev_log(ERR,
515 : : "Size (%u) of queue %u of device %u must be a power of 2",
516 : : conf->queue_size, queue_id, dev_id);
517 : 0 : return -EINVAL;
518 : : }
519 [ # # ]: 0 : if ((uint8_t)conf->op_type >= RTE_BBDEV_OP_TYPE_SIZE_MAX) {
520 : 0 : rte_bbdev_log(ERR,
521 : : "Invalid operation type (%u) ", conf->op_type);
522 : 0 : return -EINVAL;
523 : : }
524 : 0 : max_priority = dev_info.queue_priority[conf->op_type];
525 [ # # ]: 0 : if (conf->priority > max_priority) {
526 : 0 : rte_bbdev_log(ERR,
527 : : "Priority (%u) of queue %u of bbdev %u must be <= %u",
528 : : conf->priority, queue_id, dev_id, max_priority);
529 : 0 : return -EINVAL;
530 : : }
531 : : }
532 : :
533 : : /* Release existing queue (in case of queue reconfiguration) */
534 [ # # ]: 0 : if (dev->data->queues[queue_id].queue_private != NULL) {
535 : 0 : ret = dev->dev_ops->queue_release(dev, queue_id);
536 [ # # ]: 0 : if (ret < 0) {
537 : 0 : rte_bbdev_log(ERR, "Device %u queue %u release failed",
538 : : dev_id, queue_id);
539 : 0 : return ret;
540 : : }
541 : : }
542 : :
543 : : /* Get driver to setup the queue */
544 [ # # ]: 0 : ret = dev->dev_ops->queue_setup(dev, queue_id, (conf != NULL) ?
545 : : conf : &dev_info.default_queue_conf);
546 [ # # ]: 0 : if (ret < 0) {
547 : : /* This may happen when trying different priority levels */
548 : 0 : rte_bbdev_log(INFO,
549 : : "Device %u queue %u setup failed",
550 : : dev_id, queue_id);
551 : 0 : return ret;
552 : : }
553 : :
554 : : /* Store configuration */
555 : 0 : stored_conf = &dev->data->queues[queue_id].conf;
556 : : memcpy(stored_conf,
557 : : (conf != NULL) ? conf : &dev_info.default_queue_conf,
558 : : sizeof(*stored_conf));
559 : :
560 : 0 : op_type_str = rte_bbdev_op_type_str(stored_conf->op_type);
561 [ # # ]: 0 : if (op_type_str == NULL)
562 : : return -EINVAL;
563 : :
564 : 0 : rte_bbdev_log_debug("Configured dev%uq%u (size=%u, type=%s, prio=%u)",
565 : : dev_id, queue_id, stored_conf->queue_size, op_type_str,
566 : : stored_conf->priority);
567 : :
568 : 0 : return 0;
569 : : }
570 : :
571 : : RTE_EXPORT_SYMBOL(rte_bbdev_start)
572 : : int
573 : 0 : rte_bbdev_start(uint16_t dev_id)
574 : : {
575 : : int i;
576 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
577 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
578 : :
579 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
580 : :
581 [ # # ]: 0 : rte_bbdev_trace_start(dev_id);
582 : :
583 [ # # ]: 0 : if (dev->data->started) {
584 : 0 : rte_bbdev_log_debug("Device %u is already started", dev_id);
585 : 0 : return 0;
586 : : }
587 : :
588 [ # # ]: 0 : if (dev->dev_ops->start) {
589 : 0 : int ret = dev->dev_ops->start(dev);
590 [ # # ]: 0 : if (ret < 0) {
591 : 0 : rte_bbdev_log(ERR, "Device %u start failed", dev_id);
592 : 0 : return ret;
593 : : }
594 : : }
595 : :
596 : : /* Store new state */
597 [ # # ]: 0 : for (i = 0; i < dev->data->num_queues; i++)
598 [ # # ]: 0 : if (!dev->data->queues[i].conf.deferred_start)
599 : 0 : dev->data->queues[i].started = true;
600 : 0 : dev->data->started = true;
601 : :
602 : 0 : rte_bbdev_log_debug("Started device %u", dev_id);
603 : 0 : return 0;
604 : : }
605 : :
606 : : RTE_EXPORT_SYMBOL(rte_bbdev_stop)
607 : : int
608 : 0 : rte_bbdev_stop(uint16_t dev_id)
609 : : {
610 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
611 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
612 : :
613 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
614 : :
615 [ # # ]: 0 : rte_bbdev_trace_stop(dev_id);
616 : :
617 [ # # ]: 0 : if (!dev->data->started) {
618 : 0 : rte_bbdev_log_debug("Device %u is already stopped", dev_id);
619 : 0 : return 0;
620 : : }
621 : :
622 [ # # ]: 0 : if (dev->dev_ops->stop)
623 : 0 : dev->dev_ops->stop(dev);
624 : 0 : dev->data->started = false;
625 : :
626 : 0 : rte_bbdev_log_debug("Stopped device %u", dev_id);
627 : 0 : return 0;
628 : : }
629 : :
630 : : RTE_EXPORT_SYMBOL(rte_bbdev_close)
631 : : int
632 : 0 : rte_bbdev_close(uint16_t dev_id)
633 : : {
634 : : int ret;
635 : : uint16_t i;
636 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
637 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
638 : :
639 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
640 : :
641 [ # # ]: 0 : rte_bbdev_trace_close(dev_id);
642 : :
643 [ # # ]: 0 : if (dev->data->started) {
644 : 0 : ret = rte_bbdev_stop(dev_id);
645 [ # # ]: 0 : if (ret < 0) {
646 : 0 : rte_bbdev_log(ERR, "Device %u stop failed", dev_id);
647 : 0 : return ret;
648 : : }
649 : : }
650 : :
651 : : /* Free memory used by queues */
652 [ # # ]: 0 : for (i = 0; i < dev->data->num_queues; i++) {
653 : 0 : ret = dev->dev_ops->queue_release(dev, i);
654 [ # # ]: 0 : if (ret < 0) {
655 : 0 : rte_bbdev_log(ERR, "Device %u queue %u release failed",
656 : : dev_id, i);
657 : 0 : return ret;
658 : : }
659 : : }
660 : 0 : rte_free(dev->data->queues);
661 : :
662 [ # # ]: 0 : if (dev->dev_ops->close) {
663 : 0 : ret = dev->dev_ops->close(dev);
664 [ # # ]: 0 : if (ret < 0) {
665 : 0 : rte_bbdev_log(ERR, "Device %u close failed", dev_id);
666 : 0 : return ret;
667 : : }
668 : : }
669 : :
670 : : /* Clear configuration */
671 : 0 : dev->data->queues = NULL;
672 : 0 : dev->data->num_queues = 0;
673 : :
674 : 0 : rte_bbdev_log_debug("Closed device %u", dev_id);
675 : 0 : return 0;
676 : : }
677 : :
678 : : RTE_EXPORT_SYMBOL(rte_bbdev_queue_start)
679 : : int
680 : 0 : rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id)
681 : : {
682 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
683 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
684 : :
685 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
686 : :
687 [ # # ]: 0 : VALID_QUEUE_OR_RET_ERR(queue_id, dev);
688 : :
689 [ # # ]: 0 : rte_bbdev_trace_queue_start(dev_id, queue_id);
690 : :
691 [ # # ]: 0 : if (dev->data->queues[queue_id].started) {
692 : 0 : rte_bbdev_log_debug("Queue %u of device %u already started",
693 : : queue_id, dev_id);
694 : 0 : return 0;
695 : : }
696 : :
697 [ # # ]: 0 : if (dev->dev_ops->queue_start) {
698 : 0 : int ret = dev->dev_ops->queue_start(dev, queue_id);
699 [ # # ]: 0 : if (ret < 0) {
700 : 0 : rte_bbdev_log(ERR, "Device %u queue %u start failed",
701 : : dev_id, queue_id);
702 : 0 : return ret;
703 : : }
704 : : }
705 : 0 : dev->data->queues[queue_id].started = true;
706 : :
707 : 0 : rte_bbdev_log_debug("Started queue %u of device %u", queue_id, dev_id);
708 : 0 : return 0;
709 : : }
710 : :
711 : : RTE_EXPORT_SYMBOL(rte_bbdev_queue_stop)
712 : : int
713 : 0 : rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id)
714 : : {
715 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
716 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
717 : :
718 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
719 : :
720 [ # # ]: 0 : VALID_QUEUE_OR_RET_ERR(queue_id, dev);
721 : :
722 [ # # ]: 0 : rte_bbdev_trace_queue_stop(dev_id, queue_id);
723 : :
724 [ # # ]: 0 : if (!dev->data->queues[queue_id].started) {
725 : 0 : rte_bbdev_log_debug("Queue %u of device %u already stopped",
726 : : queue_id, dev_id);
727 : 0 : return 0;
728 : : }
729 : :
730 [ # # ]: 0 : if (dev->dev_ops->queue_stop) {
731 : 0 : int ret = dev->dev_ops->queue_stop(dev, queue_id);
732 [ # # ]: 0 : if (ret < 0) {
733 : 0 : rte_bbdev_log(ERR, "Device %u queue %u stop failed",
734 : : dev_id, queue_id);
735 : 0 : return ret;
736 : : }
737 : : }
738 : 0 : dev->data->queues[queue_id].started = false;
739 : :
740 : 0 : rte_bbdev_log_debug("Stopped queue %u of device %u", queue_id, dev_id);
741 : 0 : return 0;
742 : : }
743 : :
744 : : /* Get device statistics */
745 : : static void
746 : 0 : get_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats)
747 : : {
748 : : unsigned int q_id;
749 [ # # ]: 0 : for (q_id = 0; q_id < dev->data->num_queues; q_id++) {
750 : : struct rte_bbdev_stats *q_stats =
751 : 0 : &dev->data->queues[q_id].queue_stats;
752 : :
753 : 0 : stats->enqueued_count += q_stats->enqueued_count;
754 : 0 : stats->dequeued_count += q_stats->dequeued_count;
755 : 0 : stats->enqueue_err_count += q_stats->enqueue_err_count;
756 : 0 : stats->dequeue_err_count += q_stats->dequeue_err_count;
757 : 0 : stats->enqueue_warn_count += q_stats->enqueue_warn_count;
758 : 0 : stats->dequeue_warn_count += q_stats->dequeue_warn_count;
759 : : }
760 : 0 : rte_bbdev_log_debug("Got stats on %u", dev->data->dev_id);
761 : 0 : }
762 : :
763 : : static void
764 : 0 : reset_stats_in_queues(struct rte_bbdev *dev)
765 : : {
766 : : unsigned int q_id;
767 [ # # ]: 0 : for (q_id = 0; q_id < dev->data->num_queues; q_id++) {
768 : 0 : struct rte_bbdev_stats *q_stats =
769 : 0 : &dev->data->queues[q_id].queue_stats;
770 : :
771 : : memset(q_stats, 0, sizeof(*q_stats));
772 : : }
773 : 0 : rte_bbdev_log_debug("Reset stats on %u", dev->data->dev_id);
774 : 0 : }
775 : :
776 : : RTE_EXPORT_SYMBOL(rte_bbdev_stats_get)
777 : : int
778 : 0 : rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats)
779 : : {
780 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
781 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
782 : :
783 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
784 : :
785 [ # # ]: 0 : if (stats == NULL) {
786 : 0 : rte_bbdev_log(ERR, "NULL stats structure");
787 : 0 : return -EINVAL;
788 : : }
789 : :
790 : : memset(stats, 0, sizeof(*stats));
791 [ # # ]: 0 : if (dev->dev_ops->stats_get != NULL)
792 : 0 : dev->dev_ops->stats_get(dev, stats);
793 : : else
794 : 0 : get_stats_from_queues(dev, stats);
795 : :
796 : 0 : rte_bbdev_log_debug("Retrieved stats of device %u", dev_id);
797 : 0 : return 0;
798 : : }
799 : :
800 : : RTE_EXPORT_SYMBOL(rte_bbdev_stats_reset)
801 : : int
802 : 0 : rte_bbdev_stats_reset(uint16_t dev_id)
803 : : {
804 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
805 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
806 : :
807 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
808 : :
809 [ # # ]: 0 : if (dev->dev_ops->stats_reset != NULL)
810 : 0 : dev->dev_ops->stats_reset(dev);
811 : : else
812 : 0 : reset_stats_in_queues(dev);
813 : :
814 : 0 : rte_bbdev_log_debug("Reset stats of device %u", dev_id);
815 : 0 : return 0;
816 : : }
817 : :
818 : : RTE_EXPORT_SYMBOL(rte_bbdev_info_get)
819 : : int
820 : 0 : rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info)
821 : : {
822 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
823 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
824 : :
825 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->info_get, dev_id);
826 : :
827 [ # # ]: 0 : if (dev_info == NULL) {
828 : 0 : rte_bbdev_log(ERR, "NULL dev info structure");
829 : 0 : return -EINVAL;
830 : : }
831 : :
832 : : /* Copy data maintained by device interface layer */
833 : : memset(dev_info, 0, sizeof(*dev_info));
834 : 0 : dev_info->dev_name = dev->data->name;
835 : 0 : dev_info->num_queues = dev->data->num_queues;
836 : 0 : dev_info->device = dev->device;
837 : 0 : dev_info->socket_id = dev->data->socket_id;
838 : 0 : dev_info->started = dev->data->started;
839 : :
840 : : /* Copy data maintained by device driver layer */
841 : 0 : dev->dev_ops->info_get(dev, &dev_info->drv);
842 : :
843 : 0 : rte_bbdev_log_debug("Retrieved info of device %u", dev_id);
844 : 0 : return 0;
845 : : }
846 : :
847 : : RTE_EXPORT_SYMBOL(rte_bbdev_queue_info_get)
848 : : int
849 : 0 : rte_bbdev_queue_info_get(uint16_t dev_id, uint16_t queue_id,
850 : : struct rte_bbdev_queue_info *queue_info)
851 : : {
852 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
853 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
854 : :
855 [ # # ]: 0 : VALID_QUEUE_OR_RET_ERR(queue_id, dev);
856 : :
857 [ # # ]: 0 : if (queue_info == NULL) {
858 : 0 : rte_bbdev_log(ERR, "NULL queue info structure");
859 : 0 : return -EINVAL;
860 : : }
861 : :
862 : : /* Copy data to output */
863 : : memset(queue_info, 0, sizeof(*queue_info));
864 : 0 : queue_info->conf = dev->data->queues[queue_id].conf;
865 : 0 : queue_info->started = dev->data->queues[queue_id].started;
866 : :
867 : 0 : rte_bbdev_log_debug("Retrieved info of queue %u of device %u",
868 : : queue_id, dev_id);
869 : 0 : return 0;
870 : : }
871 : :
872 : : /* Calculate size needed to store bbdev_op, depending on type */
873 : : static unsigned int
874 : : get_bbdev_op_size(enum rte_bbdev_op_type type)
875 : : {
876 : : unsigned int result = 0;
877 : : switch (type) {
878 : : case RTE_BBDEV_OP_NONE:
879 : : result = RTE_MAX(sizeof(struct rte_bbdev_dec_op),
880 : : sizeof(struct rte_bbdev_enc_op));
881 : : break;
882 : : case RTE_BBDEV_OP_TURBO_DEC:
883 : : result = sizeof(struct rte_bbdev_dec_op);
884 : : break;
885 : : case RTE_BBDEV_OP_TURBO_ENC:
886 : : result = sizeof(struct rte_bbdev_enc_op);
887 : : break;
888 : : case RTE_BBDEV_OP_LDPC_DEC:
889 : : result = sizeof(struct rte_bbdev_dec_op);
890 : : break;
891 : : case RTE_BBDEV_OP_LDPC_ENC:
892 : : result = sizeof(struct rte_bbdev_enc_op);
893 : : break;
894 : : case RTE_BBDEV_OP_FFT:
895 : : result = sizeof(struct rte_bbdev_fft_op);
896 : : break;
897 : : case RTE_BBDEV_OP_MLDTS:
898 : : result = sizeof(struct rte_bbdev_mldts_op);
899 : : break;
900 : : default:
901 : : break;
902 : : }
903 : :
904 : : return result;
905 : : }
906 : :
907 : : /* Initialise a bbdev_op structure */
908 : : static void
909 : 0 : bbdev_op_init(struct rte_mempool *mempool, void *arg, void *element,
910 : : __rte_unused unsigned int n)
911 : : {
912 : 0 : enum rte_bbdev_op_type type = *(enum rte_bbdev_op_type *)arg;
913 : :
914 [ # # ]: 0 : if (type == RTE_BBDEV_OP_TURBO_DEC || type == RTE_BBDEV_OP_LDPC_DEC) {
915 : : struct rte_bbdev_dec_op *op = element;
916 : 0 : memset(op, 0, mempool->elt_size);
917 : 0 : op->mempool = mempool;
918 : 0 : } else if (type == RTE_BBDEV_OP_TURBO_ENC ||
919 [ # # ]: 0 : type == RTE_BBDEV_OP_LDPC_ENC) {
920 : : struct rte_bbdev_enc_op *op = element;
921 : 0 : memset(op, 0, mempool->elt_size);
922 : 0 : op->mempool = mempool;
923 [ # # ]: 0 : } else if (type == RTE_BBDEV_OP_FFT) {
924 : : struct rte_bbdev_fft_op *op = element;
925 : 0 : memset(op, 0, mempool->elt_size);
926 : 0 : op->mempool = mempool;
927 [ # # ]: 0 : } else if (type == RTE_BBDEV_OP_MLDTS) {
928 : : struct rte_bbdev_mldts_op *op = element;
929 : 0 : memset(op, 0, mempool->elt_size);
930 : 0 : op->mempool = mempool;
931 : : }
932 : 0 : }
933 : :
934 : : RTE_EXPORT_SYMBOL(rte_bbdev_op_pool_create)
935 : : struct rte_mempool *
936 : 0 : rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type,
937 : : unsigned int num_elements, unsigned int cache_size,
938 : : int socket_id)
939 : : {
940 : : struct rte_bbdev_op_pool_private *priv;
941 : : struct rte_mempool *mp;
942 : : const char *op_type_str;
943 : :
944 [ # # ]: 0 : if (name == NULL) {
945 : 0 : rte_bbdev_log(ERR, "NULL name for op pool");
946 : 0 : return NULL;
947 : : }
948 : :
949 [ # # ]: 0 : if (type >= BBDEV_OP_TYPE_COUNT) {
950 : 0 : rte_bbdev_log(ERR,
951 : : "Invalid op type (%u), should be less than %u",
952 : : type, BBDEV_OP_TYPE_COUNT);
953 : 0 : return NULL;
954 : : }
955 : :
956 : 0 : mp = rte_mempool_create(name, num_elements, get_bbdev_op_size(type),
957 : : cache_size, sizeof(struct rte_bbdev_op_pool_private),
958 : : NULL, NULL, bbdev_op_init, &type, socket_id, 0);
959 [ # # ]: 0 : if (mp == NULL) {
960 [ # # ]: 0 : rte_bbdev_log(ERR,
961 : : "Failed to create op pool %s (num ops=%u, op size=%u) with error: %s",
962 : : name, num_elements, get_bbdev_op_size(type),
963 : : rte_strerror(rte_errno));
964 : 0 : return NULL;
965 : : }
966 : :
967 : 0 : op_type_str = rte_bbdev_op_type_str(type);
968 [ # # ]: 0 : if (op_type_str == NULL)
969 : : return NULL;
970 : :
971 [ # # ]: 0 : rte_bbdev_log_debug(
972 : : "Op pool %s created for %u ops (type=%s, cache=%u, socket=%u, size=%u)",
973 : : name, num_elements, op_type_str, cache_size, socket_id,
974 : : get_bbdev_op_size(type));
975 : :
976 : : priv = (struct rte_bbdev_op_pool_private *)rte_mempool_get_priv(mp);
977 : 0 : priv->type = type;
978 : :
979 : 0 : return mp;
980 : : }
981 : :
982 : : RTE_EXPORT_SYMBOL(rte_bbdev_callback_register)
983 : : int
984 : 0 : rte_bbdev_callback_register(uint16_t dev_id, enum rte_bbdev_event_type event,
985 : : rte_bbdev_cb_fn cb_fn, void *cb_arg)
986 : : {
987 : : struct rte_bbdev_callback *user_cb;
988 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
989 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
990 : :
991 [ # # ]: 0 : if (event >= RTE_BBDEV_EVENT_MAX) {
992 : 0 : rte_bbdev_log(ERR,
993 : : "Invalid event type (%u), should be less than %u",
994 : : event, RTE_BBDEV_EVENT_MAX);
995 : 0 : return -EINVAL;
996 : : }
997 : :
998 [ # # ]: 0 : if (cb_fn == NULL) {
999 : 0 : rte_bbdev_log(ERR, "NULL callback function");
1000 : 0 : return -EINVAL;
1001 : : }
1002 : :
1003 : : rte_spinlock_lock(&rte_bbdev_cb_lock);
1004 : :
1005 [ # # ]: 0 : TAILQ_FOREACH(user_cb, &(dev->list_cbs), next) {
1006 [ # # ]: 0 : if (user_cb->cb_fn == cb_fn &&
1007 [ # # ]: 0 : user_cb->cb_arg == cb_arg &&
1008 [ # # ]: 0 : user_cb->event == event)
1009 : : break;
1010 : : }
1011 : :
1012 : : /* create a new callback. */
1013 [ # # ]: 0 : if (user_cb == NULL) {
1014 : 0 : user_cb = rte_zmalloc("INTR_USER_CALLBACK",
1015 : : sizeof(struct rte_bbdev_callback), 0);
1016 [ # # ]: 0 : if (user_cb != NULL) {
1017 : 0 : user_cb->cb_fn = cb_fn;
1018 : 0 : user_cb->cb_arg = cb_arg;
1019 : 0 : user_cb->event = event;
1020 : 0 : TAILQ_INSERT_TAIL(&(dev->list_cbs), user_cb, next);
1021 : : }
1022 : : }
1023 : :
1024 : : rte_spinlock_unlock(&rte_bbdev_cb_lock);
1025 [ # # ]: 0 : return (user_cb == NULL) ? -ENOMEM : 0;
1026 : : }
1027 : :
1028 : : RTE_EXPORT_SYMBOL(rte_bbdev_callback_unregister)
1029 : : int
1030 : 0 : rte_bbdev_callback_unregister(uint16_t dev_id, enum rte_bbdev_event_type event,
1031 : : rte_bbdev_cb_fn cb_fn, void *cb_arg)
1032 : : {
1033 : : int ret = 0;
1034 : : struct rte_bbdev_callback *cb, *next;
1035 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
1036 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
1037 : :
1038 [ # # ]: 0 : if (event >= RTE_BBDEV_EVENT_MAX) {
1039 : 0 : rte_bbdev_log(ERR,
1040 : : "Invalid event type (%u), should be less than %u",
1041 : : event, RTE_BBDEV_EVENT_MAX);
1042 : 0 : return -EINVAL;
1043 : : }
1044 : :
1045 [ # # ]: 0 : if (cb_fn == NULL) {
1046 : 0 : rte_bbdev_log(ERR,
1047 : : "NULL callback function cannot be unregistered");
1048 : 0 : return -EINVAL;
1049 : : }
1050 : :
1051 : : dev = &rte_bbdev_devices[dev_id];
1052 : : rte_spinlock_lock(&rte_bbdev_cb_lock);
1053 : :
1054 [ # # ]: 0 : for (cb = TAILQ_FIRST(&dev->list_cbs); cb != NULL; cb = next) {
1055 : :
1056 : 0 : next = TAILQ_NEXT(cb, next);
1057 : :
1058 [ # # # # : 0 : if (cb->cb_fn != cb_fn || cb->event != event ||
# # ]
1059 [ # # ]: 0 : (cb_arg != (void *)-1 && cb->cb_arg != cb_arg))
1060 : 0 : continue;
1061 : :
1062 : : /* If this callback is not executing right now, remove it. */
1063 [ # # ]: 0 : if (cb->active == 0) {
1064 [ # # ]: 0 : TAILQ_REMOVE(&(dev->list_cbs), cb, next);
1065 : 0 : rte_free(cb);
1066 : : } else
1067 : : ret = -EAGAIN;
1068 : : }
1069 : :
1070 : : rte_spinlock_unlock(&rte_bbdev_cb_lock);
1071 : 0 : return ret;
1072 : : }
1073 : :
1074 : : RTE_EXPORT_SYMBOL(rte_bbdev_pmd_callback_process)
1075 : : void
1076 : 0 : rte_bbdev_pmd_callback_process(struct rte_bbdev *dev,
1077 : : enum rte_bbdev_event_type event, void *ret_param)
1078 : : {
1079 : : struct rte_bbdev_callback *cb_lst;
1080 : : struct rte_bbdev_callback dev_cb;
1081 : :
1082 [ # # ]: 0 : if (dev == NULL) {
1083 : 0 : rte_bbdev_log(ERR, "NULL device");
1084 : 0 : return;
1085 : : }
1086 : :
1087 [ # # ]: 0 : if (dev->data == NULL) {
1088 : 0 : rte_bbdev_log(ERR, "NULL data structure");
1089 : 0 : return;
1090 : : }
1091 : :
1092 [ # # ]: 0 : if (event >= RTE_BBDEV_EVENT_MAX) {
1093 : 0 : rte_bbdev_log(ERR,
1094 : : "Invalid event type (%u), should be less than %u",
1095 : : event, RTE_BBDEV_EVENT_MAX);
1096 : 0 : return;
1097 : : }
1098 : :
1099 : : rte_spinlock_lock(&rte_bbdev_cb_lock);
1100 [ # # ]: 0 : TAILQ_FOREACH(cb_lst, &(dev->list_cbs), next) {
1101 [ # # # # ]: 0 : if (cb_lst->cb_fn == NULL || cb_lst->event != event)
1102 : 0 : continue;
1103 : 0 : dev_cb = *cb_lst;
1104 : 0 : cb_lst->active = 1;
1105 [ # # ]: 0 : if (ret_param != NULL)
1106 : : dev_cb.ret_param = ret_param;
1107 : :
1108 : : rte_spinlock_unlock(&rte_bbdev_cb_lock);
1109 : 0 : dev_cb.cb_fn(dev->data->dev_id, dev_cb.event,
1110 : : dev_cb.cb_arg, dev_cb.ret_param);
1111 : : rte_spinlock_lock(&rte_bbdev_cb_lock);
1112 : 0 : cb_lst->active = 0;
1113 : : }
1114 : : rte_spinlock_unlock(&rte_bbdev_cb_lock);
1115 : : }
1116 : :
1117 : : RTE_EXPORT_SYMBOL(rte_bbdev_queue_intr_enable)
1118 : : int
1119 : 0 : rte_bbdev_queue_intr_enable(uint16_t dev_id, uint16_t queue_id)
1120 : : {
1121 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
1122 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
1123 [ # # ]: 0 : VALID_QUEUE_OR_RET_ERR(queue_id, dev);
1124 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
1125 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_intr_enable, dev_id);
1126 : 0 : return dev->dev_ops->queue_intr_enable(dev, queue_id);
1127 : : }
1128 : :
1129 : : RTE_EXPORT_SYMBOL(rte_bbdev_queue_intr_disable)
1130 : : int
1131 : 0 : rte_bbdev_queue_intr_disable(uint16_t dev_id, uint16_t queue_id)
1132 : : {
1133 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
1134 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
1135 [ # # ]: 0 : VALID_QUEUE_OR_RET_ERR(queue_id, dev);
1136 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
1137 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_intr_disable, dev_id);
1138 : 0 : return dev->dev_ops->queue_intr_disable(dev, queue_id);
1139 : : }
1140 : :
1141 : : RTE_EXPORT_SYMBOL(rte_bbdev_queue_intr_ctl)
1142 : : int
1143 : 0 : rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,
1144 : : void *data)
1145 : : {
1146 : : uint32_t vec;
1147 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
1148 : : struct rte_intr_handle *intr_handle;
1149 : : int ret;
1150 : :
1151 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
1152 [ # # ]: 0 : VALID_QUEUE_OR_RET_ERR(queue_id, dev);
1153 : :
1154 : 0 : intr_handle = dev->intr_handle;
1155 [ # # ]: 0 : if (intr_handle == NULL) {
1156 : 0 : rte_bbdev_log(ERR, "Device %u intr handle unset", dev_id);
1157 : 0 : return -ENOTSUP;
1158 : : }
1159 : :
1160 [ # # ]: 0 : if (queue_id >= RTE_MAX_RXTX_INTR_VEC_ID) {
1161 : 0 : rte_bbdev_log(ERR, "Device %u queue_id %u is too big",
1162 : : dev_id, queue_id);
1163 : 0 : return -ENOTSUP;
1164 : : }
1165 : :
1166 : 0 : vec = rte_intr_vec_list_index_get(intr_handle, queue_id);
1167 : 0 : ret = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
1168 [ # # ]: 0 : if (ret && (ret != -EEXIST)) {
1169 : 0 : rte_bbdev_log(ERR,
1170 : : "dev %u q %u int ctl error op %d epfd %d vec %u",
1171 : : dev_id, queue_id, op, epfd, vec);
1172 : 0 : return ret;
1173 : : }
1174 : :
1175 : : return 0;
1176 : : }
1177 : :
1178 : :
1179 : : RTE_EXPORT_SYMBOL(rte_bbdev_op_type_str)
1180 : : const char *
1181 : 0 : rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type)
1182 : : {
1183 : : static const char * const op_types[] = {
1184 : : "RTE_BBDEV_OP_NONE",
1185 : : "RTE_BBDEV_OP_TURBO_DEC",
1186 : : "RTE_BBDEV_OP_TURBO_ENC",
1187 : : "RTE_BBDEV_OP_LDPC_DEC",
1188 : : "RTE_BBDEV_OP_LDPC_ENC",
1189 : : "RTE_BBDEV_OP_FFT",
1190 : : "RTE_BBDEV_OP_MLDTS",
1191 : : };
1192 : :
1193 [ # # ]: 0 : if (op_type < BBDEV_OP_TYPE_COUNT)
1194 : 0 : return op_types[op_type];
1195 : :
1196 : 0 : rte_bbdev_log(ERR, "Invalid operation type");
1197 : 0 : return NULL;
1198 : : }
1199 : :
1200 : : RTE_EXPORT_SYMBOL(rte_bbdev_device_status_str)
1201 : : const char *
1202 : 0 : rte_bbdev_device_status_str(enum rte_bbdev_device_status status)
1203 : : {
1204 : : static const char * const dev_sta_string[] = {
1205 : : "RTE_BBDEV_DEV_NOSTATUS",
1206 : : "RTE_BBDEV_DEV_NOT_SUPPORTED",
1207 : : "RTE_BBDEV_DEV_RESET",
1208 : : "RTE_BBDEV_DEV_CONFIGURED",
1209 : : "RTE_BBDEV_DEV_ACTIVE",
1210 : : "RTE_BBDEV_DEV_FATAL_ERR",
1211 : : "RTE_BBDEV_DEV_RESTART_REQ",
1212 : : "RTE_BBDEV_DEV_RECONFIG_REQ",
1213 : : "RTE_BBDEV_DEV_CORRECT_ERR",
1214 : : };
1215 : :
1216 : : /* Cast from enum required for clang. */
1217 [ # # ]: 0 : if ((uint8_t)status < sizeof(dev_sta_string) / sizeof(char *))
1218 : 0 : return dev_sta_string[status];
1219 : :
1220 : 0 : rte_bbdev_log(ERR, "Invalid device status");
1221 : 0 : return NULL;
1222 : : }
1223 : :
1224 : : RTE_EXPORT_SYMBOL(rte_bbdev_enqueue_status_str)
1225 : : const char *
1226 : 0 : rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
1227 : : {
1228 : : static const char * const enq_sta_string[] = {
1229 : : "RTE_BBDEV_ENQ_STATUS_NONE",
1230 : : "RTE_BBDEV_ENQ_STATUS_QUEUE_FULL",
1231 : : "RTE_BBDEV_ENQ_STATUS_RING_FULL",
1232 : : "RTE_BBDEV_ENQ_STATUS_INVALID_OP",
1233 : : };
1234 : :
1235 : : /* Cast from enum required for clang. */
1236 [ # # ]: 0 : if ((uint8_t)status < sizeof(enq_sta_string) / sizeof(char *))
1237 : 0 : return enq_sta_string[status];
1238 : :
1239 : 0 : rte_bbdev_log(ERR, "Invalid enqueue status");
1240 : 0 : return NULL;
1241 : : }
1242 : :
1243 : :
1244 : : RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bbdev_queue_ops_dump, 24.11)
1245 : : int
1246 : 0 : rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_id, FILE *f)
1247 : : {
1248 : : struct rte_bbdev_queue_data *q_data;
1249 : : struct rte_bbdev_stats *stats;
1250 : : uint16_t i;
1251 : 0 : struct rte_bbdev *dev = get_dev(dev_id);
1252 : :
1253 : 0 : VALID_DEV_OR_RET_ERR(dev, dev_id);
1254 [ # # ]: 0 : VALID_QUEUE_OR_RET_ERR(queue_id, dev);
1255 [ # # ]: 0 : VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
1256 [ # # ]: 0 : VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_ops_dump, dev_id);
1257 : :
1258 : 0 : q_data = &dev->data->queues[queue_id];
1259 : :
1260 [ # # ]: 0 : if (f == NULL)
1261 : : return -EINVAL;
1262 : :
1263 : 0 : fprintf(f, "Dump of operations on %s queue %d\n",
1264 : 0 : dev->data->name, queue_id);
1265 : 0 : fprintf(f, " Last Enqueue Status %s\n",
1266 : : rte_bbdev_enqueue_status_str(q_data->enqueue_status));
1267 [ # # ]: 0 : for (i = 0; i < RTE_BBDEV_ENQ_STATUS_SIZE_MAX; i++)
1268 [ # # ]: 0 : if (q_data->queue_stats.enqueue_status_count[i] > 0)
1269 : 0 : fprintf(f, " Enqueue Status Counters %s %" PRIu64 "\n",
1270 : : rte_bbdev_enqueue_status_str(i),
1271 : : q_data->queue_stats.enqueue_status_count[i]);
1272 : 0 : stats = &dev->data->queues[queue_id].queue_stats;
1273 : :
1274 : 0 : fprintf(f, " Enqueue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",
1275 : : stats->enqueued_count, stats->enqueue_warn_count,
1276 : : stats->enqueue_err_count);
1277 : 0 : fprintf(f, " Dequeue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",
1278 : : stats->dequeued_count, stats->dequeue_warn_count,
1279 : : stats->dequeue_err_count);
1280 : :
1281 : 0 : return dev->dev_ops->queue_ops_dump(dev, queue_id, f);
1282 : : }
1283 : :
1284 : : RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bbdev_ops_param_string, 24.11)
1285 : : char *
1286 : 0 : rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len)
1287 : : {
1288 : : static char partial[1024];
1289 : : struct rte_bbdev_dec_op *op_dec;
1290 : : struct rte_bbdev_enc_op *op_enc;
1291 : : struct rte_bbdev_fft_op *op_fft;
1292 : : struct rte_bbdev_mldts_op *op_mldts;
1293 : :
1294 : : rte_iova_t add0 = 0, add1 = 0, add2 = 0, add3 = 0, add4 = 0;
1295 : :
1296 [ # # ]: 0 : if (op == NULL) {
1297 : 0 : snprintf(str, len, "Invalid Operation pointer\n");
1298 : 0 : return str;
1299 : : }
1300 : :
1301 : : if (op_type == RTE_BBDEV_OP_LDPC_DEC) {
1302 : : op_dec = op;
1303 [ # # ]: 0 : if (op_dec->ldpc_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
1304 : 0 : snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d",
1305 : 0 : op_dec->ldpc_dec.tb_params.c,
1306 : 0 : op_dec->ldpc_dec.tb_params.cab,
1307 : : op_dec->ldpc_dec.tb_params.ea,
1308 : : op_dec->ldpc_dec.tb_params.eb,
1309 : 0 : op_dec->ldpc_dec.tb_params.r);
1310 : : else
1311 : 0 : snprintf(partial, sizeof(partial), "E %d", op_dec->ldpc_dec.cb_params.e);
1312 [ # # ]: 0 : if (op_dec->ldpc_dec.input.data != NULL)
1313 : 0 : add0 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.input.data, 0);
1314 [ # # ]: 0 : if (op_dec->ldpc_dec.hard_output.data != NULL)
1315 : 0 : add1 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.hard_output.data, 0);
1316 [ # # ]: 0 : if (op_dec->ldpc_dec.soft_output.data != NULL)
1317 : 0 : add2 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.soft_output.data, 0);
1318 [ # # ]: 0 : if (op_dec->ldpc_dec.harq_combined_input.data != NULL)
1319 : 0 : add3 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.harq_combined_input.data,
1320 : : 0);
1321 [ # # ]: 0 : if (op_dec->ldpc_dec.harq_combined_output.data != NULL)
1322 : 0 : add4 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.harq_combined_output.data,
1323 : : 0);
1324 : 0 : snprintf(str, len, "op %x st %x BG %d Zc %d Ncb %d qm %d F %d Rv %d It %d It %d "
1325 : : "HARQin %d in %" PRIx64 " ho %" PRIx64 " so %" PRIx64 " hi %" PRIx64 " "
1326 : : "ho %" PRIx64 " %s\n",
1327 : : op_dec->ldpc_dec.op_flags, op_dec->status,
1328 : 0 : op_dec->ldpc_dec.basegraph, op_dec->ldpc_dec.z_c,
1329 : 0 : op_dec->ldpc_dec.n_cb, op_dec->ldpc_dec.q_m,
1330 : 0 : op_dec->ldpc_dec.n_filler, op_dec->ldpc_dec.rv_index,
1331 : 0 : op_dec->ldpc_dec.iter_max, op_dec->ldpc_dec.iter_count,
1332 : : op_dec->ldpc_dec.harq_combined_input.length,
1333 : : add0, add1, add2, add3, add4, partial);
1334 : : } else if (op_type == RTE_BBDEV_OP_TURBO_DEC) {
1335 : : op_dec = op;
1336 [ # # ]: 0 : if (op_dec->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
1337 : 0 : snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d K %d",
1338 : 0 : op_dec->turbo_dec.tb_params.c,
1339 : 0 : op_dec->turbo_dec.tb_params.cab,
1340 : : op_dec->turbo_dec.tb_params.ea,
1341 : : op_dec->turbo_dec.tb_params.eb,
1342 : 0 : op_dec->turbo_dec.tb_params.r,
1343 : 0 : op_dec->turbo_dec.tb_params.k_neg);
1344 : : else
1345 : 0 : snprintf(partial, sizeof(partial), "E %d K %d",
1346 : : op_dec->turbo_dec.cb_params.e,
1347 : 0 : op_dec->turbo_dec.cb_params.k);
1348 [ # # ]: 0 : if (op_dec->turbo_dec.input.data != NULL)
1349 : 0 : add0 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.input.data, 0);
1350 [ # # ]: 0 : if (op_dec->turbo_dec.hard_output.data != NULL)
1351 : 0 : add1 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.hard_output.data, 0);
1352 [ # # ]: 0 : if (op_dec->turbo_dec.soft_output.data != NULL)
1353 : 0 : add2 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.soft_output.data, 0);
1354 : 0 : snprintf(str, len, "op %x st %x CBM %d Iter %d map %d Rv %d ext %d "
1355 : : "in %" PRIx64 " ho %" PRIx64 " so %" PRIx64 " %s\n",
1356 : : op_dec->turbo_dec.op_flags, op_dec->status,
1357 : 0 : op_dec->turbo_dec.code_block_mode,
1358 : 0 : op_dec->turbo_dec.iter_max, op_dec->turbo_dec.num_maps,
1359 : 0 : op_dec->turbo_dec.rv_index, op_dec->turbo_dec.ext_scale,
1360 : : add0, add1, add2, partial);
1361 : : } else if (op_type == RTE_BBDEV_OP_LDPC_ENC) {
1362 : : op_enc = op;
1363 [ # # ]: 0 : if (op_enc->ldpc_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
1364 : 0 : snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d",
1365 : 0 : op_enc->ldpc_enc.tb_params.c,
1366 : 0 : op_enc->ldpc_enc.tb_params.cab,
1367 : : op_enc->ldpc_enc.tb_params.ea,
1368 : : op_enc->ldpc_enc.tb_params.eb,
1369 : 0 : op_enc->ldpc_enc.tb_params.r);
1370 : : else
1371 : 0 : snprintf(partial, sizeof(partial), "E %d",
1372 : : op_enc->ldpc_enc.cb_params.e);
1373 [ # # ]: 0 : if (op_enc->ldpc_enc.input.data != NULL)
1374 : 0 : add0 = rte_pktmbuf_iova_offset(op_enc->ldpc_enc.input.data, 0);
1375 [ # # ]: 0 : if (op_enc->ldpc_enc.output.data != NULL)
1376 : 0 : add1 = rte_pktmbuf_iova_offset(op_enc->ldpc_enc.output.data, 0);
1377 : 0 : snprintf(str, len, "op %x st %x BG %d Zc %d Ncb %d q_m %d F %d Rv %d "
1378 : : "in %" PRIx64 " out %" PRIx64 " %s\n",
1379 : : op_enc->ldpc_enc.op_flags, op_enc->status,
1380 : 0 : op_enc->ldpc_enc.basegraph, op_enc->ldpc_enc.z_c,
1381 : 0 : op_enc->ldpc_enc.n_cb, op_enc->ldpc_enc.q_m,
1382 : 0 : op_enc->ldpc_enc.n_filler, op_enc->ldpc_enc.rv_index,
1383 : : add0, add1, partial);
1384 : : } else if (op_type == RTE_BBDEV_OP_TURBO_ENC) {
1385 : : op_enc = op;
1386 [ # # ]: 0 : if (op_enc->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
1387 : 0 : snprintf(partial, sizeof(partial),
1388 : : "C %d Cab %d Ea %d Eb %d r %d K %d Ncb %d",
1389 : 0 : op_enc->turbo_enc.tb_params.c,
1390 : 0 : op_enc->turbo_enc.tb_params.cab,
1391 : : op_enc->turbo_enc.tb_params.ea,
1392 : : op_enc->turbo_enc.tb_params.eb,
1393 : 0 : op_enc->turbo_enc.tb_params.r,
1394 : 0 : op_enc->turbo_enc.tb_params.k_neg,
1395 : 0 : op_enc->turbo_enc.tb_params.ncb_neg);
1396 : : else
1397 : 0 : snprintf(partial, sizeof(partial), "E %d K %d",
1398 : : op_enc->turbo_enc.cb_params.e,
1399 : 0 : op_enc->turbo_enc.cb_params.k);
1400 [ # # ]: 0 : if (op_enc->turbo_enc.input.data != NULL)
1401 : 0 : add0 = rte_pktmbuf_iova_offset(op_enc->turbo_enc.input.data, 0);
1402 [ # # ]: 0 : if (op_enc->turbo_enc.output.data != NULL)
1403 : 0 : add1 = rte_pktmbuf_iova_offset(op_enc->turbo_enc.output.data, 0);
1404 : 0 : snprintf(str, len, "op %x st %x CBM %d Rv %d In %" PRIx64 " Out %" PRIx64 " %s\n",
1405 : : op_enc->turbo_enc.op_flags, op_enc->status,
1406 : 0 : op_enc->turbo_enc.code_block_mode, op_enc->turbo_enc.rv_index,
1407 : : add0, add1, partial);
1408 : : } else if (op_type == RTE_BBDEV_OP_FFT) {
1409 : : op_fft = op;
1410 [ # # ]: 0 : if (op_fft->fft.base_input.data != NULL)
1411 : 0 : add0 = rte_pktmbuf_iova_offset(op_fft->fft.base_input.data, 0);
1412 [ # # ]: 0 : if (op_fft->fft.base_output.data != NULL)
1413 : 0 : add1 = rte_pktmbuf_iova_offset(op_fft->fft.base_output.data, 0);
1414 [ # # ]: 0 : if (op_fft->fft.dewindowing_input.data != NULL)
1415 : 0 : add2 = rte_pktmbuf_iova_offset(op_fft->fft.dewindowing_input.data, 0);
1416 [ # # ]: 0 : if (op_fft->fft.power_meas_output.data != NULL)
1417 : 0 : add3 = rte_pktmbuf_iova_offset(op_fft->fft.power_meas_output.data, 0);
1418 : 0 : snprintf(str, len, "op %x st %x in %d inl %d out %d outl %d cs %x ants %d "
1419 : : "idft %d dft %d cst %d ish %d dsh %d ncs %d pwsh %d fp16 %d fr %d "
1420 : : "outde %d in %" PRIx64 " out %" PRIx64 " dw %" PRIx64 " "
1421 : : "pm %" PRIx64 "\n",
1422 : : op_fft->fft.op_flags, op_fft->status,
1423 : 0 : op_fft->fft.input_sequence_size, op_fft->fft.input_leading_padding,
1424 : 0 : op_fft->fft.output_sequence_size,
1425 : 0 : op_fft->fft.output_leading_depadding,
1426 : 0 : op_fft->fft.cs_bitmap, op_fft->fft.num_antennas_log2,
1427 : 0 : op_fft->fft.idft_log2, op_fft->fft.dft_log2,
1428 : 0 : op_fft->fft.cs_time_adjustment,
1429 : 0 : op_fft->fft.idft_shift, op_fft->fft.dft_shift,
1430 : 0 : op_fft->fft.ncs_reciprocal, op_fft->fft.power_shift,
1431 : 0 : op_fft->fft.fp16_exp_adjust, op_fft->fft.freq_resample_mode,
1432 : 0 : op_fft->fft.output_depadded_size, add0, add1, add2, add3);
1433 : : } else if (op_type == RTE_BBDEV_OP_MLDTS) {
1434 : : op_mldts = op;
1435 [ # # ]: 0 : if (op_mldts->mldts.qhy_input.data != NULL)
1436 : 0 : add0 = rte_pktmbuf_iova_offset(op_mldts->mldts.qhy_input.data, 0);
1437 [ # # ]: 0 : if (op_mldts->mldts.r_input.data != NULL)
1438 : 0 : add1 = rte_pktmbuf_iova_offset(op_mldts->mldts.r_input.data, 0);
1439 [ # # ]: 0 : if (op_mldts->mldts.output.data != NULL)
1440 : 0 : add2 = rte_pktmbuf_iova_offset(op_mldts->mldts.output.data, 0);
1441 : 0 : snprintf(str, len,
1442 : : "op %x st %x rbs %d lay %d rrep %d crep%d qm %d %d %d %d "
1443 : : "qhy %" PRIx64 " r %" PRIx64 " out %" PRIx64 "\n",
1444 : : op_mldts->mldts.op_flags, op_mldts->status,
1445 : 0 : op_mldts->mldts.num_rbs, op_mldts->mldts.num_layers,
1446 : 0 : op_mldts->mldts.r_rep, op_mldts->mldts.c_rep,
1447 : 0 : op_mldts->mldts.q_m[0], op_mldts->mldts.q_m[1],
1448 : 0 : op_mldts->mldts.q_m[2], op_mldts->mldts.q_m[3],
1449 : : add0, add1, add2);
1450 : :
1451 : : } else {
1452 : 0 : snprintf(str, len, "Invalid Operation type %d\n", op_type);
1453 : : }
1454 : :
1455 : : return str;
1456 : : }
|