| 278 | } |
| 279 | |
| 280 | static int |
| 281 | testsuite_setup(void) |
| 282 | { |
| 283 | struct ipsec_testsuite_params *ts_params = &testsuite_params; |
| 284 | struct ipsec_unitest_params *ut_params = &unittest_params; |
| 285 | const struct supported_auth_algo *auth_algo; |
| 286 | const struct supported_cipher_algo *cipher_algo; |
| 287 | struct rte_cryptodev_info info; |
| 288 | uint32_t i, nb_devs, dev_id; |
| 289 | size_t sess_sz; |
| 290 | int rc; |
| 291 | |
| 292 | memset(ts_params, 0, sizeof(*ts_params)); |
| 293 | memset(ut_params, 0, sizeof(*ut_params)); |
| 294 | memset(&uparams, 0, sizeof(struct user_params)); |
| 295 | |
| 296 | uparams.auth = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 297 | uparams.cipher = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 298 | uparams.aead = RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED; |
| 299 | strcpy(uparams.auth_algo, "null"); |
| 300 | strcpy(uparams.cipher_algo, "null"); |
| 301 | |
| 302 | auth_algo = find_match_auth_algo(uparams.auth_algo); |
| 303 | cipher_algo = find_match_cipher_algo(uparams.cipher_algo); |
| 304 | fill_crypto_xform(ut_params, auth_algo, cipher_algo); |
| 305 | |
| 306 | nb_devs = rte_cryptodev_count(); |
| 307 | if (nb_devs < 1) { |
| 308 | RTE_LOG(WARNING, USER1, "No crypto devices found?\n"); |
| 309 | return TEST_SKIPPED; |
| 310 | } |
| 311 | |
| 312 | /* Find first valid crypto device */ |
| 313 | for (i = 0; i < nb_devs; i++) { |
| 314 | rc = check_cryptodev_capability(ut_params, i); |
| 315 | if (rc == 0) { |
| 316 | ts_params->valid_dev = i; |
| 317 | ts_params->valid_dev_found = 1; |
| 318 | break; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | if (ts_params->valid_dev_found == 0) { |
| 323 | RTE_LOG(WARNING, USER1, "No compatible crypto device found.\n"); |
| 324 | return TEST_SKIPPED; |
| 325 | } |
| 326 | |
| 327 | ts_params->mbuf_pool = rte_pktmbuf_pool_create( |
| 328 | "CRYPTO_MBUFPOOL", |
| 329 | NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE, |
| 330 | rte_socket_id()); |
| 331 | if (ts_params->mbuf_pool == NULL) { |
| 332 | RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n"); |
| 333 | return TEST_FAILED; |
| 334 | } |
| 335 | |
| 336 | ts_params->cop_mpool = rte_crypto_op_pool_create( |
| 337 | "MBUF_CRYPTO_SYM_OP_POOL", |
nothing calls this directly
no test coverage detected