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

Function main

dpdk/examples/vhost_crypto/main.c:474–631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474int
475main(int argc, char *argv[])
476{
477 struct rte_cryptodev_qp_conf qp_conf;
478 struct rte_cryptodev_config config;
479 struct rte_cryptodev_info dev_info;
480 char name[128];
481 uint32_t i, j, lcore;
482 int ret;
483
484 ret = rte_eal_init(argc, argv);
485 if (ret < 0)
486 return -1;
487 argc -= ret;
488 argv += ret;
489
490 ret = vhost_crypto_parse_args(argc, argv);
491 if (ret < 0)
492 rte_exit(EXIT_FAILURE, "Failed to parse arguments!\n");
493
494 for (i = 0; i < options.nb_los; i++) {
495 struct lcore_option *lo = &options.los[i];
496 struct vhost_crypto_info *info;
497
498 info = rte_zmalloc_socket(NULL, sizeof(*info),
499 RTE_CACHE_LINE_SIZE, rte_lcore_to_socket_id(
500 lo->lcore_id));
501 if (!info) {
502 ret = -ENOMEM;
503 goto error_exit;
504 }
505
506 info->cid = lo->cid;
507 info->qid = lo->qid;
508 info->nb_vids = lo->nb_sockets;
509
510 rte_cryptodev_info_get(info->cid, &dev_info);
511 if (options.zero_copy == RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE) {
512#define VHOST_CRYPTO_CDEV_NAME_AESNI_MB_PMD crypto_aesni_mb
513#define VHOST_CRYPTO_CDEV_NAME_AESNI_GCM_PMD crypto_aesni_gcm
514 if (strstr(dev_info.driver_name,
515 RTE_STR(VHOST_CRYPTO_CDEV_NAME_AESNI_MB_PMD)) ||
516 strstr(dev_info.driver_name,
517 RTE_STR(VHOST_CRYPTO_CDEV_NAME_AESNI_GCM_PMD))) {
518 RTE_LOG(ERR, USER1, "Cannot enable zero-copy in %s\n",
519 dev_info.driver_name);
520 ret = -EPERM;
521 goto error_exit;
522 }
523 }
524
525 if (dev_info.max_nb_queue_pairs < info->qid + 1) {
526 RTE_LOG(ERR, USER1, "Number of queues cannot over %u",
527 dev_info.max_nb_queue_pairs);
528 goto error_exit;
529 }
530
531 config.nb_queue_pairs = dev_info.max_nb_queue_pairs;

Callers

nothing calls this directly

Calls 15

vhost_crypto_parse_argsFunction · 0.85
rte_exitFunction · 0.85
rte_zmalloc_socketFunction · 0.85
rte_lcore_to_socket_idFunction · 0.85
rte_cryptodev_info_getFunction · 0.85
strstrFunction · 0.85
rte_cryptodev_configureFunction · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected