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

Function initialize_cryptodevs

dpdk/examples/l2fwd-crypto/main.c:2307–2560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2305}
2306
2307static int
2308initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
2309 uint8_t *enabled_cdevs)
2310{
2311 uint8_t cdev_id, cdev_count, enabled_cdev_count = 0;
2312 const struct rte_cryptodev_capabilities *cap;
2313 unsigned int sess_sz, max_sess_sz = 0;
2314 uint32_t sessions_needed = 0;
2315 int retval;
2316
2317 cdev_count = rte_cryptodev_count();
2318 if (cdev_count == 0) {
2319 printf("No crypto devices available\n");
2320 return -1;
2321 }
2322
2323 for (cdev_id = 0; cdev_id < cdev_count && enabled_cdev_count < nb_ports;
2324 cdev_id++) {
2325 if (check_cryptodev_mask(options, cdev_id) < 0)
2326 continue;
2327
2328 if (check_capabilities(options, cdev_id) < 0)
2329 continue;
2330
2331 sess_sz = rte_cryptodev_sym_get_private_session_size(cdev_id);
2332 if (sess_sz > max_sess_sz)
2333 max_sess_sz = sess_sz;
2334
2335 l2fwd_enabled_crypto_mask |= (((uint64_t)1) << cdev_id);
2336
2337 enabled_cdevs[cdev_id] = 1;
2338 enabled_cdev_count++;
2339 }
2340
2341 for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
2342 struct rte_cryptodev_qp_conf qp_conf;
2343 struct rte_cryptodev_info dev_info;
2344
2345 if (enabled_cdevs[cdev_id] == 0)
2346 continue;
2347
2348 if (check_cryptodev_mask(options, cdev_id) < 0)
2349 continue;
2350
2351 if (check_capabilities(options, cdev_id) < 0)
2352 continue;
2353
2354 retval = rte_cryptodev_socket_id(cdev_id);
2355
2356 if (retval < 0) {
2357 printf("Invalid crypto device id used\n");
2358 return -1;
2359 }
2360
2361 uint8_t socket_id = (uint8_t) retval;
2362
2363 struct rte_cryptodev_config conf = {
2364 .nb_queue_pairs = 1,

Callers 1

mainFunction · 0.85

Calls 15

rte_cryptodev_countFunction · 0.85
check_capabilitiesFunction · 0.85
rte_cryptodev_socket_idFunction · 0.85
rte_cryptodev_info_getFunction · 0.85
strcmpFunction · 0.85
snprintfFunction · 0.85
generate_random_keyFunction · 0.85

Tested by

no test coverage detected