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

Function cryptodev_init

dpdk/app/test/test_pdcp.c:271–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271static int
272cryptodev_init(int dev_id)
273{
274 struct pdcp_testsuite_params *ts_params = &testsuite_params;
275 struct rte_cryptodev_qp_conf qp_conf;
276 struct rte_cryptodev_info dev_info;
277 struct rte_cryptodev_config config;
278 int ret, socket_id;
279
280 /* Check if device was already initialized */
281 if (ts_params->cdevs_used[dev_id])
282 return 0;
283
284 rte_cryptodev_info_get(dev_id, &dev_info);
285
286 if (dev_info.max_nb_queue_pairs < 1) {
287 RTE_LOG(ERR, USER1, "Cryptodev doesn't have sufficient queue pairs available\n");
288 return -ENODEV;
289 }
290
291 socket_id = rte_socket_id();
292
293 memset(&config, 0, sizeof(config));
294 config.nb_queue_pairs = 1;
295 config.socket_id = socket_id;
296
297 ret = rte_cryptodev_configure(dev_id, &config);
298 if (ret < 0) {
299 RTE_LOG(ERR, USER1, "Could not configure cryptodev - %d\n", dev_id);
300 return -ENODEV;
301 }
302
303 memset(&qp_conf, 0, sizeof(qp_conf));
304 qp_conf.nb_descriptors = NB_DESC;
305
306 ret = rte_cryptodev_queue_pair_setup(dev_id, 0, &qp_conf, socket_id);
307 if (ret < 0) {
308 RTE_LOG(ERR, USER1, "Could not configure queue pair\n");
309 return -ENODEV;
310 }
311
312 ret = rte_cryptodev_start(dev_id);
313 if (ret < 0) {
314 RTE_LOG(ERR, USER1, "Could not start cryptodev\n");
315 return -ENODEV;
316 }
317
318 /* Mark device as initialized */
319 ts_params->cdevs_used[dev_id] = true;
320
321 return 0;
322}
323
324static void
325cryptodev_fini(int dev_id)

Callers 1

test_entity_createFunction · 0.70

Calls 6

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