net/mlx5: refactor device operations for Linux
[dpdk.git] / app / test / test_cryptodev.c
index 08a12af..8f63146 100644 (file)
@@ -767,27 +767,19 @@ test_device_configure_invalid_queue_pair_ids(void)
        struct crypto_testsuite_params *ts_params = &testsuite_params;
        uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs;
 
-       /* This test is for QAT and NITROX PMDs only */
-       if (gbl_driver_id != rte_cryptodev_driver_id_get(
-                       RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)) &&
-           gbl_driver_id != rte_cryptodev_driver_id_get(
-                       RTE_STR(CRYPTODEV_NAME_NITROX_PMD)))
-               return -ENOTSUP;
-
        /* Stop the device in case it's started so it can be configured */
        rte_cryptodev_stop(ts_params->valid_devs[0]);
 
-       /* valid - one queue pairs */
-       ts_params->conf.nb_queue_pairs = 1;
+       /* valid - max value queue pairs */
+       ts_params->conf.nb_queue_pairs = orig_nb_qps;
 
        TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
                        &ts_params->conf),
                        "Failed to configure cryptodev: dev_id %u, qp_id %u",
                        ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
 
-
-       /* valid - max value queue pairs */
-       ts_params->conf.nb_queue_pairs = orig_nb_qps;
+       /* valid - one queue pairs */
+       ts_params->conf.nb_queue_pairs = 1;
 
        TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
                        &ts_params->conf),
@@ -838,24 +830,14 @@ static int
 test_queue_pair_descriptor_setup(void)
 {
        struct crypto_testsuite_params *ts_params = &testsuite_params;
-       struct rte_cryptodev_info dev_info;
        struct rte_cryptodev_qp_conf qp_conf = {
                .nb_descriptors = MAX_NUM_OPS_INFLIGHT
        };
-
        uint16_t qp_id;
 
-       /* This test is for QAT PMD only */
-       if (gbl_driver_id != rte_cryptodev_driver_id_get(
-                       RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)))
-               return -ENOTSUP;
-
        /* Stop the device in case it's started so it can be configured */
        rte_cryptodev_stop(ts_params->valid_devs[0]);
 
-
-       rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
-
        TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
                        &ts_params->conf),
                        "Failed to configure cryptodev %u",
@@ -909,36 +891,6 @@ test_queue_pair_descriptor_setup(void)
                                ts_params->valid_devs[0]);
        }
 
-       /* invalid number of descriptors - max supported + 2 */
-       qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT + 2;
-
-       for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
-               TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
-                               ts_params->valid_devs[0], qp_id, &qp_conf,
-                               rte_cryptodev_socket_id(
-                                               ts_params->valid_devs[0])),
-                               "Unexpectedly passed test for "
-                               "rte_cryptodev_queue_pair_setup:"
-                               "num_inflights %u on qp %u on cryptodev %u",
-                               qp_conf.nb_descriptors, qp_id,
-                               ts_params->valid_devs[0]);
-       }
-
-       /* invalid number of descriptors - max value of parameter */
-       qp_conf.nb_descriptors = UINT32_MAX-1;
-
-       for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
-               TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
-                               ts_params->valid_devs[0], qp_id, &qp_conf,
-                               rte_cryptodev_socket_id(
-                                               ts_params->valid_devs[0])),
-                               "Unexpectedly passed test for "
-                               "rte_cryptodev_queue_pair_setup:"
-                               "num_inflights %u on qp %u on cryptodev %u",
-                               qp_conf.nb_descriptors, qp_id,
-                               ts_params->valid_devs[0]);
-       }
-
        qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
 
        for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
@@ -953,21 +905,6 @@ test_queue_pair_descriptor_setup(void)
                                ts_params->valid_devs[0]);
        }
 
-       /* invalid number of descriptors - max supported + 1 */
-       qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT + 1;
-
-       for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
-               TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
-                               ts_params->valid_devs[0], qp_id, &qp_conf,
-                               rte_cryptodev_socket_id(
-                                               ts_params->valid_devs[0])),
-                               "Unexpectedly passed test for "
-                               "rte_cryptodev_queue_pair_setup:"
-                               "num_inflights %u on qp %u on cryptodev %u",
-                               qp_conf.nb_descriptors, qp_id,
-                               ts_params->valid_devs[0]);
-       }
-
        /* test invalid queue pair id */
        qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;      /*valid */
 
@@ -8813,8 +8750,6 @@ test_stats(void)
 {
        struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct rte_cryptodev_stats stats;
-       struct rte_cryptodev *dev;
-       cryptodev_stats_get_t temp_pfn;
 
        if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
                return -ENOTSUP;
@@ -8832,19 +8767,16 @@ test_stats(void)
                        &cap_idx) == NULL)
                return -ENOTSUP;
 
+       if (rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats)
+                       == -ENOTSUP)
+               return -ENOTSUP;
+
        rte_cryptodev_stats_reset(ts_params->valid_devs[0]);
        TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0] + 600,
                        &stats) == -ENODEV),
                "rte_cryptodev_stats_get invalid dev failed");
        TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], 0) != 0),
                "rte_cryptodev_stats_get invalid Param failed");
-       dev = &rte_cryptodevs[ts_params->valid_devs[0]];
-       temp_pfn = dev->dev_ops->stats_get;
-       dev->dev_ops->stats_get = (cryptodev_stats_get_t)0;
-       TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats)
-                       == -ENOTSUP),
-               "rte_cryptodev_stats_get invalid Param failed");
-       dev->dev_ops->stats_get = temp_pfn;
 
        /* Test expected values */
        ut_setup();
@@ -11799,10 +11731,10 @@ static struct unit_test_suite cryptodev_testsuite  = {
        .unit_test_cases = {
                TEST_CASE_ST(ut_setup, ut_teardown,
                                test_device_configure_invalid_dev_id),
-               TEST_CASE_ST(ut_setup, ut_teardown,
-                               test_device_configure_invalid_queue_pair_ids),
                TEST_CASE_ST(ut_setup, ut_teardown,
                                test_queue_pair_descriptor_setup),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                               test_device_configure_invalid_queue_pair_ids),
 
                TEST_CASE_ST(ut_setup, ut_teardown,
                                test_multi_session),