get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43211,
    "url": "http://patches.dpdk.org/api/patches/43211/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180719083959.41480-5-pablo.de.lara.guarch@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20180719083959.41480-5-pablo.de.lara.guarch@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180719083959.41480-5-pablo.de.lara.guarch@intel.com",
    "date": "2018-07-19T08:39:58",
    "name": "[v2,4/5] examples/l2fwd-crypto: fix session mempool size",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "68304c0b878543e79e2371bda769c655760a0c62",
    "submitter": {
        "id": 9,
        "url": "http://patches.dpdk.org/api/people/9/?format=api",
        "name": "De Lara Guarch, Pablo",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "delegate": {
        "id": 22,
        "url": "http://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": "http://patches.dpdk.org/project/dpdk/patch/20180719083959.41480-5-pablo.de.lara.guarch@intel.com/mbox/",
    "series": [
        {
            "id": 677,
            "url": "http://patches.dpdk.org/api/series/677/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=677",
            "date": "2018-07-19T08:39:54",
            "name": "L2fwd-crypto fixes",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/677/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43211/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43211/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DBFF05B34;\n\tThu, 19 Jul 2018 18:47:02 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 755775B12\n\tfor <dev@dpdk.org>; Thu, 19 Jul 2018 18:46:59 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Jul 2018 09:46:57 -0700",
            "from silpixa00399466.ir.intel.com (HELO\n\tsilpixa00399466.ger.corp.intel.com) ([10.237.223.220])\n\tby fmsmga006.fm.intel.com with ESMTP; 19 Jul 2018 09:46:13 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,375,1526367600\"; d=\"scan'208\";a=\"247109927\"",
        "From": "Pablo de Lara <pablo.de.lara.guarch@intel.com>",
        "To": "declan.doherty@intel.com,\n\tfiona.trahe@intel.com",
        "Cc": "dev@dpdk.org,\n\tPablo de Lara <pablo.de.lara.guarch@intel.com>",
        "Date": "Thu, 19 Jul 2018 09:39:58 +0100",
        "Message-Id": "<20180719083959.41480-5-pablo.de.lara.guarch@intel.com>",
        "X-Mailer": "git-send-email 2.14.4",
        "In-Reply-To": "<20180719083959.41480-1-pablo.de.lara.guarch@intel.com>",
        "References": "<20180717103815.26841-1-pablo.de.lara.guarch@intel.com>\n\t<20180719083959.41480-1-pablo.de.lara.guarch@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 4/5] examples/l2fwd-crypto: fix session\n\tmempool size",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The session mempool size for this application depends\non the number of crypto devices that are capable\nof performing the operation given by the parameters on the app.\n\nHowever, previously this calculation was done before all devices\nwere checked, resulting in an incorrect number of sessions\nrequired.\n\nNow the calculation of the devices to be used is done first\n(checking the capabilities of the enabled devices),\nfollowed by the creation of the session pool, resulting\nin a correct number of objects needed for the sessions\nto be created.\n\nFixes: e3bcb99a5e13 (\"examples/l2fwd-crypto: limit number of sessions\")\n\nSigned-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>\n---\n examples/l2fwd-crypto/main.c | 272 +++++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 260 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c\nindex 15f6b856f..273c852f1 100644\n--- a/examples/l2fwd-crypto/main.c\n+++ b/examples/l2fwd-crypto/main.c\n@@ -1960,11 +1960,252 @@ check_iv_param(const struct rte_crypto_param_range *iv_range_size,\n \treturn 0;\n }\n \n+static int\n+check_capabilities(struct l2fwd_crypto_options *options, uint8_t cdev_id)\n+{\n+\tstruct rte_cryptodev_info dev_info;\n+\tconst struct rte_cryptodev_capabilities *cap;\n+\n+\trte_cryptodev_info_get(cdev_id, &dev_info);\n+\n+\t/* Set AEAD parameters */\n+\tif (options->xform_chain == L2FWD_CRYPTO_AEAD) {\n+\t\t/* Check if device supports AEAD algo */\n+\t\tcap = check_device_support_aead_algo(options, &dev_info,\n+\t\t\t\t\t\tcdev_id);\n+\t\tif (cap == NULL)\n+\t\t\treturn -1;\n+\n+\t\tif (check_iv_param(&cap->sym.aead.iv_size,\n+\t\t\t\toptions->aead_iv_param,\n+\t\t\t\toptions->aead_iv_random_size,\n+\t\t\t\toptions->aead_iv.length) != 0) {\n+\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\"Device %u does not support IV length\\n\",\n+\t\t\t\tcdev_id);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Check if length of provided AEAD key is supported\n+\t\t * by the algorithm chosen.\n+\t\t */\n+\t\tif (options->aead_key_param) {\n+\t\t\tif (check_supported_size(\n+\t\t\t\t\toptions->aead_xform.aead.key.length,\n+\t\t\t\t\tcap->sym.aead.key_size.min,\n+\t\t\t\t\tcap->sym.aead.key_size.max,\n+\t\t\t\t\tcap->sym.aead.key_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support \"\n+\t\t\t\t\t\"AEAD key length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t/*\n+\t\t * Check if length of the aead key to be randomly generated\n+\t\t * is supported by the algorithm chosen.\n+\t\t */\n+\t\t} else if (options->aead_key_random_size != -1) {\n+\t\t\tif (check_supported_size(options->aead_key_random_size,\n+\t\t\t\t\tcap->sym.aead.key_size.min,\n+\t\t\t\t\tcap->sym.aead.key_size.max,\n+\t\t\t\t\tcap->sym.aead.key_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support \"\n+\t\t\t\t\t\"AEAD key length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\n+\n+\t\t/*\n+\t\t * Check if length of provided AAD is supported\n+\t\t * by the algorithm chosen.\n+\t\t */\n+\t\tif (options->aad_param) {\n+\t\t\tif (check_supported_size(options->aad.length,\n+\t\t\t\t\tcap->sym.aead.aad_size.min,\n+\t\t\t\t\tcap->sym.aead.aad_size.max,\n+\t\t\t\t\tcap->sym.aead.aad_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support \"\n+\t\t\t\t\t\"AAD length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t/*\n+\t\t * Check if length of AAD to be randomly generated\n+\t\t * is supported by the algorithm chosen.\n+\t\t */\n+\t\t} else if (options->aad_random_size != -1) {\n+\t\t\tif (check_supported_size(options->aad_random_size,\n+\t\t\t\t\tcap->sym.aead.aad_size.min,\n+\t\t\t\t\tcap->sym.aead.aad_size.max,\n+\t\t\t\t\tcap->sym.aead.aad_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support \"\n+\t\t\t\t\t\"AAD length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\n+\t\t/* Check if digest size is supported by the algorithm. */\n+\t\tif (options->digest_size != -1) {\n+\t\t\tif (check_supported_size(options->digest_size,\n+\t\t\t\t\tcap->sym.aead.digest_size.min,\n+\t\t\t\t\tcap->sym.aead.digest_size.max,\n+\t\t\t\t\tcap->sym.aead.digest_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support \"\n+\t\t\t\t\t\"digest length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* Set cipher parameters */\n+\tif (options->xform_chain == L2FWD_CRYPTO_CIPHER_HASH ||\n+\t\t\toptions->xform_chain == L2FWD_CRYPTO_HASH_CIPHER ||\n+\t\t\toptions->xform_chain == L2FWD_CRYPTO_CIPHER_ONLY) {\n+\t\t/* Check if device supports cipher algo */\n+\t\tcap = check_device_support_cipher_algo(options, &dev_info,\n+\t\t\t\t\t\tcdev_id);\n+\t\tif (cap == NULL)\n+\t\t\treturn -1;\n+\n+\t\tif (check_iv_param(&cap->sym.cipher.iv_size,\n+\t\t\t\toptions->cipher_iv_param,\n+\t\t\t\toptions->cipher_iv_random_size,\n+\t\t\t\toptions->cipher_iv.length) != 0) {\n+\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\"Device %u does not support IV length\\n\",\n+\t\t\t\tcdev_id);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Check if length of provided cipher key is supported\n+\t\t * by the algorithm chosen.\n+\t\t */\n+\t\tif (options->ckey_param) {\n+\t\t\tif (check_supported_size(\n+\t\t\t\t\toptions->cipher_xform.cipher.key.length,\n+\t\t\t\t\tcap->sym.cipher.key_size.min,\n+\t\t\t\t\tcap->sym.cipher.key_size.max,\n+\t\t\t\t\tcap->sym.cipher.key_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support cipher \"\n+\t\t\t\t\t\"key length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t/*\n+\t\t * Check if length of the cipher key to be randomly generated\n+\t\t * is supported by the algorithm chosen.\n+\t\t */\n+\t\t} else if (options->ckey_random_size != -1) {\n+\t\t\tif (check_supported_size(options->ckey_random_size,\n+\t\t\t\t\tcap->sym.cipher.key_size.min,\n+\t\t\t\t\tcap->sym.cipher.key_size.max,\n+\t\t\t\t\tcap->sym.cipher.key_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support cipher \"\n+\t\t\t\t\t\"key length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* Set auth parameters */\n+\tif (options->xform_chain == L2FWD_CRYPTO_CIPHER_HASH ||\n+\t\t\toptions->xform_chain == L2FWD_CRYPTO_HASH_CIPHER ||\n+\t\t\toptions->xform_chain == L2FWD_CRYPTO_HASH_ONLY) {\n+\t\t/* Check if device supports auth algo */\n+\t\tcap = check_device_support_auth_algo(options, &dev_info,\n+\t\t\t\t\t\tcdev_id);\n+\t\tif (cap == NULL)\n+\t\t\treturn -1;\n+\n+\t\tif (check_iv_param(&cap->sym.auth.iv_size,\n+\t\t\t\toptions->auth_iv_param,\n+\t\t\t\toptions->auth_iv_random_size,\n+\t\t\t\toptions->auth_iv.length) != 0) {\n+\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\"Device %u does not support IV length\\n\",\n+\t\t\t\tcdev_id);\n+\t\t\treturn -1;\n+\t\t}\n+\t\t/*\n+\t\t * Check if length of provided auth key is supported\n+\t\t * by the algorithm chosen.\n+\t\t */\n+\t\tif (options->akey_param) {\n+\t\t\tif (check_supported_size(\n+\t\t\t\t\toptions->auth_xform.auth.key.length,\n+\t\t\t\t\tcap->sym.auth.key_size.min,\n+\t\t\t\t\tcap->sym.auth.key_size.max,\n+\t\t\t\t\tcap->sym.auth.key_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support auth \"\n+\t\t\t\t\t\"key length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t/*\n+\t\t * Check if length of the auth key to be randomly generated\n+\t\t * is supported by the algorithm chosen.\n+\t\t */\n+\t\t} else if (options->akey_random_size != -1) {\n+\t\t\tif (check_supported_size(options->akey_random_size,\n+\t\t\t\t\tcap->sym.auth.key_size.min,\n+\t\t\t\t\tcap->sym.auth.key_size.max,\n+\t\t\t\t\tcap->sym.auth.key_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support auth \"\n+\t\t\t\t\t\"key length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\n+\t\t/* Check if digest size is supported by the algorithm. */\n+\t\tif (options->digest_size != -1) {\n+\t\t\tif (check_supported_size(options->digest_size,\n+\t\t\t\t\tcap->sym.auth.digest_size.min,\n+\t\t\t\t\tcap->sym.auth.digest_size.max,\n+\t\t\t\t\tcap->sym.auth.digest_size.increment)\n+\t\t\t\t\t\t!= 0) {\n+\t\t\t\tRTE_LOG(DEBUG, USER1,\n+\t\t\t\t\t\"Device %u does not support \"\n+\t\t\t\t\t\"digest length\\n\",\n+\t\t\t\t\tcdev_id);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,\n \t\tuint8_t *enabled_cdevs)\n {\n-\tunsigned int cdev_id, cdev_count, enabled_cdev_count = 0;\n+\tuint8_t cdev_id, cdev_count, enabled_cdev_count = 0;\n \tconst struct rte_cryptodev_capabilities *cap;\n \tunsigned int sess_sz, max_sess_sz = 0;\n \tuint32_t sessions_needed = 0;\n@@ -1976,16 +2217,31 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,\n \t\treturn -1;\n \t}\n \n-\tfor (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {\n+\tfor (cdev_id = 0; cdev_id < cdev_count && enabled_cdev_count < nb_ports;\n+\t\t\tcdev_id++) {\n \t\tsess_sz = rte_cryptodev_sym_get_private_session_size(cdev_id);\n \t\tif (sess_sz > max_sess_sz)\n \t\t\tmax_sess_sz = sess_sz;\n+\n+\t\tif (check_cryptodev_mask(options, cdev_id) < 0)\n+\t\t\tcontinue;\n+\n+\t\tif (check_capabilities(options, cdev_id) < 0)\n+\t\t\tcontinue;\n+\n+\t\tl2fwd_enabled_crypto_mask |= (((uint64_t)1) << cdev_id);\n+\n+\t\tenabled_cdevs[cdev_id] = 1;\n+\t\tenabled_cdev_count++;\n \t}\n \n-\tfor (cdev_id = 0; cdev_id < cdev_count && enabled_cdev_count < nb_ports;\n-\t\t\tcdev_id++) {\n+\tfor (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {\n \t\tstruct rte_cryptodev_qp_conf qp_conf;\n \t\tstruct rte_cryptodev_info dev_info;\n+\n+\t\tif (enabled_cdevs[cdev_id] == 0)\n+\t\t\tcontinue;\n+\n \t\tretval = rte_cryptodev_socket_id(cdev_id);\n \n \t\tif (retval < 0) {\n@@ -2000,9 +2256,6 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,\n \t\t\t.socket_id = socket_id,\n \t\t};\n \n-\t\tif (check_cryptodev_mask(options, (uint8_t)cdev_id))\n-\t\t\tcontinue;\n-\n \t\trte_cryptodev_info_get(cdev_id, &dev_info);\n \n \t\t/*\n@@ -2349,11 +2602,6 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,\n \t\t\t\t\tcdev_id, retval);\n \t\t\treturn -1;\n \t\t}\n-\n-\t\tl2fwd_enabled_crypto_mask |= (((uint64_t)1) << cdev_id);\n-\n-\t\tenabled_cdevs[cdev_id] = 1;\n-\t\tenabled_cdev_count++;\n \t}\n \n \treturn enabled_cdev_count;\n",
    "prefixes": [
        "v2",
        "4/5"
    ]
}