Show a patch.

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

{
    "id": 73444,
    "url": "https://patches.dpdk.org/api/patches/73444/",
    "web_url": "https://patches.dpdk.org/patch/73444/",
    "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": "<20200707150239.13400-3-arkadiuszx.kusztal@intel.com>",
    "date": "2020-07-07T15:02:38",
    "name": "[v5,2/3] drivers/qat: add multi process handling of driver id",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ab03a37f69ea76d8267315808eead5fcf4c88183",
    "submitter": {
        "id": 452,
        "url": "https://patches.dpdk.org/api/people/452/",
        "name": "Arek Kusztal",
        "email": "arkadiuszx.kusztal@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/73444/mbox/",
    "series": [
        {
            "id": 10855,
            "url": "https://patches.dpdk.org/api/series/10855/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10855",
            "date": "2020-07-07T15:02:36",
            "name": "drivers/qat: improve handling of multi process",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/10855/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73444/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/73444/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "References": "<20200707150239.13400-1-arkadiuszx.kusztal@intel.com>",
        "X-Mailman-Version": "2.1.15",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9675\"; a=\"127204242\"",
            "E=Sophos;i=\"5.75,324,1589266800\"; d=\"scan'208\";a=\"127204242\"",
            "E=Sophos;i=\"5.75,324,1589266800\"; d=\"scan'208\";a=\"297415582\""
        ],
        "From": "Arek Kusztal <arkadiuszx.kusztal@intel.com>",
        "IronPort-SDR": [
            "\n STif4UC+4GsMtlhIZNwS85DzQQtZJLo8EJCazLD0V4lmAeTiCJlELvEEsDX9elcYsDoJtK17zL\n yhmCF2uEtj1A==",
            "\n O1OJ+4witIS/Ej/nMAIUcSAoA7QiUc8pDAmoDDRbfV2M3diYbfjKZdnKyEzEy+pPOSt5Wyfqit\n dOrtjfbQxHlg=="
        ],
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-ExtLoop1": "1",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<20200707150239.13400-3-arkadiuszx.kusztal@intel.com>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 7D302A00BE;\n\tTue,  7 Jul 2020 17:03:42 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 14E351DE95;\n\tTue,  7 Jul 2020 17:03:23 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by dpdk.org (Postfix) with ESMTP id E34EF1DE84\n for <dev@dpdk.org>; Tue,  7 Jul 2020 17:03:20 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 Jul 2020 08:03:20 -0700",
            "from akusztax-mobl.ger.corp.intel.com ([10.104.121.84])\n by orsmga002.jf.intel.com with ESMTP; 07 Jul 2020 08:03:18 -0700"
        ],
        "X-Mailer": "git-send-email 2.19.1.windows.1",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v5 2/3] drivers/qat: add multi process handling\n\tof driver id",
        "Precedence": "list",
        "Date": "Tue,  7 Jul 2020 17:02:38 +0200",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Amp-File-Uploaded": "False",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Cc": "akhil.goyal@nxp.com, fiona.trahe@intel.com,\n Arek Kusztal <arkadiuszx.kusztal@intel.com>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "In-Reply-To": "<20200707150239.13400-1-arkadiuszx.kusztal@intel.com>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "MIME-Version": "1.0",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Content-Transfer-Encoding": "8bit",
        "To": "dev@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "As cryptodev driver_id is allocated per-process, a corner case exists where\nbinaries for primary and secondary processes could have different\ndriver_ids if built differently. Add checking in qat PMD to catch and\nhandle the case where driver_ids are inconsistent.\n\nSigned-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>\n---\n drivers/common/qat/qat_device.h   |  6 ++++++\n drivers/crypto/qat/qat_asym.c     |  4 ++--\n drivers/crypto/qat/qat_asym_pmd.c | 21 +++++++++++++++++----\n drivers/crypto/qat/qat_asym_pmd.h |  2 +-\n drivers/crypto/qat/qat_sym.c      |  2 +-\n drivers/crypto/qat/qat_sym.h      |  2 +-\n drivers/crypto/qat/qat_sym_pmd.c  | 27 +++++++++++++++++++++++----\n drivers/crypto/qat/qat_sym_pmd.h  |  2 +-\n 8 files changed, 52 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h\nindex b5fe394..e6337c6 100644\n--- a/drivers/common/qat/qat_device.h\n+++ b/drivers/common/qat/qat_device.h\n@@ -92,10 +92,16 @@ struct qat_pci_device {\n \tstruct qat_sym_dev_private *sym_dev;\n \t/**< link back to cryptodev private data */\n \n+\tint qat_sym_driver_id;\n+\t/**< Symmetric driver id used by this device */\n+\n \t/* Data relating to asymmetric crypto service */\n \tstruct qat_asym_dev_private *asym_dev;\n \t/**< link back to cryptodev private data */\n \n+\tint qat_asym_driver_id;\n+\t/**< Symmetric driver id used by this device */\n+\n \t/* Data relating to compression service */\n \tstruct qat_comp_dev_private *comp_dev;\n \t/**< link back to compressdev private data */\ndiff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c\nindex ae0dd79..8597381 100644\n--- a/drivers/crypto/qat/qat_asym.c\n+++ b/drivers/crypto/qat/qat_asym.c\n@@ -475,7 +475,7 @@ qat_asym_build_request(void *in_op,\n \tif (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {\n \t\tctx = (struct qat_asym_session *)\n \t\t\tget_asym_session_private_data(\n-\t\t\top->asym->session, cryptodev_qat_asym_driver_id);\n+\t\t\top->asym->session, qat_asym_driver_id);\n \t\tif (unlikely(ctx == NULL)) {\n \t\t\tQAT_LOG(ERR, \"Session has not been created for this device\");\n \t\t\tgoto error;\n@@ -693,7 +693,7 @@ qat_asym_process_response(void **op, uint8_t *resp,\n \n \tif (rx_op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {\n \t\tctx = (struct qat_asym_session *)get_asym_session_private_data(\n-\t\t\trx_op->asym->session, cryptodev_qat_asym_driver_id);\n+\t\t\trx_op->asym->session, qat_asym_driver_id);\n \t\tqat_asym_collect_response(rx_op, cookie, ctx->xform);\n \t} else if (rx_op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {\n \t\tqat_asym_collect_response(rx_op, cookie, rx_op->asym->xform);\ndiff --git a/drivers/crypto/qat/qat_asym_pmd.c b/drivers/crypto/qat/qat_asym_pmd.c\nindex cc448cd..d584ac7 100644\n--- a/drivers/crypto/qat/qat_asym_pmd.c\n+++ b/drivers/crypto/qat/qat_asym_pmd.c\n@@ -11,7 +11,7 @@\n #include \"qat_sym_capabilities.h\"\n #include \"qat_asym_capabilities.h\"\n \n-uint8_t cryptodev_qat_asym_driver_id;\n+uint8_t qat_asym_driver_id;\n \n static const struct rte_cryptodev_capabilities qat_gen1_asym_capabilities[] = {\n \tQAT_BASE_GEN1_ASYM_CAPABILITIES,\n@@ -63,7 +63,7 @@ static void qat_asym_dev_info_get(struct rte_cryptodev *dev,\n \t\t\t\t\t\t\tQAT_SERVICE_ASYMMETRIC);\n \t\tinfo->feature_flags = dev->feature_flags;\n \t\tinfo->capabilities = internals->qat_dev_capabilities;\n-\t\tinfo->driver_id = cryptodev_qat_asym_driver_id;\n+\t\tinfo->driver_id = qat_asym_driver_id;\n \t\t/* No limit of number of sessions */\n \t\tinfo->sym.max_nb_sessions = 0;\n \t}\n@@ -251,6 +251,19 @@ qat_asym_dev_create(struct qat_pci_device *qat_pci_dev,\n \tstruct rte_cryptodev *cryptodev;\n \tstruct qat_asym_dev_private *internals;\n \n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\tqat_pci_dev->qat_asym_driver_id =\n+\t\t\t\tqat_asym_driver_id;\n+\t} else if (rte_eal_process_type() == RTE_PROC_SECONDARY) {\n+\t\tif (qat_pci_dev->qat_asym_driver_id !=\n+\t\t\t\tqat_asym_driver_id) {\n+\t\t\tQAT_LOG(ERR,\n+\t\t\t\t\"Device %s have different driver id than corresponding device in primary process\",\n+\t\t\t\tname);\n+\t\t\treturn -(EFAULT);\n+\t\t}\n+\t}\n+\n \tsnprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, \"%s_%s\",\n \t\t\tqat_pci_dev->name, \"asym\");\n \tQAT_LOG(DEBUG, \"Creating QAT ASYM device %s\\n\", name);\n@@ -268,7 +281,7 @@ qat_asym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t\treturn -ENODEV;\n \n \tqat_dev_instance->asym_rte_dev.name = cryptodev->data->name;\n-\tcryptodev->driver_id = cryptodev_qat_asym_driver_id;\n+\tcryptodev->driver_id = qat_asym_driver_id;\n \tcryptodev->dev_ops = &crypto_qat_ops;\n \n \tcryptodev->enqueue_burst = qat_asym_pmd_enqueue_op_burst;\n@@ -326,4 +339,4 @@ qat_asym_dev_destroy(struct qat_pci_device *qat_pci_dev)\n static struct cryptodev_driver qat_crypto_drv;\n RTE_PMD_REGISTER_CRYPTO_DRIVER(qat_crypto_drv,\n \t\tcryptodev_qat_asym_driver,\n-\t\tcryptodev_qat_asym_driver_id);\n+\t\tqat_asym_driver_id);\ndiff --git a/drivers/crypto/qat/qat_asym_pmd.h b/drivers/crypto/qat/qat_asym_pmd.h\nindex 0535bc6..ddf413f 100644\n--- a/drivers/crypto/qat/qat_asym_pmd.h\n+++ b/drivers/crypto/qat/qat_asym_pmd.h\n@@ -13,7 +13,7 @@\n #define CRYPTODEV_NAME_QAT_ASYM_PMD\tcrypto_qat_asym\n \n \n-extern uint8_t cryptodev_qat_asym_driver_id;\n+extern uint8_t qat_asym_driver_id;\n \n /** private data structure for a QAT device.\n  * This QAT device is a device offering only asymmetric crypto service,\ndiff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c\nindex 55251d1..6d568ab 100644\n--- a/drivers/crypto/qat/qat_sym.c\n+++ b/drivers/crypto/qat/qat_sym.c\n@@ -206,7 +206,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,\n \t\treturn -EINVAL;\n \t} else if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {\n \t\tctx = (struct qat_sym_session *)get_sym_session_private_data(\n-\t\t\t\top->sym->session, cryptodev_qat_driver_id);\n+\t\t\t\top->sym->session, qat_sym_driver_id);\n #ifdef RTE_LIBRTE_SECURITY\n \t} else {\n \t\tctx = (struct qat_sym_session *)get_sec_session_private_data(\ndiff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h\nindex 02e7239..dbca74e 100644\n--- a/drivers/crypto/qat/qat_sym.h\n+++ b/drivers/crypto/qat/qat_sym.h\n@@ -197,7 +197,7 @@ qat_sym_process_response(void **op, uint8_t *resp)\n \t\t\tsess = (struct qat_sym_session *)\n \t\t\t\t\tget_sym_session_private_data(\n \t\t\t\t\trx_op->sym->session,\n-\t\t\t\t\tcryptodev_qat_driver_id);\n+\t\t\t\t\tqat_sym_driver_id);\n \t\t}\n \n \t\trx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;\ndiff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c\nindex bdcb42e..6ef9a34 100644\n--- a/drivers/crypto/qat/qat_sym_pmd.c\n+++ b/drivers/crypto/qat/qat_sym_pmd.c\n@@ -19,7 +19,7 @@\n \n #define MIXED_CRYPTO_MIN_FW_VER 0x04090000\n \n-uint8_t cryptodev_qat_driver_id;\n+uint8_t qat_sym_driver_id;\n \n static const struct rte_cryptodev_capabilities qat_gen1_sym_capabilities[] = {\n \tQAT_BASE_GEN1_SYM_CAPABILITIES,\n@@ -92,7 +92,7 @@ static void qat_sym_dev_info_get(struct rte_cryptodev *dev,\n \t\t\tqat_qps_per_service(sym_hw_qps, QAT_SERVICE_SYMMETRIC);\n \t\tinfo->feature_flags = dev->feature_flags;\n \t\tinfo->capabilities = internals->qat_dev_capabilities;\n-\t\tinfo->driver_id = cryptodev_qat_driver_id;\n+\t\tinfo->driver_id = qat_sym_driver_id;\n \t\t/* No limit of number of sessions */\n \t\tinfo->sym.max_nb_sessions = 0;\n \t}\n@@ -317,6 +317,25 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \tstruct rte_cryptodev *cryptodev;\n \tstruct qat_sym_dev_private *internals;\n \n+\t/*\n+\t * All processes must use same driver id so they can share sessions.\n+\t * Store driver_id so we can validate that all processes have the same\n+\t * value, typically they have, but could differ if binaries built\n+\t * separately.\n+\t */\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\tqat_pci_dev->qat_sym_driver_id =\n+\t\t\t\tqat_sym_driver_id;\n+\t} else if (rte_eal_process_type() == RTE_PROC_SECONDARY) {\n+\t\tif (qat_pci_dev->qat_sym_driver_id !=\n+\t\t\t\tqat_sym_driver_id) {\n+\t\t\tQAT_LOG(ERR,\n+\t\t\t\t\"Device %s have different driver id than corresponding device in primary process\",\n+\t\t\t\tname);\n+\t\t\treturn -(EFAULT);\n+\t\t}\n+\t}\n+\n #ifdef RTE_LIBRTE_SECURITY\n \tstruct rte_security_ctx *security_instance;\n #endif\n@@ -338,7 +357,7 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,\n \t\treturn -ENODEV;\n \n \tqat_dev_instance->sym_rte_dev.name = cryptodev->data->name;\n-\tcryptodev->driver_id = cryptodev_qat_driver_id;\n+\tcryptodev->driver_id = qat_sym_driver_id;\n \tcryptodev->dev_ops = &crypto_qat_ops;\n \n \tcryptodev->enqueue_burst = qat_sym_pmd_enqueue_op_burst;\n@@ -434,4 +453,4 @@ qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev)\n static struct cryptodev_driver qat_crypto_drv;\n RTE_PMD_REGISTER_CRYPTO_DRIVER(qat_crypto_drv,\n \t\tcryptodev_qat_sym_driver,\n-\t\tcryptodev_qat_driver_id);\n+\t\tqat_sym_driver_id);\ndiff --git a/drivers/crypto/qat/qat_sym_pmd.h b/drivers/crypto/qat/qat_sym_pmd.h\nindex c625fef..cf4e1a0 100644\n--- a/drivers/crypto/qat/qat_sym_pmd.h\n+++ b/drivers/crypto/qat/qat_sym_pmd.h\n@@ -23,7 +23,7 @@\n #define QAT_SYM_CAP_MIXED_CRYPTO\t(1 << 0)\n #define QAT_SYM_CAP_VALID\t\t(1 << 31)\n \n-extern uint8_t cryptodev_qat_driver_id;\n+extern uint8_t qat_sym_driver_id;\n \n /** private data structure for a QAT device.\n  * This QAT device is a device offering only symmetric crypto service,\n",
    "prefixes": [
        "v5",
        "2/3"
    ]
}