get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 75838,
    "url": "http://patches.dpdk.org/api/patches/75838/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200821162944.29840-14-bruce.richardson@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": "<20200821162944.29840-14-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200821162944.29840-14-bruce.richardson@intel.com",
    "date": "2020-08-21T16:29:39",
    "name": "[v2,13/18] raw/ioat: add data path for idxd devices",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "affd27afe1a68874c42232952d1c88e8b3e666da",
    "submitter": {
        "id": 20,
        "url": "http://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200821162944.29840-14-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 11744,
            "url": "http://patches.dpdk.org/api/series/11744/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11744",
            "date": "2020-08-21T16:29:26",
            "name": "raw/ioat: enhancements and new hardware support",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/11744/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/75838/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/75838/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 220D7A04AF;\n\tFri, 21 Aug 2020 18:32:34 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6EA611C0B6;\n\tFri, 21 Aug 2020 18:30:41 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id 139F81C19A\n for <dev@dpdk.org>; Fri, 21 Aug 2020 18:30:38 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Aug 2020 09:30:38 -0700",
            "from silpixa00399126.ir.intel.com ([10.237.222.56])\n by orsmga006.jf.intel.com with ESMTP; 21 Aug 2020 09:30:36 -0700"
        ],
        "IronPort-SDR": [
            "\n sbXaPY1mQPW0X8VnwZKAVQVP9wXerV24xpyBafSbJH/pocBTWM/KDmi/c3KhPCUuqKIIn75CVa\n KPQqvag5eyzA==",
            "\n TuS9mC+BzbU1Te43V/SFBEKugwpvlAqPwKJO23jq3BiqORurEV+s0P3S0KuPmOwJehMgjLy+s4\n uq6ivzo8sBrw=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9719\"; a=\"173615908\"",
            "E=Sophos;i=\"5.76,337,1592895600\"; d=\"scan'208\";a=\"173615908\"",
            "E=Sophos;i=\"5.76,337,1592895600\"; d=\"scan'208\";a=\"297992929\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cheng1.jiang@intel.com, patrick.fu@intel.com, ping.yu@intel.com,\n kevin.laatz@intel.com, Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Fri, 21 Aug 2020 17:29:39 +0100",
        "Message-Id": "<20200821162944.29840-14-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200821162944.29840-1-bruce.richardson@intel.com>",
        "References": "<20200721095140.719297-1-bruce.richardson@intel.com>\n <20200821162944.29840-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 13/18] raw/ioat: add data path for idxd devices",
        "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": "Add support for doing copies using DSA hardware. This is implemented by\njust switching on the device type field at the start of the inline\nfunctions. Since there is no hardware which will have both device types\npresent this branch will always be predictable after the first call,\nmeaning it has little to no perf penalty.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n drivers/raw/ioat/ioat_common.c         |   1 +\n drivers/raw/ioat/ioat_rawdev.c         |   1 +\n drivers/raw/ioat/rte_ioat_rawdev_fns.h | 164 +++++++++++++++++++++++--\n 3 files changed, 157 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c\nindex 85b13b0bae..23a9d71dd3 100644\n--- a/drivers/raw/ioat/ioat_common.c\n+++ b/drivers/raw/ioat/ioat_common.c\n@@ -146,6 +146,7 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,\n \n \tidxd = rawdev->dev_private;\n \t*idxd = *base_idxd; /* copy over the main fields already passed in */\n+\tidxd->public.type = RTE_IDXD_DEV;\n \tidxd->rawdev = rawdev;\n \tidxd->mz = mz;\n \ndiff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c\nindex 20c8b671a6..15133737b9 100644\n--- a/drivers/raw/ioat/ioat_rawdev.c\n+++ b/drivers/raw/ioat/ioat_rawdev.c\n@@ -253,6 +253,7 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)\n \trawdev->driver_name = dev->device.driver->name;\n \n \tioat = rawdev->dev_private;\n+\tioat->type = RTE_IOAT_DEV;\n \tioat->rawdev = rawdev;\n \tioat->mz = mz;\n \tioat->regs = dev->mem_resource[0].addr;\ndiff --git a/drivers/raw/ioat/rte_ioat_rawdev_fns.h b/drivers/raw/ioat/rte_ioat_rawdev_fns.h\nindex 1939437d50..19aaaa50c8 100644\n--- a/drivers/raw/ioat/rte_ioat_rawdev_fns.h\n+++ b/drivers/raw/ioat/rte_ioat_rawdev_fns.h\n@@ -194,8 +194,8 @@ struct rte_idxd_rawdev {\n /**\n  * Enqueue a copy operation onto the ioat device\n  */\n-static inline int\n-rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,\n+static __rte_always_inline int\n+__ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,\n \t\tunsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl,\n \t\tint fence)\n {\n@@ -233,8 +233,8 @@ rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,\n /**\n  * Trigger hardware to begin performing enqueued copy operations\n  */\n-static inline void\n-rte_ioat_do_copies(int dev_id)\n+static __rte_always_inline void\n+__ioat_perform_ops(int dev_id)\n {\n \tstruct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private;\n \tioat->desc_ring[(ioat->next_write - 1) & (ioat->ring_size - 1)].u\n@@ -248,8 +248,8 @@ rte_ioat_do_copies(int dev_id)\n  * @internal\n  * Returns the index of the last completed operation.\n  */\n-static inline int\n-rte_ioat_get_last_completed(struct rte_ioat_rawdev *ioat, int *error)\n+static __rte_always_inline int\n+__ioat_get_last_completed(struct rte_ioat_rawdev *ioat, int *error)\n {\n \tuint64_t status = ioat->status;\n \n@@ -263,8 +263,8 @@ rte_ioat_get_last_completed(struct rte_ioat_rawdev *ioat, int *error)\n /**\n  * Returns details of copy operations that have been completed\n  */\n-static inline int\n-rte_ioat_completed_copies(int dev_id, uint8_t max_copies,\n+static __rte_always_inline int\n+__ioat_completed_ops(int dev_id, uint8_t max_copies,\n \t\tuintptr_t *src_hdls, uintptr_t *dst_hdls)\n {\n \tstruct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private;\n@@ -274,7 +274,7 @@ rte_ioat_completed_copies(int dev_id, uint8_t max_copies,\n \tint error;\n \tint i = 0;\n \n-\tend_read = (rte_ioat_get_last_completed(ioat, &error) + 1) & mask;\n+\tend_read = (__ioat_get_last_completed(ioat, &error) + 1) & mask;\n \tcount = (end_read - (read & mask)) & mask;\n \n \tif (error) {\n@@ -311,4 +311,150 @@ rte_ioat_completed_copies(int dev_id, uint8_t max_copies,\n \treturn count;\n }\n \n+static __rte_always_inline int\n+__idxd_enqueue_copy(int dev_id, rte_iova_t src, rte_iova_t dst,\n+\t\tunsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl,\n+\t\tint fence __rte_unused)\n+{\n+\tstruct rte_idxd_rawdev *idxd = rte_rawdevs[dev_id].dev_private;\n+\tstruct rte_idxd_desc_batch *b = &idxd->batch_ring[idxd->next_batch];\n+\tuint32_t op_flags = (idxd_op_memmove << IDXD_CMD_OP_SHIFT) |\n+\t\t\tIDXD_FLAG_CACHE_CONTROL;\n+\n+\t/* check for room in the handle ring */\n+\tif (((idxd->next_free_hdl + 1) & (idxd->hdl_ring_sz - 1)) == idxd->next_ret_hdl) {\n+\t\trte_errno = ENOSPC;\n+\t\treturn 0;\n+\t}\n+\tif (b->op_count >= BATCH_SIZE) {\n+\t\trte_errno = ENOSPC;\n+\t\treturn 0;\n+\t}\n+\t/* check that we can actually use the current batch */\n+\tif (b->submitted) {\n+\t\trte_errno = ENOSPC;\n+\t\treturn 0;\n+\t}\n+\n+\t/* write the descriptor */\n+\tb->ops[b->op_count++] = (struct rte_idxd_hw_desc){\n+\t\t.op_flags =  op_flags,\n+\t\t.src = src,\n+\t\t.dst = dst,\n+\t\t.size = length\n+\t};\n+\n+\t/* store the completion details */\n+\tif (!idxd->hdls_disable)\n+\t\tidxd->hdl_ring[idxd->next_free_hdl] = (struct rte_idxd_user_hdl) {\n+\t\t\t.src = src_hdl,\n+\t\t\t.dst = dst_hdl\n+\t\t};\n+\tif (++idxd->next_free_hdl == idxd->hdl_ring_sz)\n+\t\tidxd->next_free_hdl = 0;\n+\n+\treturn 1;\n+}\n+\n+static __rte_always_inline void\n+__idxd_movdir64b(volatile void *dst, const void *src)\n+{\n+\tasm volatile (\".byte 0x66, 0x0f, 0x38, 0xf8, 0x02\"\n+\t\t\t:\n+\t\t\t: \"a\" (dst), \"d\" (src));\n+}\n+\n+static __rte_always_inline void\n+__idxd_perform_ops(int dev_id)\n+{\n+\tstruct rte_idxd_rawdev *idxd = rte_rawdevs[dev_id].dev_private;\n+\tstruct rte_idxd_desc_batch *b = &idxd->batch_ring[idxd->next_batch];\n+\n+\tif (b->submitted || b->op_count == 0)\n+\t\treturn;\n+\tb->hdl_end = idxd->next_free_hdl;\n+\tb->comp.status = 0;\n+\tb->submitted = 1;\n+\tb->batch_desc.size = b->op_count + 1;\n+\t__idxd_movdir64b(idxd->portal, &b->batch_desc);\n+\n+\tif (++idxd->next_batch == idxd->batch_ring_sz)\n+\t\tidxd->next_batch = 0;\n+}\n+\n+static __rte_always_inline int\n+__idxd_completed_ops(int dev_id, uint8_t max_ops,\n+\t\tuintptr_t *src_hdls, uintptr_t *dst_hdls)\n+{\n+\tstruct rte_idxd_rawdev *idxd = rte_rawdevs[dev_id].dev_private;\n+\tstruct rte_idxd_desc_batch *b = &idxd->batch_ring[idxd->next_completed];\n+\tuint16_t h_idx = idxd->next_ret_hdl;\n+\tint n = 0;\n+\n+\twhile (b->submitted && b->comp.status != 0) {\n+\t\tidxd->last_completed_hdl = b->hdl_end;\n+\t\tb->submitted = 0;\n+\t\tb->op_count = 0;\n+\t\tif (++idxd->next_completed == idxd->batch_ring_sz)\n+\t\t\tidxd->next_completed = 0;\n+\t\tb = &idxd->batch_ring[idxd->next_completed];\n+\t}\n+\n+\tif (!idxd->hdls_disable)\n+\t\tfor (n = 0; n < max_ops && h_idx != idxd->last_completed_hdl; n++) {\n+\t\t\tsrc_hdls[n] = idxd->hdl_ring[h_idx].src;\n+\t\t\tdst_hdls[n] = idxd->hdl_ring[h_idx].dst;\n+\t\t\tif (++h_idx == idxd->hdl_ring_sz)\n+\t\t\t\th_idx = 0;\n+\t\t}\n+\telse\n+\t\twhile (h_idx != idxd->last_completed_hdl) {\n+\t\t\tn++;\n+\t\t\tif (++h_idx == idxd->hdl_ring_sz)\n+\t\t\t\th_idx = 0;\n+\t\t}\n+\n+\tidxd->next_ret_hdl = h_idx;\n+\n+\treturn n;\n+}\n+\n+static inline int\n+rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,\n+\t\tunsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl,\n+\t\tint fence)\n+{\n+\tenum rte_ioat_dev_type *type = rte_rawdevs[dev_id].dev_private;\n+\tif (*type == RTE_IDXD_DEV)\n+\t\treturn __idxd_enqueue_copy(dev_id, src, dst, length,\n+\t\t\t\tsrc_hdl, dst_hdl, fence);\n+\telse\n+\t\treturn __ioat_enqueue_copy(dev_id, src, dst, length,\n+\t\t\t\tsrc_hdl, dst_hdl, fence);\n+}\n+\n+static inline void\n+rte_ioat_do_copies(int dev_id)\n+{\n+\tenum rte_ioat_dev_type *type = rte_rawdevs[dev_id].dev_private;\n+\tif (*type == RTE_IDXD_DEV)\n+\t\treturn __idxd_perform_ops(dev_id);\n+\telse\n+\t\treturn __ioat_perform_ops(dev_id);\n+}\n+\n+static inline int\n+rte_ioat_completed_copies(int dev_id, uint8_t max_copies,\n+\t\tuintptr_t *src_hdls, uintptr_t *dst_hdls)\n+{\n+\tenum rte_ioat_dev_type *type = rte_rawdevs[dev_id].dev_private;\n+\tif (*type == RTE_IDXD_DEV)\n+\t\treturn __idxd_completed_ops(dev_id, max_copies,\n+\t\t\t\tsrc_hdls, dst_hdls);\n+\telse\n+\t\treturn __ioat_completed_ops(dev_id,  max_copies,\n+\t\t\t\tsrc_hdls, dst_hdls);\n+}\n+\n+\n #endif /* _RTE_IOAT_RAWDEV_FNS_H_ */\n",
    "prefixes": [
        "v2",
        "13/18"
    ]
}