Show a patch.

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

{
    "id": 74495,
    "url": "https://patches.dpdk.org/api/patches/74495/",
    "web_url": "https://patches.dpdk.org/patch/74495/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20200720121621.23628-2-david.coyle@intel.com>",
    "date": "2020-07-20T12:16:20",
    "name": "[v2,1/2] crypto/qat: improve security instance setup",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "21d7b3e99adc9a04885a28945717a282585f6284",
    "submitter": {
        "id": 961,
        "url": "https://patches.dpdk.org/api/people/961/",
        "name": "Coyle, David",
        "email": "david.coyle@intel.com"
    },
    "delegate": {
        "id": 6690,
        "url": "https://patches.dpdk.org/api/users/6690/",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "akhil.goyal@nxp.com"
    },
    "mbox": "https://patches.dpdk.org/patch/74495/mbox/",
    "series": [
        {
            "id": 11171,
            "url": "https://patches.dpdk.org/api/series/11171/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11171",
            "date": "2020-07-20T12:16:19",
            "name": "improve security instance setup",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/11171/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74495/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74495/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9687\"; a=\"214578332\"",
            "E=Sophos;i=\"5.75,375,1589266800\"; d=\"scan'208\";a=\"214578332\"",
            "E=Sophos;i=\"5.75,375,1589266800\"; d=\"scan'208\";a=\"271422847\""
        ],
        "IronPort-SDR": [
            "\n NVpYM8Y17Ci/l1aizHyU8M+BP0Qw4a3njjlti5U95bzDEJhQz8deNz5gYBY+n6gmbpMtiLIGbX\n h1BawbVooG6w==",
            "\n hjGmqfAEpHr+CkIzkS0dZtL0wcwbtQpTn6N6IAq1C4hNM8Gnzx+HEOIN+fMlz/T5wQwpEHQ676\n ib15PMhZ5r0w=="
        ],
        "X-Amp-File-Uploaded": "False",
        "Precedence": "list",
        "X-Mailman-Version": "2.1.15",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<20200716153600.66071-1-david.coyle@intel.com>\n <20200720121621.23628-1-david.coyle@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 1/2] crypto/qat: improve security instance\n\tsetup",
        "Sender": "\"dev\" <dev-bounces@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 52ACDA0540;\n\tMon, 20 Jul 2020 14:41:08 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2266D2C38;\n\tMon, 20 Jul 2020 14:41:04 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by dpdk.org (Postfix) with ESMTP id EDDD81DBB\n for <dev@dpdk.org>; Mon, 20 Jul 2020 14:41:00 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 20 Jul 2020 05:40:59 -0700",
            "from silpixa00399912.ir.intel.com (HELO\n silpixa00399912.ger.corp.intel.com) ([10.237.223.64])\n by fmsmga008.fm.intel.com with ESMTP; 20 Jul 2020 05:40:56 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Mailer": "git-send-email 2.17.1",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-ExtLoop1": "1",
        "Date": "Mon, 20 Jul 2020 13:16:20 +0100",
        "To": "akhil.goyal@nxp.com, declan.doherty@intel.com,\n pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com",
        "From": "David Coyle <david.coyle@intel.com>",
        "In-Reply-To": "<20200720121621.23628-1-david.coyle@intel.com>",
        "Cc": "dev@dpdk.org, brendan.ryan@intel.com, mairtin.oloingsigh@intel.com,\n David Coyle <david.coyle@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20200720121621.23628-2-david.coyle@intel.com>",
        "Return-Path": "<dev-bounces@dpdk.org>"
    },
    "content": "This patch makes some improvements to the security instance setup for\nthe QAT SYM PMD, as follows:\n- fix potential memory leak where the security instance was not freed if\n  an error occurred later in the device creation\n- tidy-up security instance initialization code by moving it all,\n  including enabling the RTE_CRYPTODEV_FF_SECURITY feature, into one\n  '#ifdef RTE_LIBRTE_SECURITY' block\n\nFixes: 6f0ef237404b (\"crypto/qat: support DOCSIS protocol\")\n\nSigned-off-by: David Coyle <david.coyle@intel.com>\nAcked-by: Fiona Trahe <fiona.trahe@intel.com>\n---\n drivers/crypto/qat/qat_sym_pmd.c | 42 ++++++++++++++++++--------------\n 1 file changed, 24 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c\nindex c7e323cce..43870ac04 100644\n--- a/drivers/crypto/qat/qat_sym_pmd.c\n+++ b/drivers/crypto/qat/qat_sym_pmd.c\n@@ -310,7 +310,7 @@ int\n qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t\tstruct qat_dev_cmd_param *qat_dev_cmd_param __rte_unused)\n {\n-\tint i = 0;\n+\tint i = 0, ret = 0;\n \tstruct qat_device_info *qat_dev_instance =\n \t\t\t&qat_pci_devs[qat_pci_dev->qat_dev_id];\n \n@@ -346,10 +346,6 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t\t}\n \t}\n \n-#ifdef RTE_LIBRTE_SECURITY\n-\tstruct rte_security_ctx *security_instance;\n-#endif\n-\n \tsnprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, \"%s_%s\",\n \t\t\tqat_pci_dev->name, \"sym\");\n \tQAT_LOG(DEBUG, \"Creating QAT SYM device %s\", name);\n@@ -381,8 +377,7 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t\t\tRTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |\n \t\t\tRTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT |\n \t\t\tRTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT |\n-\t\t\tRTE_CRYPTODEV_FF_DIGEST_ENCRYPTED |\n-\t\t\tRTE_CRYPTODEV_FF_SECURITY;\n+\t\t\tRTE_CRYPTODEV_FF_DIGEST_ENCRYPTED;\n \n \tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n \t\treturn 0;\n@@ -392,19 +387,21 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t\t\tqat_pci_dev->qat_dev_gen);\n \n #ifdef RTE_LIBRTE_SECURITY\n+\tstruct rte_security_ctx *security_instance;\n \tsecurity_instance = rte_malloc(\"qat_sec\",\n \t\t\t\tsizeof(struct rte_security_ctx),\n \t\t\t\tRTE_CACHE_LINE_SIZE);\n \tif (security_instance == NULL) {\n \t\tQAT_LOG(ERR, \"rte_security_ctx memory alloc failed\");\n-\t\trte_cryptodev_pmd_destroy(cryptodev);\n-\t\treturn -ENOMEM;\n+\t\tret = -ENOMEM;\n+\t\tgoto error;\n \t}\n \n \tsecurity_instance->device = (void *)cryptodev;\n \tsecurity_instance->ops = &security_qat_ops;\n \tsecurity_instance->sess_cnt = 0;\n \tcryptodev->security_ctx = security_instance;\n+\tcryptodev->feature_flags |= RTE_CRYPTODEV_FF_SECURITY;\n #endif\n \n \tinternals = cryptodev->data->dev_private;\n@@ -428,10 +425,8 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t\tQAT_LOG(DEBUG,\n \t\t\t\"QAT gen %d capabilities unknown\",\n \t\t\tqat_pci_dev->qat_dev_gen);\n-\t\trte_cryptodev_pmd_destroy(cryptodev);\n-\t\tmemset(&qat_dev_instance->sym_rte_dev, 0,\n-\t\t\tsizeof(qat_dev_instance->sym_rte_dev));\n-\t\treturn -(EINVAL);\n+\t\tret = -(EINVAL);\n+\t\tgoto error;\n \t}\n \n \tinternals->capa_mz = rte_memzone_lookup(capa_memz_name);\n@@ -442,12 +437,11 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t}\n \tif (internals->capa_mz == NULL) {\n \t\tQAT_LOG(DEBUG,\n-\t\t\t\"Error allocating memzone for capabilities, destroying PMD for %s\",\n+\t\t\t\"Error allocating memzone for capabilities, destroying \"\n+\t\t\t\"PMD for %s\",\n \t\t\tname);\n-\t\trte_cryptodev_pmd_destroy(cryptodev);\n-\t\tmemset(&qat_dev_instance->sym_rte_dev, 0,\n-\t\t\tsizeof(qat_dev_instance->sym_rte_dev));\n-\t\treturn -EFAULT;\n+\t\tret = -EFAULT;\n+\t\tgoto error;\n \t}\n \n \tmemcpy(internals->capa_mz->addr, capabilities, capa_size);\n@@ -467,6 +461,17 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t\t\tcryptodev->data->name, internals->sym_dev_id);\n \n \treturn 0;\n+\n+error:\n+#ifdef RTE_LIBRTE_SECURITY\n+\trte_free(cryptodev->security_ctx);\n+\tcryptodev->security_ctx = NULL;\n+#endif\n+\trte_cryptodev_pmd_destroy(cryptodev);\n+\tmemset(&qat_dev_instance->sym_rte_dev, 0,\n+\t\tsizeof(qat_dev_instance->sym_rte_dev));\n+\n+\treturn ret;\n }\n \n int\n@@ -485,6 +490,7 @@ qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev)\n \tcryptodev = rte_cryptodev_pmd_get_dev(qat_pci_dev->sym_dev->sym_dev_id);\n #ifdef RTE_LIBRTE_SECURITY\n \trte_free(cryptodev->security_ctx);\n+\tcryptodev->security_ctx = NULL;\n #endif\n \trte_cryptodev_pmd_destroy(cryptodev);\n \tqat_pci_devs[qat_pci_dev->qat_dev_id].sym_rte_dev.name = NULL;\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}