bpf: allow self-xor operation
[dpdk.git] / app / test-crypto-perf / cperf_test_common.c
index 85603ee..89f13fd 100644 (file)
@@ -86,7 +86,7 @@ static void
 mempool_obj_init(struct rte_mempool *mp,
                 void *opaque_arg,
                 void *obj,
-                __attribute__((unused)) unsigned int i)
+                __rte_unused unsigned int i)
 {
        struct obj_params *params = opaque_arg;
        struct rte_crypto_op *op = obj;
@@ -140,6 +140,22 @@ cperf_alloc_common_memory(const struct cperf_options *options,
        uint16_t crypto_op_size = sizeof(struct rte_crypto_op) +
                sizeof(struct rte_crypto_sym_op);
        uint16_t crypto_op_private_size;
+
+       if (options->op_type == CPERF_ASYM_MODEX) {
+               snprintf(pool_name, RTE_MEMPOOL_NAMESIZE, "perf_asym_op_pool%u",
+                        rte_socket_id());
+               *pool = rte_crypto_op_pool_create(
+                       pool_name, RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+                       options->pool_sz, 0, 0, rte_socket_id());
+               if (*pool == NULL) {
+                       RTE_LOG(ERR, USER1,
+                               "Cannot allocate mempool for device %u\n",
+                               dev_id);
+                       return -1;
+               }
+               return 0;
+       }
+
        /*
         * If doing AES-CCM, IV field needs to be 16 bytes long,
         * and AAD field needs to be long enough to have 18 bytes,
@@ -194,7 +210,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,
                                (mbuf_size * segments_nb);
                params.dst_buf_offset = *dst_buf_offset;
                /* Destination buffer will be one segment only */
-               obj_size += max_size;
+               obj_size += max_size + sizeof(struct rte_mbuf);
        }
 
        *pool = rte_mempool_create_empty(pool_name,