| 368 | } |
| 369 | |
| 370 | static int |
| 371 | crosscheck_init(void) |
| 372 | { |
| 373 | struct crosscheck_testsuite_params *ts_params = &testsuite_params; |
| 374 | const struct rte_cryptodev_symmetric_capability *cap; |
| 375 | const uint32_t nb_queue_pairs = 1; |
| 376 | struct rte_cryptodev_info info; |
| 377 | uint32_t session_priv_size = 0; |
| 378 | uint32_t nb_devs, dev_id; |
| 379 | uint8_t i; |
| 380 | |
| 381 | memset(ts_params, 0, sizeof(*ts_params)); |
| 382 | |
| 383 | /* Create list of valid crypto devs */ |
| 384 | nb_devs = rte_cryptodev_count(); |
| 385 | for (dev_id = 0; dev_id < nb_devs; dev_id++) { |
| 386 | rte_cryptodev_info_get(dev_id, &info); |
| 387 | |
| 388 | if (info.sym.max_nb_sessions != 0 && info.sym.max_nb_sessions < MAX_NB_SESSIONS) |
| 389 | continue; |
| 390 | if (info.max_nb_queue_pairs < nb_queue_pairs) |
| 391 | continue; |
| 392 | ts_params->valid_devs[ts_params->valid_dev_count++] = dev_id; |
| 393 | /* Obtaining configuration parameters, that will satisfy all cryptodevs */ |
| 394 | session_priv_size = RTE_MAX(session_priv_size, |
| 395 | rte_cryptodev_sym_get_private_session_size(dev_id)); |
| 396 | } |
| 397 | |
| 398 | if (ts_params->valid_dev_count < 2) { |
| 399 | RTE_LOG(WARNING, USER1, "Min number of cryptodevs for test is 2, found (%d)\n", |
| 400 | ts_params->valid_dev_count); |
| 401 | return TEST_SKIPPED; |
| 402 | } |
| 403 | |
| 404 | /* Create pools for mbufs, crypto operations and sessions */ |
| 405 | ts_params->mbuf_pool = rte_pktmbuf_pool_create("CRYPTO_MBUFPOOL", NUM_MBUFS, |
| 406 | MBUF_CACHE_SIZE, 0, MBUF_SIZE, rte_socket_id()); |
| 407 | if (ts_params->mbuf_pool == NULL) { |
| 408 | RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n"); |
| 409 | return TEST_FAILED; |
| 410 | } |
| 411 | |
| 412 | ts_params->op_mpool = rte_crypto_op_pool_create("MBUF_CRYPTO_SYM_OP_POOL", |
| 413 | RTE_CRYPTO_OP_TYPE_SYMMETRIC, NUM_MBUFS, MBUF_CACHE_SIZE, |
| 414 | DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_sym_xform) + |
| 415 | MAXIMUM_IV_LENGTH, rte_socket_id()); |
| 416 | |
| 417 | if (ts_params->op_mpool == NULL) { |
| 418 | RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); |
| 419 | return TEST_FAILED; |
| 420 | } |
| 421 | |
| 422 | ts_params->session_mpool = rte_cryptodev_sym_session_pool_create("test_sess_mp", |
| 423 | MAX_NB_SESSIONS, session_priv_size, 0, 0, SOCKET_ID_ANY); |
| 424 | TEST_ASSERT_NOT_NULL(ts_params->session_mpool, "session mempool allocation failed"); |
| 425 | |
| 426 | /* Setup queue pair conf params */ |
| 427 | ts_params->conf.nb_queue_pairs = nb_queue_pairs; |
no test coverage detected