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

Function cryptodev_init

dpdk/app/test-security-perf/test_security_perf.c:47–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45static struct test_ctx ctx;
46
47static int
48cryptodev_init(struct test_ctx *ctx, uint8_t nb_lcores)
49{
50 const char dev_names[][RTE_CRYPTODEV_NAME_MAX_LEN] = {
51 "crypto_cn10k",
52 "crypto_cn9k",
53 "crypto_dpaa_sec",
54 "crypto_dpaa2_sec",
55 };
56 struct rte_cryptodev_qp_conf qp_conf;
57 struct rte_cryptodev_info dev_info;
58 struct rte_cryptodev_config config;
59 unsigned int j, nb_qp, qps_reqd;
60 uint8_t socket_id;
61 uint32_t dev_cnt;
62 int ret, core_id;
63 void *sec_ctx;
64 uint64_t i;
65
66 i = 0;
67 do {
68 dev_cnt = rte_cryptodev_devices_get(dev_names[i],
69 ctx->enabled_cdevs,
70 RTE_CRYPTO_MAX_DEVS);
71 i++;
72 } while (dev_cnt == 0 && i < RTE_DIM(dev_names));
73
74 if (dev_cnt == 0)
75 return -1;
76
77 /* Check first device for capabilities */
78 rte_cryptodev_info_get(0, &dev_info);
79 if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_SECURITY)) {
80 RTE_LOG(ERR, USER1,
81 "Security not supported by the cryptodev\n");
82 return -1;
83 }
84
85 sec_ctx = rte_cryptodev_get_sec_ctx(0);
86 ctx->sec_ctx = sec_ctx;
87
88 socket_id = rte_socket_id();
89 qps_reqd = nb_lcores;
90 core_id = 0;
91 i = 0;
92
93 do {
94 rte_cryptodev_info_get(i, &dev_info);
95 qps_reqd = RTE_MIN(dev_info.max_nb_queue_pairs, qps_reqd);
96
97 for (j = 0; j < qps_reqd; j++) {
98 ctx->lconf[core_id].dev_id = i;
99 ctx->lconf[core_id].qp_id = j;
100 ctx->lconf[core_id].ctx = ctx;
101 core_id++;
102 if (core_id == RTE_MAX_LCORE)
103 break;
104 }

Callers 1

mainFunction · 0.70

Calls 8

rte_cryptodev_info_getFunction · 0.85
rte_socket_idFunction · 0.85
memsetFunction · 0.85
rte_cryptodev_configureFunction · 0.85
rte_cryptodev_startFunction · 0.85

Tested by

no test coverage detected