get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 92152,
    "url": "http://patches.dpdk.org/api/patches/92152/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210426095259.225354-2-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": "<20210426095259.225354-2-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210426095259.225354-2-bruce.richardson@intel.com",
    "date": "2021-04-26T09:52:48",
    "name": "[v2,01/12] raw/ioat: add unit tests for completion batching",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7760890a48dd20626dde25cb4a3c325bdf40a2f3",
    "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/20210426095259.225354-2-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 16669,
            "url": "http://patches.dpdk.org/api/series/16669/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=16669",
            "date": "2021-04-26T09:52:48",
            "name": "ioat driver updates",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/16669/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/92152/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/92152/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id BE622A0548;\n\tMon, 26 Apr 2021 11:53:17 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3F06841110;\n\tMon, 26 Apr 2021 11:53:17 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id 0041B40140\n for <dev@dpdk.org>; Mon, 26 Apr 2021 11:53:13 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Apr 2021 02:53:12 -0700",
            "from silpixa00399126.ir.intel.com ([10.237.223.81])\n by orsmga008.jf.intel.com with ESMTP; 26 Apr 2021 02:53:10 -0700"
        ],
        "IronPort-SDR": [
            "\n BXzefYvaQlHoVEFXCCamc2f6Vhhnn4JNSqm8JZDIkmaYDoUZvDH6eCbC2fUoY+wxk1B6PwhEul\n bxqmOsBL9ahg==",
            "\n RSWaQ9/WTaN4DfENnVns1rG0AckEMAL/wQoP+/625LG6lmXHtsAO41i6qK/xrPf2yC2Hy7Wnnd\n gDZxSyFbyBUg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,9965\"; a=\"183442897\"",
            "E=Sophos;i=\"5.82,252,1613462400\"; d=\"scan'208\";a=\"183442897\"",
            "E=Sophos;i=\"5.82,252,1613462400\"; d=\"scan'208\";a=\"429336891\""
        ],
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "kevin.laatz@intel.com, jiayu.hu@intel.com,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Mon, 26 Apr 2021 10:52:48 +0100",
        "Message-Id": "<20210426095259.225354-2-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20210426095259.225354-1-bruce.richardson@intel.com>",
        "References": "<20210318182042.43658-2-bruce.richardson@intel.com>\n <20210426095259.225354-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 01/12] raw/ioat: add unit tests for completion\n batching",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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 in additional unit tests to verify that we can get completion reports\nof multiple batches in a single completed_ops() call. Also verify we can\nget smaller number of completions if that is requested too.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n drivers/raw/ioat/ioat_rawdev_test.c | 199 +++++++++++++++++++---------\n 1 file changed, 137 insertions(+), 62 deletions(-)",
    "diff": "diff --git a/drivers/raw/ioat/ioat_rawdev_test.c b/drivers/raw/ioat/ioat_rawdev_test.c\nindex 101f24a677..a5064d739d 100644\n--- a/drivers/raw/ioat/ioat_rawdev_test.c\n+++ b/drivers/raw/ioat/ioat_rawdev_test.c\n@@ -11,6 +11,7 @@\n \n #define MAX_SUPPORTED_RAWDEVS 64\n #define TEST_SKIPPED 77\n+#define COPY_LEN 1024\n \n int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */\n \n@@ -34,32 +35,114 @@ print_err(const char *func, int lineno, const char *format, ...)\n \treturn ret;\n }\n \n+static int\n+do_multi_copies(int dev_id, int split_batches, int split_completions)\n+{\n+\tstruct rte_mbuf *srcs[32], *dsts[32];\n+\tstruct rte_mbuf *completed_src[64];\n+\tstruct rte_mbuf *completed_dst[64];\n+\tunsigned int i, j;\n+\n+\tfor (i = 0; i < RTE_DIM(srcs); i++) {\n+\t\tchar *src_data;\n+\n+\t\tif (split_batches && i == RTE_DIM(srcs) / 2)\n+\t\t\trte_ioat_perform_ops(dev_id);\n+\n+\t\tsrcs[i] = rte_pktmbuf_alloc(pool);\n+\t\tdsts[i] = rte_pktmbuf_alloc(pool);\n+\t\tsrc_data = rte_pktmbuf_mtod(srcs[i], char *);\n+\n+\t\tfor (j = 0; j < COPY_LEN; j++)\n+\t\t\tsrc_data[j] = rand() & 0xFF;\n+\n+\t\tif (rte_ioat_enqueue_copy(dev_id,\n+\t\t\t\tsrcs[i]->buf_iova + srcs[i]->data_off,\n+\t\t\t\tdsts[i]->buf_iova + dsts[i]->data_off,\n+\t\t\t\tCOPY_LEN,\n+\t\t\t\t(uintptr_t)srcs[i],\n+\t\t\t\t(uintptr_t)dsts[i]) != 1) {\n+\t\t\tPRINT_ERR(\"Error with rte_ioat_enqueue_copy for buffer %u\\n\",\n+\t\t\t\t\ti);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\trte_ioat_perform_ops(dev_id);\n+\tusleep(100);\n+\n+\tif (split_completions) {\n+\t\t/* gather completions in two halves */\n+\t\tuint16_t half_len = RTE_DIM(srcs) / 2;\n+\t\tif (rte_ioat_completed_ops(dev_id, half_len, (void *)completed_src,\n+\t\t\t\t(void *)completed_dst) != half_len) {\n+\t\t\tPRINT_ERR(\"Error with rte_ioat_completed_ops - first half request\\n\");\n+\t\t\trte_rawdev_dump(dev_id, stdout);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (rte_ioat_completed_ops(dev_id, half_len, (void *)&completed_src[half_len],\n+\t\t\t\t(void *)&completed_dst[half_len]) != half_len) {\n+\t\t\tPRINT_ERR(\"Error with rte_ioat_completed_ops - second half request\\n\");\n+\t\t\trte_rawdev_dump(dev_id, stdout);\n+\t\t\treturn -1;\n+\t\t}\n+\t} else {\n+\t\t/* gather all completions in one go */\n+\t\tif (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,\n+\t\t\t\t(void *)completed_dst) != RTE_DIM(srcs)) {\n+\t\t\tPRINT_ERR(\"Error with rte_ioat_completed_ops\\n\");\n+\t\t\trte_rawdev_dump(dev_id, stdout);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\tfor (i = 0; i < RTE_DIM(srcs); i++) {\n+\t\tchar *src_data, *dst_data;\n+\n+\t\tif (completed_src[i] != srcs[i]) {\n+\t\t\tPRINT_ERR(\"Error with source pointer %u\\n\", i);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (completed_dst[i] != dsts[i]) {\n+\t\t\tPRINT_ERR(\"Error with dest pointer %u\\n\", i);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tsrc_data = rte_pktmbuf_mtod(srcs[i], char *);\n+\t\tdst_data = rte_pktmbuf_mtod(dsts[i], char *);\n+\t\tfor (j = 0; j < COPY_LEN; j++)\n+\t\t\tif (src_data[j] != dst_data[j]) {\n+\t\t\t\tPRINT_ERR(\"Error with copy of packet %u, byte %u\\n\",\n+\t\t\t\t\t\ti, j);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\trte_pktmbuf_free(srcs[i]);\n+\t\trte_pktmbuf_free(dsts[i]);\n+\t}\n+\treturn 0;\n+}\n+\n static int\n test_enqueue_copies(int dev_id)\n {\n-\tconst unsigned int length = 1024;\n \tunsigned int i;\n \n+\t/* test doing a single copy */\n \tdo {\n \t\tstruct rte_mbuf *src, *dst;\n \t\tchar *src_data, *dst_data;\n \t\tstruct rte_mbuf *completed[2] = {0};\n \n-\t\t/* test doing a single copy */\n \t\tsrc = rte_pktmbuf_alloc(pool);\n \t\tdst = rte_pktmbuf_alloc(pool);\n-\t\tsrc->data_len = src->pkt_len = length;\n-\t\tdst->data_len = dst->pkt_len = length;\n \t\tsrc_data = rte_pktmbuf_mtod(src, char *);\n \t\tdst_data = rte_pktmbuf_mtod(dst, char *);\n \n-\t\tfor (i = 0; i < length; i++)\n+\t\tfor (i = 0; i < COPY_LEN; i++)\n \t\t\tsrc_data[i] = rand() & 0xFF;\n \n \t\tif (rte_ioat_enqueue_copy(dev_id,\n \t\t\t\tsrc->buf_iova + src->data_off,\n \t\t\t\tdst->buf_iova + dst->data_off,\n-\t\t\t\tlength,\n+\t\t\t\tCOPY_LEN,\n \t\t\t\t(uintptr_t)src,\n \t\t\t\t(uintptr_t)dst) != 1) {\n \t\t\tPRINT_ERR(\"Error with rte_ioat_enqueue_copy\\n\");\n@@ -79,99 +162,91 @@ test_enqueue_copies(int dev_id)\n \t\t\treturn -1;\n \t\t}\n \n-\t\tfor (i = 0; i < length; i++)\n+\t\tfor (i = 0; i < COPY_LEN; i++)\n \t\t\tif (dst_data[i] != src_data[i]) {\n-\t\t\t\tPRINT_ERR(\"Data mismatch at char %u\\n\", i);\n+\t\t\t\tPRINT_ERR(\"Data mismatch at char %u [Got %02x not %02x]\\n\",\n+\t\t\t\t\t\ti, dst_data[i], src_data[i]);\n \t\t\t\treturn -1;\n \t\t\t}\n \t\trte_pktmbuf_free(src);\n \t\trte_pktmbuf_free(dst);\n \t} while (0);\n \n-\t/* test doing multiple copies */\n+\t/* test doing a multiple single copies */\n \tdo {\n-\t\tstruct rte_mbuf *srcs[32], *dsts[32];\n-\t\tstruct rte_mbuf *completed_src[64];\n-\t\tstruct rte_mbuf *completed_dst[64];\n-\t\tunsigned int j;\n-\n-\t\tfor (i = 0; i < RTE_DIM(srcs); i++) {\n-\t\t\tchar *src_data;\n+\t\tconst uint16_t max_ops = 4;\n+\t\tstruct rte_mbuf *src, *dst;\n+\t\tchar *src_data, *dst_data;\n+\t\tstruct rte_mbuf *completed[32] = {0};\n+\t\tconst uint16_t max_completions = RTE_DIM(completed) / 2;\n \n-\t\t\tsrcs[i] = rte_pktmbuf_alloc(pool);\n-\t\t\tdsts[i] = rte_pktmbuf_alloc(pool);\n-\t\t\tsrcs[i]->data_len = srcs[i]->pkt_len = length;\n-\t\t\tdsts[i]->data_len = dsts[i]->pkt_len = length;\n-\t\t\tsrc_data = rte_pktmbuf_mtod(srcs[i], char *);\n+\t\tsrc = rte_pktmbuf_alloc(pool);\n+\t\tdst = rte_pktmbuf_alloc(pool);\n+\t\tsrc_data = rte_pktmbuf_mtod(src, char *);\n+\t\tdst_data = rte_pktmbuf_mtod(dst, char *);\n \n-\t\t\tfor (j = 0; j < length; j++)\n-\t\t\t\tsrc_data[j] = rand() & 0xFF;\n+\t\tfor (i = 0; i < COPY_LEN; i++)\n+\t\t\tsrc_data[i] = rand() & 0xFF;\n \n+\t\t/* perform the same copy <max_ops> times */\n+\t\tfor (i = 0; i < max_ops; i++) {\n \t\t\tif (rte_ioat_enqueue_copy(dev_id,\n-\t\t\t\t\tsrcs[i]->buf_iova + srcs[i]->data_off,\n-\t\t\t\t\tdsts[i]->buf_iova + dsts[i]->data_off,\n-\t\t\t\t\tlength,\n-\t\t\t\t\t(uintptr_t)srcs[i],\n-\t\t\t\t\t(uintptr_t)dsts[i]) != 1) {\n-\t\t\t\tPRINT_ERR(\"Error with rte_ioat_enqueue_copy for buffer %u\\n\",\n-\t\t\t\t\t\ti);\n+\t\t\t\t\tsrc->buf_iova + src->data_off,\n+\t\t\t\t\tdst->buf_iova + dst->data_off,\n+\t\t\t\t\tCOPY_LEN,\n+\t\t\t\t\t(uintptr_t)src,\n+\t\t\t\t\t(uintptr_t)dst) != 1) {\n+\t\t\t\tPRINT_ERR(\"Error with rte_ioat_enqueue_copy\\n\");\n \t\t\t\treturn -1;\n \t\t\t}\n+\t\t\trte_ioat_perform_ops(dev_id);\n \t\t}\n-\t\trte_ioat_perform_ops(dev_id);\n-\t\tusleep(100);\n+\t\tusleep(10);\n \n-\t\tif (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,\n-\t\t\t\t(void *)completed_dst) != RTE_DIM(srcs)) {\n+\t\tif (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],\n+\t\t\t\t(void *)&completed[max_completions]) != max_ops) {\n \t\t\tPRINT_ERR(\"Error with rte_ioat_completed_ops\\n\");\n \t\t\treturn -1;\n \t\t}\n-\t\tfor (i = 0; i < RTE_DIM(srcs); i++) {\n-\t\t\tchar *src_data, *dst_data;\n+\t\tif (completed[0] != src || completed[max_completions] != dst) {\n+\t\t\tPRINT_ERR(\"Error with completions: got (%p, %p), not (%p,%p)\\n\",\n+\t\t\t\t\tcompleted[0], completed[max_completions], src, dst);\n+\t\t\treturn -1;\n+\t\t}\n \n-\t\t\tif (completed_src[i] != srcs[i]) {\n-\t\t\t\tPRINT_ERR(\"Error with source pointer %u\\n\", i);\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tif (completed_dst[i] != dsts[i]) {\n-\t\t\t\tPRINT_ERR(\"Error with dest pointer %u\\n\", i);\n+\t\tfor (i = 0; i < COPY_LEN; i++)\n+\t\t\tif (dst_data[i] != src_data[i]) {\n+\t\t\t\tPRINT_ERR(\"Data mismatch at char %u\\n\", i);\n \t\t\t\treturn -1;\n \t\t\t}\n-\n-\t\t\tsrc_data = rte_pktmbuf_mtod(srcs[i], char *);\n-\t\t\tdst_data = rte_pktmbuf_mtod(dsts[i], char *);\n-\t\t\tfor (j = 0; j < length; j++)\n-\t\t\t\tif (src_data[j] != dst_data[j]) {\n-\t\t\t\t\tPRINT_ERR(\"Error with copy of packet %u, byte %u\\n\",\n-\t\t\t\t\t\t\ti, j);\n-\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\trte_pktmbuf_free(srcs[i]);\n-\t\t\trte_pktmbuf_free(dsts[i]);\n-\t\t}\n-\n+\t\trte_pktmbuf_free(src);\n+\t\trte_pktmbuf_free(dst);\n \t} while (0);\n \n+\t/* test doing multiple copies */\n+\tdo_multi_copies(dev_id, 0, 0); /* enqueue and complete one batch at a time */\n+\tdo_multi_copies(dev_id, 1, 0); /* enqueue 2 batches and then complete both */\n+\tdo_multi_copies(dev_id, 0, 1); /* enqueue 1 batch, then complete in two halves */\n \treturn 0;\n }\n \n static int\n test_enqueue_fill(int dev_id)\n {\n-\tconst unsigned int length[] = {8, 64, 1024, 50, 100, 89};\n+\tconst unsigned int lengths[] = {8, 64, 1024, 50, 100, 89};\n \tstruct rte_mbuf *dst = rte_pktmbuf_alloc(pool);\n \tchar *dst_data = rte_pktmbuf_mtod(dst, char *);\n \tstruct rte_mbuf *completed[2] = {0};\n \tuint64_t pattern = 0xfedcba9876543210;\n \tunsigned int i, j;\n \n-\tfor (i = 0; i < RTE_DIM(length); i++) {\n+\tfor (i = 0; i < RTE_DIM(lengths); i++) {\n \t\t/* reset dst_data */\n-\t\tmemset(dst_data, 0, length[i]);\n+\t\tmemset(dst_data, 0, lengths[i]);\n \n \t\t/* perform the fill operation */\n \t\tif (rte_ioat_enqueue_fill(dev_id, pattern,\n-\t\t\t\tdst->buf_iova + dst->data_off, length[i],\n+\t\t\t\tdst->buf_iova + dst->data_off, lengths[i],\n \t\t\t\t(uintptr_t)dst) != 1) {\n \t\t\tPRINT_ERR(\"Error with rte_ioat_enqueue_fill\\n\");\n \t\t\treturn -1;\n@@ -186,11 +261,11 @@ test_enqueue_fill(int dev_id)\n \t\t\treturn -1;\n \t\t}\n \t\t/* check the result */\n-\t\tfor (j = 0; j < length[i]; j++) {\n+\t\tfor (j = 0; j < lengths[i]; j++) {\n \t\t\tchar pat_byte = ((char *)&pattern)[j % 8];\n \t\t\tif (dst_data[j] != pat_byte) {\n-\t\t\t\tPRINT_ERR(\"Error with fill operation (length = %u): got (%x), not (%x)\\n\",\n-\t\t\t\t\t\tlength[i], dst_data[j],\n+\t\t\t\tPRINT_ERR(\"Error with fill operation (lengths = %u): got (%x), not (%x)\\n\",\n+\t\t\t\t\t\tlengths[i], dst_data[j],\n \t\t\t\t\t\tpat_byte);\n \t\t\t\treturn -1;\n \t\t\t}\n",
    "prefixes": [
        "v2",
        "01/12"
    ]
}