| 13640 | } |
| 13641 | |
| 13642 | static int |
| 13643 | test_enq_callback_setup(void) |
| 13644 | { |
| 13645 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 13646 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 13647 | struct rte_cryptodev_info dev_info; |
| 13648 | struct rte_cryptodev_qp_conf qp_conf = { |
| 13649 | .nb_descriptors = MAX_NUM_OPS_INFLIGHT |
| 13650 | }; |
| 13651 | |
| 13652 | struct rte_cryptodev_cb *cb; |
| 13653 | uint16_t qp_id = 0; |
| 13654 | int j = 0; |
| 13655 | |
| 13656 | /* Skip test if synchronous API is used */ |
| 13657 | if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) |
| 13658 | return TEST_SKIPPED; |
| 13659 | |
| 13660 | /* Verify the crypto capabilities for which enqueue/dequeue is done. */ |
| 13661 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 13662 | cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL; |
| 13663 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 13664 | &cap_idx) == NULL) |
| 13665 | return TEST_SKIPPED; |
| 13666 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 13667 | cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL; |
| 13668 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 13669 | &cap_idx) == NULL) |
| 13670 | return TEST_SKIPPED; |
| 13671 | |
| 13672 | /* Stop the device in case it's started so it can be configured */ |
| 13673 | rte_cryptodev_stop(ts_params->valid_devs[0]); |
| 13674 | |
| 13675 | rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); |
| 13676 | |
| 13677 | TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0], |
| 13678 | &ts_params->conf), |
| 13679 | "Failed to configure cryptodev %u", |
| 13680 | ts_params->valid_devs[0]); |
| 13681 | |
| 13682 | qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; |
| 13683 | qp_conf.mp_session = ts_params->session_mpool; |
| 13684 | |
| 13685 | TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( |
| 13686 | ts_params->valid_devs[0], qp_id, &qp_conf, |
| 13687 | rte_cryptodev_socket_id(ts_params->valid_devs[0])), |
| 13688 | "Failed test for " |
| 13689 | "rte_cryptodev_queue_pair_setup: num_inflights " |
| 13690 | "%u on qp %u on cryptodev %u", |
| 13691 | qp_conf.nb_descriptors, qp_id, |
| 13692 | ts_params->valid_devs[0]); |
| 13693 | |
| 13694 | enq_cb_called = false; |
| 13695 | /* Test with invalid crypto device */ |
| 13696 | cb = rte_cryptodev_add_enq_callback(RTE_CRYPTO_MAX_DEVS, |
| 13697 | qp_id, test_enq_callback, NULL); |
| 13698 | if (rte_errno == ENOTSUP) { |
| 13699 | RTE_LOG(ERR, USER1, "%s line %d: " |
nothing calls this directly
no test coverage detected