Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/74544/?format=api
https://patches.dpdk.org/api/patches/74544/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200721095140.719297-6-bruce.richardson@intel.com/", "project": { "id": 1, "url": "https://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": "<20200721095140.719297-6-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200721095140.719297-6-bruce.richardson@intel.com", "date": "2020-07-21T09:51:25", "name": "[20.11,05/20] raw/ioat: split header for readability", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "f595f5f349a5cd48c6aadb1c76f0d2502de619c9", "submitter": { "id": 20, "url": "https://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200721095140.719297-6-bruce.richardson@intel.com/mbox/", "series": [ { "id": 11200, "url": "https://patches.dpdk.org/api/series/11200/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11200", "date": "2020-07-21T09:51:20", "name": "raw/ioat: enhancements and new hardware support", "version": 1, "mbox": "https://patches.dpdk.org/series/11200/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/74544/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/74544/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 38027A0526;\n\tTue, 21 Jul 2020 11:52:42 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8B2ED1C033;\n\tTue, 21 Jul 2020 11:52:22 +0200 (CEST)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by dpdk.org (Postfix) with ESMTP id 659531C00E\n for <dev@dpdk.org>; Tue, 21 Jul 2020 11:52:20 +0200 (CEST)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Jul 2020 02:52:20 -0700", "from silpixa00399126.ir.intel.com ([10.237.222.36])\n by fmsmga005.fm.intel.com with ESMTP; 21 Jul 2020 02:52:18 -0700" ], "IronPort-SDR": [ "\n hKpn2SAEX9upDRQoWOX6V2YDPOfDinLi/jQnwlWreuL0p55VmMR1CoNEUv3AsOfSGzEQgiKesy\n zaZJ3YV8twzQ==", "\n FRTVT6C6Vu9wilWYJazzVIFdfi8P7azos2N7njRJlBnnxhLnbcvQa8QmWOJYJkarX5h0/VPy7k\n /51NY4BrL6aA==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9688\"; a=\"151440760\"", "E=Sophos;i=\"5.75,378,1589266800\"; d=\"scan'208\";a=\"151440760\"", "E=Sophos;i=\"5.75,378,1589266800\"; d=\"scan'208\";a=\"488023718\"" ], "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, kevin.laatz@intel.com,\n Bruce Richardson <bruce.richardson@intel.com>", "Date": "Tue, 21 Jul 2020 10:51:25 +0100", "Message-Id": "<20200721095140.719297-6-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20200721095140.719297-1-bruce.richardson@intel.com>", "References": "<20200721095140.719297-1-bruce.richardson@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH 20.11 05/20] raw/ioat: split header for\n\treadability", "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": "Rather than having a single long complicated header file for general use we\ncan split things so that there is one header with all the publically needed\ninformation - data structs and function prototypes - while the rest of the\ninternal details are put separately. This makes it easier to read,\nunderstand and use the APIs.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n drivers/raw/ioat/meson.build | 1 +\n drivers/raw/ioat/rte_ioat_rawdev.h | 144 +---------------------\n drivers/raw/ioat/rte_ioat_rawdev_fns.h | 164 +++++++++++++++++++++++++\n 3 files changed, 171 insertions(+), 138 deletions(-)\n create mode 100644 drivers/raw/ioat/rte_ioat_rawdev_fns.h", "diff": "diff --git a/drivers/raw/ioat/meson.build b/drivers/raw/ioat/meson.build\nindex 0878418ae..f66e9b605 100644\n--- a/drivers/raw/ioat/meson.build\n+++ b/drivers/raw/ioat/meson.build\n@@ -8,4 +8,5 @@ sources = files('ioat_rawdev.c',\n deps += ['rawdev', 'bus_pci', 'mbuf']\n \n install_headers('rte_ioat_rawdev.h',\n+\t\t'rte_ioat_rawdev_fns.h',\n \t\t'rte_ioat_spec.h')\ndiff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h\nindex fd3a8fe14..6d338f50c 100644\n--- a/drivers/raw/ioat/rte_ioat_rawdev.h\n+++ b/drivers/raw/ioat/rte_ioat_rawdev.h\n@@ -14,12 +14,7 @@\n * @b EXPERIMENTAL: these structures and APIs may change without prior notice\n */\n \n-#include <x86intrin.h>\n-#include <rte_atomic.h>\n-#include <rte_memory.h>\n-#include <rte_memzone.h>\n-#include <rte_prefetch.h>\n-#include \"rte_ioat_spec.h\"\n+#include <rte_common.h>\n \n /** Name of the device driver */\n #define IOAT_PMD_RAWDEV_NAME rawdev_ioat\n@@ -38,38 +33,6 @@ struct rte_ioat_rawdev_config {\n \tbool hdls_disable; /**< when set, ignore user-supplied handle parameters */\n };\n \n-/**\n- * @internal\n- * Structure representing a device instance\n- */\n-struct rte_ioat_rawdev {\n-\tstruct rte_rawdev *rawdev;\n-\tconst struct rte_memzone *mz;\n-\tconst struct rte_memzone *desc_mz;\n-\n-\tvolatile struct rte_ioat_registers *regs;\n-\tphys_addr_t status_addr;\n-\tphys_addr_t ring_addr;\n-\n-\tunsigned short ring_size;\n-\tstruct rte_ioat_generic_hw_desc *desc_ring;\n-\tbool hdls_disable;\n-\t__m128i *hdls; /* completion handles for returning to user */\n-\n-\n-\tunsigned short next_read;\n-\tunsigned short next_write;\n-\n-\t/* some statistics for tracking, if added/changed update xstats fns*/\n-\tuint64_t enqueue_failed __rte_cache_aligned;\n-\tuint64_t enqueued;\n-\tuint64_t started;\n-\tuint64_t completed;\n-\n-\t/* to report completions, the device will write status back here */\n-\tvolatile uint64_t status __rte_cache_aligned;\n-};\n-\n /**\n * Enqueue a copy operation onto the ioat device\n *\n@@ -104,38 +67,7 @@ struct rte_ioat_rawdev {\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-\tstruct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private;\n-\tunsigned short read = ioat->next_read;\n-\tunsigned short write = ioat->next_write;\n-\tunsigned short mask = ioat->ring_size - 1;\n-\tunsigned short space = mask + read - write;\n-\tstruct rte_ioat_generic_hw_desc *desc;\n-\n-\tif (space == 0) {\n-\t\tioat->enqueue_failed++;\n-\t\treturn 0;\n-\t}\n-\n-\tioat->next_write = write + 1;\n-\twrite &= mask;\n-\n-\tdesc = &ioat->desc_ring[write];\n-\tdesc->size = length;\n-\t/* set descriptor write-back every 16th descriptor */\n-\tdesc->u.control_raw = (uint32_t)((!!fence << 4) | (!(write & 0xF)) << 3);\n-\tdesc->src_addr = src;\n-\tdesc->dest_addr = dst;\n-\tif (!ioat->hdls_disable)\n-\t\tioat->hdls[write] = _mm_set_epi64x((int64_t)dst_hdl,\n-\t\t\t\t\t(int64_t)src_hdl);\n-\n-\trte_prefetch0(&ioat->desc_ring[ioat->next_write & mask]);\n-\n-\tioat->enqueued++;\n-\treturn 1;\n-}\n+\t\tint fence);\n \n /**\n * Trigger hardware to begin performing enqueued copy operations\n@@ -147,31 +79,7 @@ rte_ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst,\n * The rawdev device id of the ioat instance\n */\n static inline void\n-rte_ioat_do_copies(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-\t\t\t.control.completion_update = 1;\n-\trte_compiler_barrier();\n-\tioat->regs->dmacount = ioat->next_write;\n-\tioat->started = ioat->enqueued;\n-}\n-\n-/**\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-{\n-\tuint64_t status = ioat->status;\n-\n-\t/* lower 3 bits indicate \"transfer status\" : active, idle, halted.\n-\t * We can ignore bit 0.\n-\t */\n-\t*error = status & (RTE_IOAT_CHANSTS_SUSPENDED | RTE_IOAT_CHANSTS_ARMED);\n-\treturn (status - ioat->ring_addr) >> 6;\n-}\n+rte_ioat_do_copies(int dev_id);\n \n /**\n * Returns details of copy operations that have been completed\n@@ -206,49 +114,9 @@ rte_ioat_get_last_completed(struct rte_ioat_rawdev *ioat, int *error)\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-\tstruct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private;\n-\tunsigned short mask = (ioat->ring_size - 1);\n-\tunsigned short read = ioat->next_read;\n-\tunsigned short end_read, count;\n-\tint error;\n-\tint i = 0;\n-\n-\tend_read = (rte_ioat_get_last_completed(ioat, &error) + 1) & mask;\n-\tcount = (end_read - (read & mask)) & mask;\n-\n-\tif (error) {\n-\t\trte_errno = EIO;\n-\t\treturn -1;\n-\t}\n-\n-\tif (ioat->hdls_disable) {\n-\t\tread += count;\n-\t\tgoto end;\n-\t}\n-\n-\tif (count > max_copies)\n-\t\tcount = max_copies;\n-\n-\tfor (; i < count - 1; i += 2, read += 2) {\n-\t\t__m128i hdls0 = _mm_load_si128(&ioat->hdls[read & mask]);\n-\t\t__m128i hdls1 = _mm_load_si128(&ioat->hdls[(read + 1) & mask]);\n+\t\tuintptr_t *src_hdls, uintptr_t *dst_hdls);\n \n-\t\t_mm_storeu_si128((void *)&src_hdls[i],\n-\t\t\t\t_mm_unpacklo_epi64(hdls0, hdls1));\n-\t\t_mm_storeu_si128((void *)&dst_hdls[i],\n-\t\t\t\t_mm_unpackhi_epi64(hdls0, hdls1));\n-\t}\n-\tfor (; i < count; i++, read++) {\n-\t\tuintptr_t *hdls = (void *)&ioat->hdls[read & mask];\n-\t\tsrc_hdls[i] = hdls[0];\n-\t\tdst_hdls[i] = hdls[1];\n-\t}\n-end:\n-\tioat->next_read = read;\n-\tioat->completed += count;\n-\treturn count;\n-}\n+/* include the implementation details from a separate file */\n+#include \"rte_ioat_rawdev_fns.h\"\n \n #endif /* _RTE_IOAT_RAWDEV_H_ */\ndiff --git a/drivers/raw/ioat/rte_ioat_rawdev_fns.h b/drivers/raw/ioat/rte_ioat_rawdev_fns.h\nnew file mode 100644\nindex 000000000..06b4edcbb\n--- /dev/null\n+++ b/drivers/raw/ioat/rte_ioat_rawdev_fns.h\n@@ -0,0 +1,164 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Intel Corporation\n+ */\n+#ifndef _RTE_IOAT_RAWDEV_FNS_H_\n+#define _RTE_IOAT_RAWDEV_FNS_H_\n+\n+#include <x86intrin.h>\n+#include <rte_memzone.h>\n+#include <rte_prefetch.h>\n+#include \"rte_ioat_spec.h\"\n+\n+/**\n+ * @internal\n+ * Structure representing a device instance\n+ */\n+struct rte_ioat_rawdev {\n+\tstruct rte_rawdev *rawdev;\n+\tconst struct rte_memzone *mz;\n+\tconst struct rte_memzone *desc_mz;\n+\n+\tvolatile struct rte_ioat_registers *regs;\n+\tphys_addr_t status_addr;\n+\tphys_addr_t ring_addr;\n+\n+\tunsigned short ring_size;\n+\tbool hdls_disable;\n+\tstruct rte_ioat_generic_hw_desc *desc_ring;\n+\t__m128i *hdls; /* completion handles for returning to user */\n+\n+\n+\tunsigned short next_read;\n+\tunsigned short next_write;\n+\n+\t/* some statistics for tracking, if added/changed update xstats fns*/\n+\tuint64_t enqueue_failed __rte_cache_aligned;\n+\tuint64_t enqueued;\n+\tuint64_t started;\n+\tuint64_t completed;\n+\n+\t/* to report completions, the device will write status back here */\n+\tvolatile uint64_t status __rte_cache_aligned;\n+};\n+\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+\t\tunsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl,\n+\t\tint fence)\n+{\n+\tstruct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private;\n+\tunsigned short read = ioat->next_read;\n+\tunsigned short write = ioat->next_write;\n+\tunsigned short mask = ioat->ring_size - 1;\n+\tunsigned short space = mask + read - write;\n+\tstruct rte_ioat_generic_hw_desc *desc;\n+\n+\tif (space == 0) {\n+\t\tioat->enqueue_failed++;\n+\t\treturn 0;\n+\t}\n+\n+\tioat->next_write = write + 1;\n+\twrite &= mask;\n+\n+\tdesc = &ioat->desc_ring[write];\n+\tdesc->size = length;\n+\t/* set descriptor write-back every 16th descriptor */\n+\tdesc->u.control_raw = (uint32_t)((!!fence << 4) | (!(write & 0xF)) << 3);\n+\tdesc->src_addr = src;\n+\tdesc->dest_addr = dst;\n+\n+\tif (!ioat->hdls_disable)\n+\t\tioat->hdls[write] = _mm_set_epi64x((int64_t)dst_hdl,\n+\t\t\t\t\t(int64_t)src_hdl);\n+\trte_prefetch0(&ioat->desc_ring[ioat->next_write & mask]);\n+\n+\tioat->enqueued++;\n+\treturn 1;\n+}\n+\n+/**\n+ * Trigger hardware to begin performing enqueued copy operations\n+ */\n+static inline void\n+rte_ioat_do_copies(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+\t\t\t.control.completion_update = 1;\n+\trte_compiler_barrier();\n+\tioat->regs->dmacount = ioat->next_write;\n+\tioat->started = ioat->enqueued;\n+}\n+\n+/**\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+{\n+\tuint64_t status = ioat->status;\n+\n+\t/* lower 3 bits indicate \"transfer status\" : active, idle, halted.\n+\t * We can ignore bit 0.\n+\t */\n+\t*error = status & (RTE_IOAT_CHANSTS_SUSPENDED | RTE_IOAT_CHANSTS_ARMED);\n+\treturn (status - ioat->ring_addr) >> 6;\n+}\n+\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+\t\tuintptr_t *src_hdls, uintptr_t *dst_hdls)\n+{\n+\tstruct rte_ioat_rawdev *ioat = rte_rawdevs[dev_id].dev_private;\n+\tunsigned short mask = (ioat->ring_size - 1);\n+\tunsigned short read = ioat->next_read;\n+\tunsigned short end_read, count;\n+\tint error;\n+\tint i = 0;\n+\n+\tend_read = (rte_ioat_get_last_completed(ioat, &error) + 1) & mask;\n+\tcount = (end_read - (read & mask)) & mask;\n+\n+\tif (error) {\n+\t\trte_errno = EIO;\n+\t\treturn -1;\n+\t}\n+\n+\tif (ioat->hdls_disable) {\n+\t\tread += count;\n+\t\tgoto end;\n+\t}\n+\n+\tif (count > max_copies)\n+\t\tcount = max_copies;\n+\n+\tfor (; i < count - 1; i += 2, read += 2) {\n+\t\t__m128i hdls0 = _mm_load_si128(&ioat->hdls[read & mask]);\n+\t\t__m128i hdls1 = _mm_load_si128(&ioat->hdls[(read + 1) & mask]);\n+\n+\t\t_mm_storeu_si128((void *)&src_hdls[i],\n+\t\t\t\t_mm_unpacklo_epi64(hdls0, hdls1));\n+\t\t_mm_storeu_si128((void *)&dst_hdls[i],\n+\t\t\t\t_mm_unpackhi_epi64(hdls0, hdls1));\n+\t}\n+\tfor (; i < count; i++, read++) {\n+\t\tuintptr_t *hdls = (void *)&ioat->hdls[read & mask];\n+\t\tsrc_hdls[i] = hdls[0];\n+\t\tdst_hdls[i] = hdls[1];\n+\t}\n+\n+end:\n+\tioat->next_read = read;\n+\tioat->completed += count;\n+\treturn count;\n+}\n+\n+#endif /* _RTE_IOAT_RAWDEV_FNS_H_ */\n", "prefixes": [ "20.11", "05/20" ] }{ "id": 74544, "url": "