get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/27662/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 27662,
    "url": "https://patches.dpdk.org/api/patches/27662/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20170818080520.43088-7-pablo.de.lara.guarch@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20170818080520.43088-7-pablo.de.lara.guarch@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20170818080520.43088-7-pablo.de.lara.guarch@intel.com",
    "date": "2017-08-18T08:05:20",
    "name": "[dpdk-dev,6/6] app/crypto-perf: use single mempool",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "28c6d6f2f3e6ffff8e48fd9fc4d8d6d29cf337f6",
    "submitter": {
        "id": 9,
        "url": "https://patches.dpdk.org/api/people/9/?format=api",
        "name": "De Lara Guarch, Pablo",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "delegate": {
        "id": 22,
        "url": "https://patches.dpdk.org/api/users/22/?format=api",
        "username": "pdelarag",
        "first_name": "Pablo",
        "last_name": "de Lara Guarch",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20170818080520.43088-7-pablo.de.lara.guarch@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/27662/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/27662/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id D455090F8;\n\tFri, 18 Aug 2017 18:05:26 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id 578AE7D7F\n\tfor <dev@dpdk.org>; Fri, 18 Aug 2017 18:05:24 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga105.jf.intel.com with ESMTP; 18 Aug 2017 09:05:23 -0700",
            "from silpixa00399464.ir.intel.com (HELO\n\tsilpixa00399464.ger.corp.intel.com) ([10.237.222.157])\n\tby FMSMGA003.fm.intel.com with ESMTP; 18 Aug 2017 09:05:20 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,393,1498546800\"; d=\"scan'208\";a=\"891439779\"",
        "From": "Pablo de Lara <pablo.de.lara.guarch@intel.com>",
        "To": "declan.doherty@intel.com, fiona.trahe@intel.com, deepak.k.jain@intel.com,\n\tjohn.griffin@intel.com, jerin.jacob@caviumnetworks.com,\n\takhil.goyal@nxp.com, hemant.agrawal@nxp.com",
        "Cc": "dev@dpdk.org,\n\tPablo de Lara <pablo.de.lara.guarch@intel.com>",
        "Date": "Fri, 18 Aug 2017 09:05:20 +0100",
        "Message-Id": "<20170818080520.43088-7-pablo.de.lara.guarch@intel.com>",
        "X-Mailer": "git-send-email 2.9.4",
        "In-Reply-To": "<20170818080520.43088-1-pablo.de.lara.guarch@intel.com>",
        "References": "<20170818080520.43088-1-pablo.de.lara.guarch@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 6/6] app/crypto-perf: use single mempool",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "In order to improve memory utilization, a single mempool\nis created, containing the crypto operation and mbufs\n(one if operation is in-place, two if out-of-place).\nThis way, a single object is allocated and freed\nper operation, reducing the amount of memory in cache,\nwhich improves scalability.\n\nSigned-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>\n---\n app/test-crypto-perf/cperf_ops.c             |  96 ++++++--\n app/test-crypto-perf/cperf_ops.h             |   2 +-\n app/test-crypto-perf/cperf_test_latency.c    | 350 ++++++++++++--------------\n app/test-crypto-perf/cperf_test_throughput.c | 347 ++++++++++++--------------\n app/test-crypto-perf/cperf_test_verify.c     | 356 ++++++++++++---------------\n 5 files changed, 553 insertions(+), 598 deletions(-)",
    "diff": "diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c\nindex ad32065..f76dbdd 100644\n--- a/app/test-crypto-perf/cperf_ops.c\n+++ b/app/test-crypto-perf/cperf_ops.c\n@@ -37,7 +37,7 @@\n \n static int\n cperf_set_ops_null_cipher(struct rte_crypto_op **ops,\n-\t\tstruct rte_mbuf **bufs_in, struct rte_mbuf **bufs_out,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset,\n \t\tuint16_t nb_ops, struct rte_cryptodev_sym_session *sess,\n \t\tconst struct cperf_options *options,\n \t\tconst struct cperf_test_vector *test_vector __rte_unused,\n@@ -48,10 +48,18 @@ cperf_set_ops_null_cipher(struct rte_crypto_op **ops,\n \tfor (i = 0; i < nb_ops; i++) {\n \t\tstruct rte_crypto_sym_op *sym_op = ops[i]->sym;\n \n+\t\tops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n \t\trte_crypto_op_attach_sym_session(ops[i], sess);\n \n-\t\tsym_op->m_src = bufs_in[i];\n-\t\tsym_op->m_dst = bufs_out[i];\n+\t\tsym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tsrc_buf_offset);\n+\n+\t\t/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */\n+\t\tif (dst_buf_offset == 0)\n+\t\t\tsym_op->m_dst = NULL;\n+\t\telse\n+\t\t\tsym_op->m_dst = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tdst_buf_offset);\n \n \t\t/* cipher parameters */\n \t\tsym_op->cipher.data.length = options->test_buffer_size;\n@@ -63,7 +71,7 @@ cperf_set_ops_null_cipher(struct rte_crypto_op **ops,\n \n static int\n cperf_set_ops_null_auth(struct rte_crypto_op **ops,\n-\t\tstruct rte_mbuf **bufs_in, struct rte_mbuf **bufs_out,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset,\n \t\tuint16_t nb_ops, struct rte_cryptodev_sym_session *sess,\n \t\tconst struct cperf_options *options,\n \t\tconst struct cperf_test_vector *test_vector __rte_unused,\n@@ -74,10 +82,18 @@ cperf_set_ops_null_auth(struct rte_crypto_op **ops,\n \tfor (i = 0; i < nb_ops; i++) {\n \t\tstruct rte_crypto_sym_op *sym_op = ops[i]->sym;\n \n+\t\tops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n \t\trte_crypto_op_attach_sym_session(ops[i], sess);\n \n-\t\tsym_op->m_src = bufs_in[i];\n-\t\tsym_op->m_dst = bufs_out[i];\n+\t\tsym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tsrc_buf_offset);\n+\n+\t\t/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */\n+\t\tif (dst_buf_offset == 0)\n+\t\t\tsym_op->m_dst = NULL;\n+\t\telse\n+\t\t\tsym_op->m_dst = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tdst_buf_offset);\n \n \t\t/* auth parameters */\n \t\tsym_op->auth.data.length = options->test_buffer_size;\n@@ -89,7 +105,7 @@ cperf_set_ops_null_auth(struct rte_crypto_op **ops,\n \n static int\n cperf_set_ops_cipher(struct rte_crypto_op **ops,\n-\t\tstruct rte_mbuf **bufs_in, struct rte_mbuf **bufs_out,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset,\n \t\tuint16_t nb_ops, struct rte_cryptodev_sym_session *sess,\n \t\tconst struct cperf_options *options,\n \t\tconst struct cperf_test_vector *test_vector,\n@@ -100,10 +116,18 @@ cperf_set_ops_cipher(struct rte_crypto_op **ops,\n \tfor (i = 0; i < nb_ops; i++) {\n \t\tstruct rte_crypto_sym_op *sym_op = ops[i]->sym;\n \n+\t\tops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n \t\trte_crypto_op_attach_sym_session(ops[i], sess);\n \n-\t\tsym_op->m_src = bufs_in[i];\n-\t\tsym_op->m_dst = bufs_out[i];\n+\t\tsym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tsrc_buf_offset);\n+\n+\t\t/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */\n+\t\tif (dst_buf_offset == 0)\n+\t\t\tsym_op->m_dst = NULL;\n+\t\telse\n+\t\t\tsym_op->m_dst = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tdst_buf_offset);\n \n \t\t/* cipher parameters */\n \t\tif (options->cipher_algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 ||\n@@ -132,7 +156,7 @@ cperf_set_ops_cipher(struct rte_crypto_op **ops,\n \n static int\n cperf_set_ops_auth(struct rte_crypto_op **ops,\n-\t\tstruct rte_mbuf **bufs_in, struct rte_mbuf **bufs_out,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset,\n \t\tuint16_t nb_ops, struct rte_cryptodev_sym_session *sess,\n \t\tconst struct cperf_options *options,\n \t\tconst struct cperf_test_vector *test_vector,\n@@ -143,10 +167,18 @@ cperf_set_ops_auth(struct rte_crypto_op **ops,\n \tfor (i = 0; i < nb_ops; i++) {\n \t\tstruct rte_crypto_sym_op *sym_op = ops[i]->sym;\n \n+\t\tops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n \t\trte_crypto_op_attach_sym_session(ops[i], sess);\n \n-\t\tsym_op->m_src = bufs_in[i];\n-\t\tsym_op->m_dst = bufs_out[i];\n+\t\tsym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tsrc_buf_offset);\n+\n+\t\t/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */\n+\t\tif (dst_buf_offset == 0)\n+\t\t\tsym_op->m_dst = NULL;\n+\t\telse\n+\t\t\tsym_op->m_dst = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tdst_buf_offset);\n \n \t\tif (test_vector->auth_iv.length) {\n \t\t\tuint8_t *iv_ptr = rte_crypto_op_ctod_offset(ops[i],\n@@ -167,9 +199,9 @@ cperf_set_ops_auth(struct rte_crypto_op **ops,\n \t\t\tstruct rte_mbuf *buf, *tbuf;\n \n \t\t\tif (options->out_of_place) {\n-\t\t\t\tbuf =  bufs_out[i];\n+\t\t\t\tbuf = sym_op->m_dst;\n \t\t\t} else {\n-\t\t\t\ttbuf =  bufs_in[i];\n+\t\t\t\ttbuf = sym_op->m_src;\n \t\t\t\twhile ((tbuf->next != NULL) &&\n \t\t\t\t\t\t(offset >= tbuf->data_len)) {\n \t\t\t\t\toffset -= tbuf->data_len;\n@@ -219,7 +251,7 @@ cperf_set_ops_auth(struct rte_crypto_op **ops,\n \n static int\n cperf_set_ops_cipher_auth(struct rte_crypto_op **ops,\n-\t\tstruct rte_mbuf **bufs_in, struct rte_mbuf **bufs_out,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset,\n \t\tuint16_t nb_ops, struct rte_cryptodev_sym_session *sess,\n \t\tconst struct cperf_options *options,\n \t\tconst struct cperf_test_vector *test_vector,\n@@ -230,10 +262,18 @@ cperf_set_ops_cipher_auth(struct rte_crypto_op **ops,\n \tfor (i = 0; i < nb_ops; i++) {\n \t\tstruct rte_crypto_sym_op *sym_op = ops[i]->sym;\n \n+\t\tops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n \t\trte_crypto_op_attach_sym_session(ops[i], sess);\n \n-\t\tsym_op->m_src = bufs_in[i];\n-\t\tsym_op->m_dst = bufs_out[i];\n+\t\tsym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tsrc_buf_offset);\n+\n+\t\t/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */\n+\t\tif (dst_buf_offset == 0)\n+\t\t\tsym_op->m_dst = NULL;\n+\t\telse\n+\t\t\tsym_op->m_dst = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tdst_buf_offset);\n \n \t\t/* cipher parameters */\n \t\tif (options->cipher_algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 ||\n@@ -256,9 +296,9 @@ cperf_set_ops_cipher_auth(struct rte_crypto_op **ops,\n \t\t\tstruct rte_mbuf *buf, *tbuf;\n \n \t\t\tif (options->out_of_place) {\n-\t\t\t\tbuf =  bufs_out[i];\n+\t\t\t\tbuf = sym_op->m_dst;\n \t\t\t} else {\n-\t\t\t\ttbuf =  bufs_in[i];\n+\t\t\t\ttbuf = sym_op->m_src;\n \t\t\t\twhile ((tbuf->next != NULL) &&\n \t\t\t\t\t\t(offset >= tbuf->data_len)) {\n \t\t\t\t\toffset -= tbuf->data_len;\n@@ -316,7 +356,7 @@ cperf_set_ops_cipher_auth(struct rte_crypto_op **ops,\n \n static int\n cperf_set_ops_aead(struct rte_crypto_op **ops,\n-\t\tstruct rte_mbuf **bufs_in, struct rte_mbuf **bufs_out,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset,\n \t\tuint16_t nb_ops, struct rte_cryptodev_sym_session *sess,\n \t\tconst struct cperf_options *options,\n \t\tconst struct cperf_test_vector *test_vector,\n@@ -329,10 +369,18 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,\n \tfor (i = 0; i < nb_ops; i++) {\n \t\tstruct rte_crypto_sym_op *sym_op = ops[i]->sym;\n \n+\t\tops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n \t\trte_crypto_op_attach_sym_session(ops[i], sess);\n \n-\t\tsym_op->m_src = bufs_in[i];\n-\t\tsym_op->m_dst = bufs_out[i];\n+\t\tsym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tsrc_buf_offset);\n+\n+\t\t/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */\n+\t\tif (dst_buf_offset == 0)\n+\t\t\tsym_op->m_dst = NULL;\n+\t\telse\n+\t\t\tsym_op->m_dst = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tdst_buf_offset);\n \n \t\t/* AEAD parameters */\n \t\tsym_op->aead.data.length = options->test_buffer_size;\n@@ -354,9 +402,9 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,\n \t\t\tstruct rte_mbuf *buf, *tbuf;\n \n \t\t\tif (options->out_of_place) {\n-\t\t\t\tbuf =  bufs_out[i];\n+\t\t\t\tbuf = sym_op->m_dst;\n \t\t\t} else {\n-\t\t\t\ttbuf =  bufs_in[i];\n+\t\t\t\ttbuf = sym_op->m_src;\n \t\t\t\twhile ((tbuf->next != NULL) &&\n \t\t\t\t\t\t(offset >= tbuf->data_len)) {\n \t\t\t\t\toffset -= tbuf->data_len;\ndiff --git a/app/test-crypto-perf/cperf_ops.h b/app/test-crypto-perf/cperf_ops.h\nindex 1f8fa93..94951cc 100644\n--- a/app/test-crypto-perf/cperf_ops.h\n+++ b/app/test-crypto-perf/cperf_ops.h\n@@ -47,7 +47,7 @@ typedef struct rte_cryptodev_sym_session *(*cperf_sessions_create_t)(\n \t\tuint16_t iv_offset);\n \n typedef int (*cperf_populate_ops_t)(struct rte_crypto_op **ops,\n-\t\tstruct rte_mbuf **bufs_in, struct rte_mbuf **bufs_out,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset,\n \t\tuint16_t nb_ops, struct rte_cryptodev_sym_session *sess,\n \t\tconst struct cperf_options *options,\n \t\tconst struct cperf_test_vector *test_vector,\ndiff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c\nindex 997844a..2415d77 100644\n--- a/app/test-crypto-perf/cperf_test_latency.c\n+++ b/app/test-crypto-perf/cperf_test_latency.c\n@@ -50,17 +50,15 @@ struct cperf_latency_ctx {\n \tuint16_t qp_id;\n \tuint8_t lcore_id;\n \n-\tstruct rte_mempool *pkt_mbuf_pool_in;\n-\tstruct rte_mempool *pkt_mbuf_pool_out;\n-\tstruct rte_mbuf **mbufs_in;\n-\tstruct rte_mbuf **mbufs_out;\n-\n-\tstruct rte_mempool *crypto_op_pool;\n+\tstruct rte_mempool *pool;\n \n \tstruct rte_cryptodev_sym_session *sess;\n \n \tcperf_populate_ops_t populate_ops;\n \n+\tuint32_t src_buf_offset;\n+\tuint32_t dst_buf_offset;\n+\n \tconst struct cperf_options *options;\n \tconst struct cperf_test_vector *test_vector;\n \tstruct cperf_op_result *res;\n@@ -74,116 +72,128 @@ struct priv_op_data {\n #define min(a, b) (a < b ? (uint64_t)a : (uint64_t)b)\n \n static void\n-cperf_latency_test_free(struct cperf_latency_ctx *ctx, uint32_t mbuf_nb)\n+cperf_latency_test_free(struct cperf_latency_ctx *ctx)\n {\n-\tuint32_t i;\n-\n \tif (ctx) {\n \t\tif (ctx->sess) {\n \t\t\trte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);\n \t\t\trte_cryptodev_sym_session_free(ctx->sess);\n \t\t}\n \n-\t\tif (ctx->mbufs_in) {\n-\t\t\tfor (i = 0; i < mbuf_nb; i++)\n-\t\t\t\trte_pktmbuf_free(ctx->mbufs_in[i]);\n-\n-\t\t\trte_free(ctx->mbufs_in);\n-\t\t}\n-\n-\t\tif (ctx->mbufs_out) {\n-\t\t\tfor (i = 0; i < mbuf_nb; i++) {\n-\t\t\t\tif (ctx->mbufs_out[i] != NULL)\n-\t\t\t\t\trte_pktmbuf_free(ctx->mbufs_out[i]);\n-\t\t\t}\n-\n-\t\t\trte_free(ctx->mbufs_out);\n-\t\t}\n-\n-\t\tif (ctx->pkt_mbuf_pool_in)\n-\t\t\trte_mempool_free(ctx->pkt_mbuf_pool_in);\n-\n-\t\tif (ctx->pkt_mbuf_pool_out)\n-\t\t\trte_mempool_free(ctx->pkt_mbuf_pool_out);\n-\n-\t\tif (ctx->crypto_op_pool)\n-\t\t\trte_mempool_free(ctx->crypto_op_pool);\n+\t\tif (ctx->pool)\n+\t\t\trte_mempool_free(ctx->pool);\n \n \t\trte_free(ctx->res);\n \t\trte_free(ctx);\n \t}\n }\n \n-static struct rte_mbuf *\n-cperf_mbuf_create(struct rte_mempool *mempool,\n-\t\tuint32_t segment_sz,\n-\t\tuint32_t segment_nb,\n-\t\tconst struct cperf_options *options)\n-{\n-\tstruct rte_mbuf *mbuf;\n-\tuint8_t *mbuf_data;\n-\tuint32_t remaining_bytes = options->max_buffer_size;\n+struct obj_params {\n+\tuint32_t src_buf_offset;\n+\tuint32_t dst_buf_offset;\n+\tuint16_t segment_sz;\n+\tuint16_t segments_nb;\n+};\n \n-\tmbuf = rte_pktmbuf_alloc(mempool);\n-\tif (mbuf == NULL)\n-\t\tgoto error;\n+static void\n+fill_single_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,\n+\t\tvoid *obj, uint32_t mbuf_offset, uint16_t segment_sz)\n+{\n+\tuint32_t mbuf_hdr_size = sizeof(struct rte_mbuf);\n+\n+\t/* start of buffer is after mbuf structure and priv data */\n+\tm->priv_size = 0;\n+\tm->buf_addr = (char *)m + mbuf_hdr_size;\n+\tm->buf_physaddr = rte_mempool_virt2phy(mp, obj) +\n+\t\tmbuf_offset + mbuf_hdr_size;\n+\tm->buf_len = segment_sz;\n+\tm->data_len = segment_sz;\n+\n+\t/* No headroom needed for the buffer */\n+\tm->data_off = 0;\n+\n+\t/* init some constant fields */\n+\tm->pool = mp;\n+\tm->nb_segs = 1;\n+\tm->port = 0xff;\n+\trte_mbuf_refcnt_set(m, 1);\n+\tm->next = NULL;\n+}\n \n-\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf, segment_sz);\n-\tif (mbuf_data == NULL)\n-\t\tgoto error;\n+static void\n+fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,\n+\t\tvoid *obj, uint32_t mbuf_offset, uint16_t segment_sz,\n+\t\tuint16_t segments_nb)\n+{\n+\tuint16_t mbuf_hdr_size = sizeof(struct rte_mbuf);\n+\tuint16_t remaining_segments = segments_nb;\n+\tstruct rte_mbuf *next_mbuf;\n+\tphys_addr_t next_seg_phys_addr = rte_mempool_virt2phy(mp, obj) +\n+\t\t\t mbuf_offset + mbuf_hdr_size;\n+\n+\tdo {\n+\t\t/* start of buffer is after mbuf structure and priv data */\n+\t\tm->priv_size = 0;\n+\t\tm->buf_addr = (char *)m + mbuf_hdr_size;\n+\t\tm->buf_physaddr = next_seg_phys_addr;\n+\t\tnext_seg_phys_addr = (phys_addr_t)((uint8_t *)next_seg_phys_addr +\n+\t\t\t\tmbuf_hdr_size + segment_sz);\n+\t\tm->buf_len = segment_sz;\n+\t\tm->data_len = segment_sz;\n+\n+\t\t/* No headroom needed for the buffer */\n+\t\tm->data_off = 0;\n+\n+\t\t/* init some constant fields */\n+\t\tm->pool = mp;\n+\t\tm->nb_segs = segments_nb;\n+\t\tm->port = 0xff;\n+\t\trte_mbuf_refcnt_set(m, 1);\n+\t\tnext_mbuf = (struct rte_mbuf *) ((uint8_t *) m +\n+\t\t\t\t\tmbuf_hdr_size + segment_sz);\n+\t\tm->next = next_mbuf;\n+\t\tm = next_mbuf;\n+\t\tremaining_segments--;\n+\n+\t} while (remaining_segments > 0);\n+\n+\tm->next = NULL;\n+}\n \n-\tif (options->max_buffer_size <= segment_sz)\n-\t\tremaining_bytes = 0;\n+static void\n+mempool_obj_init(struct rte_mempool *mp,\n+\t\t void *opaque_arg,\n+\t\t void *obj,\n+\t\t __attribute__((unused)) unsigned int i)\n+{\n+\tstruct obj_params *params = opaque_arg;\n+\tstruct rte_crypto_op *op = obj;\n+\tstruct rte_mbuf *m = (struct rte_mbuf *) ((uint8_t *) obj +\n+\t\t\t\t\tparams->src_buf_offset);\n+\t/* Set crypto operation */\n+\top->type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;\n+\top->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n+\top->sess_type = RTE_CRYPTO_OP_WITH_SESSION;\n+\n+\t/* Set source buffer */\n+\top->sym->m_src = m;\n+\tif (params->segments_nb == 1)\n+\t\tfill_single_seg_mbuf(m, mp, obj, params->src_buf_offset,\n+\t\t\t\tparams->segment_sz);\n \telse\n-\t\tremaining_bytes -= segment_sz;\n-\n-\tsegment_nb--;\n-\n-\twhile (remaining_bytes) {\n-\t\tstruct rte_mbuf *m;\n-\n-\t\tm = rte_pktmbuf_alloc(mempool);\n-\t\tif (m == NULL)\n-\t\t\tgoto error;\n-\n-\t\trte_pktmbuf_chain(mbuf, m);\n-\n-\t\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf, segment_sz);\n-\t\tif (mbuf_data == NULL)\n-\t\t\tgoto error;\n-\n-\t\tif (remaining_bytes <= segment_sz)\n-\t\t\tremaining_bytes = 0;\n-\t\telse\n-\t\t\tremaining_bytes -= segment_sz;\n-\n-\t\tsegment_nb--;\n-\t}\n-\n-\t/*\n-\t * If there was not enough room for the digest at the end\n-\t * of the last segment, allocate a new one\n-\t */\n-\tif (segment_nb != 0) {\n-\t\tstruct rte_mbuf *m;\n-\n-\t\tm = rte_pktmbuf_alloc(mempool);\n-\n-\t\tif (m == NULL)\n-\t\t\tgoto error;\n-\n-\t\trte_pktmbuf_chain(mbuf, m);\n-\t\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf,\tsegment_sz);\n-\t\tif (mbuf_data == NULL)\n-\t\t\tgoto error;\n-\t}\n-\n-\treturn mbuf;\n-error:\n-\tif (mbuf != NULL)\n-\t\trte_pktmbuf_free(mbuf);\n-\n-\treturn NULL;\n+\t\tfill_multi_seg_mbuf(m, mp, obj, params->src_buf_offset,\n+\t\t\t\tparams->segment_sz, params->segments_nb);\n+\n+\n+\t/* Set destination buffer */\n+\tif (params->dst_buf_offset) {\n+\t\tm = (struct rte_mbuf *) ((uint8_t *) obj +\n+\t\t\t\tparams->dst_buf_offset);\n+\t\tfill_single_seg_mbuf(m, mp, obj, params->dst_buf_offset,\n+\t\t\t\tparams->segment_sz);\n+\t\top->sym->m_dst = m;\n+\t} else\n+\t\top->sym->m_dst = NULL;\n }\n \n void *\n@@ -194,7 +204,6 @@ cperf_latency_test_constructor(struct rte_mempool *sess_mp,\n \t\tconst struct cperf_op_fns *op_fns)\n {\n \tstruct cperf_latency_ctx *ctx = NULL;\n-\tunsigned int mbuf_idx = 0;\n \tchar pool_name[32] = \"\";\n \n \tctx = rte_malloc(NULL, sizeof(struct cperf_latency_ctx), 0);\n@@ -218,83 +227,52 @@ cperf_latency_test_constructor(struct rte_mempool *sess_mp,\n \tif (ctx->sess == NULL)\n \t\tgoto err;\n \n-\tsnprintf(pool_name, sizeof(pool_name), \"cperf_pool_in_cdev_%d\",\n-\t\t\t\tdev_id);\n-\n+\t/* Calculate the object size */\n+\tuint16_t crypto_op_size = sizeof(struct rte_crypto_op) +\n+\t\tsizeof(struct rte_crypto_sym_op);\n+\tuint16_t crypto_op_private_size = sizeof(struct priv_op_data) +\n+\t\t\t\ttest_vector->cipher_iv.length +\n+\t\t\t\ttest_vector->auth_iv.length +\n+\t\t\t\toptions->aead_aad_sz;\n+\tuint16_t crypto_op_total_size = crypto_op_size +\n+\t\t\t\tcrypto_op_private_size;\n+\tuint16_t crypto_op_total_size_padded =\n+\t\t\t\tRTE_CACHE_LINE_ROUNDUP(crypto_op_total_size);\n+\tuint32_t mbuf_size = sizeof(struct rte_mbuf) + options->segment_sz;\n \tuint32_t max_size = options->max_buffer_size + options->digest_sz;\n-\tuint32_t segment_nb = (max_size % options->segment_sz) ?\n+\tuint16_t segments_nb = (max_size % options->segment_sz) ?\n \t\t\t(max_size / options->segment_sz) + 1 :\n \t\t\tmax_size / options->segment_sz;\n+\tuint32_t obj_size = crypto_op_total_size_padded +\n+\t\t\t\t(mbuf_size * segments_nb);\n \n-\tctx->pkt_mbuf_pool_in = rte_pktmbuf_pool_create(pool_name,\n-\t\t\toptions->pool_sz * segment_nb, 0, 0,\n-\t\t\tRTE_PKTMBUF_HEADROOM + options->segment_sz,\n-\t\t\trte_socket_id());\n-\n-\tif (ctx->pkt_mbuf_pool_in == NULL)\n-\t\tgoto err;\n-\n-\t/* Generate mbufs_in with plaintext populated for test */\n-\tctx->mbufs_in = rte_malloc(NULL,\n-\t\t\t(sizeof(struct rte_mbuf *) *\n-\t\t\tctx->options->pool_sz), 0);\n-\n-\tfor (mbuf_idx = 0; mbuf_idx < options->pool_sz; mbuf_idx++) {\n-\t\tctx->mbufs_in[mbuf_idx] = cperf_mbuf_create(\n-\t\t\t\tctx->pkt_mbuf_pool_in,\n-\t\t\t\toptions->segment_sz,\n-\t\t\t\tsegment_nb,\n-\t\t\t\toptions);\n-\t\tif (ctx->mbufs_in[mbuf_idx] == NULL)\n-\t\t\tgoto err;\n-\t}\n-\n-\tif (options->out_of_place == 1)\t{\n-\n-\t\tsnprintf(pool_name, sizeof(pool_name),\n-\t\t\t\t\"cperf_pool_out_cdev_%d\",\n-\t\t\t\tdev_id);\n-\n-\t\tctx->pkt_mbuf_pool_out = rte_pktmbuf_pool_create(\n-\t\t\t\tpool_name, options->pool_sz, 0, 0,\n-\t\t\t\tRTE_PKTMBUF_HEADROOM +\n-\t\t\t\tmax_size,\n-\t\t\t\trte_socket_id());\n-\n-\t\tif (ctx->pkt_mbuf_pool_out == NULL)\n-\t\t\tgoto err;\n-\t}\n-\n-\tctx->mbufs_out = rte_malloc(NULL,\n-\t\t\t(sizeof(struct rte_mbuf *) *\n-\t\t\tctx->options->pool_sz), 0);\n-\n-\tfor (mbuf_idx = 0; mbuf_idx < options->pool_sz; mbuf_idx++) {\n-\t\tif (options->out_of_place == 1)\t{\n-\t\t\tctx->mbufs_out[mbuf_idx] = cperf_mbuf_create(\n-\t\t\t\t\tctx->pkt_mbuf_pool_out, max_size,\n-\t\t\t\t\t1, options);\n-\t\t\tif (ctx->mbufs_out[mbuf_idx] == NULL)\n-\t\t\t\tgoto err;\n-\t\t} else {\n-\t\t\tctx->mbufs_out[mbuf_idx] = NULL;\n-\t\t}\n-\t}\n-\n-\tsnprintf(pool_name, sizeof(pool_name), \"cperf_op_pool_cdev_%d\",\n+\tsnprintf(pool_name, sizeof(pool_name), \"pool_in_cdev_%d\",\n \t\t\tdev_id);\n \n-\tuint16_t priv_size = RTE_ALIGN_CEIL(sizeof(struct priv_op_data) +\n-\t\t\ttest_vector->cipher_iv.length +\n-\t\t\ttest_vector->auth_iv.length +\n-\t\t\ttest_vector->aead_iv.length, 16) +\n-\t\t\tRTE_ALIGN_CEIL(options->aead_aad_sz, 16);\n+\tctx->src_buf_offset = crypto_op_total_size_padded;\n+\n+\tstruct obj_params params = {\n+\t\t.segment_sz = options->segment_sz,\n+\t\t.segments_nb = segments_nb,\n+\t\t.src_buf_offset = crypto_op_total_size_padded,\n+\t\t.dst_buf_offset = 0\n+\t};\n+\n+\tif (options->out_of_place) {\n+\t\tctx->dst_buf_offset = ctx->src_buf_offset +\n+\t\t\t\t(mbuf_size * segments_nb);\n+\t\tparams.dst_buf_offset = ctx->dst_buf_offset;\n+\t\t/* Destination buffer will be one segment online */\n+\t\tobj_size += max_size;\n+\t}\n \n-\tctx->crypto_op_pool = rte_crypto_op_pool_create(pool_name,\n-\t\t\tRTE_CRYPTO_OP_TYPE_SYMMETRIC, options->pool_sz,\n-\t\t\t512, priv_size, rte_socket_id());\n+\tctx->pool = rte_mempool_create(pool_name,\n+\t\t\toptions->pool_sz, obj_size, 512, 0,\n+\t\t\tNULL, NULL, mempool_obj_init,\n+\t\t\t(void *)&params,\n+\t\t\trte_socket_id(), 0);\n \n-\tif (ctx->crypto_op_pool == NULL)\n+\tif (ctx->pool == NULL)\n \t\tgoto err;\n \n \tctx->res = rte_malloc(NULL, sizeof(struct cperf_op_result) *\n@@ -305,7 +283,7 @@ cperf_latency_test_constructor(struct rte_mempool *sess_mp,\n \n \treturn ctx;\n err:\n-\tcperf_latency_test_free(ctx, mbuf_idx);\n+\tcperf_latency_test_free(ctx);\n \n \treturn NULL;\n }\n@@ -370,7 +348,7 @@ cperf_latency_test_runner(void *arg)\n \n \twhile (test_burst_size <= ctx->options->max_burst_size) {\n \t\tuint64_t ops_enqd = 0, ops_deqd = 0;\n-\t\tuint64_t m_idx = 0, b_idx = 0;\n+\t\tuint64_t b_idx = 0;\n \n \t\tuint64_t tsc_val, tsc_end, tsc_start;\n \t\tuint64_t tsc_max = 0, tsc_min = ~0UL, tsc_tot = 0, tsc_idx = 0;\n@@ -385,11 +363,9 @@ cperf_latency_test_runner(void *arg)\n \t\t\t\t\t\t\tctx->options->total_ops -\n \t\t\t\t\t\t\tenqd_tot;\n \n-\t\t\t/* Allocate crypto ops from pool */\n-\t\t\tif (burst_size != rte_crypto_op_bulk_alloc(\n-\t\t\t\t\tctx->crypto_op_pool,\n-\t\t\t\t\tRTE_CRYPTO_OP_TYPE_SYMMETRIC,\n-\t\t\t\t\tops, burst_size)) {\n+\t\t\t/* Allocate objects containing crypto operations and mbufs */\n+\t\t\tif (rte_mempool_get_bulk(ctx->pool, (void **)ops,\n+\t\t\t\t\t\tburst_size) != 0) {\n \t\t\t\tRTE_LOG(ERR, USER1,\n \t\t\t\t\t\"Failed to allocate more crypto operations \"\n \t\t\t\t\t\"from the the crypto operation pool.\\n\"\n@@ -399,8 +375,8 @@ cperf_latency_test_runner(void *arg)\n \t\t\t}\n \n \t\t\t/* Setup crypto op, attach mbuf etc */\n-\t\t\t(ctx->populate_ops)(ops, &ctx->mbufs_in[m_idx],\n-\t\t\t\t\t&ctx->mbufs_out[m_idx],\n+\t\t\t(ctx->populate_ops)(ops, ctx->src_buf_offset,\n+\t\t\t\t\tctx->dst_buf_offset,\n \t\t\t\t\tburst_size, ctx->sess, ctx->options,\n \t\t\t\t\tctx->test_vector, iv_offset);\n \n@@ -429,7 +405,7 @@ cperf_latency_test_runner(void *arg)\n \n \t\t\t/* Free memory for not enqueued operations */\n \t\t\tif (ops_enqd != burst_size)\n-\t\t\t\trte_mempool_put_bulk(ctx->crypto_op_pool,\n+\t\t\t\trte_mempool_put_bulk(ctx->pool,\n \t\t\t\t\t\t(void **)&ops[ops_enqd],\n \t\t\t\t\t\tburst_size - ops_enqd);\n \n@@ -445,16 +421,11 @@ cperf_latency_test_runner(void *arg)\n \t\t\t}\n \n \t\t\tif (likely(ops_deqd))  {\n-\t\t\t\t/*\n-\t\t\t\t * free crypto ops so they can be reused. We don't free\n-\t\t\t\t * the mbufs here as we don't want to reuse them as\n-\t\t\t\t * the crypto operation will change the data and cause\n-\t\t\t\t * failures.\n-\t\t\t\t */\n+\t\t\t\t/* free crypto ops so they can be reused. */\n \t\t\t\tfor (i = 0; i < ops_deqd; i++)\n \t\t\t\t\tstore_timestamp(ops_processed[i], tsc_end);\n \n-\t\t\t\trte_mempool_put_bulk(ctx->crypto_op_pool,\n+\t\t\t\trte_mempool_put_bulk(ctx->pool,\n \t\t\t\t\t\t(void **)ops_processed, ops_deqd);\n \n \t\t\t\tdeqd_tot += ops_deqd;\n@@ -466,9 +437,6 @@ cperf_latency_test_runner(void *arg)\n \t\t\tenqd_max = max(ops_enqd, enqd_max);\n \t\t\tenqd_min = min(ops_enqd, enqd_min);\n \n-\t\t\tm_idx += ops_enqd;\n-\t\t\tm_idx = m_idx + test_burst_size > ctx->options->pool_sz ?\n-\t\t\t\t\t0 : m_idx;\n \t\t\tb_idx++;\n \t\t}\n \n@@ -487,7 +455,7 @@ cperf_latency_test_runner(void *arg)\n \t\t\t\tfor (i = 0; i < ops_deqd; i++)\n \t\t\t\t\tstore_timestamp(ops_processed[i], tsc_end);\n \n-\t\t\t\trte_mempool_put_bulk(ctx->crypto_op_pool,\n+\t\t\t\trte_mempool_put_bulk(ctx->pool,\n \t\t\t\t\t\t(void **)ops_processed, ops_deqd);\n \n \t\t\t\tdeqd_tot += ops_deqd;\n@@ -585,5 +553,5 @@ cperf_latency_test_destructor(void *arg)\n \n \trte_cryptodev_stop(ctx->dev_id);\n \n-\tcperf_latency_test_free(ctx, ctx->options->pool_sz);\n+\tcperf_latency_test_free(ctx);\n }\ndiff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c\nindex 121ceb1..46889c4 100644\n--- a/app/test-crypto-perf/cperf_test_throughput.c\n+++ b/app/test-crypto-perf/cperf_test_throughput.c\n@@ -43,131 +43,141 @@ struct cperf_throughput_ctx {\n \tuint16_t qp_id;\n \tuint8_t lcore_id;\n \n-\tstruct rte_mempool *pkt_mbuf_pool_in;\n-\tstruct rte_mempool *pkt_mbuf_pool_out;\n-\tstruct rte_mbuf **mbufs_in;\n-\tstruct rte_mbuf **mbufs_out;\n-\n-\tstruct rte_mempool *crypto_op_pool;\n+\tstruct rte_mempool *pool;\n \n \tstruct rte_cryptodev_sym_session *sess;\n \n \tcperf_populate_ops_t populate_ops;\n \n+\tuint32_t src_buf_offset;\n+\tuint32_t dst_buf_offset;\n+\n \tconst struct cperf_options *options;\n \tconst struct cperf_test_vector *test_vector;\n };\n \n static void\n-cperf_throughput_test_free(struct cperf_throughput_ctx *ctx, uint32_t mbuf_nb)\n+cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)\n {\n-\tuint32_t i;\n-\n \tif (ctx) {\n \t\tif (ctx->sess) {\n \t\t\trte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);\n \t\t\trte_cryptodev_sym_session_free(ctx->sess);\n \t\t}\n \n-\t\tif (ctx->mbufs_in) {\n-\t\t\tfor (i = 0; i < mbuf_nb; i++)\n-\t\t\t\trte_pktmbuf_free(ctx->mbufs_in[i]);\n-\n-\t\t\trte_free(ctx->mbufs_in);\n-\t\t}\n-\n-\t\tif (ctx->mbufs_out) {\n-\t\t\tfor (i = 0; i < mbuf_nb; i++) {\n-\t\t\t\tif (ctx->mbufs_out[i] != NULL)\n-\t\t\t\t\trte_pktmbuf_free(ctx->mbufs_out[i]);\n-\t\t\t}\n-\n-\t\t\trte_free(ctx->mbufs_out);\n-\t\t}\n-\n-\t\tif (ctx->pkt_mbuf_pool_in)\n-\t\t\trte_mempool_free(ctx->pkt_mbuf_pool_in);\n-\n-\t\tif (ctx->pkt_mbuf_pool_out)\n-\t\t\trte_mempool_free(ctx->pkt_mbuf_pool_out);\n-\n-\t\tif (ctx->crypto_op_pool)\n-\t\t\trte_mempool_free(ctx->crypto_op_pool);\n+\t\tif (ctx->pool)\n+\t\t\trte_mempool_free(ctx->pool);\n \n \t\trte_free(ctx);\n \t}\n }\n \n-static struct rte_mbuf *\n-cperf_mbuf_create(struct rte_mempool *mempool,\n-\t\tuint32_t segment_sz,\n-\t\tuint32_t segment_nb,\n-\t\tconst struct cperf_options *options)\n-{\n-\tstruct rte_mbuf *mbuf;\n-\tuint8_t *mbuf_data;\n-\tuint32_t remaining_bytes = options->max_buffer_size;\n+struct obj_params {\n+\tuint32_t src_buf_offset;\n+\tuint32_t dst_buf_offset;\n+\tuint16_t segment_sz;\n+\tuint16_t segments_nb;\n+};\n \n-\tmbuf = rte_pktmbuf_alloc(mempool);\n-\tif (mbuf == NULL)\n-\t\tgoto error;\n+static void\n+fill_single_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,\n+\t\tvoid *obj, uint32_t mbuf_offset, uint16_t segment_sz)\n+{\n+\tuint32_t mbuf_hdr_size = sizeof(struct rte_mbuf);\n+\n+\t/* start of buffer is after mbuf structure and priv data */\n+\tm->priv_size = 0;\n+\tm->buf_addr = (char *)m + mbuf_hdr_size;\n+\tm->buf_physaddr = rte_mempool_virt2phy(mp, obj) +\n+\t\tmbuf_offset + mbuf_hdr_size;\n+\tm->buf_len = segment_sz;\n+\tm->data_len = segment_sz;\n+\n+\t/* No headroom needed for the buffer */\n+\tm->data_off = 0;\n+\n+\t/* init some constant fields */\n+\tm->pool = mp;\n+\tm->nb_segs = 1;\n+\tm->port = 0xff;\n+\trte_mbuf_refcnt_set(m, 1);\n+\tm->next = NULL;\n+}\n \n-\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf, segment_sz);\n-\tif (mbuf_data == NULL)\n-\t\tgoto error;\n+static void\n+fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,\n+\t\tvoid *obj, uint32_t mbuf_offset, uint16_t segment_sz,\n+\t\tuint16_t segments_nb)\n+{\n+\tuint16_t mbuf_hdr_size = sizeof(struct rte_mbuf);\n+\tuint16_t remaining_segments = segments_nb;\n+\tstruct rte_mbuf *next_mbuf;\n+\tphys_addr_t next_seg_phys_addr = rte_mempool_virt2phy(mp, obj) +\n+\t\t\t mbuf_offset + mbuf_hdr_size;\n+\n+\tdo {\n+\t\t/* start of buffer is after mbuf structure and priv data */\n+\t\tm->priv_size = 0;\n+\t\tm->buf_addr = (char *)m + mbuf_hdr_size;\n+\t\tm->buf_physaddr = next_seg_phys_addr;\n+\t\tnext_seg_phys_addr = (phys_addr_t)((uint8_t *)next_seg_phys_addr +\n+\t\t\t\tmbuf_hdr_size + segment_sz);\n+\t\tm->buf_len = segment_sz;\n+\t\tm->data_len = segment_sz;\n+\n+\t\t/* No headroom needed for the buffer */\n+\t\tm->data_off = 0;\n+\n+\t\t/* init some constant fields */\n+\t\tm->pool = mp;\n+\t\tm->nb_segs = segments_nb;\n+\t\tm->port = 0xff;\n+\t\trte_mbuf_refcnt_set(m, 1);\n+\t\tnext_mbuf = (struct rte_mbuf *) ((uint8_t *) m +\n+\t\t\t\t\tmbuf_hdr_size + segment_sz);\n+\t\tm->next = next_mbuf;\n+\t\tm = next_mbuf;\n+\t\tremaining_segments--;\n+\n+\t} while (remaining_segments > 0);\n+\n+\tm->next = NULL;\n+}\n \n-\tif (options->max_buffer_size <= segment_sz)\n-\t\tremaining_bytes = 0;\n+static void\n+mempool_obj_init(struct rte_mempool *mp,\n+\t\t void *opaque_arg,\n+\t\t void *obj,\n+\t\t __attribute__((unused)) unsigned int i)\n+{\n+\tstruct obj_params *params = opaque_arg;\n+\tstruct rte_crypto_op *op = obj;\n+\tstruct rte_mbuf *m = (struct rte_mbuf *) ((uint8_t *) obj +\n+\t\t\t\t\tparams->src_buf_offset);\n+\t/* Set crypto operation */\n+\top->type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;\n+\top->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n+\top->sess_type = RTE_CRYPTO_OP_WITH_SESSION;\n+\n+\t/* Set source buffer */\n+\top->sym->m_src = m;\n+\tif (params->segments_nb == 1)\n+\t\tfill_single_seg_mbuf(m, mp, obj, params->src_buf_offset,\n+\t\t\t\tparams->segment_sz);\n \telse\n-\t\tremaining_bytes -= segment_sz;\n-\n-\tsegment_nb--;\n-\n-\twhile (remaining_bytes) {\n-\t\tstruct rte_mbuf *m;\n-\n-\t\tm = rte_pktmbuf_alloc(mempool);\n-\t\tif (m == NULL)\n-\t\t\tgoto error;\n-\n-\t\trte_pktmbuf_chain(mbuf, m);\n-\n-\t\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf, segment_sz);\n-\t\tif (mbuf_data == NULL)\n-\t\t\tgoto error;\n-\n-\t\tif (remaining_bytes <= segment_sz)\n-\t\t\tremaining_bytes = 0;\n-\t\telse\n-\t\t\tremaining_bytes -= segment_sz;\n-\n-\t\tsegment_nb--;\n-\t}\n-\n-\t/*\n-\t * If there was not enough room for the digest at the end\n-\t * of the last segment, allocate a new one\n-\t */\n-\tif (segment_nb != 0) {\n-\t\tstruct rte_mbuf *m;\n-\n-\t\tm = rte_pktmbuf_alloc(mempool);\n-\n-\t\tif (m == NULL)\n-\t\t\tgoto error;\n-\n-\t\trte_pktmbuf_chain(mbuf, m);\n-\t\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf,\tsegment_sz);\n-\t\tif (mbuf_data == NULL)\n-\t\t\tgoto error;\n-\t}\n-\n-\treturn mbuf;\n-error:\n-\tif (mbuf != NULL)\n-\t\trte_pktmbuf_free(mbuf);\n-\n-\treturn NULL;\n+\t\tfill_multi_seg_mbuf(m, mp, obj, params->src_buf_offset,\n+\t\t\t\tparams->segment_sz, params->segments_nb);\n+\n+\n+\t/* Set destination buffer */\n+\tif (params->dst_buf_offset) {\n+\t\tm = (struct rte_mbuf *) ((uint8_t *) obj +\n+\t\t\t\tparams->dst_buf_offset);\n+\t\tfill_single_seg_mbuf(m, mp, obj, params->dst_buf_offset,\n+\t\t\t\tparams->segment_sz);\n+\t\top->sym->m_dst = m;\n+\t} else\n+\t\top->sym->m_dst = NULL;\n }\n \n void *\n@@ -178,7 +188,6 @@ cperf_throughput_test_constructor(struct rte_mempool *sess_mp,\n \t\tconst struct cperf_op_fns *op_fns)\n {\n \tstruct cperf_throughput_ctx *ctx = NULL;\n-\tunsigned int mbuf_idx = 0;\n \tchar pool_name[32] = \"\";\n \n \tctx = rte_malloc(NULL, sizeof(struct cperf_throughput_ctx), 0);\n@@ -201,83 +210,56 @@ cperf_throughput_test_constructor(struct rte_mempool *sess_mp,\n \tif (ctx->sess == NULL)\n \t\tgoto err;\n \n-\tsnprintf(pool_name, sizeof(pool_name), \"cperf_pool_in_cdev_%d\",\n-\t\t\tdev_id);\n-\n+\t/* Calculate the object size */\n+\tuint16_t crypto_op_size = sizeof(struct rte_crypto_op) +\n+\t\tsizeof(struct rte_crypto_sym_op);\n+\tuint16_t crypto_op_private_size = test_vector->cipher_iv.length +\n+\t\t\t\ttest_vector->auth_iv.length +\n+\t\t\t\toptions->aead_aad_sz;\n+\tuint16_t crypto_op_total_size = crypto_op_size +\n+\t\t\t\tcrypto_op_private_size;\n+\tuint16_t crypto_op_total_size_padded =\n+\t\t\t\tRTE_CACHE_LINE_ROUNDUP(crypto_op_total_size);\n+\tuint32_t mbuf_size = sizeof(struct rte_mbuf) + options->segment_sz;\n \tuint32_t max_size = options->max_buffer_size + options->digest_sz;\n-\tuint32_t segment_nb = (max_size % options->segment_sz) ?\n+\tuint16_t segments_nb = (max_size % options->segment_sz) ?\n \t\t\t(max_size / options->segment_sz) + 1 :\n \t\t\tmax_size / options->segment_sz;\n+\tuint32_t obj_size = crypto_op_total_size_padded +\n+\t\t\t\t(mbuf_size * segments_nb);\n \n-\tctx->pkt_mbuf_pool_in = rte_pktmbuf_pool_create(pool_name,\n-\t\t\toptions->pool_sz * segment_nb, 0, 0,\n-\t\t\tRTE_PKTMBUF_HEADROOM + options->segment_sz,\n-\t\t\trte_socket_id());\n-\n-\tif (ctx->pkt_mbuf_pool_in == NULL)\n-\t\tgoto err;\n-\n-\t/* Generate mbufs_in with plaintext populated for test */\n-\tctx->mbufs_in = rte_malloc(NULL,\n-\t\t\t(sizeof(struct rte_mbuf *) * ctx->options->pool_sz), 0);\n-\n-\tfor (mbuf_idx = 0; mbuf_idx < options->pool_sz; mbuf_idx++) {\n-\t\tctx->mbufs_in[mbuf_idx] = cperf_mbuf_create(\n-\t\t\t\tctx->pkt_mbuf_pool_in,\n-\t\t\t\toptions->segment_sz,\n-\t\t\t\tsegment_nb,\n-\t\t\t\toptions);\n-\t\tif (ctx->mbufs_in[mbuf_idx] == NULL)\n-\t\t\tgoto err;\n-\t}\n-\n-\tif (options->out_of_place == 1)\t{\n-\n-\t\tsnprintf(pool_name, sizeof(pool_name), \"cperf_pool_out_cdev_%d\",\n-\t\t\t\tdev_id);\n-\n-\t\tctx->pkt_mbuf_pool_out = rte_pktmbuf_pool_create(\n-\t\t\t\tpool_name, options->pool_sz, 0, 0,\n-\t\t\t\tRTE_PKTMBUF_HEADROOM +\n-\t\t\t\tmax_size,\n-\t\t\t\trte_socket_id());\n-\n-\t\tif (ctx->pkt_mbuf_pool_out == NULL)\n-\t\t\tgoto err;\n-\t}\n+\tsnprintf(pool_name, sizeof(pool_name), \"pool_in_cdev_%d\",\n+\t\t\tdev_id);\n \n-\tctx->mbufs_out = rte_malloc(NULL,\n-\t\t\t(sizeof(struct rte_mbuf *) *\n-\t\t\tctx->options->pool_sz), 0);\n-\n-\tfor (mbuf_idx = 0; mbuf_idx < options->pool_sz; mbuf_idx++) {\n-\t\tif (options->out_of_place == 1)\t{\n-\t\t\tctx->mbufs_out[mbuf_idx] = cperf_mbuf_create(\n-\t\t\t\t\tctx->pkt_mbuf_pool_out, max_size,\n-\t\t\t\t\t1, options);\n-\t\t\tif (ctx->mbufs_out[mbuf_idx] == NULL)\n-\t\t\t\tgoto err;\n-\t\t} else {\n-\t\t\tctx->mbufs_out[mbuf_idx] = NULL;\n-\t\t}\n+\tctx->src_buf_offset = crypto_op_total_size_padded;\n+\n+\tstruct obj_params params = {\n+\t\t.segment_sz = options->segment_sz,\n+\t\t.segments_nb = segments_nb,\n+\t\t.src_buf_offset = crypto_op_total_size_padded,\n+\t\t.dst_buf_offset = 0\n+\t};\n+\n+\tif (options->out_of_place) {\n+\t\tctx->dst_buf_offset = ctx->src_buf_offset +\n+\t\t\t\t(mbuf_size * segments_nb);\n+\t\tparams.dst_buf_offset = ctx->dst_buf_offset;\n+\t\t/* Destination buffer will be one segment online */\n+\t\tobj_size += max_size;\n \t}\n \n-\tsnprintf(pool_name, sizeof(pool_name), \"cperf_op_pool_cdev_%d\",\n-\t\t\tdev_id);\n-\n-\tuint16_t priv_size = RTE_ALIGN_CEIL(test_vector->cipher_iv.length +\n-\t\ttest_vector->auth_iv.length + test_vector->aead_iv.length, 16) +\n-\t\tRTE_ALIGN_CEIL(options->aead_aad_sz, 16);\n+\tctx->pool = rte_mempool_create(pool_name,\n+\t\t\toptions->pool_sz, obj_size, 512, 0,\n+\t\t\tNULL, NULL, mempool_obj_init,\n+\t\t\t(void *)&params,\n+\t\t\trte_socket_id(), 0);\n \n-\tctx->crypto_op_pool = rte_crypto_op_pool_create(pool_name,\n-\t\t\tRTE_CRYPTO_OP_TYPE_SYMMETRIC, options->pool_sz,\n-\t\t\t512, priv_size, rte_socket_id());\n-\tif (ctx->crypto_op_pool == NULL)\n+\tif (ctx->pool == NULL)\n \t\tgoto err;\n \n \treturn ctx;\n err:\n-\tcperf_throughput_test_free(ctx, mbuf_idx);\n+\tcperf_throughput_test_free(ctx);\n \n \treturn NULL;\n }\n@@ -329,7 +311,7 @@ cperf_throughput_test_runner(void *test_ctx)\n \t\tuint64_t ops_enqd = 0, ops_enqd_total = 0, ops_enqd_failed = 0;\n \t\tuint64_t ops_deqd = 0, ops_deqd_total = 0, ops_deqd_failed = 0;\n \n-\t\tuint64_t m_idx = 0, tsc_start, tsc_end, tsc_duration;\n+\t\tuint64_t tsc_start, tsc_end, tsc_duration;\n \n \t\tuint16_t ops_unused = 0;\n \n@@ -345,11 +327,9 @@ cperf_throughput_test_runner(void *test_ctx)\n \n \t\t\tuint16_t ops_needed = burst_size - ops_unused;\n \n-\t\t\t/* Allocate crypto ops from pool */\n-\t\t\tif (ops_needed != rte_crypto_op_bulk_alloc(\n-\t\t\t\t\tctx->crypto_op_pool,\n-\t\t\t\t\tRTE_CRYPTO_OP_TYPE_SYMMETRIC,\n-\t\t\t\t\tops, ops_needed)) {\n+\t\t\t/* Allocate objects containing crypto operations and mbufs */\n+\t\t\tif (rte_mempool_get_bulk(ctx->pool, (void **)ops,\n+\t\t\t\t\t\tops_needed) != 0) {\n \t\t\t\tRTE_LOG(ERR, USER1,\n \t\t\t\t\t\"Failed to allocate more crypto operations \"\n \t\t\t\t\t\"from the the crypto operation pool.\\n\"\n@@ -359,10 +339,11 @@ cperf_throughput_test_runner(void *test_ctx)\n \t\t\t}\n \n \t\t\t/* Setup crypto op, attach mbuf etc */\n-\t\t\t(ctx->populate_ops)(ops, &ctx->mbufs_in[m_idx],\n-\t\t\t\t\t&ctx->mbufs_out[m_idx],\n-\t\t\t\t\tops_needed, ctx->sess, ctx->options,\n-\t\t\t\t\tctx->test_vector, iv_offset);\n+\t\t\t(ctx->populate_ops)(ops, ctx->src_buf_offset,\n+\t\t\t\t\tctx->dst_buf_offset,\n+\t\t\t\t\tops_needed, ctx->sess,\n+\t\t\t\t\tctx->options, ctx->test_vector,\n+\t\t\t\t\tiv_offset);\n \n \t\t\t/**\n \t\t\t * When ops_needed is smaller than ops_enqd, the\n@@ -407,12 +388,8 @@ cperf_throughput_test_runner(void *test_ctx)\n \t\t\t\t\tops_processed, test_burst_size);\n \n \t\t\tif (likely(ops_deqd))  {\n-\t\t\t\t/* free crypto ops so they can be reused. We don't free\n-\t\t\t\t * the mbufs here as we don't want to reuse them as\n-\t\t\t\t * the crypto operation will change the data and cause\n-\t\t\t\t * failures.\n-\t\t\t\t */\n-\t\t\t\trte_mempool_put_bulk(ctx->crypto_op_pool,\n+\t\t\t\t/* free crypto ops so they can be reused. */\n+\t\t\t\trte_mempool_put_bulk(ctx->pool,\n \t\t\t\t\t\t(void **)ops_processed, ops_deqd);\n \n \t\t\t\tops_deqd_total += ops_deqd;\n@@ -425,9 +402,6 @@ cperf_throughput_test_runner(void *test_ctx)\n \t\t\t\tops_deqd_failed++;\n \t\t\t}\n \n-\t\t\tm_idx += ops_needed;\n-\t\t\tm_idx = m_idx + test_burst_size > ctx->options->pool_sz ?\n-\t\t\t\t\t0 : m_idx;\n \t\t}\n \n \t\t/* Dequeue any operations still in the crypto device */\n@@ -442,9 +416,8 @@ cperf_throughput_test_runner(void *test_ctx)\n \t\t\tif (ops_deqd == 0)\n \t\t\t\tops_deqd_failed++;\n \t\t\telse {\n-\t\t\t\trte_mempool_put_bulk(ctx->crypto_op_pool,\n+\t\t\t\trte_mempool_put_bulk(ctx->pool,\n \t\t\t\t\t\t(void **)ops_processed, ops_deqd);\n-\n \t\t\t\tops_deqd_total += ops_deqd;\n \t\t\t}\n \t\t}\n@@ -532,5 +505,5 @@ cperf_throughput_test_destructor(void *arg)\n \n \trte_cryptodev_stop(ctx->dev_id);\n \n-\tcperf_throughput_test_free(ctx, ctx->options->pool_sz);\n+\tcperf_throughput_test_free(ctx);\n }\ndiff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c\nindex b18426c..aa065ed 100644\n--- a/app/test-crypto-perf/cperf_test_verify.c\n+++ b/app/test-crypto-perf/cperf_test_verify.c\n@@ -43,135 +43,141 @@ struct cperf_verify_ctx {\n \tuint16_t qp_id;\n \tuint8_t lcore_id;\n \n-\tstruct rte_mempool *pkt_mbuf_pool_in;\n-\tstruct rte_mempool *pkt_mbuf_pool_out;\n-\tstruct rte_mbuf **mbufs_in;\n-\tstruct rte_mbuf **mbufs_out;\n-\n-\tstruct rte_mempool *crypto_op_pool;\n+\tstruct rte_mempool *pool;\n \n \tstruct rte_cryptodev_sym_session *sess;\n \n \tcperf_populate_ops_t populate_ops;\n \n+\tuint32_t src_buf_offset;\n+\tuint32_t dst_buf_offset;\n+\n \tconst struct cperf_options *options;\n \tconst struct cperf_test_vector *test_vector;\n };\n \n-struct cperf_op_result {\n-\tenum rte_crypto_op_status status;\n-};\n-\n static void\n-cperf_verify_test_free(struct cperf_verify_ctx *ctx, uint32_t mbuf_nb)\n+cperf_verify_test_free(struct cperf_verify_ctx *ctx)\n {\n-\tuint32_t i;\n-\n \tif (ctx) {\n \t\tif (ctx->sess) {\n \t\t\trte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);\n \t\t\trte_cryptodev_sym_session_free(ctx->sess);\n \t\t}\n \n-\t\tif (ctx->mbufs_in) {\n-\t\t\tfor (i = 0; i < mbuf_nb; i++)\n-\t\t\t\trte_pktmbuf_free(ctx->mbufs_in[i]);\n-\n-\t\t\trte_free(ctx->mbufs_in);\n-\t\t}\n-\n-\t\tif (ctx->mbufs_out) {\n-\t\t\tfor (i = 0; i < mbuf_nb; i++) {\n-\t\t\t\tif (ctx->mbufs_out[i] != NULL)\n-\t\t\t\t\trte_pktmbuf_free(ctx->mbufs_out[i]);\n-\t\t\t}\n-\n-\t\t\trte_free(ctx->mbufs_out);\n-\t\t}\n-\n-\t\tif (ctx->pkt_mbuf_pool_in)\n-\t\t\trte_mempool_free(ctx->pkt_mbuf_pool_in);\n-\n-\t\tif (ctx->pkt_mbuf_pool_out)\n-\t\t\trte_mempool_free(ctx->pkt_mbuf_pool_out);\n-\n-\t\tif (ctx->crypto_op_pool)\n-\t\t\trte_mempool_free(ctx->crypto_op_pool);\n+\t\tif (ctx->pool)\n+\t\t\trte_mempool_free(ctx->pool);\n \n \t\trte_free(ctx);\n \t}\n }\n \n-static struct rte_mbuf *\n-cperf_mbuf_create(struct rte_mempool *mempool,\n-\t\tuint32_t segment_sz,\n-\t\tuint32_t segment_nb,\n-\t\tconst struct cperf_options *options)\n-{\n-\tstruct rte_mbuf *mbuf;\n-\tuint8_t *mbuf_data;\n-\tuint32_t remaining_bytes = options->max_buffer_size;\n+struct obj_params {\n+\tuint32_t src_buf_offset;\n+\tuint32_t dst_buf_offset;\n+\tuint16_t segment_sz;\n+\tuint16_t segments_nb;\n+};\n \n-\tmbuf = rte_pktmbuf_alloc(mempool);\n-\tif (mbuf == NULL)\n-\t\tgoto error;\n+static void\n+fill_single_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,\n+\t\tvoid *obj, uint32_t mbuf_offset, uint16_t segment_sz)\n+{\n+\tuint32_t mbuf_hdr_size = sizeof(struct rte_mbuf);\n+\n+\t/* start of buffer is after mbuf structure and priv data */\n+\tm->priv_size = 0;\n+\tm->buf_addr = (char *)m + mbuf_hdr_size;\n+\tm->buf_physaddr = rte_mempool_virt2phy(mp, obj) +\n+\t\tmbuf_offset + mbuf_hdr_size;\n+\tm->buf_len = segment_sz;\n+\tm->data_len = segment_sz;\n+\n+\t/* No headroom needed for the buffer */\n+\tm->data_off = 0;\n+\n+\t/* init some constant fields */\n+\tm->pool = mp;\n+\tm->nb_segs = 1;\n+\tm->port = 0xff;\n+\trte_mbuf_refcnt_set(m, 1);\n+\tm->next = NULL;\n+}\n \n-\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf, segment_sz);\n-\tif (mbuf_data == NULL)\n-\t\tgoto error;\n+static void\n+fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,\n+\t\tvoid *obj, uint32_t mbuf_offset, uint16_t segment_sz,\n+\t\tuint16_t segments_nb)\n+{\n+\tuint16_t mbuf_hdr_size = sizeof(struct rte_mbuf);\n+\tuint16_t remaining_segments = segments_nb;\n+\tstruct rte_mbuf *next_mbuf;\n+\tphys_addr_t next_seg_phys_addr = rte_mempool_virt2phy(mp, obj) +\n+\t\t\t mbuf_offset + mbuf_hdr_size;\n+\n+\tdo {\n+\t\t/* start of buffer is after mbuf structure and priv data */\n+\t\tm->priv_size = 0;\n+\t\tm->buf_addr = (char *)m + mbuf_hdr_size;\n+\t\tm->buf_physaddr = next_seg_phys_addr;\n+\t\tnext_seg_phys_addr = (phys_addr_t)((uint8_t *)next_seg_phys_addr +\n+\t\t\t\tmbuf_hdr_size + segment_sz);\n+\t\tm->buf_len = segment_sz;\n+\t\tm->data_len = segment_sz;\n+\n+\t\t/* No headroom needed for the buffer */\n+\t\tm->data_off = 0;\n+\n+\t\t/* init some constant fields */\n+\t\tm->pool = mp;\n+\t\tm->nb_segs = segments_nb;\n+\t\tm->port = 0xff;\n+\t\trte_mbuf_refcnt_set(m, 1);\n+\t\tnext_mbuf = (struct rte_mbuf *) ((uint8_t *) m +\n+\t\t\t\t\tmbuf_hdr_size + segment_sz);\n+\t\tm->next = next_mbuf;\n+\t\tm = next_mbuf;\n+\t\tremaining_segments--;\n+\n+\t} while (remaining_segments > 0);\n+\n+\tm->next = NULL;\n+}\n \n-\tif (options->max_buffer_size <= segment_sz)\n-\t\tremaining_bytes = 0;\n+static void\n+mempool_obj_init(struct rte_mempool *mp,\n+\t\t void *opaque_arg,\n+\t\t void *obj,\n+\t\t __attribute__((unused)) unsigned int i)\n+{\n+\tstruct obj_params *params = opaque_arg;\n+\tstruct rte_crypto_op *op = obj;\n+\tstruct rte_mbuf *m = (struct rte_mbuf *) ((uint8_t *) obj +\n+\t\t\t\t\tparams->src_buf_offset);\n+\t/* Set crypto operation */\n+\top->type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;\n+\top->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n+\top->sess_type = RTE_CRYPTO_OP_WITH_SESSION;\n+\n+\t/* Set source buffer */\n+\top->sym->m_src = m;\n+\tif (params->segments_nb == 1)\n+\t\tfill_single_seg_mbuf(m, mp, obj, params->src_buf_offset,\n+\t\t\t\tparams->segment_sz);\n \telse\n-\t\tremaining_bytes -= segment_sz;\n-\n-\tsegment_nb--;\n-\n-\twhile (remaining_bytes) {\n-\t\tstruct rte_mbuf *m;\n-\n-\t\tm = rte_pktmbuf_alloc(mempool);\n-\t\tif (m == NULL)\n-\t\t\tgoto error;\n-\n-\t\trte_pktmbuf_chain(mbuf, m);\n-\n-\t\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf, segment_sz);\n-\t\tif (mbuf_data == NULL)\n-\t\t\tgoto error;\n-\n-\t\tif (remaining_bytes <= segment_sz)\n-\t\t\tremaining_bytes = 0;\n-\t\telse\n-\t\t\tremaining_bytes -= segment_sz;\n-\n-\t\tsegment_nb--;\n-\t}\n-\n-\t/*\n-\t * If there was not enough room for the digest at the end\n-\t * of the last segment, allocate a new one\n-\t */\n-\tif (segment_nb != 0) {\n-\t\tstruct rte_mbuf *m;\n-\n-\t\tm = rte_pktmbuf_alloc(mempool);\n-\n-\t\tif (m == NULL)\n-\t\t\tgoto error;\n-\n-\t\trte_pktmbuf_chain(mbuf, m);\n-\t\tmbuf_data = (uint8_t *)rte_pktmbuf_append(mbuf,\tsegment_sz);\n-\t\tif (mbuf_data == NULL)\n-\t\t\tgoto error;\n-\t}\n-\n-\treturn mbuf;\n-error:\n-\tif (mbuf != NULL)\n-\t\trte_pktmbuf_free(mbuf);\n-\n-\treturn NULL;\n+\t\tfill_multi_seg_mbuf(m, mp, obj, params->src_buf_offset,\n+\t\t\t\tparams->segment_sz, params->segments_nb);\n+\n+\n+\t/* Set destination buffer */\n+\tif (params->dst_buf_offset) {\n+\t\tm = (struct rte_mbuf *) ((uint8_t *) obj +\n+\t\t\t\tparams->dst_buf_offset);\n+\t\tfill_single_seg_mbuf(m, mp, obj, params->dst_buf_offset,\n+\t\t\t\tparams->segment_sz);\n+\t\top->sym->m_dst = m;\n+\t} else\n+\t\top->sym->m_dst = NULL;\n }\n \n static void\n@@ -210,7 +216,6 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,\n \t\tconst struct cperf_op_fns *op_fns)\n {\n \tstruct cperf_verify_ctx *ctx = NULL;\n-\tunsigned int mbuf_idx = 0;\n \tchar pool_name[32] = \"\";\n \n \tctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);\n@@ -224,7 +229,7 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,\n \tctx->options = options;\n \tctx->test_vector = test_vector;\n \n-\t/* IV goes at the end of the cryptop operation */\n+\t/* IV goes at the end of the crypto operation */\n \tuint16_t iv_offset = sizeof(struct rte_crypto_op) +\n \t\tsizeof(struct rte_crypto_sym_op);\n \n@@ -233,83 +238,56 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,\n \tif (ctx->sess == NULL)\n \t\tgoto err;\n \n-\tsnprintf(pool_name, sizeof(pool_name), \"cperf_pool_in_cdev_%d\",\n-\t\t\tdev_id);\n-\n+\t/* Calculate the object size */\n+\tuint16_t crypto_op_size = sizeof(struct rte_crypto_op) +\n+\t\tsizeof(struct rte_crypto_sym_op);\n+\tuint16_t crypto_op_private_size = test_vector->cipher_iv.length +\n+\t\t\t\ttest_vector->auth_iv.length +\n+\t\t\t\toptions->aead_aad_sz;\n+\tuint16_t crypto_op_total_size = crypto_op_size +\n+\t\t\t\tcrypto_op_private_size;\n+\tuint16_t crypto_op_total_size_padded =\n+\t\t\t\tRTE_CACHE_LINE_ROUNDUP(crypto_op_total_size);\n+\tuint32_t mbuf_size = sizeof(struct rte_mbuf) + options->segment_sz;\n \tuint32_t max_size = options->max_buffer_size + options->digest_sz;\n-\tuint32_t segment_nb = (max_size % options->segment_sz) ?\n+\tuint16_t segments_nb = (max_size % options->segment_sz) ?\n \t\t\t(max_size / options->segment_sz) + 1 :\n \t\t\tmax_size / options->segment_sz;\n+\tuint32_t obj_size = crypto_op_total_size_padded +\n+\t\t\t\t(mbuf_size * segments_nb);\n \n-\tctx->pkt_mbuf_pool_in = rte_pktmbuf_pool_create(pool_name,\n-\t\t\toptions->pool_sz * segment_nb, 0, 0,\n-\t\t\tRTE_PKTMBUF_HEADROOM + options->segment_sz,\n-\t\t\trte_socket_id());\n-\n-\tif (ctx->pkt_mbuf_pool_in == NULL)\n-\t\tgoto err;\n-\n-\t/* Generate mbufs_in with plaintext populated for test */\n-\tctx->mbufs_in = rte_malloc(NULL,\n-\t\t\t(sizeof(struct rte_mbuf *) * ctx->options->pool_sz), 0);\n-\n-\tfor (mbuf_idx = 0; mbuf_idx < options->pool_sz; mbuf_idx++) {\n-\t\tctx->mbufs_in[mbuf_idx] = cperf_mbuf_create(\n-\t\t\t\tctx->pkt_mbuf_pool_in,\n-\t\t\t\toptions->segment_sz,\n-\t\t\t\tsegment_nb,\n-\t\t\t\toptions);\n-\t\tif (ctx->mbufs_in[mbuf_idx] == NULL)\n-\t\t\tgoto err;\n-\t}\n-\n-\tif (options->out_of_place == 1)\t{\n-\n-\t\tsnprintf(pool_name, sizeof(pool_name), \"cperf_pool_out_cdev_%d\",\n-\t\t\t\tdev_id);\n-\n-\t\tctx->pkt_mbuf_pool_out = rte_pktmbuf_pool_create(\n-\t\t\t\tpool_name, options->pool_sz, 0, 0,\n-\t\t\t\tRTE_PKTMBUF_HEADROOM +\n-\t\t\t\tmax_size,\n-\t\t\t\trte_socket_id());\n-\n-\t\tif (ctx->pkt_mbuf_pool_out == NULL)\n-\t\t\tgoto err;\n-\t}\n+\tsnprintf(pool_name, sizeof(pool_name), \"pool_in_cdev_%d\",\n+\t\t\tdev_id);\n \n-\tctx->mbufs_out = rte_malloc(NULL,\n-\t\t\t(sizeof(struct rte_mbuf *) *\n-\t\t\tctx->options->pool_sz), 0);\n-\n-\tfor (mbuf_idx = 0; mbuf_idx < options->pool_sz; mbuf_idx++) {\n-\t\tif (options->out_of_place == 1)\t{\n-\t\t\tctx->mbufs_out[mbuf_idx] = cperf_mbuf_create(\n-\t\t\t\t\tctx->pkt_mbuf_pool_out, max_size,\n-\t\t\t\t\t1, options);\n-\t\t\tif (ctx->mbufs_out[mbuf_idx] == NULL)\n-\t\t\t\tgoto err;\n-\t\t} else {\n-\t\t\tctx->mbufs_out[mbuf_idx] = NULL;\n-\t\t}\n+\tctx->src_buf_offset = crypto_op_total_size_padded;\n+\n+\tstruct obj_params params = {\n+\t\t.segment_sz = options->segment_sz,\n+\t\t.segments_nb = segments_nb,\n+\t\t.src_buf_offset = crypto_op_total_size_padded,\n+\t\t.dst_buf_offset = 0\n+\t};\n+\n+\tif (options->out_of_place) {\n+\t\tctx->dst_buf_offset = ctx->src_buf_offset +\n+\t\t\t\t(mbuf_size * segments_nb);\n+\t\tparams.dst_buf_offset = ctx->dst_buf_offset;\n+\t\t/* Destination buffer will be one segment online */\n+\t\tobj_size += max_size;\n \t}\n \n-\tsnprintf(pool_name, sizeof(pool_name), \"cperf_op_pool_cdev_%d\",\n-\t\t\tdev_id);\n-\n-\tuint16_t priv_size = RTE_ALIGN_CEIL(test_vector->cipher_iv.length +\n-\t\ttest_vector->auth_iv.length + test_vector->aead_iv.length, 16) +\n-\t\tRTE_ALIGN_CEIL(options->aead_aad_sz, 16);\n+\tctx->pool = rte_mempool_create(pool_name,\n+\t\t\toptions->pool_sz, obj_size, 512, 0,\n+\t\t\tNULL, NULL, mempool_obj_init,\n+\t\t\t(void *)&params,\n+\t\t\trte_socket_id(), 0);\n \n-\tctx->crypto_op_pool = rte_crypto_op_pool_create(pool_name,\n-\t\t\tRTE_CRYPTO_OP_TYPE_SYMMETRIC, options->pool_sz,\n-\t\t\t512, priv_size, rte_socket_id());\n-\tif (ctx->crypto_op_pool == NULL)\n+\tif (ctx->pool == NULL)\n \t\tgoto err;\n \n \treturn ctx;\n err:\n-\tcperf_verify_test_free(ctx, mbuf_idx);\n+\tcperf_verify_test_free(ctx);\n \n \treturn NULL;\n }\n@@ -425,7 +403,7 @@ cperf_verify_test_runner(void *test_ctx)\n \n \tstatic int only_once;\n \n-\tuint64_t i, m_idx = 0;\n+\tuint64_t i;\n \tuint16_t ops_unused = 0;\n \n \tstruct rte_crypto_op *ops[ctx->options->max_burst_size];\n@@ -465,11 +443,9 @@ cperf_verify_test_runner(void *test_ctx)\n \n \t\tuint16_t ops_needed = burst_size - ops_unused;\n \n-\t\t/* Allocate crypto ops from pool */\n-\t\tif (ops_needed != rte_crypto_op_bulk_alloc(\n-\t\t\t\tctx->crypto_op_pool,\n-\t\t\t\tRTE_CRYPTO_OP_TYPE_SYMMETRIC,\n-\t\t\t\tops, ops_needed)) {\n+\t\t/* Allocate objects containing crypto operations and mbufs */\n+\t\tif (rte_mempool_get_bulk(ctx->pool, (void **)ops,\n+\t\t\t\t\tops_needed) != 0) {\n \t\t\tRTE_LOG(ERR, USER1,\n \t\t\t\t\"Failed to allocate more crypto operations \"\n \t\t\t\t\"from the the crypto operation pool.\\n\"\n@@ -479,8 +455,8 @@ cperf_verify_test_runner(void *test_ctx)\n \t\t}\n \n \t\t/* Setup crypto op, attach mbuf etc */\n-\t\t(ctx->populate_ops)(ops, &ctx->mbufs_in[m_idx],\n-\t\t\t\t&ctx->mbufs_out[m_idx],\n+\t\t(ctx->populate_ops)(ops, ctx->src_buf_offset,\n+\t\t\t\tctx->dst_buf_offset,\n \t\t\t\tops_needed, ctx->sess, ctx->options,\n \t\t\t\tctx->test_vector, iv_offset);\n \n@@ -520,10 +496,6 @@ cperf_verify_test_runner(void *test_ctx)\n \t\tops_deqd = rte_cryptodev_dequeue_burst(ctx->dev_id, ctx->qp_id,\n \t\t\t\tops_processed, ctx->options->max_burst_size);\n \n-\t\tm_idx += ops_needed;\n-\t\tif (m_idx + ctx->options->max_burst_size > ctx->options->pool_sz)\n-\t\t\tm_idx = 0;\n-\n \t\tif (ops_deqd == 0) {\n \t\t\t/**\n \t\t\t * Count dequeue polls which didn't return any\n@@ -538,13 +510,10 @@ cperf_verify_test_runner(void *test_ctx)\n \t\t\tif (cperf_verify_op(ops_processed[i], ctx->options,\n \t\t\t\t\t\tctx->test_vector))\n \t\t\t\tops_failed++;\n-\t\t\t/* free crypto ops so they can be reused. We don't free\n-\t\t\t * the mbufs here as we don't want to reuse them as\n-\t\t\t * the crypto operation will change the data and cause\n-\t\t\t * failures.\n-\t\t\t */\n-\t\t\trte_crypto_op_free(ops_processed[i]);\n \t\t}\n+\t\t/* free crypto ops so they can be reused. */\n+\t\trte_mempool_put_bulk(ctx->pool,\n+\t\t\t\t\t(void **)ops_processed, ops_deqd);\n \t\tops_deqd_total += ops_deqd;\n \t}\n \n@@ -566,13 +535,10 @@ cperf_verify_test_runner(void *test_ctx)\n \t\t\tif (cperf_verify_op(ops_processed[i], ctx->options,\n \t\t\t\t\t\tctx->test_vector))\n \t\t\t\tops_failed++;\n-\t\t\t/* free crypto ops so they can be reused. We don't free\n-\t\t\t * the mbufs here as we don't want to reuse them as\n-\t\t\t * the crypto operation will change the data and cause\n-\t\t\t * failures.\n-\t\t\t */\n-\t\t\trte_crypto_op_free(ops_processed[i]);\n \t\t}\n+\t\t/* free crypto ops so they can be reused. */\n+\t\trte_mempool_put_bulk(ctx->pool,\n+\t\t\t\t\t(void **)ops_processed, ops_deqd);\n \t\tops_deqd_total += ops_deqd;\n \t}\n \n@@ -628,5 +594,5 @@ cperf_verify_test_destructor(void *arg)\n \n \trte_cryptodev_stop(ctx->dev_id);\n \n-\tcperf_verify_test_free(ctx, ctx->options->pool_sz);\n+\tcperf_verify_test_free(ctx);\n }\n",
    "prefixes": [
        "dpdk-dev",
        "6/6"
    ]
}