get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 97398,
    "url": "http://patches.dpdk.org/api/patches/97398/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210826183301.333442-5-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": "<20210826183301.333442-5-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210826183301.333442-5-bruce.richardson@intel.com",
    "date": "2021-08-26T18:32:58",
    "name": "[RFC,4/7] app/test: add basic dmadev copy tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "caa104e4bc99a72024d5c80176cc8d347188d540",
    "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/20210826183301.333442-5-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 18477,
            "url": "http://patches.dpdk.org/api/series/18477/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=18477",
            "date": "2021-08-26T18:32:54",
            "name": "add test suite for DMA drivers",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/18477/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/97398/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/97398/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 0F11AA0C43;\n\tThu, 26 Aug 2021 20:33:44 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E646641256;\n\tThu, 26 Aug 2021 20:33:28 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by mails.dpdk.org (Postfix) with ESMTP id A9D9E41228\n for <dev@dpdk.org>; Thu, 26 Aug 2021 20:33:26 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Aug 2021 11:33:26 -0700",
            "from silpixa00399126.ir.intel.com ([10.237.223.29])\n by fmsmga006.fm.intel.com with ESMTP; 26 Aug 2021 11:33:24 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10088\"; a=\"217847151\"",
            "E=Sophos;i=\"5.84,354,1620716400\"; d=\"scan'208\";a=\"217847151\"",
            "E=Sophos;i=\"5.84,354,1620716400\"; d=\"scan'208\";a=\"685030822\""
        ],
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "conor.walsh@intel.com, kevin.laatz@intel.com,\n Chengwen Feng <fengchengwen@huawei.com>, jerinj@marvell.com,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Thu, 26 Aug 2021 19:32:58 +0100",
        "Message-Id": "<20210826183301.333442-5-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20210826183301.333442-1-bruce.richardson@intel.com>",
        "References": "<20210826183301.333442-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [RFC PATCH 4/7] app/test: add basic dmadev copy tests",
        "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": "For each dmadev instance, perform some basic copy tests to validate that\nfunctionality.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n app/test/test_dmadev.c | 157 +++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 157 insertions(+)",
    "diff": "diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c\nindex f895556d29..a9f7d34a94 100644\n--- a/app/test/test_dmadev.c\n+++ b/app/test/test_dmadev.c\n@@ -1,11 +1,14 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n  * Copyright(c) 2021 HiSilicon Limited.\n  */\n+#include <unistd.h>\n \n #include <rte_common.h>\n #include <rte_dev.h>\n #include <rte_dmadev.h>\n #include <rte_bus_vdev.h>\n+#include <rte_mbuf.h>\n+#include <rte_random.h>\n \n #include \"test.h\"\n \n@@ -14,6 +17,11 @@ extern int test_dmadev_api(uint16_t dev_id);\n \n #define PRINT_ERR(...) print_err(__func__, __LINE__, __VA_ARGS__)\n \n+#define COPY_LEN 1024\n+\n+static struct rte_mempool *pool;\n+static uint16_t id_count;\n+\n static inline int\n __rte_format_printf(3, 4)\n print_err(const char *func, int lineno, const char *format, ...)\n@@ -29,10 +37,123 @@ print_err(const char *func, int lineno, const char *format, ...)\n \treturn ret;\n }\n \n+static int\n+test_enqueue_copies(int dev_id, uint16_t vchan)\n+{\n+\tunsigned int i;\n+\tuint16_t id;\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+\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\tfor (i = 0; i < COPY_LEN; i++)\n+\t\t\tsrc_data[i] = rte_rand() & 0xFF;\n+\n+\t\tid = rte_dmadev_copy(dev_id, vchan, src->buf_iova + src->data_off,\n+\t\t\t\tdst->buf_iova + dst->data_off, COPY_LEN, RTE_DMA_OP_FLAG_SUBMIT);\n+\t\tif (id != id_count) {\n+\t\t\tPRINT_ERR(\"Error with rte_dmadev_copy, got %u, expected %u\\n\",\n+\t\t\t\t\tid, id_count);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\t/* give time for copy to finish, then check it was done */\n+\t\tusleep(10);\n+\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 [Got %02x not %02x]\\n\", i,\n+\t\t\t\t\t\tdst_data[i], src_data[i]);\n+\t\t\t\trte_dmadev_dump(dev_id, stderr);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\n+\t\t/* now check completion works */\n+\t\tif (rte_dmadev_completed(dev_id, vchan, 1, &id, NULL) != 1) {\n+\t\t\tPRINT_ERR(\"Error with rte_dmadev_completed\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (id != id_count) {\n+\t\t\tPRINT_ERR(\"Error:incorrect job id received, %u [expected %u]\\n\",\n+\t\t\t\t\tid, id_count);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\trte_pktmbuf_free(src);\n+\t\trte_pktmbuf_free(dst);\n+\n+\t\t/* now check completion works */\n+\t\tif (rte_dmadev_completed(dev_id, 0, 1, NULL, NULL) != 0) {\n+\t\t\tPRINT_ERR(\"Error with rte_dmadev_completed in empty check\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tid_count++;\n+\n+\t} while (0);\n+\n+\t/* test doing a multiple single copies */\n+\tdo {\n+\t\tconst uint16_t max_ops = 4;\n+\t\tstruct rte_mbuf *src, *dst;\n+\t\tchar *src_data, *dst_data;\n+\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\tfor (i = 0; i < COPY_LEN; i++)\n+\t\t\tsrc_data[i] = rte_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_dmadev_copy(dev_id, vchan,\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, RTE_DMA_OP_FLAG_SUBMIT) != id_count++) {\n+\t\t\t\tPRINT_ERR(\"Error with rte_dmadev_copy\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\t\tusleep(10);\n+\n+\t\tif ((i = rte_dmadev_completed(dev_id, vchan, max_ops * 2, &id, NULL)) != max_ops) {\n+\t\t\tPRINT_ERR(\"Error with rte_dmadev_completed, got %u not %u\\n\", i, max_ops);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (id != id_count - 1) {\n+\t\t\tPRINT_ERR(\"Error, incorrect job id returned: got %u not %u\\n\",\n+\t\t\t\t\tid, id_count - 1);\n+\t\t\treturn -1;\n+\t\t}\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+\t\t}\n+\t\trte_pktmbuf_free(src);\n+\t\trte_pktmbuf_free(dst);\n+\t} while (0);\n+\n+\treturn 0;\n+}\n+\n static int\n test_dmadev_instance(uint16_t dev_id)\n {\n #define TEST_RINGSIZE 512\n+\tstruct rte_dmadev_stats stats;\n+\tint i;\n+\n \t/* Setup of the dmadev device. 8< */\n \tstruct rte_dmadev_info info;\n \tconst struct rte_dmadev_conf conf = { .nb_vchans = 1};\n@@ -68,9 +189,45 @@ test_dmadev_instance(uint16_t dev_id)\n \t\tPRINT_ERR(\"Error with rte_rawdev_start()\\n\");\n \t\treturn -1;\n \t}\n+\tid_count = 0;\n \n+\t/* create a mempool for running tests */\n+\tpool = rte_pktmbuf_pool_create(\"TEST_DMADEV_POOL\",\n+\t\t\tTEST_RINGSIZE * 2, /* n == num elements */\n+\t\t\t32,  /* cache size */\n+\t\t\t0,   /* priv size */\n+\t\t\t2048, /* data room size */\n+\t\t\tinfo.device->numa_node);\n+\tif (pool == NULL) {\n+\t\tPRINT_ERR(\"Error with mempool creation\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\t/* run the test cases, use many iterations to ensure UINT16_MAX id wraparound */\n+\tprintf(\"DMA Dev: %u, Running Copy Tests\\n\", dev_id);\n+\tfor (i = 0; i < 640; i++) {\n+\n+\t\tif (test_enqueue_copies(dev_id, vchan) != 0) {\n+\t\t\tprintf(\"Error with iteration %d\\n\", i);\n+\t\t\trte_dmadev_dump(dev_id, stdout);\n+\t\t\tgoto err;\n+\t\t}\n+\n+\t\trte_dmadev_stats_get(dev_id, 0, &stats);\n+\t\tprintf(\"Ops submitted: %\"PRIu64\"\\t\", stats.submitted);\n+\t\tprintf(\"Ops completed: %\"PRIu64\"\\r\", stats.completed);\n+\t}\n+\tprintf(\"\\n\");\n+\n+\n+\trte_mempool_free(pool);\n \trte_dmadev_stop(dev_id);\n \treturn 0;\n+\n+err:\n+\trte_mempool_free(pool);\n+\trte_dmadev_stop(dev_id);\n+\treturn -1;\n }\n \n static int\n",
    "prefixes": [
        "RFC",
        "4/7"
    ]
}