app/crypto-perf: overwrite mbuf when verifying
[dpdk.git] / app / test-crypto-perf / main.c
index cdd3cc8..ffa7180 100644 (file)
@@ -42,6 +42,7 @@
 #include "cperf_test_throughput.h"
 #include "cperf_test_latency.h"
 #include "cperf_test_verify.h"
+#include "cperf_test_pmd_cyclecount.h"
 
 #define NUM_SESSIONS 2048
 #define SESS_MEMPOOL_CACHE_SIZE 64
@@ -49,7 +50,8 @@
 const char *cperf_test_type_strs[] = {
        [CPERF_TEST_TYPE_THROUGHPUT] = "throughput",
        [CPERF_TEST_TYPE_LATENCY] = "latency",
-       [CPERF_TEST_TYPE_VERIFY] = "verify"
+       [CPERF_TEST_TYPE_VERIFY] = "verify",
+       [CPERF_TEST_TYPE_PMDCC] = "pmd-cyclecount"
 };
 
 const char *cperf_op_type_strs[] = {
@@ -75,6 +77,11 @@ const struct cperf_test cperf_testmap[] = {
                                cperf_verify_test_constructor,
                                cperf_verify_test_runner,
                                cperf_verify_test_destructor
+               },
+               [CPERF_TEST_TYPE_PMDCC] = {
+                               cperf_pmd_cyclecount_test_constructor,
+                               cperf_pmd_cyclecount_test_runner,
+                               cperf_pmd_cyclecount_test_destructor
                }
 };
 
@@ -107,13 +114,11 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
        uint32_t max_sess_size = 0, sess_size;
 
        for (cdev_id = 0; cdev_id < rte_cryptodev_count(); cdev_id++) {
-               sess_size = sizeof(struct rte_cryptodev_sym_session) +
-                       rte_cryptodev_get_private_session_size(cdev_id);
+               sess_size = rte_cryptodev_get_private_session_size(cdev_id);
                if (sess_size > max_sess_size)
                        max_sess_size = sess_size;
        }
 
-
        for (i = 0; i < enabled_cdev_count &&
                        i < RTE_CRYPTO_MAX_DEVS; i++) {
                cdev_id = enabled_cdevs[i];
@@ -125,7 +130,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
                };
 
                struct rte_cryptodev_qp_conf qp_conf = {
-                               .nb_descriptors = 2048
+                           .nb_descriptors = opts->nb_descriptors
                };
 
 
@@ -154,20 +159,20 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
                        session_pool_socket[socket_id] = sess_mp;
                }
 
-               ret = rte_cryptodev_configure(cdev_id, &conf,
-                               session_pool_socket[socket_id]);
+               ret = rte_cryptodev_configure(cdev_id, &conf);
                if (ret < 0) {
                        printf("Failed to configure cryptodev %u", cdev_id);
                        return -EINVAL;
                }
 
-               ret = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf,
-                               socket_id);
-               if (ret < 0) {
-                       printf("Failed to setup queue pair %u on "
-                               "cryptodev %u", 0, cdev_id);
-                       return -EINVAL;
-               }
+               ret = rte_cryptodev_queue_pair_setup(cdev_id, 0,
+                               &qp_conf, socket_id,
+                               session_pool_socket[socket_id]);
+                       if (ret < 0) {
+                               printf("Failed to setup queue pair %u on "
+                                       "cryptodev %u", 0, cdev_id);
+                               return -EINVAL;
+                       }
 
                ret = rte_cryptodev_start(cdev_id);
                if (ret < 0) {
@@ -210,7 +215,6 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,
                                        capability,
                                        opts->auth_key_sz,
                                        opts->digest_sz,
-                                       0,
                                        opts->auth_iv_sz);
                        if (ret != 0)
                                return ret;
@@ -475,7 +479,10 @@ main(int argc, char **argv)
 
                cdev_id = enabled_cdevs[i];
 
-               ctx[cdev_id] = cperf_testmap[opts.test].constructor(cdev_id, 0,
+               uint8_t socket_id = rte_cryptodev_socket_id(cdev_id);
+
+               ctx[cdev_id] = cperf_testmap[opts.test].constructor(
+                               session_pool_socket[socket_id], cdev_id, 0,
                                &opts, t_vec, &op_fns);
                if (ctx[cdev_id] == NULL) {
                        RTE_LOG(ERR, USER1, "Test run constructor failed\n");
@@ -503,7 +510,14 @@ main(int argc, char **argv)
                                ctx[cdev_id], lcore_id);
                        i++;
                }
-               rte_eal_mp_wait_lcore();
+               i = 0;
+               RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+
+                       if (i == nb_cryptodevs)
+                               break;
+                       rte_eal_wait_lcore(lcore_id);
+                       i++;
+               }
 
                /* Get next size from range or list */
                if (opts.inc_buffer_size != 0)