get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41052,
    "url": "http://patches.dpdk.org/api/patches/41052/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1528892062-4997-22-git-send-email-tomaszx.jozwiak@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": "<1528892062-4997-22-git-send-email-tomaszx.jozwiak@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1528892062-4997-22-git-send-email-tomaszx.jozwiak@intel.com",
    "date": "2018-06-13T12:14:05",
    "name": "[v3,21/38] crypto/qat: use common stats structures",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "0be5cb90ea43e36cbd8b2c44339b4ae1c78cc01c",
    "submitter": {
        "id": 949,
        "url": "http://patches.dpdk.org/api/people/949/?format=api",
        "name": "Tomasz Jozwiak",
        "email": "tomaszx.jozwiak@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/1528892062-4997-22-git-send-email-tomaszx.jozwiak@intel.com/mbox/",
    "series": [
        {
            "id": 111,
            "url": "http://patches.dpdk.org/api/series/111/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=111",
            "date": "2018-06-13T12:13:44",
            "name": "crypto/qat: refactor to support multiple services",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/111/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41052/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/41052/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "X-BeenThere": "dev@dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "From": "Tomasz Jozwiak <tomaszx.jozwiak@intel.com>",
        "To": "fiona.trahe@intel.com,\n\ttomaszx.jozwiak@intel.com,\n\tdev@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "X-Amp-File-Uploaded": "False",
        "References": "<1523040732-3290-1-git-send-email-fiona.trahe@intel.com>\n\t<1528892062-4997-1-git-send-email-tomaszx.jozwiak@intel.com>",
        "In-Reply-To": "<1528892062-4997-1-git-send-email-tomaszx.jozwiak@intel.com>",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "X-Mailer": "git-send-email 2.7.4",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9F28E1EFA8;\n\tWed, 13 Jun 2018 14:15:15 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id EC6431EF52\n\tfor <dev@dpdk.org>; Wed, 13 Jun 2018 14:15:01 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Jun 2018 05:14:58 -0700",
            "from tjozwiax-mobl.ger.corp.intel.com (HELO localhost.localdomain)\n\t([10.103.104.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 13 Jun 2018 05:14:53 -0700"
        ],
        "X-Original-To": "patchwork@dpdk.org",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,218,1526367600\"; d=\"scan'208\";a=\"63727759\"",
        "Subject": "[dpdk-dev] [PATCH v3 21/38] crypto/qat: use common stats structures",
        "Date": "Wed, 13 Jun 2018 14:14:05 +0200",
        "Message-Id": "<1528892062-4997-22-git-send-email-tomaszx.jozwiak@intel.com>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Precedence": "list"
    },
    "content": "From: Fiona Trahe <fiona.trahe@intel.com>\n\nSplit qat_sym_stats_get/reset into 2 functions, a wrapper function calling\na new qat_stats_get/reset function which can be called per service.\nRemove cryptodev stats struct from qat_qp, replace with qat_common_stats.\nAdd links for qat_qp into qat_pci_device using an array per service to\navoid need for a lock and so qp_id for the service can be used as index.\n\nSigned-off-by: Fiona Trahe <fiona.trahe@intel.com>\n---\n drivers/crypto/qat/qat_common.h | 13 +++++\n drivers/crypto/qat/qat_device.c |  1 +\n drivers/crypto/qat/qat_device.h |  3 ++\n drivers/crypto/qat/qat_qp.h     |  2 +-\n drivers/crypto/qat/qat_sym.c    | 86 ++++++++++++++++++++++++++++-----\n 5 files changed, 91 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/drivers/crypto/qat/qat_common.h b/drivers/crypto/qat/qat_common.h\nindex 63e5569ea..fcf5c4c09 100644\n--- a/drivers/crypto/qat/qat_common.h\n+++ b/drivers/crypto/qat/qat_common.h\n@@ -49,6 +49,19 @@ struct qat_sgl {\n \tstruct qat_flat_buf buffers[QAT_SGL_MAX_NUMBER];\n } __rte_packed __rte_cache_aligned;\n \n+/** Common, i.e. not service-specific, statistics */\n+struct qat_common_stats {\n+\tuint64_t enqueued_count;\n+\t/**< Count of all operations enqueued */\n+\tuint64_t dequeued_count;\n+\t/**< Count of all operations dequeued */\n+\n+\tuint64_t enqueue_err_count;\n+\t/**< Total error count on operations enqueued */\n+\tuint64_t dequeue_err_count;\n+\t/**< Total error count on operations dequeued */\n+};\n+\n int\n qat_sgl_fill_array(struct rte_mbuf *buf, uint64_t buf_start,\n \t\tstruct qat_sgl *list, uint32_t data_len);\ndiff --git a/drivers/crypto/qat/qat_device.c b/drivers/crypto/qat/qat_device.c\nindex 8ad3162e1..4dfbc84c8 100644\n--- a/drivers/crypto/qat/qat_device.c\n+++ b/drivers/crypto/qat/qat_device.c\n@@ -148,6 +148,7 @@ qat_pci_device_allocate(struct rte_pci_device *pci_dev)\n \t}\n \n \tqat_dev = qat_pci_get_dev(qat_dev_id);\n+\tmemset(qat_dev, 0, sizeof(*qat_dev));\n \tsnprintf(qat_dev->name, QAT_DEV_NAME_MAX_LEN, \"%s\", name);\n \tqat_dev->qat_dev_id = qat_dev_id;\n \tqat_dev->pci_dev = pci_dev;\ndiff --git a/drivers/crypto/qat/qat_device.h b/drivers/crypto/qat/qat_device.h\nindex 855bf6c1c..d1615e2a7 100644\n--- a/drivers/crypto/qat/qat_device.h\n+++ b/drivers/crypto/qat/qat_device.h\n@@ -50,6 +50,9 @@ struct qat_pci_device {\n \tuint8_t attached : 1;\n \t/**< Flag indicating the device is attached */\n \n+\tstruct qat_qp *qps_in_use[QAT_MAX_SERVICES][ADF_MAX_QPS_PER_BUNDLE];\n+\t/**< links to qps set up for each service, index same as on API */\n+\n \t/* Data relating to symmetric crypto service */\n \tstruct qat_sym_dev_private *sym_dev;\n \t/**< link back to cryptodev private data */\ndiff --git a/drivers/crypto/qat/qat_qp.h b/drivers/crypto/qat/qat_qp.h\nindex d482d5732..49d9f29d3 100644\n--- a/drivers/crypto/qat/qat_qp.h\n+++ b/drivers/crypto/qat/qat_qp.h\n@@ -78,7 +78,7 @@ struct qat_qp {\n \tuint16_t\t\tinflights16;\n \tstruct\tqat_queue\ttx_q;\n \tstruct\tqat_queue\trx_q;\n-\tstruct\trte_cryptodev_stats stats;\n+\tstruct\tqat_common_stats stats;\n \tstruct rte_mempool *op_cookie_pool;\n \tvoid **op_cookies;\n \tuint32_t nb_descriptors;\ndiff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c\nindex e77fbe4c4..8007e25d6 100644\n--- a/drivers/crypto/qat/qat_sym.c\n+++ b/drivers/crypto/qat/qat_sym.c\n@@ -717,20 +717,24 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,\n }\n \n \n-void qat_sym_stats_get(struct rte_cryptodev *dev,\n-\t\tstruct rte_cryptodev_stats *stats)\n+static void qat_stats_get(struct qat_pci_device *dev,\n+\t\tstruct qat_common_stats *stats,\n+\t\tenum qat_service_type service)\n {\n \tint i;\n-\tstruct qat_qp **qp = (struct qat_qp **)(dev->data->queue_pairs);\n+\tstruct qat_qp **qp;\n \n-\tPMD_INIT_FUNC_TRACE();\n-\tif (stats == NULL) {\n-\t\tPMD_DRV_LOG(ERR, \"invalid stats ptr NULL\");\n+\tif (stats == NULL || dev == NULL || service >= QAT_SERVICE_INVALID) {\n+\t\tPMD_DRV_LOG(ERR, \"invalid param: stats %p, dev %p, service %d\",\n+\t\t\t\tstats, dev, service);\n \t\treturn;\n \t}\n-\tfor (i = 0; i < dev->data->nb_queue_pairs; i++) {\n+\n+\tqp = dev->qps_in_use[service];\n+\tfor (i = 0; i < ADF_MAX_QPS_PER_BUNDLE; i++) {\n \t\tif (qp[i] == NULL) {\n-\t\t\tPMD_DRV_LOG(DEBUG, \"Uninitialised queue pair\");\n+\t\t\tPMD_DRV_LOG(DEBUG, \"Service %d Uninitialised qp %d\",\n+\t\t\t\t\tservice, i);\n \t\t\tcontinue;\n \t\t}\n \n@@ -741,22 +745,74 @@ void qat_sym_stats_get(struct rte_cryptodev *dev,\n \t}\n }\n \n-void qat_sym_stats_reset(struct rte_cryptodev *dev)\n+void qat_sym_stats_get(struct rte_cryptodev *dev,\n+\t\tstruct rte_cryptodev_stats *stats)\n+{\n+\tstruct qat_common_stats qat_stats = {0};\n+\tstruct qat_sym_dev_private *qat_priv;\n+\n+\tif (stats == NULL || dev == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"invalid ptr: stats %p, dev %p\", stats, dev);\n+\t\treturn;\n+\t}\n+\tqat_priv = dev->data->dev_private;\n+\n+\tqat_stats_get(qat_priv->qat_dev, &qat_stats, QAT_SERVICE_SYMMETRIC);\n+\tstats->enqueued_count = qat_stats.enqueued_count;\n+\tstats->dequeued_count = qat_stats.dequeued_count;\n+\tstats->enqueue_err_count = qat_stats.enqueue_err_count;\n+\tstats->dequeue_err_count = qat_stats.dequeue_err_count;\n+}\n+\n+static void qat_stats_reset(struct qat_pci_device *dev,\n+\t\tenum qat_service_type service)\n {\n \tint i;\n-\tstruct qat_qp **qp = (struct qat_qp **)(dev->data->queue_pairs);\n+\tstruct qat_qp **qp;\n \n-\tPMD_INIT_FUNC_TRACE();\n-\tfor (i = 0; i < dev->data->nb_queue_pairs; i++)\n+\tif (dev == NULL || service >= QAT_SERVICE_INVALID) {\n+\t\tPMD_DRV_LOG(ERR, \"invalid param: dev %p, service %d\",\n+\t\t\t\tdev, service);\n+\t\treturn;\n+\t}\n+\n+\tqp = dev->qps_in_use[service];\n+\tfor (i = 0; i < ADF_MAX_QPS_PER_BUNDLE; i++) {\n+\t\tif (qp[i] == NULL) {\n+\t\t\tPMD_DRV_LOG(DEBUG, \"Service %d Uninitialised qp %d\",\n+\t\t\t\t\tservice, i);\n+\t\t\tcontinue;\n+\t\t}\n \t\tmemset(&(qp[i]->stats), 0, sizeof(qp[i]->stats));\n-\tPMD_DRV_LOG(DEBUG, \"QAT crypto: stats cleared\");\n+\t}\n+\n+\tPMD_DRV_LOG(DEBUG, \"QAT crypto: %d stats cleared\", service);\n+}\n+\n+void qat_sym_stats_reset(struct rte_cryptodev *dev)\n+{\n+\tstruct qat_sym_dev_private *qat_priv;\n+\n+\tif (dev == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"invalid cryptodev ptr %p\", dev);\n+\t\treturn;\n+\t}\n+\tqat_priv = dev->data->dev_private;\n+\n+\tqat_stats_reset(qat_priv->qat_dev, QAT_SERVICE_SYMMETRIC);\n+\n }\n \n int qat_sym_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id)\n {\n+\tstruct qat_sym_dev_private *qat_private = dev->data->dev_private;\n+\n \tPMD_DRV_LOG(DEBUG, \"Release sym qp %u on device %d\",\n \t\t\t\tqueue_pair_id, dev->data->dev_id);\n \n+\tqat_private->qat_dev->qps_in_use[QAT_SERVICE_SYMMETRIC][queue_pair_id]\n+\t\t\t\t\t\t= NULL;\n+\n \treturn qat_qp_release((struct qat_qp **)\n \t\t\t&(dev->data->queue_pairs[queue_pair_id]));\n }\n@@ -801,6 +857,10 @@ int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,\n \tif (ret != 0)\n \t\treturn ret;\n \n+\t/* store a link to the qp in the qat_pci_device */\n+\tqat_private->qat_dev->qps_in_use[QAT_SERVICE_SYMMETRIC][qp_id]\n+\t\t\t\t\t\t\t= *qp_addr;\n+\n \tqp = (struct qat_qp *)*qp_addr;\n \n \tfor (i = 0; i < qp->nb_descriptors; i++) {\n",
    "prefixes": [
        "v3",
        "21/38"
    ]
}