MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_bbdev_queue_configure

Function rte_bbdev_queue_configure

dpdk/lib/bbdev/rte_bbdev.c:434–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434int
435rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
436 const struct rte_bbdev_queue_conf *conf)
437{
438 int ret = 0;
439 struct rte_bbdev_driver_info dev_info;
440 struct rte_bbdev *dev = get_dev(dev_id);
441 const struct rte_bbdev_op_cap *p;
442 struct rte_bbdev_queue_conf *stored_conf;
443 const char *op_type_str;
444 unsigned int max_priority;
445 VALID_DEV_OR_RET_ERR(dev, dev_id);
446
447 VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
448
449 VALID_QUEUE_OR_RET_ERR(queue_id, dev);
450
451 if (dev->data->queues[queue_id].started || dev->data->started) {
452 rte_bbdev_log(ERR,
453 "Queue %u of device %u cannot be configured when started",
454 queue_id, dev_id);
455 return -EBUSY;
456 }
457
458 VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_release, dev_id);
459 VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_setup, dev_id);
460
461 /* Get device driver information to verify config is valid */
462 VALID_FUNC_OR_RET_ERR(dev->dev_ops->info_get, dev_id);
463 memset(&dev_info, 0, sizeof(dev_info));
464 dev->dev_ops->info_get(dev, &dev_info);
465
466 /* Check configuration is valid */
467 if (conf != NULL) {
468 if ((conf->op_type == RTE_BBDEV_OP_NONE) &&
469 (dev_info.capabilities[0].type ==
470 RTE_BBDEV_OP_NONE)) {
471 ret = 1;
472 } else {
473 for (p = dev_info.capabilities;
474 p->type != RTE_BBDEV_OP_NONE; p++) {
475 if (conf->op_type == p->type) {
476 ret = 1;
477 break;
478 }
479 }
480 }
481 if (ret == 0) {
482 rte_bbdev_log(ERR, "Invalid operation type");
483 return -EINVAL;
484 }
485 if (conf->queue_size > dev_info.queue_size_lim) {
486 rte_bbdev_log(ERR,
487 "Size (%u) of queue %u of device %u must be: <= %u",
488 conf->queue_size, queue_id, dev_id,
489 dev_info.queue_size_lim);
490 return -EINVAL;
491 }

Callers 6

add_bbdev_devFunction · 0.85
test_bbdev_statsFunction · 0.85
prepare_bbdev_deviceFunction · 0.85

Calls 5

get_devFunction · 0.85
memsetFunction · 0.85
rte_bbdev_op_type_strFunction · 0.85
rte_is_power_of_2Function · 0.50
memcpyFunction · 0.50

Tested by 5

add_bbdev_devFunction · 0.68
test_bbdev_statsFunction · 0.68