get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 67800,
    "url": "https://patches.dpdk.org/api/patches/67800/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200403163656.60545-5-david.coyle@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": "<20200403163656.60545-5-david.coyle@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200403163656.60545-5-david.coyle@intel.com",
    "date": "2020-04-03T16:36:56",
    "name": "[v2,4/4] app/crypto-perf: add support for multi-function processing",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "41e0924c210bcac9d3e0c7775fee0af95a7a1eb4",
    "submitter": {
        "id": 961,
        "url": "https://patches.dpdk.org/api/people/961/?format=api",
        "name": "Coyle, David",
        "email": "david.coyle@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200403163656.60545-5-david.coyle@intel.com/mbox/",
    "series": [
        {
            "id": 9194,
            "url": "https://patches.dpdk.org/api/series/9194/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9194",
            "date": "2020-04-03T16:36:52",
            "name": "introduce multi-function processing support",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/9194/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/67800/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/67800/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 70A15A0562;\n\tFri,  3 Apr 2020 18:49:29 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id EB64E1C202;\n\tFri,  3 Apr 2020 18:48:45 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by dpdk.org (Postfix) with ESMTP id 5DAA41C1FD\n for <dev@dpdk.org>; Fri,  3 Apr 2020 18:48:43 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 03 Apr 2020 09:48:42 -0700",
            "from silpixa00399912.ir.intel.com (HELO\n silpixa00399912.ger.corp.intel.com) ([10.237.223.64])\n by fmsmga004.fm.intel.com with ESMTP; 03 Apr 2020 09:48:40 -0700"
        ],
        "IronPort-SDR": [
            "\n IAf/Q83hYfZLqDHJpCBA6te97CiGbKHcVRfaWaCorJBv0NvPstvjugEQMAdt56QkwuRwF1fsMh\n qsbhHyDQxWMg==",
            "\n 66Q+GYOImn3vmKYD9LqaKLdBbMTzMPddL1fzGLGmh5QczidnTZPkcOS6PpWT03YE1+8322J8GK\n uLEXxf/VAbyA=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.72,340,1580803200\"; d=\"scan'208\";a=\"274016929\"",
        "From": "David Coyle <david.coyle@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "declan.doherty@intel.com, fiona.trahe@intel.com,\n pablo.de.lara.guarch@intel.com, brendan.ryan@intel.com,\n shreyansh.jain@nxp.com, hemant.agrawal@nxp.com,\n David Coyle <david.coyle@intel.com>,\n Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>",
        "Date": "Fri,  3 Apr 2020 17:36:56 +0100",
        "Message-Id": "<20200403163656.60545-5-david.coyle@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200403163656.60545-1-david.coyle@intel.com>",
        "References": "<20200403163656.60545-1-david.coyle@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 4/4] app/crypto-perf: add support for\n\tmulti-function processing",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Support for multi-function operations, via a raw device, has been\nadded to the test-crypto-perf app.\n\nA new optype has been added: multi-fn\nA new parameter has been added for multi-fn mode:\n--multi-fn-params <params>\n\nThe <params> field specify what type of multi-function processing\nis required and the options associated with that. Currently the\nfollowing are supported:\n\ndocsis-cipher-crc,<cipher_offset>,<crc_offset>\npon-cipher-crc-bip,<buffer_padding_sz>\n\nSigned-off-by: David Coyle <david.coyle@intel.com>\nSigned-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>\n---\n app/test-crypto-perf/Makefile                 |   5 +\n app/test-crypto-perf/cperf_ops.c              | 265 ++++++++++++\n app/test-crypto-perf/cperf_options.h          |  37 +-\n app/test-crypto-perf/cperf_options_parsing.c  | 396 ++++++++++++++++--\n app/test-crypto-perf/cperf_test_common.c      |  88 +++-\n app/test-crypto-perf/cperf_test_latency.c     | 176 ++++++--\n .../cperf_test_pmd_cyclecount.c               |  96 ++++-\n app/test-crypto-perf/cperf_test_throughput.c  | 164 ++++++--\n .../cperf_test_vector_parsing.c               |  35 +-\n app/test-crypto-perf/cperf_test_vectors.c     |  53 +++\n app/test-crypto-perf/cperf_test_vectors.h     |   9 +\n app/test-crypto-perf/cperf_test_verify.c      | 205 +++++++--\n app/test-crypto-perf/main.c                   | 255 +++++++++--\n app/test-crypto-perf/meson.build              |   6 +\n 14 files changed, 1584 insertions(+), 206 deletions(-)",
    "diff": "diff --git a/app/test-crypto-perf/Makefile b/app/test-crypto-perf/Makefile\nindex 78135f38c..baf706e4a 100644\n--- a/app/test-crypto-perf/Makefile\n+++ b/app/test-crypto-perf/Makefile\n@@ -26,4 +26,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER),y)\n LDLIBS += -lrte_pmd_crypto_scheduler\n endif\n \n+ifeq ($(CONFIG_RTE_LIBRTE_MULTI_FN_COMMON)$(CONFIG_RTE_LIBRTE_RAWDEV),yy)\n+CFLAGS += -DMULTI_FN_SUPPORTED\n+LDLIBS += -lrte_multi_fn\n+endif\n+\n include $(RTE_SDK)/mk/rte.app.mk\ndiff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c\nindex 97584ceed..29f294ac5 100644\n--- a/app/test-crypto-perf/cperf_ops.c\n+++ b/app/test-crypto-perf/cperf_ops.c\n@@ -3,6 +3,10 @@\n  */\n \n #include <rte_cryptodev.h>\n+#include <rte_ether.h>\n+#ifdef MULTI_FN_SUPPORTED\n+#include <rte_multi_fn.h>\n+#endif /* MULTI_FN_SUPPORTED */\n \n #include \"cperf_ops.h\"\n #include \"cperf_test_vectors.h\"\n@@ -505,6 +509,168 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,\n \treturn 0;\n }\n \n+#ifdef MULTI_FN_SUPPORTED\n+static int\n+cperf_set_ops_multi_fn_cipher_crc(struct rte_crypto_op **ops,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset __rte_unused,\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+\t\tuint16_t iv_offset, uint32_t *imix_idx)\n+{\n+\tuint32_t buffer_sz, offset;\n+\tuint16_t i;\n+\n+\tfor (i = 0; i < nb_ops; i++) {\n+\t\tstruct rte_multi_fn_op *mf_op =\n+\t\t\t\t\t(struct rte_multi_fn_op *)ops[i];\n+\t\tstruct rte_crypto_sym_op *cipher_op;\n+\t\tstruct rte_multi_fn_err_detect_op *crc_op;\n+\t\tstruct rte_multi_fn_op *mf_cipher_op;\n+\n+\t\tmf_op->sess = (struct rte_multi_fn_session *)sess;\n+\t\tmf_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tsrc_buf_offset);\n+\t\tmf_op->m_dst = NULL;\n+\n+\t\tif (options->imix_distribution_count) {\n+\t\t\tbuffer_sz =\n+\t\t\t\toptions->imix_buffer_sizes[*imix_idx];\n+\t\t\t*imix_idx = (*imix_idx + 1) % options->pool_sz;\n+\t\t} else\n+\t\t\tbuffer_sz = options->test_buffer_size;\n+\n+\t\tif (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {\n+\t\t\t/* CRC -> Cipher */\n+\t\t\tcrc_op = &mf_op->err_detect;\n+\t\t\tcipher_op = &mf_op->next->crypto_sym;\n+\t\t\tmf_cipher_op = mf_op->next;\n+\t\t} else {\n+\t\t\t/* Cipher -> CRC */\n+\t\t\tcipher_op = &mf_op->crypto_sym;\n+\t\t\tcrc_op = &mf_op->next->err_detect;\n+\t\t\tmf_cipher_op = mf_op;\n+\t\t}\n+\n+\t\tcrc_op->data.offset = test_vector->multi_fn_data.crc_offset;\n+\t\tcrc_op->data.length = buffer_sz - crc_op->data.offset -\n+\t\t\t\t\tRTE_ETHER_CRC_LEN;\n+\t\toffset = crc_op->data.offset + crc_op->data.length;\n+\t\tcrc_op->output.data = rte_pktmbuf_mtod_offset(mf_op->m_src,\n+\t\t\t\t\t\t\t\tuint8_t *,\n+\t\t\t\t\t\t\t\toffset);\n+\t\tcrc_op->output.phys_addr = rte_pktmbuf_iova_offset(mf_op->m_src,\n+\t\t\t\t\t\t\t\toffset);\n+\n+\t\tcipher_op->cipher.data.offset = test_vector->data.cipher_offset;\n+\t\tcipher_op->cipher.data.length = buffer_sz -\n+\t\t\t\t\t\tcipher_op->cipher.data.offset;\n+\n+\t\tif (options->test == CPERF_TEST_TYPE_VERIFY) {\n+\t\t\tuint8_t *iv_ptr = (uint8_t *)mf_cipher_op + iv_offset;\n+\t\t\tmemcpy(iv_ptr, test_vector->cipher_iv.data,\n+\t\t\t\t\ttest_vector->cipher_iv.length);\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+#define PLI_SHIFT_BITS 2\n+\n+static int\n+cperf_set_ops_multi_fn_cipher_crc_bip(struct rte_crypto_op **ops,\n+\t\tuint32_t src_buf_offset, uint32_t dst_buf_offset __rte_unused,\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, uint16_t iv_offset,\n+\t\tuint32_t *imix_idx)\n+{\n+\tuint32_t buffer_sz, offset;\n+\tuint16_t i;\n+\tint crc_len;\n+\n+\tfor (i = 0; i < nb_ops; i++) {\n+\t\tstruct rte_multi_fn_op *mf_op =\n+\t\t\t\t\t(struct rte_multi_fn_op *)ops[i];\n+\t\tstruct rte_crypto_sym_op *cipher_op;\n+\t\tstruct rte_multi_fn_err_detect_op *crc_op;\n+\t\tstruct rte_multi_fn_err_detect_op *bip_op;\n+\t\tstruct rte_multi_fn_op *mf_cipher_op;\n+\n+\t\tmf_op->sess = (struct rte_multi_fn_session *)sess;\n+\t\tmf_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +\n+\t\t\t\t\t\t\tsrc_buf_offset);\n+\t\tmf_op->m_dst = NULL;\n+\n+\t\tif (options->imix_distribution_count) {\n+\t\t\tbuffer_sz =\n+\t\t\t\toptions->imix_buffer_sizes[*imix_idx];\n+\t\t\t*imix_idx = (*imix_idx + 1) % options->pool_sz;\n+\t\t} else\n+\t\t\tbuffer_sz = options->test_buffer_size;\n+\n+\t\tif (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {\n+\t\t\t/* CRC -> Cipher -> BIP */\n+\t\t\tcrc_op = &mf_op->err_detect;\n+\t\t\tcipher_op = &mf_op->next->crypto_sym;\n+\t\t\tbip_op = &mf_op->next->next->err_detect;\n+\t\t} else {\n+\t\t\t/* BIP-> Cipher -> CRC */\n+\t\t\tbip_op = &mf_op->err_detect;\n+\t\t\tcipher_op = &mf_op->next->crypto_sym;\n+\t\t\tcrc_op = &mf_op->next->next->err_detect;\n+\t\t}\n+\t\tmf_cipher_op = mf_op->next;\n+\n+\t\tcrc_op->data.offset = test_vector->multi_fn_data.crc_offset;\n+\t\tcrc_len = buffer_sz - crc_op->data.offset -\n+\t\t\t\toptions->multi_fn_opts.buffer_padding -\n+\t\t\t\tRTE_ETHER_CRC_LEN;\n+\t\tcrc_len = crc_len > 0 ? crc_len : 0;\n+\t\tcrc_op->data.length = crc_len;\n+\t\toffset = crc_op->data.offset + crc_op->data.length;\n+\t\tcrc_op->output.data = rte_pktmbuf_mtod_offset(mf_op->m_src,\n+\t\t\t\t\t\t\t\tuint8_t *,\n+\t\t\t\t\t\t\t\toffset);\n+\t\tcrc_op->output.phys_addr = rte_pktmbuf_iova_offset(mf_op->m_src,\n+\t\t\t\t\t\t\t\toffset);\n+\n+\t\tcipher_op->cipher.data.offset = test_vector->data.cipher_offset;\n+\t\tcipher_op->cipher.data.length = buffer_sz -\n+\t\t\t\t\t\tcipher_op->cipher.data.offset;\n+\n+\t\tbip_op->data.offset = test_vector->multi_fn_data.bip_offset;\n+\t\tbip_op->data.length = buffer_sz - bip_op->data.offset;\n+\t\toffset = options->test_buffer_size;\n+\t\tbip_op->output.data = rte_pktmbuf_mtod_offset(mf_op->m_src,\n+\t\t\t\t\t\t\t\tuint8_t *,\n+\t\t\t\t\t\t\t\toffset);\n+\t\tbip_op->output.phys_addr = rte_pktmbuf_iova_offset(mf_op->m_src,\n+\t\t\t\t\t\t\t\toffset);\n+\n+\t\tif (options->test == CPERF_TEST_TYPE_VERIFY) {\n+\t\t\tuint8_t *iv_ptr = (uint8_t *)mf_cipher_op + iv_offset;\n+\t\t\tmemcpy(iv_ptr, test_vector->cipher_iv.data,\n+\t\t\t\t\ttest_vector->cipher_iv.length);\n+\t\t}\n+\n+\t\t/*\n+\t\t * This is very protocol specific but IPSec MB uses the PLI\n+\t\t * (Payload Length Indication) field of the PON frame header\n+\t\t * to get the CRC length. So set the PLI here now\n+\t\t */\n+\t\tuint16_t *pli_key_idx = rte_pktmbuf_mtod(mf_op->m_src,\n+\t\t\t\t\t\t\t\tuint16_t *);\n+\t\tuint16_t pli = cipher_op->cipher.data.length -\n+\t\t\t\toptions->multi_fn_opts.buffer_padding;\n+\t\t*pli_key_idx = rte_bswap16(pli) << PLI_SHIFT_BITS;\n+\t}\n+\n+\treturn 0;\n+}\n+#endif /* MULTI_FN_SUPPORTED */\n+\n static struct rte_cryptodev_sym_session *\n cperf_create_session(struct rte_mempool *sess_mp,\n \tstruct rte_mempool *priv_mp,\n@@ -590,6 +756,90 @@ cperf_create_session(struct rte_mempool *sess_mp,\n \t\t\t\t\t&sess_conf, sess_mp);\n \t}\n #endif\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\t/*\n+\t * multi function\n+\t */\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\tstruct rte_multi_fn_xform mf_cipher_xform;\n+\t\tstruct rte_multi_fn_xform mf_crc_xform;\n+\t\tstruct rte_multi_fn_xform mf_bip_xform;\n+\t\tstruct rte_multi_fn_xform *first_xform = NULL;\n+\t\tstruct rte_crypto_cipher_xform *cipher_xform;\n+\n+\t\tif (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC ||\n+\t\t\toptions->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\n+\t\t\tmf_cipher_xform.type =\n+\t\t\t\tRTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM;\n+\t\t\tmf_cipher_xform.crypto_sym.type =\n+\t\t\t\tRTE_CRYPTO_SYM_XFORM_CIPHER;\n+\t\t\tcipher_xform = &mf_cipher_xform.crypto_sym.cipher;\n+\t\t\tcipher_xform->algo = options->cipher_algo;\n+\t\t\tcipher_xform->op = options->cipher_op;\n+\t\t\tcipher_xform->iv.offset = iv_offset;\n+\t\t\tcipher_xform->key.data = test_vector->cipher_key.data;\n+\t\t\tcipher_xform->key.length =\n+\t\t\t\t\t\ttest_vector->cipher_key.length;\n+\t\t\tcipher_xform->iv.length = test_vector->cipher_iv.length;\n+\n+\t\t\tmf_crc_xform.type =\n+\t\t\t\tRTE_MULTI_FN_XFORM_TYPE_ERR_DETECT;\n+\t\t\tmf_crc_xform.err_detect.algo =\n+\t\t\t\tRTE_MULTI_FN_ERR_DETECT_CRC32_ETH;\n+\n+\t\t\tif (cipher_xform->op ==\n+\t\t\t\t\tRTE_CRYPTO_CIPHER_OP_ENCRYPT) {\n+\t\t\t\tmf_crc_xform.err_detect.op =\n+\t\t\t\t\tRTE_MULTI_FN_ERR_DETECT_OP_GENERATE;\n+\t\t\t} else {\n+\t\t\t\tmf_crc_xform.err_detect.op =\n+\t\t\t\t\tRTE_MULTI_FN_ERR_DETECT_OP_VERIFY;\n+\t\t\t}\n+\n+\t\t\tmf_bip_xform.type =\n+\t\t\t\tRTE_MULTI_FN_XFORM_TYPE_ERR_DETECT;\n+\t\t\tmf_bip_xform.err_detect.algo =\n+\t\t\t\tRTE_MULTI_FN_ERR_DETECT_BIP32;\n+\t\t\tmf_bip_xform.err_detect.op =\n+\t\t\t\tRTE_MULTI_FN_ERR_DETECT_OP_GENERATE;\n+\n+\t\t\tif (options->multi_fn_opts.ops ==\n+\t\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC) {\n+\t\t\t\tif (cipher_xform->op ==\n+\t\t\t\t\t\tRTE_CRYPTO_CIPHER_OP_ENCRYPT) {\n+\t\t\t\t\tfirst_xform = &mf_crc_xform;\n+\t\t\t\t\tmf_crc_xform.next = &mf_cipher_xform;\n+\t\t\t\t\tmf_cipher_xform.next = NULL;\n+\t\t\t\t} else {\n+\t\t\t\t\tfirst_xform = &mf_cipher_xform;\n+\t\t\t\t\tmf_cipher_xform.next = &mf_crc_xform;\n+\t\t\t\t\tmf_crc_xform.next = NULL;\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tif (cipher_xform->op ==\n+\t\t\t\t\t\tRTE_CRYPTO_CIPHER_OP_ENCRYPT) {\n+\t\t\t\t\tfirst_xform = &mf_crc_xform;\n+\t\t\t\t\tmf_crc_xform.next = &mf_cipher_xform;\n+\t\t\t\t\tmf_cipher_xform.next = &mf_bip_xform;\n+\t\t\t\t\tmf_bip_xform.next = NULL;\n+\t\t\t\t} else {\n+\t\t\t\t\tfirst_xform = &mf_bip_xform;\n+\t\t\t\t\tmf_bip_xform.next = &mf_cipher_xform;\n+\t\t\t\t\tmf_cipher_xform.next = &mf_crc_xform;\n+\t\t\t\t\tmf_crc_xform.next = NULL;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\n+\t\treturn (void *)rte_multi_fn_session_create(dev_id,\n+\t\t\t\t\tfirst_xform, rte_socket_id());\n+\t}\n+#endif /* MULTI_FN_SUPPORTED */\n+\n \tsess = rte_cryptodev_sym_session_create(sess_mp);\n \t/*\n \t * cipher only\n@@ -773,5 +1023,20 @@ cperf_get_op_functions(const struct cperf_options *options,\n \t\treturn 0;\n \t}\n #endif\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\tif (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC)\n+\t\t\top_fns->populate_ops =\n+\t\t\t\tcperf_set_ops_multi_fn_cipher_crc;\n+\t\telse if (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP)\n+\t\t\top_fns->populate_ops =\n+\t\t\t\tcperf_set_ops_multi_fn_cipher_crc_bip;\n+\t\telse\n+\t\t\treturn -1;\n+\t\treturn 0;\n+\t}\n+#endif /* MULTI_FN_SUPPORTED */\n \treturn -1;\n }\ndiff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-perf/cperf_options.h\nindex 1ed0a77e5..0ca542224 100644\n--- a/app/test-crypto-perf/cperf_options.h\n+++ b/app/test-crypto-perf/cperf_options.h\n@@ -10,6 +10,9 @@\n #ifdef RTE_LIBRTE_SECURITY\n #include <rte_security.h>\n #endif\n+#ifdef MULTI_FN_SUPPORTED\n+#include <rte_multi_fn.h>\n+#endif /* MULTI_FN_SUPPORTED */\n \n #define CPERF_PTEST_TYPE\t(\"ptest\")\n #define CPERF_SILENT\t\t(\"silent\")\n@@ -52,6 +55,10 @@\n #define CPERF_PDCP_DOMAIN\t(\"pdcp-domain\")\n #endif\n \n+#ifdef MULTI_FN_SUPPORTED\n+#define CPERF_MULTI_FN_PARAMS\t(\"multi-fn-params\")\n+#endif /* MULTI_FN_SUPPORTED */\n+\n #define CPERF_CSV\t\t(\"csv-friendly\")\n \n /* benchmark-specific options */\n@@ -75,11 +82,34 @@ enum cperf_op_type {\n \tCPERF_CIPHER_THEN_AUTH,\n \tCPERF_AUTH_THEN_CIPHER,\n \tCPERF_AEAD,\n-\tCPERF_PDCP\n+\tCPERF_PDCP,\n+#ifdef MULTI_FN_SUPPORTED\n+\tCPERF_MULTI_FN\n+#endif /* MULTI_FN_SUPPORTED */\n };\n \n extern const char *cperf_op_type_strs[];\n \n+#ifdef MULTI_FN_SUPPORTED\n+enum cperf_multi_fn_ops {\n+\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC,\n+\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP\n+};\n+\n+extern const char *cperf_multi_fn_ops_strs[];\n+\n+struct cperf_multi_fn_options {\n+\tenum cperf_multi_fn_ops ops;\n+\n+\t/* DOCSIS_CIPHER_CRC */\n+\tuint32_t cipher_offset;\n+\tuint32_t crc_offset;\n+\n+\t/* PON_CIPHER_CRC_BIP */\n+\tuint32_t buffer_padding;\n+};\n+#endif /* MULTI_FN_SUPPORTED */\n+\n struct cperf_options {\n \tenum cperf_perf_test_type test;\n \n@@ -123,6 +153,11 @@ struct cperf_options {\n \tuint16_t pdcp_sn_sz;\n \tenum rte_security_pdcp_domain pdcp_domain;\n #endif\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tstruct cperf_multi_fn_options multi_fn_opts;\n+#endif /* MULTI_FN_SUPPORTED */\n+\n \tchar device_type[RTE_CRYPTODEV_NAME_MAX_LEN];\n \tenum cperf_op_type op_type;\n \ndiff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c\nindex f43c5bede..25da68105 100644\n--- a/app/test-crypto-perf/cperf_options_parsing.c\n+++ b/app/test-crypto-perf/cperf_options_parsing.c\n@@ -7,6 +7,7 @@\n \n #include <rte_cryptodev.h>\n #include <rte_malloc.h>\n+#include <rte_ether.h>\n \n #include \"cperf_options.h\"\n \n@@ -34,7 +35,7 @@ usage(char *progname)\n \t\t\" --desc-nb N: set number of descriptors for each crypto device\\n\"\n \t\t\" --devtype TYPE: set crypto device type to use\\n\"\n \t\t\" --optype cipher-only / auth-only / cipher-then-auth /\\n\"\n-\t\t\"           auth-then-cipher / aead : set operation type\\n\"\n+\t\t\"           auth-then-cipher / aead%s : set operation type\\n\"\n \t\t\" --sessionless: enable session-less crypto operations\\n\"\n \t\t\" --out-of-place: enable out-of-place crypto operations\\n\"\n \t\t\" --test-file NAME: set the test vector file path\\n\"\n@@ -53,11 +54,20 @@ usage(char *progname)\n \t\t\" --aead-iv-sz N: set the AEAD IV size\\n\"\n \t\t\" --aead-aad-sz N: set the AEAD AAD size\\n\"\n \t\t\" --digest-sz N: set the digest size\\n\"\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t\" --multi-fn-params PARAMS: set multi function parameters\\n\"\n+#endif /* MULTI_FN_SUPPORTED */\n \t\t\" --pmd-cyclecount-delay-ms N: set delay between enqueue\\n\"\n \t\t\"           and dequeue in pmd-cyclecount benchmarking mode\\n\"\n \t\t\" --csv-friendly: enable test result output CSV friendly\\n\"\n \t\t\" -h: prints this help\\n\",\n-\t\tprogname);\n+\t\tprogname,\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t\" / multi-fn\"\n+#else\n+\t\t\"\"\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t);\n }\n \n static int\n@@ -446,7 +456,13 @@ parse_op_type(struct cperf_options *opts, const char *arg)\n \t\t{\n \t\t\tcperf_op_type_strs[CPERF_PDCP],\n \t\t\tCPERF_PDCP\n+\t\t},\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t{\n+\t\t\tcperf_op_type_strs[CPERF_MULTI_FN],\n+\t\t\tCPERF_MULTI_FN\n \t\t}\n+#endif /* MULTI_FN_SUPPORTED */\n \t};\n \n \tint id = get_str_key_id_mapping(optype_namemap,\n@@ -744,6 +760,112 @@ parse_aead_aad_sz(struct cperf_options *opts, const char *arg)\n \treturn parse_uint16_t(&opts->aead_aad_sz, arg);\n }\n \n+#ifdef MULTI_FN_SUPPORTED\n+static int\n+parse_multi_fn_ops(struct cperf_options *opts, const char *arg)\n+{\n+\tstruct name_id_map multi_fn_ops_namemap[] = {\n+\t\t{\n+\t\t\tcperf_multi_fn_ops_strs\n+\t\t\t[CPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC],\n+\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC\n+\t\t},\n+\t\t{\n+\t\t\tcperf_multi_fn_ops_strs\n+\t\t\t[CPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP],\n+\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP\n+\t\t}\n+\t};\n+\n+\tint id = get_str_key_id_mapping(multi_fn_ops_namemap,\n+\t\t\tRTE_DIM(multi_fn_ops_namemap), arg);\n+\tif (id < 0) {\n+\t\tRTE_LOG(ERR, USER1, \"invalid multi function operation specified\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\topts->multi_fn_opts.ops = (enum cperf_multi_fn_ops)id;\n+\n+\treturn 0;\n+}\n+\n+static int\n+parse_multi_fn_params(struct cperf_options *opts, const char *arg)\n+{\n+\tchar *token;\n+\tchar *copy_arg = strdup(arg);\n+\n+\tif (copy_arg == NULL)\n+\t\treturn -1;\n+\n+\terrno = 0;\n+\ttoken = strtok(copy_arg, \",\");\n+\n+\t/* Parse first value */\n+\tif (token == NULL || parse_multi_fn_ops(opts, token) < 0)\n+\t\tgoto err_multi_fn_opts;\n+\n+\tif (opts->multi_fn_opts.ops ==\n+\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC) {\n+\t\t/* Next params is cipher_offset */\n+\t\ttoken = strtok(NULL, \",\");\n+\n+\t\tif (token == NULL ||\n+\t\t\tparse_uint32_t(&opts->multi_fn_opts.cipher_offset,\n+\t\t\t\t\ttoken) < 0) {\n+\t\t\tRTE_LOG(ERR, USER1, \"invalid %s multi function cipher \"\n+\t\t\t\t\"offset specified\\n\",\n+\t\t\t\tcperf_multi_fn_ops_strs[\n+\t\t\t\t\t\topts->multi_fn_opts.ops]);\n+\t\t\tgoto err_multi_fn_opts;\n+\t\t}\n+\n+\t\t/* Next params is crc_offset */\n+\t\ttoken = strtok(NULL, \",\");\n+\n+\t\tif (token == NULL ||\n+\t\t\tparse_uint32_t(&opts->multi_fn_opts.crc_offset,\n+\t\t\t\t\ttoken) < 0) {\n+\t\t\tRTE_LOG(ERR, USER1, \"invalid %s multi function crc \"\n+\t\t\t\t\"offset specified\\n\",\n+\t\t\t\tcperf_multi_fn_ops_strs[\n+\t\t\t\t\t\topts->multi_fn_opts.ops]);\n+\t\t\tgoto err_multi_fn_opts;\n+\t\t}\n+\n+\t} else if (opts->multi_fn_opts.ops ==\n+\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\t/* Next param is buffer_padding */\n+\t\ttoken = strtok(NULL, \",\");\n+\n+\t\tif (token == NULL ||\n+\t\t\tparse_uint32_t(&opts->multi_fn_opts.buffer_padding,\n+\t\t\t\t\ttoken) < 0) {\n+\t\t\tRTE_LOG(ERR, USER1, \"invalid %s multi function buffer \"\n+\t\t\t\t\"padding specified\\n\",\n+\t\t\t\tcperf_multi_fn_ops_strs[\n+\t\t\t\t\t\topts->multi_fn_opts.ops]);\n+\t\t\tgoto err_multi_fn_opts;\n+\t\t}\n+\t}\n+\n+\ttoken = strtok(NULL, \",\");\n+\n+\tif (token != NULL) {\n+\t\tRTE_LOG(ERR, USER1, \"unknown %s multi function parameter\\n\",\n+\t\t\tcperf_multi_fn_ops_strs[opts->multi_fn_opts.ops]);\n+\t\tgoto err_multi_fn_opts;\n+\t}\n+\n+\tfree(copy_arg);\n+\treturn 0;\n+\n+err_multi_fn_opts:\n+\tfree(copy_arg);\n+\treturn -1;\n+}\n+#endif /* MULTI_FN_SUPPORTED */\n+\n static int\n parse_csv_friendly(struct cperf_options *opts, const char *arg __rte_unused)\n {\n@@ -821,6 +943,11 @@ static struct option lgopts[] = {\n \t{ CPERF_PDCP_SN_SZ, required_argument, 0, 0 },\n \t{ CPERF_PDCP_DOMAIN, required_argument, 0, 0 },\n #endif\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\t{ CPERF_MULTI_FN_PARAMS, required_argument, 0, 0 },\n+#endif /* MULTI_FN_SUPPORTED */\n+\n \t{ CPERF_CSV, no_argument, 0, 0},\n \n \t{ CPERF_PMDCC_DELAY_MS, required_argument, 0, 0 },\n@@ -891,47 +1018,57 @@ cperf_options_default(struct cperf_options *opts)\n \topts->pdcp_sn_sz = 12;\n \topts->pdcp_domain = RTE_SECURITY_PDCP_MODE_CONTROL;\n #endif\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\topts->multi_fn_opts.ops = CPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC;\n+\topts->multi_fn_opts.cipher_offset = 0;\n+\topts->multi_fn_opts.crc_offset = 0;\n+\topts->multi_fn_opts.buffer_padding = 0;\n+#endif /* MULTI_FN_SUPPORTED */\n }\n \n static int\n cperf_opts_parse_long(int opt_idx, struct cperf_options *opts)\n {\n \tstruct long_opt_parser parsermap[] = {\n-\t\t{ CPERF_PTEST_TYPE,\tparse_cperf_test_type },\n-\t\t{ CPERF_SILENT,\t\tparse_silent },\n-\t\t{ CPERF_POOL_SIZE,\tparse_pool_sz },\n-\t\t{ CPERF_TOTAL_OPS,\tparse_total_ops },\n-\t\t{ CPERF_BURST_SIZE,\tparse_burst_sz },\n-\t\t{ CPERF_BUFFER_SIZE,\tparse_buffer_sz },\n-\t\t{ CPERF_SEGMENT_SIZE,\tparse_segment_sz },\n-\t\t{ CPERF_DESC_NB,\tparse_desc_nb },\n-\t\t{ CPERF_DEVTYPE,\tparse_device_type },\n-\t\t{ CPERF_OPTYPE,\t\tparse_op_type },\n-\t\t{ CPERF_SESSIONLESS,\tparse_sessionless },\n-\t\t{ CPERF_OUT_OF_PLACE,\tparse_out_of_place },\n-\t\t{ CPERF_IMIX,\t\tparse_imix },\n-\t\t{ CPERF_TEST_FILE,\tparse_test_file },\n-\t\t{ CPERF_TEST_NAME,\tparse_test_name },\n-\t\t{ CPERF_CIPHER_ALGO,\tparse_cipher_algo },\n-\t\t{ CPERF_CIPHER_OP,\tparse_cipher_op },\n-\t\t{ CPERF_CIPHER_KEY_SZ,\tparse_cipher_key_sz },\n-\t\t{ CPERF_CIPHER_IV_SZ,\tparse_cipher_iv_sz },\n-\t\t{ CPERF_AUTH_ALGO,\tparse_auth_algo },\n-\t\t{ CPERF_AUTH_OP,\tparse_auth_op },\n-\t\t{ CPERF_AUTH_KEY_SZ,\tparse_auth_key_sz },\n-\t\t{ CPERF_AUTH_IV_SZ,\tparse_auth_iv_sz },\n-\t\t{ CPERF_AEAD_ALGO,\tparse_aead_algo },\n-\t\t{ CPERF_AEAD_OP,\tparse_aead_op },\n-\t\t{ CPERF_AEAD_KEY_SZ,\tparse_aead_key_sz },\n-\t\t{ CPERF_AEAD_IV_SZ,\tparse_aead_iv_sz },\n-\t\t{ CPERF_AEAD_AAD_SZ,\tparse_aead_aad_sz },\n-\t\t{ CPERF_DIGEST_SZ,\tparse_digest_sz },\n+\t\t{ CPERF_PTEST_TYPE,\t\tparse_cperf_test_type },\n+\t\t{ CPERF_SILENT,\t\t\tparse_silent },\n+\t\t{ CPERF_POOL_SIZE,\t\tparse_pool_sz },\n+\t\t{ CPERF_TOTAL_OPS,\t\tparse_total_ops },\n+\t\t{ CPERF_BURST_SIZE,\t\tparse_burst_sz },\n+\t\t{ CPERF_BUFFER_SIZE,\t\tparse_buffer_sz },\n+\t\t{ CPERF_SEGMENT_SIZE,\t\tparse_segment_sz },\n+\t\t{ CPERF_DESC_NB,\t\tparse_desc_nb },\n+\t\t{ CPERF_DEVTYPE,\t\tparse_device_type },\n+\t\t{ CPERF_OPTYPE,\t\t\tparse_op_type },\n+\t\t{ CPERF_SESSIONLESS,\t\tparse_sessionless },\n+\t\t{ CPERF_OUT_OF_PLACE,\t\tparse_out_of_place },\n+\t\t{ CPERF_IMIX,\t\t\tparse_imix },\n+\t\t{ CPERF_TEST_FILE,\t\tparse_test_file },\n+\t\t{ CPERF_TEST_NAME,\t\tparse_test_name },\n+\t\t{ CPERF_CIPHER_ALGO,\t\tparse_cipher_algo },\n+\t\t{ CPERF_CIPHER_OP,\t\tparse_cipher_op },\n+\t\t{ CPERF_CIPHER_KEY_SZ,\t\tparse_cipher_key_sz },\n+\t\t{ CPERF_CIPHER_IV_SZ,\t\tparse_cipher_iv_sz },\n+\t\t{ CPERF_AUTH_ALGO,\t\tparse_auth_algo },\n+\t\t{ CPERF_AUTH_OP,\t\tparse_auth_op },\n+\t\t{ CPERF_AUTH_KEY_SZ,\t\tparse_auth_key_sz },\n+\t\t{ CPERF_AUTH_IV_SZ,\t\tparse_auth_iv_sz },\n+\t\t{ CPERF_AEAD_ALGO,\t\tparse_aead_algo },\n+\t\t{ CPERF_AEAD_OP,\t\tparse_aead_op },\n+\t\t{ CPERF_AEAD_KEY_SZ,\t\tparse_aead_key_sz },\n+\t\t{ CPERF_AEAD_IV_SZ,\t\tparse_aead_iv_sz },\n+\t\t{ CPERF_AEAD_AAD_SZ,\t\tparse_aead_aad_sz },\n+\t\t{ CPERF_DIGEST_SZ,\t\tparse_digest_sz },\n #ifdef RTE_LIBRTE_SECURITY\n-\t\t{ CPERF_PDCP_SN_SZ,\tparse_pdcp_sn_sz },\n-\t\t{ CPERF_PDCP_DOMAIN,\tparse_pdcp_domain },\n+\t\t{ CPERF_PDCP_SN_SZ,\t\tparse_pdcp_sn_sz },\n+\t\t{ CPERF_PDCP_DOMAIN,\t\tparse_pdcp_domain },\n #endif\n-\t\t{ CPERF_CSV,\t\tparse_csv_friendly},\n-\t\t{ CPERF_PMDCC_DELAY_MS,\tparse_pmd_cyclecount_delay_ms},\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t{ CPERF_MULTI_FN_PARAMS,\tparse_multi_fn_params },\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t{ CPERF_CSV,\t\t\tparse_csv_friendly },\n+\t\t{ CPERF_PMDCC_DELAY_MS,\t\tparse_pmd_cyclecount_delay_ms },\n \t};\n \tunsigned int i;\n \n@@ -1031,6 +1168,155 @@ check_cipher_buffer_length(struct cperf_options *options)\n \treturn 0;\n }\n \n+#ifdef MULTI_FN_SUPPORTED\n+#define DOCSIS_CIPHER_CRC_OFFSET_DIFF (RTE_ETHER_HDR_LEN - RTE_ETHER_TYPE_LEN)\n+#define DOCSIS_MIN_CIPHER_SIZE        (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)\n+\n+#define PON_FRAME_HDR_SIZE      (8U)\n+#define PON_FRAME_MULTIPLE_SIZE (4)\n+#define PON_FRAME_INVALID_SIZE  (12)\n+\n+static int\n+check_multi_fn_options(struct cperf_options *options)\n+{\n+\tuint32_t buffer_size, buffer_size_idx = 0;\n+\n+\toptions->digest_sz = 0;\n+\n+\tif (options->multi_fn_opts.ops ==\n+\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC ||\n+\t\toptions->multi_fn_opts.ops ==\n+\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\n+\t\t/* Check the device type is a rawdev */\n+\t\tif (strcmp(options->device_type, \"rawdev_aesni_mb\") != 0) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Invalid device type %s for \"\n+\t\t\t\t\"multi-function\\n\",\n+\t\t\t\toptions->device_type);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\t/* Only single segment supported */\n+\t\tif (options->segment_sz < options->max_buffer_size) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Segmented buffers not supported \"\n+\t\t\t\t\"for multi-function\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\t/* Out-of-place not supported */\n+\t\tif (options->out_of_place) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Out-of-place not supported for \"\n+\t\t\t\t\"multi-function\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\tif (options->multi_fn_opts.ops ==\n+\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC) {\n+\t\t/*\n+\t\t * Cipher offset must be at least 12 bytes (Ethernet SRC and\n+\t\t * DEST MACs) greater than CRC offset\n+\t\t */\n+\t\tif (options->multi_fn_opts.cipher_offset <\n+\t\t\t\toptions->multi_fn_opts.crc_offset +\n+\t\t\t\t\tDOCSIS_CIPHER_CRC_OFFSET_DIFF) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Cipher and CRC offsets not valid \"\n+\t\t\t\t\"for %s multi-function operation - \"\n+\t\t\t\t\"cipher_offset must greater than or equal to \"\n+\t\t\t\t\"crc_offset + %u\\n\",\n+\t\t\t\tcperf_multi_fn_ops_strs[\n+\t\t\t\t\t\toptions->multi_fn_opts.ops],\n+\t\t\t\tDOCSIS_CIPHER_CRC_OFFSET_DIFF);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\tif (options->multi_fn_opts.ops ==\n+\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\toptions->multi_fn_opts.cipher_offset = PON_FRAME_HDR_SIZE;\n+\t\toptions->multi_fn_opts.crc_offset = PON_FRAME_HDR_SIZE;\n+\t}\n+\n+\tif (options->inc_buffer_size != 0)\n+\t\tbuffer_size = options->min_buffer_size;\n+\telse\n+\t\tbuffer_size = options->buffer_size_list[0];\n+\n+\twhile (buffer_size <= options->max_buffer_size) {\n+\t\tif (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC) {\n+\t\t\t/* Buffer must be large enough to accommodate offsets */\n+\t\t\tif (buffer_size <\n+\t\t\t\t\t(options->multi_fn_opts.cipher_offset +\n+\t\t\t\t\t\tDOCSIS_MIN_CIPHER_SIZE) ||\n+\t\t\t\tbuffer_size <\n+\t\t\t\t\t(options->multi_fn_opts.crc_offset +\n+\t\t\t\t\t\t\tRTE_ETHER_CRC_LEN)) {\n+\t\t\t\tRTE_LOG(ERR, USER1, \"Some of the buffer sizes \"\n+\t\t\t\t\t\"are not valid for %s multi-function \"\n+\t\t\t\t\t\"operation\\n\",\n+\t\t\t\t\tcperf_multi_fn_ops_strs[\n+\t\t\t\t\t\toptions->multi_fn_opts.ops]);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t} else if (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\t\t/*\n+\t\t\t * Buffer length must be:\n+\t\t\t * - a multiple of 4\n+\t\t\t * - large enough to accommodate PON frame header and\n+\t\t\t *   any padding\n+\t\t\t * - not 12\n+\t\t\t */\n+\t\t\tif (((buffer_size % PON_FRAME_MULTIPLE_SIZE) != 0) ||\n+\t\t\t\t(buffer_size < (PON_FRAME_HDR_SIZE +\n+\t\t\t\toptions->multi_fn_opts.buffer_padding)) ||\n+\t\t\t\t(buffer_size == PON_FRAME_INVALID_SIZE)) {\n+\n+\t\t\t\tRTE_LOG(ERR, USER1, \"Some of the buffer sizes \"\n+\t\t\t\t\t\"are not suitable for %s \"\n+\t\t\t\t\t\"multi-function operation\\n\",\n+\t\t\t\t\tcperf_multi_fn_ops_strs[\n+\t\t\t\t\t\toptions->multi_fn_opts.ops]);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\t/*\n+\t\t\t * Padding length must be valid:\n+\t\t\t * - 0, if buffer length == 8\n+\t\t\t * - less than 8, if buffer length >= 16\n+\t\t\t * - less than 4, if buffer length >= 20\n+\t\t\t */\n+\t\t\tif ((buffer_size == 8 &&\n+\t\t\t\toptions->multi_fn_opts.buffer_padding != 0) ||\n+\t\t\t\t(buffer_size >= 16 &&\n+\t\t\t\toptions->multi_fn_opts.buffer_padding >= 8) ||\n+\t\t\t\t(buffer_size >= 20 &&\n+\t\t\t\toptions->multi_fn_opts.buffer_padding >= 4)) {\n+\n+\t\t\t\tRTE_LOG(ERR, USER1, \"Padding length not valid \"\n+\t\t\t\t\t\"for some of the buffer sizes for %s \"\n+\t\t\t\t\t\"multi-function operation\\n\",\n+\t\t\t\t\tcperf_multi_fn_ops_strs[\n+\t\t\t\t\t\toptions->multi_fn_opts.ops]);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (options->inc_buffer_size != 0)\n+\t\t\tbuffer_size += options->inc_buffer_size;\n+\t\telse {\n+\t\t\tif (++buffer_size_idx == options->buffer_size_count)\n+\t\t\t\tbreak;\n+\t\t\tbuffer_size =\n+\t\t\t\toptions->buffer_size_list[buffer_size_idx];\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+#endif /* MULTI_FN_SUPPORTED */\n+\n int\n cperf_options_check(struct cperf_options *options)\n {\n@@ -1151,6 +1437,13 @@ cperf_options_check(struct cperf_options *options)\n \t\t\treturn -EINVAL;\n \t}\n \n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\tif (check_multi_fn_options(options) < 0)\n+\t\t\treturn -EINVAL;\n+\t}\n+#endif /* MULTI_FN_SUPPORTED */\n+\n \treturn 0;\n }\n \n@@ -1236,4 +1529,37 @@ cperf_options_dump(struct cperf_options *opts)\n \t\tprintf(\"# aead aad size: %u\\n\", opts->aead_aad_sz);\n \t\tprintf(\"#\\n\");\n \t}\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (opts->op_type == CPERF_MULTI_FN) {\n+\t\tif (opts->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC ||\n+\t\t\topts->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\t\tprintf(\"# cipher algorithm: %s\\n\",\n+\t\t\t\trte_crypto_cipher_algorithm_strings[\n+\t\t\t\t\t\t\topts->cipher_algo]);\n+\t\t\tprintf(\"# cipher operation: %s\\n\",\n+\t\t\t\trte_crypto_cipher_operation_strings[\n+\t\t\t\t\t\t\topts->cipher_op]);\n+\t\t\tprintf(\"# cipher key size: %u\\n\", opts->cipher_key_sz);\n+\t\t\tprintf(\"# cipher iv size: %u\\n\", opts->cipher_iv_sz);\n+\t\t\tprintf(\"# multi fn operations: %s\\n\",\n+\t\t\t\tcperf_multi_fn_ops_strs[\n+\t\t\t\t\t\topts->multi_fn_opts.ops]);\n+\t\t}\n+\t\tif (opts->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC) {\n+\t\t\tprintf(\"# multi fn cipher offset: %u\\n\",\n+\t\t\t\topts->multi_fn_opts.cipher_offset);\n+\t\t\tprintf(\"# multi fn crc offset: %u\\n\",\n+\t\t\t\topts->multi_fn_opts.crc_offset);\n+\t\t}\n+\t\tif (opts->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP)\n+\t\t\tprintf(\"# multi fn buffer padding: %u\\n\",\n+\t\t\t\topts->multi_fn_opts.buffer_padding);\n+\t\tprintf(\"#\\n\");\n+\t}\n+#endif /* MULTI_FN_SUPPORTED */\n }\ndiff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c\nindex 85603eed5..6a92c1ae6 100644\n--- a/app/test-crypto-perf/cperf_test_common.c\n+++ b/app/test-crypto-perf/cperf_test_common.c\n@@ -14,6 +14,8 @@ struct obj_params {\n \tuint16_t headroom_sz;\n \tuint16_t data_len;\n \tuint16_t segments_nb;\n+\tuint16_t ops_per_obj_nb;\n+\tuint8_t multi_fn;\n };\n \n static void\n@@ -92,15 +94,39 @@ mempool_obj_init(struct rte_mempool *mp,\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-\top->phys_addr = rte_mem_virt2iova(obj);\n-\top->mempool = mp;\n+\n+\tif (!params->multi_fn) {\n+\t\t/* Set crypto operation */\n+\t\top->type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;\n+\t\top->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;\n+\t\top->sess_type = RTE_CRYPTO_OP_WITH_SESSION;\n+\t\top->phys_addr = rte_mem_virt2iova(obj);\n+\t\top->mempool = mp;\n+\t\top->sym->m_src = m;\n+\t\top->sym->m_dst = NULL;\n+\t} else {\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t/* Set multi-function operation(s) */\n+\t\tstruct rte_multi_fn_op *mf_op, *next_mf_op;\n+\t\tuint16_t remaining_ops, op_sz;\n+\t\tremaining_ops = params->ops_per_obj_nb;\n+\t\tmf_op = obj;\n+\t\top_sz = params->src_buf_offset / params->ops_per_obj_nb;\n+\t\tdo {\n+\t\t\tmf_op->mempool = mp;\n+\t\t\tmf_op->m_src = m;\n+\t\t\tmf_op->m_dst = NULL;\n+\t\t\tnext_mf_op = (struct rte_multi_fn_op *)\n+\t\t\t\t\t((uint8_t *) mf_op + op_sz);\n+\t\t\tmf_op->next = next_mf_op;\n+\t\t\tmf_op = next_mf_op;\n+\n+\t\t\tremaining_ops--;\n+\t\t} while (remaining_ops > 0);\n+#endif /* MULTI_FN_SUPPORTED */\n+\t}\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, params->headroom_sz,\n@@ -118,9 +144,15 @@ mempool_obj_init(struct rte_mempool *mp,\n \t\tfill_single_seg_mbuf(m, mp, obj, params->dst_buf_offset,\n \t\t\t\tparams->segment_sz, params->headroom_sz,\n \t\t\t\tparams->data_len);\n-\t\top->sym->m_dst = m;\n-\t} else\n-\t\top->sym->m_dst = NULL;\n+\t\tif (!params->multi_fn) {\n+\t\t\top->sym->m_dst = m;\n+\t\t} else {\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t\tstruct rte_multi_fn_op *mf_op = obj;\n+\t\t\tmf_op->m_dst = m;\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t}\n+\t}\n }\n \n int\n@@ -134,12 +166,38 @@ cperf_alloc_common_memory(const struct cperf_options *options,\n {\n \tconst char *mp_ops_name;\n \tchar pool_name[32] = \"\";\n+\tuint8_t multi_fn = 0;\n \tint ret;\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_size;\n \tuint16_t crypto_op_private_size;\n+\tuint16_t ops_per_obj_nb;\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\tcrypto_op_size = sizeof(struct rte_multi_fn_op);\n+\t\tif (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC) {\n+\t\t\tops_per_obj_nb = 2;\n+\t\t} else if  (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\t\tops_per_obj_nb = 3;\n+\t\t} else {\n+\t\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\t\"Invalid multi-function operations for pool \"\n+\t\t\t\t\"creation\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tmulti_fn = 1;\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\tcrypto_op_size = sizeof(struct rte_crypto_op) +\n+\t\t\tsizeof(struct rte_crypto_sym_op);\n+\t\tops_per_obj_nb = 1;\n+\t}\n+\n \t/*\n \t * If doing AES-CCM, IV field needs to be 16 bytes long,\n \t * and AAD field needs to be long enough to have 18 bytes,\n@@ -162,7 +220,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,\n \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+\tuint16_t crypto_op_total_size_padded = ops_per_obj_nb *\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@@ -186,7 +244,9 @@ cperf_alloc_common_memory(const struct cperf_options *options,\n \t\t\t    options->tailroom_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\t.dst_buf_offset = 0,\n+\t\t.ops_per_obj_nb = ops_per_obj_nb,\n+\t\t.multi_fn = multi_fn,\n \t};\n \n \tif (options->out_of_place) {\ndiff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c\nindex 0e4d0e153..92df4fb74 100644\n--- a/app/test-crypto-perf/cperf_test_latency.c\n+++ b/app/test-crypto-perf/cperf_test_latency.c\n@@ -6,6 +6,10 @@\n #include <rte_cycles.h>\n #include <rte_crypto.h>\n #include <rte_cryptodev.h>\n+#ifdef MULTI_FN_SUPPORTED\n+#include <rte_rawdev.h>\n+#include <rte_multi_fn.h>\n+#endif /* MULTI_FN_SUPPORTED */\n \n #include \"cperf_test_latency.h\"\n #include \"cperf_ops.h\"\n@@ -43,18 +47,27 @@ struct priv_op_data {\n static void\n cperf_latency_test_free(struct cperf_latency_ctx *ctx)\n {\n-\tif (ctx) {\n-\t\tif (ctx->sess) {\n+\tif (!ctx)\n+\t\treturn;\n+\n+\tif (ctx->sess) {\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (ctx->options->op_type == CPERF_MULTI_FN) {\n+\t\t\trte_multi_fn_session_destroy(ctx->dev_id,\n+\t\t\t\t(struct rte_multi_fn_session *)ctx->sess);\n+\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t{\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+\t}\n \n-\t\tif (ctx->pool)\n-\t\t\trte_mempool_free(ctx->pool);\n+\tif (ctx->pool)\n+\t\trte_mempool_free(ctx->pool);\n \n-\t\trte_free(ctx->res);\n-\t\trte_free(ctx);\n-\t}\n+\trte_free(ctx->res);\n+\trte_free(ctx);\n }\n \n void *\n@@ -67,6 +80,7 @@ cperf_latency_test_constructor(struct rte_mempool *sess_mp,\n {\n \tstruct cperf_latency_ctx *ctx = NULL;\n \tsize_t extra_op_priv_size = sizeof(struct priv_op_data);\n+\tuint16_t iv_offset;\n \n \tctx = rte_malloc(NULL, sizeof(struct cperf_latency_ctx), 0);\n \tif (ctx == NULL)\n@@ -79,10 +93,19 @@ cperf_latency_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 crypto operation */\n-\tuint16_t iv_offset = sizeof(struct rte_crypto_op) +\n-\t\tsizeof(struct rte_crypto_sym_op) +\n-\t\tsizeof(struct cperf_op_result *);\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\t/* IV goes at the end of the multi-function operation */\n+\t\tiv_offset = sizeof(struct rte_multi_fn_op) +\n+\t\t\tsizeof(struct cperf_op_result *);\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\t/* IV goes at the end of the crypto operation */\n+\t\tiv_offset = sizeof(struct rte_crypto_op) +\n+\t\t\tsizeof(struct rte_crypto_sym_op) +\n+\t\t\tsizeof(struct cperf_op_result *);\n+\t}\n \n \tctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,\n \t\t\ttest_vector, iv_offset);\n@@ -138,34 +161,65 @@ cperf_latency_test_runner(void *arg)\n \n \tuint32_t lcore = rte_lcore_id();\n \n+\tuint16_t iv_offset;\n+\n+\tint multi_fn = 0;\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (ctx->options->op_type == CPERF_MULTI_FN)\n+\t\tmulti_fn = 1;\n+#else\n+\tRTE_SET_USED(multi_fn);\n+#endif /* MULTI_FN_SUPPORTED */\n+\n #ifdef CPERF_LINEARIZATION_ENABLE\n-\tstruct rte_cryptodev_info dev_info;\n \tint linearize = 0;\n \n \t/* Check if source mbufs require coalescing */\n \tif (ctx->options->segment_sz < ctx->options->max_buffer_size) {\n-\t\trte_cryptodev_info_get(ctx->dev_id, &dev_info);\n-\t\tif ((dev_info.feature_flags &\n-\t\t\t\tRTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER) == 0)\n+\t\tif (!multi_fn) {\n+\t\t\tstruct rte_cryptodev_info dev_info;\n+\t\t\trte_cryptodev_info_get(ctx->dev_id, &dev_info);\n+\t\t\tif ((dev_info.feature_flags &\n+\t\t\t\t\tRTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER) ==\n+\t\t\t\t\t\t\t\t\t0)\n+\t\t\t\tlinearize = 1;\n+\t\t} else\n \t\t\tlinearize = 1;\n \t}\n #endif /* CPERF_LINEARIZATION_ENABLE */\n \n \tctx->lcore_id = lcore;\n \n-\t/* Warm up the host CPU before starting the test */\n-\tfor (i = 0; i < ctx->options->total_ops; i++)\n-\t\trte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id, NULL, 0);\n-\n \t/* Get first size from range or list */\n \tif (ctx->options->inc_burst_size != 0)\n \t\ttest_burst_size = ctx->options->min_burst_size;\n \telse\n \t\ttest_burst_size = ctx->options->burst_size_list[0];\n \n-\tuint16_t iv_offset = sizeof(struct rte_crypto_op) +\n-\t\tsizeof(struct rte_crypto_sym_op) +\n-\t\tsizeof(struct cperf_op_result *);\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (multi_fn) {\n+\t\t/* Warm up the host CPU before starting the test */\n+\t\tfor (i = 0; i < ctx->options->total_ops; i++)\n+\t\t\trte_rawdev_enqueue_buffers(ctx->dev_id, NULL, 0,\n+\t\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\n+\t\tiv_offset = sizeof(struct rte_multi_fn_op) +\n+\t\t\tsizeof(struct cperf_op_result *);\n+\n+\t\tmulti_fn = 1;\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\t/* Warm up the host CPU before starting the test */\n+\t\tfor (i = 0; i < ctx->options->total_ops; i++)\n+\t\t\trte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id,\n+\t\t\t\t\t\tNULL, 0);\n+\n+\t\tiv_offset = sizeof(struct rte_crypto_op) +\n+\t\t\tsizeof(struct rte_crypto_sym_op) +\n+\t\t\tsizeof(struct cperf_op_result *);\n+\t}\n \n \twhile (test_burst_size <= ctx->options->max_burst_size) {\n \t\tuint64_t ops_enqd = 0, ops_deqd = 0;\n@@ -215,13 +269,40 @@ cperf_latency_test_runner(void *arg)\n \t\t\t}\n #endif /* CPERF_LINEARIZATION_ENABLE */\n \n-\t\t\t/* Enqueue burst of ops on crypto device */\n-\t\t\tops_enqd = rte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id,\n-\t\t\t\t\tops, burst_size);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t\tif (multi_fn) {\n+\t\t\t\t/* Enqueue burst of op on raw device */\n+\t\t\t\tops_enqd = rte_rawdev_enqueue_buffers(\n+\t\t\t\t\tctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops,\n+\t\t\t\t\tburst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\n+\t\t\t\t/*\n+\t\t\t\t * Dequeue processed burst of ops from raw\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\tops_deqd = rte_rawdev_dequeue_buffers(\n+\t\t\t\t\tctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops_processed,\n+\t\t\t\t\ttest_burst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\t\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\t{\n+\t\t\t\t/* Enqueue burst of ops on crypto device */\n+\t\t\t\tops_enqd = rte_cryptodev_enqueue_burst(\n+\t\t\t\t\tctx->dev_id, ctx->qp_id, ops,\n+\t\t\t\t\tburst_size);\n \n-\t\t\t/* Dequeue processed burst of ops from crypto device */\n-\t\t\tops_deqd = rte_cryptodev_dequeue_burst(ctx->dev_id, ctx->qp_id,\n-\t\t\t\t\tops_processed, test_burst_size);\n+\t\t\t\t/*\n+\t\t\t\t * Dequeue processed burst of ops from crypto\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\tops_deqd = rte_cryptodev_dequeue_burst(\n+\t\t\t\t\tctx->dev_id, ctx->qp_id, ops_processed,\n+\t\t\t\t\ttest_burst_size);\n+\t\t\t}\n \n \t\t\ttsc_end = rte_rdtsc_precise();\n \n@@ -262,14 +343,41 @@ cperf_latency_test_runner(void *arg)\n \t\t\tb_idx++;\n \t\t}\n \n-\t\t/* Dequeue any operations still in the crypto device */\n+\t\t/* Dequeue any operations still in the device */\n \t\twhile (deqd_tot < ctx->options->total_ops) {\n-\t\t\t/* Sending 0 length burst to flush sw crypto device */\n-\t\t\trte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id, NULL, 0);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t\tif (multi_fn) {\n+\t\t\t\t/*\n+\t\t\t\t * Sending 0 length burst to flush sw raw\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\trte_rawdev_enqueue_buffers(ctx->dev_id, NULL, 0,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n \n-\t\t\t/* dequeue burst */\n-\t\t\tops_deqd = rte_cryptodev_dequeue_burst(ctx->dev_id, ctx->qp_id,\n-\t\t\t\t\tops_processed, test_burst_size);\n+\t\t\t\t/*\n+\t\t\t\t * Dequeue processed burst of ops from raw\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\tops_deqd = rte_rawdev_dequeue_buffers(\n+\t\t\t\t\tctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops_processed,\n+\t\t\t\t\ttest_burst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\t\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\t{\n+\t\t\t\t/*\n+\t\t\t\t * Sending 0 length burst to flush sw crypto\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\trte_cryptodev_enqueue_burst(ctx->dev_id,\n+\t\t\t\t\tctx->qp_id, NULL, 0);\n+\n+\t\t\t\t/* dequeue burst */\n+\t\t\t\tops_deqd = rte_cryptodev_dequeue_burst(\n+\t\t\t\t\tctx->dev_id, ctx->qp_id, ops_processed,\n+\t\t\t\t\ttest_burst_size);\n+\t\t\t}\n \n \t\t\ttsc_end = rte_rdtsc_precise();\n \ndiff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c\nindex 74371faa8..f0a7dbf7c 100644\n--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c\n+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c\n@@ -6,6 +6,10 @@\n \n #include <rte_crypto.h>\n #include <rte_cryptodev.h>\n+#ifdef MULTI_FN_SUPPORTED\n+#include <rte_rawdev.h>\n+#include <rte_multi_fn.h>\n+#endif /* MULTI_FN_SUPPORTED */\n #include <rte_cycles.h>\n #include <rte_malloc.h>\n \n@@ -44,6 +48,7 @@ struct pmd_cyclecount_state {\n \tuint32_t lcore;\n \tuint64_t delay;\n \tint linearize;\n+\tint multi_fn;\n \tuint32_t ops_enqd;\n \tuint32_t ops_deqd;\n \tuint32_t ops_enq_retries;\n@@ -53,29 +58,37 @@ struct pmd_cyclecount_state {\n \tdouble cycles_per_deq;\n };\n \n-static const uint16_t iv_offset =\n-\t\tsizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op);\n+static uint16_t iv_offset;\n \n static void\n cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)\n {\n-\tif (ctx) {\n-\t\tif (ctx->sess) {\n+\tif (!ctx)\n+\t\treturn;\n+\n+\tif (ctx->sess) {\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (ctx->options->op_type == CPERF_MULTI_FN) {\n+\t\t\trte_multi_fn_session_destroy(ctx->dev_id,\n+\t\t\t\t(struct rte_multi_fn_session *)ctx->sess);\n+\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t{\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+\t}\n \n-\t\tif (ctx->pool)\n-\t\t\trte_mempool_free(ctx->pool);\n+\tif (ctx->pool)\n+\t\trte_mempool_free(ctx->pool);\n \n-\t\tif (ctx->ops)\n-\t\t\trte_free(ctx->ops);\n+\tif (ctx->ops)\n+\t\trte_free(ctx->ops);\n \n-\t\tif (ctx->ops_processed)\n-\t\t\trte_free(ctx->ops_processed);\n+\tif (ctx->ops_processed)\n+\t\trte_free(ctx->ops_processed);\n \n-\t\trte_free(ctx);\n-\t}\n+\trte_free(ctx);\n }\n \n void *\n@@ -103,9 +116,17 @@ cperf_pmd_cyclecount_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 crypto operation */\n-\tuint16_t iv_offset = sizeof(struct rte_crypto_op) +\n-\t\t\tsizeof(struct rte_crypto_sym_op);\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\t/* IV goes at the end of the multi-function operation */\n+\t\tiv_offset = sizeof(struct rte_multi_fn_op);\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\t/* IV goes at the end of the crypto operation */\n+\t\tiv_offset = sizeof(struct rte_crypto_op) +\n+\t\t\t\tsizeof(struct rte_crypto_sym_op);\n+\t}\n \n \tctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,\n \t\t\ttest_vector, iv_offset);\n@@ -237,8 +258,18 @@ pmd_cyclecount_bench_enq(struct pmd_cyclecount_state *state,\n \t\tstruct rte_crypto_op **ops = &state->ctx->ops[cur_iter_op];\n \t\tuint32_t burst_enqd;\n \n-\t\tburst_enqd = rte_cryptodev_enqueue_burst(state->ctx->dev_id,\n-\t\t\t\tstate->ctx->qp_id, ops, burst_size);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (state->multi_fn)\n+\t\t\tburst_enqd = rte_rawdev_enqueue_buffers(\n+\t\t\t\t\tstate->ctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops,\n+\t\t\t\t\tburst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&state->ctx->qp_id);\n+\t\telse\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\tburst_enqd = rte_cryptodev_enqueue_burst(\n+\t\t\t\t\tstate->ctx->dev_id, state->ctx->qp_id,\n+\t\t\t\t\tops, burst_size);\n \n \t\t/* if we couldn't enqueue anything, the queue is full */\n \t\tif (!burst_enqd) {\n@@ -268,8 +299,18 @@ pmd_cyclecount_bench_deq(struct pmd_cyclecount_state *state,\n \t\t\t\t&state->ctx->ops[cur_iter_op];\n \t\tuint32_t burst_deqd;\n \n-\t\tburst_deqd = rte_cryptodev_dequeue_burst(state->ctx->dev_id,\n-\t\t\t\tstate->ctx->qp_id, ops_processed, burst_size);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (state->multi_fn)\n+\t\t\tburst_deqd = rte_rawdev_dequeue_buffers(\n+\t\t\t\t\tstate->ctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops_processed,\n+\t\t\t\t\tburst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&state->ctx->qp_id);\n+\t\telse\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\tburst_deqd = rte_cryptodev_dequeue_burst(\n+\t\t\t\t\tstate->ctx->dev_id, state->ctx->qp_id,\n+\t\t\t\t\tops_processed, burst_size);\n \n \t\tif (burst_deqd < burst_size)\n \t\t\tstate->ops_deq_retries++;\n@@ -390,6 +431,12 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx)\n \tstate.opts = opts;\n \tstate.lcore = rte_lcore_id();\n \tstate.linearize = 0;\n+\tstate.multi_fn = 0;\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (opts->op_type == CPERF_MULTI_FN)\n+\t\tstate.multi_fn = 1;\n+#endif /* MULTI_FN_SUPPORTED */\n \n \tstatic rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);\n \tstatic bool warmup = true;\n@@ -406,12 +453,15 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx)\n \n \t/* Check if source mbufs require coalescing */\n \tif (opts->segments_sz < ctx->options->max_buffer_size) {\n-\t\trte_cryptodev_info_get(state.ctx->dev_id, &dev_info);\n-\t\tif ((dev_info.feature_flags &\n+\t\tif (!state.multi_fn) {\n+\t\t\trte_cryptodev_info_get(state.ctx->dev_id, &dev_info);\n+\t\t\tif ((dev_info.feature_flags &\n \t\t\t\t    RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER) ==\n-\t\t\t\t0) {\n+\t\t\t\t\t\t\t\t0) {\n+\t\t\t\tstate.linearize = 1;\n+\t\t\t}\n+\t\t} else\n \t\t\tstate.linearize = 1;\n-\t\t}\n \t}\n #endif /* CPERF_LINEARIZATION_ENABLE */\n \ndiff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c\nindex 35c51026f..e569d820d 100644\n--- a/app/test-crypto-perf/cperf_test_throughput.c\n+++ b/app/test-crypto-perf/cperf_test_throughput.c\n@@ -6,6 +6,10 @@\n #include <rte_cycles.h>\n #include <rte_crypto.h>\n #include <rte_cryptodev.h>\n+#ifdef MULTI_FN_SUPPORTED\n+#include <rte_rawdev.h>\n+#include <rte_multi_fn.h>\n+#endif /* MULTI_FN_SUPPORTED */\n \n #include \"cperf_test_throughput.h\"\n #include \"cperf_ops.h\"\n@@ -44,11 +48,20 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)\n \t\t\t\t(struct rte_security_session *)ctx->sess);\n \t\t} else\n #endif\n-\t\t{\n-\t\t\trte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess);\n-\t\t\trte_cryptodev_sym_session_free(ctx->sess);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t\tif (ctx->options->op_type == CPERF_MULTI_FN) {\n+\t\t\t\trte_multi_fn_session_destroy(ctx->dev_id,\n+\t\t\t\t\t(struct rte_multi_fn_session *)\n+\t\t\t\t\t\tctx->sess);\n+\t\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\t{\n+\t\t\t\trte_cryptodev_sym_session_clear(ctx->dev_id,\n+\t\t\t\t\tctx->sess);\n+\t\t\t\trte_cryptodev_sym_session_free(ctx->sess);\n+\t\t\t}\n \t\t}\n-\t}\n+\n \tif (ctx->pool)\n \t\trte_mempool_free(ctx->pool);\n \n@@ -64,6 +77,7 @@ 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+\tuint16_t iv_offset;\n \n \tctx = rte_malloc(NULL, sizeof(struct cperf_throughput_ctx), 0);\n \tif (ctx == NULL)\n@@ -76,9 +90,17 @@ cperf_throughput_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 crypto operation */\n-\tuint16_t iv_offset = sizeof(struct rte_crypto_op) +\n-\t\tsizeof(struct rte_crypto_sym_op);\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\t/* IV goes at the end of the multi-function operation */\n+\t\tiv_offset = sizeof(struct rte_multi_fn_op);\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\t/* IV goes at the end of the crypto operation */\n+\t\tiv_offset = sizeof(struct rte_crypto_op) +\n+\t\t\tsizeof(struct rte_crypto_sym_op);\n+\t}\n \n \tctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,\n \t\t\ttest_vector, iv_offset);\n@@ -113,24 +135,55 @@ cperf_throughput_test_runner(void *test_ctx)\n \n \tuint32_t lcore = rte_lcore_id();\n \n+\tuint16_t iv_offset;\n+\n+\tint multi_fn = 0;\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (ctx->options->op_type == CPERF_MULTI_FN)\n+\t\tmulti_fn = 1;\n+#else\n+\tRTE_SET_USED(multi_fn);\n+#endif /* MULTI_FN_SUPPORTED */\n+\n #ifdef CPERF_LINEARIZATION_ENABLE\n-\tstruct rte_cryptodev_info dev_info;\n \tint linearize = 0;\n \n \t/* Check if source mbufs require coalescing */\n \tif (ctx->options->segment_sz < ctx->options->max_buffer_size) {\n-\t\trte_cryptodev_info_get(ctx->dev_id, &dev_info);\n-\t\tif ((dev_info.feature_flags &\n-\t\t\t\tRTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER) == 0)\n+\t\tif (!multi_fn) {\n+\t\t\tstruct rte_cryptodev_info dev_info;\n+\t\t\trte_cryptodev_info_get(ctx->dev_id, &dev_info);\n+\t\t\tif ((dev_info.feature_flags &\n+\t\t\t\t\tRTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER) ==\n+\t\t\t\t\t\t\t\t\t0)\n+\t\t\t\tlinearize = 1;\n+\t\t} else\n \t\t\tlinearize = 1;\n \t}\n #endif /* CPERF_LINEARIZATION_ENABLE */\n \n \tctx->lcore_id = lcore;\n \n-\t/* Warm up the host CPU before starting the test */\n-\tfor (i = 0; i < ctx->options->total_ops; i++)\n-\t\trte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id, NULL, 0);\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (multi_fn) {\n+\t\tiv_offset = sizeof(struct rte_multi_fn_op);\n+\n+\t\t/* Warm up the host CPU before starting the test */\n+\t\tfor (i = 0; i < ctx->options->total_ops; i++)\n+\t\t\trte_rawdev_enqueue_buffers(ctx->dev_id, NULL, 0,\n+\t\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\tiv_offset = sizeof(struct rte_crypto_op) +\n+\t\t\t\tsizeof(struct rte_crypto_sym_op);\n+\n+\t\t/* Warm up the host CPU before starting the test */\n+\t\tfor (i = 0; i < ctx->options->total_ops; i++)\n+\t\t\trte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id,\n+\t\t\t\t\t\tNULL, 0);\n+\t}\n \n \t/* Get first size from range or list */\n \tif (ctx->options->inc_burst_size != 0)\n@@ -138,9 +191,6 @@ cperf_throughput_test_runner(void *test_ctx)\n \telse\n \t\ttest_burst_size = ctx->options->burst_size_list[0];\n \n-\tuint16_t iv_offset = sizeof(struct rte_crypto_op) +\n-\t\tsizeof(struct rte_crypto_sym_op);\n-\n \twhile (test_burst_size <= ctx->options->max_burst_size) {\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@@ -203,9 +253,41 @@ cperf_throughput_test_runner(void *test_ctx)\n \t\t\t}\n #endif /* CPERF_LINEARIZATION_ENABLE */\n \n-\t\t\t/* Enqueue burst of ops on crypto device */\n-\t\t\tops_enqd = rte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id,\n-\t\t\t\t\tops, burst_size);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t\tif (multi_fn) {\n+\t\t\t\t/* Enqueue burst of op on raw device */\n+\t\t\t\tops_enqd = rte_rawdev_enqueue_buffers(\n+\t\t\t\t\t\tctx->dev_id,\n+\t\t\t\t\t\t(struct rte_rawdev_buf **)ops,\n+\t\t\t\t\t\tburst_size,\n+\t\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\n+\t\t\t\t/*\n+\t\t\t\t * Dequeue processed burst of ops from raw\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\tops_deqd = rte_rawdev_dequeue_buffers(\n+\t\t\t\t\tctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops_processed,\n+\t\t\t\t\ttest_burst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\t\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\t{\n+\t\t\t\t/* Enqueue burst of ops on crypto device */\n+\t\t\t\tops_enqd = rte_cryptodev_enqueue_burst(\n+\t\t\t\t\tctx->dev_id, ctx->qp_id, ops,\n+\t\t\t\t\tburst_size);\n+\n+\t\t\t\t/*\n+\t\t\t\t * Dequeue processed burst of ops from crypto\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\tops_deqd = rte_cryptodev_dequeue_burst(\n+\t\t\t\t\t\tctx->dev_id, ctx->qp_id,\n+\t\t\t\t\t\tops_processed, test_burst_size);\n+\t\t\t}\n+\n \t\t\tif (ops_enqd < burst_size)\n \t\t\t\tops_enqd_failed++;\n \n@@ -216,11 +298,6 @@ cperf_throughput_test_runner(void *test_ctx)\n \t\t\tops_unused = burst_size - ops_enqd;\n \t\t\tops_enqd_total += ops_enqd;\n \n-\n-\t\t\t/* Dequeue processed burst of ops from crypto device */\n-\t\t\tops_deqd = rte_cryptodev_dequeue_burst(ctx->dev_id, ctx->qp_id,\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. */\n \t\t\t\trte_mempool_put_bulk(ctx->pool,\n@@ -238,15 +315,38 @@ cperf_throughput_test_runner(void *test_ctx)\n \n \t\t}\n \n-\t\t/* Dequeue any operations still in the crypto device */\n-\n+\t\t/* Dequeue any operations still in the device */\n \t\twhile (ops_deqd_total < ctx->options->total_ops) {\n-\t\t\t/* Sending 0 length burst to flush sw crypto device */\n-\t\t\trte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id, NULL, 0);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\t\tif (multi_fn) {\n+\t\t\t\t/*\n+\t\t\t\t * Sending 0 length burst to flush sw raw\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\trte_rawdev_enqueue_buffers(ctx->dev_id, NULL, 0,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n \n-\t\t\t/* dequeue burst */\n-\t\t\tops_deqd = rte_cryptodev_dequeue_burst(ctx->dev_id, ctx->qp_id,\n-\t\t\t\t\tops_processed, test_burst_size);\n+\t\t\t\t/* dequeue burst */\n+\t\t\t\tops_deqd = rte_rawdev_dequeue_buffers(\n+\t\t\t\t\tctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops_processed,\n+\t\t\t\t\ttest_burst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\t\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\t{\n+\t\t\t\t/*\n+\t\t\t\t * Sending 0 length burst to flush sw crypto\n+\t\t\t\t * device\n+\t\t\t\t */\n+\t\t\t\trte_cryptodev_enqueue_burst(\n+\t\t\t\t\tctx->dev_id, ctx->qp_id, NULL, 0);\n+\n+\t\t\t\t/* dequeue burst */\n+\t\t\t\tops_deqd = rte_cryptodev_dequeue_burst(\n+\t\t\t\t\tctx->dev_id, ctx->qp_id, ops_processed,\n+\t\t\t\t\ttest_burst_size);\n+\t\t\t}\n \t\t\tif (ops_deqd == 0)\n \t\t\t\tops_deqd_failed++;\n \t\t\telse {\ndiff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c\nindex 1e9dfcfff..1395d86f2 100644\n--- a/app/test-crypto-perf/cperf_test_vector_parsing.c\n+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c\n@@ -581,11 +581,38 @@ cperf_test_vector_get_from_file(struct cperf_options *opts)\n \t}\n \n \t/* other values not included in the file */\n-\ttest_vector->data.cipher_offset = 0;\n-\ttest_vector->data.cipher_length = opts->max_buffer_size;\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (opts->op_type == CPERF_MULTI_FN) {\n+\t\tif (opts->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC ||\n+\t\t\topts->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\t\ttest_vector->data.cipher_offset =\n+\t\t\t\t\topts->multi_fn_opts.cipher_offset;\n+\t\t\ttest_vector->data.cipher_length =\n+\t\t\t\t\topts->max_buffer_size;\n+\n+\t\t\ttest_vector->multi_fn_data.crc_offset =\n+\t\t\t\t\topts->multi_fn_opts.crc_offset;\n+\t\t\ttest_vector->multi_fn_data.crc_length =\n+\t\t\t\t\topts->max_buffer_size;\n+\t\t}\n \n-\ttest_vector->data.auth_offset = 0;\n-\ttest_vector->data.auth_length = opts->max_buffer_size;\n+\t\tif (opts->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\t\ttest_vector->multi_fn_data.bip_offset = 0;\n+\t\t\ttest_vector->multi_fn_data.bip_length =\n+\t\t\t\t\topts->max_buffer_size;\n+\t\t}\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\ttest_vector->data.cipher_offset = 0;\n+\t\ttest_vector->data.cipher_length = opts->max_buffer_size;\n+\n+\t\ttest_vector->data.auth_offset = 0;\n+\t\ttest_vector->data.auth_length = opts->max_buffer_size;\n+\t}\n \n \treturn test_vector;\n }\ndiff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c\nindex 41641650c..5b6a048b1 100644\n--- a/app/test-crypto-perf/cperf_test_vectors.c\n+++ b/app/test-crypto-perf/cperf_test_vectors.c\n@@ -587,5 +587,58 @@ cperf_test_vector_get_dummy(struct cperf_options *options)\n \t\tmemcpy(t_vec->aead_iv.data, iv, options->aead_iv_sz);\n \t\tt_vec->aead_iv.length = options->aead_iv_sz;\n \t}\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\tif (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC ||\n+\t\t\toptions->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\t\tif (options->cipher_algo == RTE_CRYPTO_CIPHER_NULL) {\n+\t\t\t\tt_vec->cipher_key.length = 0;\n+\t\t\t\tt_vec->ciphertext.data = plaintext;\n+\t\t\t\tt_vec->cipher_key.data = NULL;\n+\t\t\t} else {\n+\t\t\t\tt_vec->cipher_key.length =\n+\t\t\t\t\t\toptions->cipher_key_sz;\n+\t\t\t\tt_vec->ciphertext.data = ciphertext;\n+\t\t\t\tt_vec->cipher_key.data = cipher_key;\n+\t\t\t}\n+\n+\t\t\t/* Init IV data ptr */\n+\t\t\tt_vec->cipher_iv.data = NULL;\n+\n+\t\t\tif (options->cipher_iv_sz != 0) {\n+\t\t\t\t/* Set IV parameters */\n+\t\t\t\tt_vec->cipher_iv.data = rte_malloc(NULL,\n+\t\t\t\t\t\toptions->cipher_iv_sz, 16);\n+\t\t\t\tif (t_vec->cipher_iv.data == NULL) {\n+\t\t\t\t\trte_free(t_vec);\n+\t\t\t\t\treturn NULL;\n+\t\t\t\t}\n+\t\t\t\tmemcpy(t_vec->cipher_iv.data, iv,\n+\t\t\t\t\toptions->cipher_iv_sz);\n+\t\t\t}\n+\t\t\tt_vec->ciphertext.length = options->max_buffer_size;\n+\t\t\tt_vec->cipher_iv.length = options->cipher_iv_sz;\n+\t\t\tt_vec->data.cipher_offset =\n+\t\t\t\t\toptions->multi_fn_opts.cipher_offset;\n+\t\t\tt_vec->data.cipher_length = options->max_buffer_size;\n+\n+\t\t\tt_vec->multi_fn_data.crc_offset =\n+\t\t\t\t\toptions->multi_fn_opts.crc_offset;\n+\t\t\tt_vec->multi_fn_data.crc_length =\n+\t\t\t\t\toptions->max_buffer_size;\n+\t\t}\n+\n+\t\tif (options->multi_fn_opts.ops ==\n+\t\t\t\tCPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP) {\n+\t\t\tt_vec->multi_fn_data.bip_offset = 0;\n+\t\t\tt_vec->multi_fn_data.bip_length =\n+\t\t\t\t\toptions->max_buffer_size;\n+\t\t}\n+\t}\n+#endif /* MULTI_FN_SUPPORTED */\n+\n \treturn t_vec;\n }\ndiff --git a/app/test-crypto-perf/cperf_test_vectors.h b/app/test-crypto-perf/cperf_test_vectors.h\nindex 6f10823ef..ad9ea89e6 100644\n--- a/app/test-crypto-perf/cperf_test_vectors.h\n+++ b/app/test-crypto-perf/cperf_test_vectors.h\n@@ -68,6 +68,15 @@ struct cperf_test_vector {\n \t\tuint32_t aead_offset;\n \t\tuint32_t aead_length;\n \t} data;\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tstruct {\n+\t\tuint32_t crc_offset;\n+\t\tuint32_t crc_length;\n+\t\tuint32_t bip_offset;\n+\t\tuint32_t bip_length;\n+\t} multi_fn_data;\n+#endif /* MULTI_FN_SUPPORTED */\n };\n \n struct cperf_test_vector*\ndiff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c\nindex 833bc9a55..30ef2f568 100644\n--- a/app/test-crypto-perf/cperf_test_verify.c\n+++ b/app/test-crypto-perf/cperf_test_verify.c\n@@ -6,6 +6,10 @@\n #include <rte_cycles.h>\n #include <rte_crypto.h>\n #include <rte_cryptodev.h>\n+#ifdef MULTI_FN_SUPPORTED\n+#include <rte_rawdev.h>\n+#include <rte_multi_fn.h>\n+#endif /* MULTI_FN_SUPPORTED */\n \n #include \"cperf_test_verify.h\"\n #include \"cperf_ops.h\"\n@@ -36,17 +40,26 @@ struct cperf_op_result {\n static void\n cperf_verify_test_free(struct cperf_verify_ctx *ctx)\n {\n-\tif (ctx) {\n-\t\tif (ctx->sess) {\n+\tif (ctx)\n+\t\treturn;\n+\n+\tif (ctx->sess) {\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (ctx->options->op_type == CPERF_MULTI_FN) {\n+\t\t\trte_multi_fn_session_destroy(ctx->dev_id,\n+\t\t\t\t(struct rte_multi_fn_session *)ctx->sess);\n+\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t{\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+\t}\n \n-\t\tif (ctx->pool)\n-\t\t\trte_mempool_free(ctx->pool);\n+\tif (ctx->pool)\n+\t\trte_mempool_free(ctx->pool);\n \n-\t\trte_free(ctx);\n-\t}\n+\trte_free(ctx);\n }\n \n void *\n@@ -58,6 +71,7 @@ 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+\tuint16_t iv_offset;\n \n \tctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);\n \tif (ctx == NULL)\n@@ -70,9 +84,17 @@ 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 crypto operation */\n-\tuint16_t iv_offset = sizeof(struct rte_crypto_op) +\n-\t\tsizeof(struct rte_crypto_sym_op);\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN) {\n+\t\t/* IV goes at the end of the multi-function operation */\n+\t\tiv_offset = sizeof(struct rte_multi_fn_op);\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\t/* IV goes at the end of the crypto operation */\n+\t\tiv_offset = sizeof(struct rte_crypto_op) +\n+\t\t\tsizeof(struct rte_crypto_sym_op);\n+\t}\n \n \tctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options,\n \t\t\ttest_vector, iv_offset);\n@@ -91,6 +113,65 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,\n \treturn NULL;\n }\n \n+#ifdef MULTI_FN_SUPPORTED\n+static int\n+cperf_verify_mf_op(struct rte_multi_fn_op *op,\n+\t\t\tconst struct cperf_options *options,\n+\t\t\tconst struct cperf_test_vector *vector)\n+{\n+\tconst struct rte_mbuf *m;\n+\tuint32_t len;\n+\tuint16_t nb_segs;\n+\tuint8_t *data;\n+\tint res = 0;\n+\n+\tif (op->overall_status != RTE_MULTI_FN_OP_STATUS_SUCCESS)\n+\t\treturn 1;\n+\n+\tif (op->m_dst)\n+\t\tm = op->m_dst;\n+\telse\n+\t\tm = op->m_src;\n+\tnb_segs = m->nb_segs;\n+\tlen = 0;\n+\twhile (m && nb_segs != 0) {\n+\t\tlen += m->data_len;\n+\t\tm = m->next;\n+\t\tnb_segs--;\n+\t}\n+\n+\tdata = rte_malloc(NULL, len, 0);\n+\tif (data == NULL)\n+\t\treturn 1;\n+\n+\tif (op->m_dst)\n+\t\tm = op->m_dst;\n+\telse\n+\t\tm = op->m_src;\n+\tnb_segs = m->nb_segs;\n+\tlen = 0;\n+\twhile (m && nb_segs != 0) {\n+\t\tmemcpy(data + len, rte_pktmbuf_mtod(m, uint8_t *),\n+\t\t\t\tm->data_len);\n+\t\tlen += m->data_len;\n+\t\tm = m->next;\n+\t\tnb_segs--;\n+\t}\n+\n+\tif (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT)\n+\t\tres += memcmp(data,\n+\t\t\t\tvector->ciphertext.data,\n+\t\t\t\toptions->test_buffer_size);\n+\telse\n+\t\tres += memcmp(data,\n+\t\t\t\tvector->plaintext.data,\n+\t\t\t\toptions->test_buffer_size);\n+\n+\trte_free(data);\n+\treturn !!res;\n+}\n+#endif /* MULTI_FN_SUPPORTED */\n+\n static int\n cperf_verify_op(struct rte_crypto_op *op,\n \t\tconst struct cperf_options *options,\n@@ -104,6 +185,12 @@ cperf_verify_op(struct rte_crypto_op *op,\n \tuint8_t\tcipher, auth;\n \tint res = 0;\n \n+#ifdef MULTI_FN_SUPPORTED\n+\tif (options->op_type == CPERF_MULTI_FN)\n+\t\treturn cperf_verify_mf_op((struct rte_multi_fn_op *)op, options,\n+\t\t\t\t\t\tvector);\n+#endif /* MULTI_FN_SUPPORTED */\n+\n \tif (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)\n \t\treturn 1;\n \n@@ -252,15 +339,30 @@ cperf_verify_test_runner(void *test_ctx)\n \n \tuint32_t lcore = rte_lcore_id();\n \n+\tuint16_t iv_offset;\n+\n+\tint multi_fn = 0;\n+\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (ctx->options->op_type == CPERF_MULTI_FN)\n+\t\tmulti_fn = 1;\n+#else\n+\tRTE_SET_USED(multi_fn);\n+#endif /* MULTI_FN_SUPPORTED */\n+\n #ifdef CPERF_LINEARIZATION_ENABLE\n-\tstruct rte_cryptodev_info dev_info;\n \tint linearize = 0;\n \n \t/* Check if source mbufs require coalescing */\n \tif (ctx->options->segment_sz < ctx->options->max_buffer_size) {\n-\t\trte_cryptodev_info_get(ctx->dev_id, &dev_info);\n-\t\tif ((dev_info.feature_flags &\n-\t\t\t\tRTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER) == 0)\n+\t\tif (!multi_fn) {\n+\t\t\tstruct rte_cryptodev_info dev_info;\n+\t\t\trte_cryptodev_info_get(ctx->dev_id, &dev_info);\n+\t\t\tif ((dev_info.feature_flags &\n+\t\t\t\t\tRTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER) ==\n+\t\t\t\t\t\t\t\t\t0)\n+\t\t\t\tlinearize = 1;\n+\t\t} else\n \t\t\tlinearize = 1;\n \t}\n #endif /* CPERF_LINEARIZATION_ENABLE */\n@@ -271,12 +373,18 @@ cperf_verify_test_runner(void *test_ctx)\n \t\tprintf(\"\\n# Running verify test on device: %u, lcore: %u\\n\",\n \t\t\tctx->dev_id, lcore);\n \n-\tuint16_t iv_offset = sizeof(struct rte_crypto_op) +\n-\t\tsizeof(struct rte_crypto_sym_op);\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (multi_fn)\n+\t\tiv_offset = sizeof(struct rte_multi_fn_op);\n+\telse\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\tiv_offset = sizeof(struct rte_crypto_op) +\n+\t\t\tsizeof(struct rte_crypto_sym_op);\n \n \twhile (ops_enqd_total < ctx->options->total_ops) {\n \n-\t\tuint16_t burst_size = ((ops_enqd_total + ctx->options->max_burst_size)\n+\t\tuint16_t burst_size = ((ops_enqd_total +\n+\t\t\t\t\t\tctx->options->max_burst_size)\n \t\t\t\t<= ctx->options->total_ops) ?\n \t\t\t\t\t\tctx->options->max_burst_size :\n \t\t\t\t\t\tctx->options->total_ops -\n@@ -319,9 +427,32 @@ cperf_verify_test_runner(void *test_ctx)\n \t\t}\n #endif /* CPERF_LINEARIZATION_ENABLE */\n \n-\t\t/* Enqueue burst of ops on crypto device */\n-\t\tops_enqd = rte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id,\n-\t\t\t\tops, burst_size);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (multi_fn) {\n+\t\t\t/* Enqueue burst of op on raw device */\n+\t\t\tops_enqd = rte_rawdev_enqueue_buffers(ctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops,\n+\t\t\t\t\tburst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\n+\t\t\t/* Dequeue processed burst of ops from raw device */\n+\t\t\tops_deqd = rte_rawdev_dequeue_buffers(ctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops_processed,\n+\t\t\t\t\tctx->options->max_burst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t{\n+\t\t\t/* Enqueue burst of ops on crypto device */\n+\t\t\tops_enqd = rte_cryptodev_enqueue_burst(ctx->dev_id,\n+\t\t\t\t\tctx->qp_id, ops, burst_size);\n+\n+\t\t\t/* Dequeue processed burst of ops from crypto device */\n+\t\t\tops_deqd = rte_cryptodev_dequeue_burst(ctx->dev_id,\n+\t\t\t\t\tctx->qp_id, ops_processed,\n+\t\t\t\t\tctx->options->max_burst_size);\n+\t\t}\n+\n \t\tif (ops_enqd < burst_size)\n \t\t\tops_enqd_failed++;\n \n@@ -332,11 +463,6 @@ cperf_verify_test_runner(void *test_ctx)\n \t\tops_unused = burst_size - ops_enqd;\n \t\tops_enqd_total += ops_enqd;\n \n-\n-\t\t/* Dequeue processed burst of ops from crypto device */\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\tif (ops_deqd == 0) {\n \t\t\t/**\n \t\t\t * Count dequeue polls which didn't return any\n@@ -358,15 +484,32 @@ cperf_verify_test_runner(void *test_ctx)\n \t\tops_deqd_total += ops_deqd;\n \t}\n \n-\t/* Dequeue any operations still in the crypto device */\n-\n+\t/* Dequeue any operations still in the device */\n \twhile (ops_deqd_total < ctx->options->total_ops) {\n-\t\t/* Sending 0 length burst to flush sw crypto device */\n-\t\trte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id, NULL, 0);\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (multi_fn) {\n+\t\t\t/* Sending 0 length burst to flush sw raw device */\n+\t\t\trte_rawdev_enqueue_buffers(ctx->dev_id, NULL, 0,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\n+\t\t\t/* dequeue burst */\n+\t\t\tops_deqd = rte_rawdev_dequeue_buffers(ctx->dev_id,\n+\t\t\t\t\t(struct rte_rawdev_buf **)ops_processed,\n+\t\t\t\t\tctx->options->max_burst_size,\n+\t\t\t\t\t(rte_rawdev_obj_t)&ctx->qp_id);\n+\t\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t{\n+\t\t\t/* Sending 0 length burst to flush sw crypto device */\n+\t\t\trte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id,\n+\t\t\t\t\tNULL, 0);\n+\n+\t\t\t/* dequeue burst */\n+\t\t\tops_deqd = rte_cryptodev_dequeue_burst(ctx->dev_id,\n+\t\t\t\t\tctx->qp_id, ops_processed,\n+\t\t\t\t\tctx->options->max_burst_size);\n+\t\t}\n \n-\t\t/* dequeue burst */\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 \t\tif (ops_deqd == 0) {\n \t\t\tops_deqd_failed++;\n \t\t\tcontinue;\ndiff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c\nindex 52a1860fb..c8334160e 100644\n--- a/app/test-crypto-perf/main.c\n+++ b/app/test-crypto-perf/main.c\n@@ -12,6 +12,10 @@\n #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER\n #include <rte_cryptodev_scheduler.h>\n #endif\n+#ifdef MULTI_FN_SUPPORTED\n+#include <rte_rawdev.h>\n+#include <rte_multi_fn.h>\n+#endif /* MULTI_FN_SUPPORTED */\n \n #include \"cperf.h\"\n #include \"cperf_options.h\"\n@@ -39,9 +43,19 @@ const char *cperf_op_type_strs[] = {\n \t[CPERF_CIPHER_THEN_AUTH] = \"cipher-then-auth\",\n \t[CPERF_AUTH_THEN_CIPHER] = \"auth-then-cipher\",\n \t[CPERF_AEAD] = \"aead\",\n-\t[CPERF_PDCP] = \"pdcp\"\n+\t[CPERF_PDCP] = \"pdcp\",\n+#ifdef MULTI_FN_SUPPORTED\n+\t[CPERF_MULTI_FN] = \"multi-fn\"\n+#endif /* MULTI_FN_SUPPORTED */\n };\n \n+#ifdef MULTI_FN_SUPPORTED\n+const char *cperf_multi_fn_ops_strs[] = {\n+\t[CPERF_MULTI_FN_OPS_DOCSIS_CIPHER_CRC] = \"docsis-cipher-crc\",\n+\t[CPERF_MULTI_FN_OPS_PON_CIPHER_CRC_BIP] = \"pon-cipher-crc-bip\"\n+};\n+#endif /* MULTI_FN_SUPPORTED */\n+\n const struct cperf_test cperf_testmap[] = {\n \t\t[CPERF_TEST_TYPE_THROUGHPUT] = {\n \t\t\t\tcperf_throughput_test_constructor,\n@@ -294,7 +308,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)\n }\n \n static int\n-cperf_verify_devices_capabilities(struct cperf_options *opts,\n+cperf_verify_crypto_devices_capabilities(struct cperf_options *opts,\n \t\tuint8_t *enabled_cdevs, uint8_t nb_cryptodevs)\n {\n \tstruct rte_cryptodev_sym_capability_idx cap_idx;\n@@ -369,8 +383,136 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,\n \t\t}\n \t}\n \n+#ifdef MULTI_FN_SUPPORTED\n+\tif (opts->op_type == CPERF_MULTI_FN)\n+\t\treturn -1;\n+#endif /* MULTI_FN_SUPPORTED */\n+\n+\treturn 0;\n+}\n+\n+#ifdef MULTI_FN_SUPPORTED\n+static uint8_t\n+cperf_get_rawdevs(const char *driver_name, uint8_t *devices,\n+\t\tuint8_t nb_devices)\n+{\n+\tstruct rte_rawdev_info rdev_info;\n+\tuint8_t i, count = 0;\n+\n+\tfor (i = 0; i < RTE_RAWDEV_MAX_DEVS && count < nb_devices; i++) {\n+\t\tmemset(&rdev_info, 0, sizeof(struct rte_rawdev_info));\n+\t\tif (!rte_rawdev_info_get(i, &rdev_info) &&\n+\t\t\t!strncmp(rdev_info.driver_name,\n+\t\t\t\t\tdriver_name,\n+\t\t\t\t\tstrlen(driver_name) + 1))\n+\t\t\tdevices[count++] = i;\n+\t}\n+\n+\treturn count;\n+}\n+\n+static int\n+cperf_initialize_rawdev(struct cperf_options *opts, uint8_t *enabled_rdevs)\n+{\n+\tuint8_t enabled_rdev_count = 0, nb_lcores, rdev_id;\n+\tunsigned int i, j;\n+\tint ret;\n+\n+\tenabled_rdev_count = cperf_get_rawdevs(opts->device_type,\n+\t\t\tenabled_rdevs, RTE_RAWDEV_MAX_DEVS);\n+\tif (enabled_rdev_count == 0) {\n+\t\tprintf(\"No raw devices type %s available\\n\",\n+\t\t\t\topts->device_type);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tnb_lcores = rte_lcore_count() - 1;\n+\n+\tif (nb_lcores < 1) {\n+\t\tRTE_LOG(ERR, USER1,\n+\t\t\t\"Number of enabled cores need to be higher than 1\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/*\n+\t * Calculate number of needed queue pairs, based on the amount\n+\t * of available number of logical cores and crypto devices.\n+\t * For instance, if there are 4 cores and 2 crypto devices,\n+\t * 2 queue pairs will be set up per device.\n+\t */\n+\topts->nb_qps = (nb_lcores % enabled_rdev_count) ?\n+\t\t\t\t(nb_lcores / enabled_rdev_count) + 1 :\n+\t\t\t\tnb_lcores / enabled_rdev_count;\n+\n+\tfor (i = 0; i < enabled_rdev_count &&\n+\t\t\ti < RTE_RAWDEV_MAX_DEVS; i++) {\n+\t\trdev_id = enabled_rdevs[i];\n+\n+\t\tstruct rte_rawdev_info rdev_info = {0};\n+\t\tstruct rte_multi_fn_dev_info mf_info  = {0};\n+\t\tstruct rte_multi_fn_dev_config mf_dev_conf = {0};\n+\t\tstruct rte_multi_fn_qp_config qp_conf = {0};\n+\t\tuint8_t socket_id = rte_cryptodev_socket_id(rdev_id);\n+\n+\t\t/*\n+\t\t * Range check the socket_id - negative values become big\n+\t\t * positive ones due to use of unsigned value\n+\t\t */\n+\t\tif (socket_id >= RTE_MAX_NUMA_NODES)\n+\t\t\tsocket_id = 0;\n+\n+\t\trdev_info.dev_private = &mf_info;\n+\t\trte_rawdev_info_get(rdev_id, &rdev_info);\n+\t\tif (opts->nb_qps > mf_info.max_nb_queues) {\n+\t\t\tprintf(\"Number of needed queue pairs is higher \"\n+\t\t\t\t\"than the maximum number of queue pairs \"\n+\t\t\t\t\"per device.\\n\");\n+\t\t\tprintf(\"Lower the number of cores or increase \"\n+\t\t\t\t\"the number of raw devices\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tmf_dev_conf.nb_queues = opts->nb_qps;\n+\t\trdev_info.dev_private = &mf_dev_conf;\n+\t\tqp_conf.nb_descriptors = opts->nb_descriptors;\n+\n+\t\tret = rte_rawdev_configure(rdev_id, &rdev_info);\n+\t\tif (ret < 0) {\n+\t\t\tprintf(\"Failed to configure rawdev %u\", rdev_id);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tfor (j = 0; j < opts->nb_qps; j++) {\n+\t\t\tret = rte_rawdev_queue_setup(rdev_id, j, &qp_conf);\n+\t\t\tif (ret < 0) {\n+\t\t\t\tprintf(\"Failed to setup queue pair %u on \"\n+\t\t\t\t\t\"rawdev %u\", j, rdev_id);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t}\n+\n+\t\tret = rte_rawdev_start(rdev_id);\n+\t\tif (ret < 0) {\n+\t\t\tprintf(\"Failed to start raw device %u: error %d\\n\",\n+\t\t\t\trdev_id, ret);\n+\t\t\treturn -EPERM;\n+\t\t}\n+\t}\n+\n+\treturn enabled_rdev_count;\n+}\n+\n+static int\n+cperf_verify_raw_devices_capabilities(struct cperf_options *opts,\n+\t\t__rte_unused uint8_t *enabled_rdevs,\n+\t\t__rte_unused uint8_t nb_rawdevs)\n+{\n+\tif (opts->op_type != CPERF_MULTI_FN)\n+\t\treturn -1;\n+\n \treturn 0;\n }\n+#endif /* MULTI_FN_SUPPORTED */\n \n static int\n cperf_check_test_vector(struct cperf_options *opts,\n@@ -499,10 +641,16 @@ main(int argc, char **argv)\n \tstruct cperf_test_vector *t_vec = NULL;\n \tstruct cperf_op_fns op_fns;\n \tvoid *ctx[RTE_MAX_LCORE] = { };\n-\tint nb_cryptodevs = 0;\n+\tint nb_devs = 0;\n \tuint16_t total_nb_qps = 0;\n-\tuint8_t cdev_id, i;\n-\tuint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS] = { 0 };\n+\tuint8_t dev_id, i;\n+#ifndef MULTI_FN_SUPPORTED\n+\tuint8_t enabled_devs[RTE_CRYPTO_MAX_DEVS] = { 0 };\n+#else\n+\tuint8_t max_devs = RTE_MAX(RTE_CRYPTO_MAX_DEVS, RTE_RAWDEV_MAX_DEVS);\n+\tuint8_t enabled_devs[max_devs];\n+\tmemset(enabled_devs, 0x0, max_devs);\n+#endif /* MULTI_FN_SUPPORTED */\n \n \tuint8_t buffer_size_idx = 0;\n \n@@ -531,24 +679,49 @@ main(int argc, char **argv)\n \t\tgoto err;\n \t}\n \n-\tnb_cryptodevs = cperf_initialize_cryptodev(&opts, enabled_cdevs);\n+#ifdef MULTI_FN_SUPPORTED\n+\tif (opts.op_type == CPERF_MULTI_FN) {\n+\t\tnb_devs = cperf_initialize_rawdev(&opts, enabled_devs);\n \n-\tif (!opts.silent)\n-\t\tcperf_options_dump(&opts);\n+\t\tif (!opts.silent)\n+\t\t\tcperf_options_dump(&opts);\n \n-\tif (nb_cryptodevs < 1) {\n-\t\tRTE_LOG(ERR, USER1, \"Failed to initialise requested crypto \"\n-\t\t\t\t\"device type\\n\");\n-\t\tnb_cryptodevs = 0;\n-\t\tgoto err;\n-\t}\n+\t\tif (nb_devs < 1) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Failed to initialise requested \"\n+\t\t\t\t\t\"raw device type\\n\");\n+\t\t\tnb_devs = 0;\n+\t\t\tgoto err;\n+\t\t}\n \n-\tret = cperf_verify_devices_capabilities(&opts, enabled_cdevs,\n-\t\t\tnb_cryptodevs);\n-\tif (ret) {\n-\t\tRTE_LOG(ERR, USER1, \"Crypto device type does not support \"\n-\t\t\t\t\"capabilities requested\\n\");\n-\t\tgoto err;\n+\t\tret = cperf_verify_raw_devices_capabilities(&opts,\n+\t\t\t\tenabled_devs, nb_devs);\n+\t\tif (ret) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Raw device type does not \"\n+\t\t\t\t\t\"support capabilities requested\\n\");\n+\t\t\tgoto err;\n+\t\t}\n+\t} else\n+#endif /* MULTI_FN_SUPPORTED */\n+\t{\n+\t\tnb_devs = cperf_initialize_cryptodev(&opts, enabled_devs);\n+\n+\t\tif (!opts.silent)\n+\t\t\tcperf_options_dump(&opts);\n+\n+\t\tif (nb_devs < 1) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Failed to initialise requested \"\n+\t\t\t\t\t\"crypto device type\\n\");\n+\t\t\tnb_devs = 0;\n+\t\t\tgoto err;\n+\t\t}\n+\n+\t\tret = cperf_verify_crypto_devices_capabilities(&opts,\n+\t\t\t\tenabled_devs, nb_devs);\n+\t\tif (ret) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Crypto device type does not \"\n+\t\t\t\t\t\"support capabilities requested\\n\");\n+\t\t\tgoto err;\n+\t\t}\n \t}\n \n \tif (opts.test_file != NULL) {\n@@ -585,23 +758,29 @@ main(int argc, char **argv)\n \tif (!opts.silent)\n \t\tshow_test_vector(t_vec);\n \n-\ttotal_nb_qps = nb_cryptodevs * opts.nb_qps;\n+\ttotal_nb_qps = nb_devs * opts.nb_qps;\n \n \ti = 0;\n-\tuint8_t qp_id = 0, cdev_index = 0;\n+\tuint8_t qp_id = 0, dev_index = 0;\n \tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n \n \t\tif (i == total_nb_qps)\n \t\t\tbreak;\n \n-\t\tcdev_id = enabled_cdevs[cdev_index];\n+\t\tdev_id = enabled_devs[dev_index];\n \n-\t\tuint8_t socket_id = rte_cryptodev_socket_id(cdev_id);\n+\t\tuint8_t socket_id;\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (opts.op_type == CPERF_MULTI_FN)\n+\t\t\tsocket_id = rte_rawdev_socket_id(dev_id);\n+\t\telse\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\tsocket_id = rte_cryptodev_socket_id(dev_id);\n \n \t\tctx[i] = cperf_testmap[opts.test].constructor(\n \t\t\t\tsession_pool_socket[socket_id].sess_mp,\n \t\t\t\tsession_pool_socket[socket_id].priv_mp,\n-\t\t\t\tcdev_id, qp_id,\n+\t\t\t\tdev_id, qp_id,\n \t\t\t\t&opts, t_vec, &op_fns);\n \t\tif (ctx[i] == NULL) {\n \t\t\tRTE_LOG(ERR, USER1, \"Test run constructor failed\\n\");\n@@ -609,7 +788,7 @@ main(int argc, char **argv)\n \t\t}\n \t\tqp_id = (qp_id + 1) % opts.nb_qps;\n \t\tif (qp_id == 0)\n-\t\t\tcdev_index++;\n+\t\t\tdev_index++;\n \t\ti++;\n \t}\n \n@@ -726,9 +905,15 @@ main(int argc, char **argv)\n \t\ti++;\n \t}\n \n-\tfor (i = 0; i < nb_cryptodevs &&\n-\t\t\ti < RTE_CRYPTO_MAX_DEVS; i++)\n-\t\trte_cryptodev_stop(enabled_cdevs[i]);\n+\tfor (i = 0; i < nb_devs &&\n+\t\t\ti < RTE_DIM(enabled_devs); i++) {\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (opts.op_type == CPERF_MULTI_FN)\n+\t\t\trte_rawdev_stop(enabled_devs[i]);\n+\t\telse\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\trte_cryptodev_stop(enabled_devs[i]);\n+\t}\n \n \tfree_test_vector(t_vec, &opts);\n \n@@ -746,9 +931,15 @@ main(int argc, char **argv)\n \t\ti++;\n \t}\n \n-\tfor (i = 0; i < nb_cryptodevs &&\n-\t\t\ti < RTE_CRYPTO_MAX_DEVS; i++)\n-\t\trte_cryptodev_stop(enabled_cdevs[i]);\n+\tfor (i = 0; i < nb_devs &&\n+\t\t\ti < RTE_DIM(enabled_devs); i++) {\n+#ifdef MULTI_FN_SUPPORTED\n+\t\tif (opts.op_type == CPERF_MULTI_FN)\n+\t\t\trte_rawdev_stop(enabled_devs[i]);\n+\t\telse\n+#endif /* MULTI_FN_SUPPORTED */\n+\t\t\trte_cryptodev_stop(enabled_devs[i]);\n+\t}\n \trte_free(opts.imix_buffer_sizes);\n \tfree_test_vector(t_vec, &opts);\n \ndiff --git a/app/test-crypto-perf/meson.build b/app/test-crypto-perf/meson.build\nindex 0674396da..28b54611f 100644\n--- a/app/test-crypto-perf/meson.build\n+++ b/app/test-crypto-perf/meson.build\n@@ -13,3 +13,9 @@ sources = files('cperf_ops.c',\n \t\t'cperf_test_verify.c',\n \t\t'main.c')\n deps += ['cryptodev', 'security']\n+#deps += ['cryptodev', 'security', 'rawdev', 'common_multi_fn']\n+\n+if dpdk_conf.has('RTE_LIBRTE_MULTI_FN_COMMON') and dpdk_conf.has('RTE_LIBRTE_PMD_AESNI_MB_RAWDEV')\n+\tdeps += ['rawdev', 'common_multi_fn']\n+\tcflags += ['-DMULTI_FN_SUPPORTED']\n+endif\n",
    "prefixes": [
        "v2",
        "4/4"
    ]
}