Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/83716/?format=api
https://patches.dpdk.org/api/patches/83716/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201105090423.11954-4-ndabilpuram@marvell.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": "<20201105090423.11954-4-ndabilpuram@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20201105090423.11954-4-ndabilpuram@marvell.com", "date": "2020-11-05T09:04:23", "name": "[v2,3/3] test: add test case to validate VFIO DMA map/unmap", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "99478871743fad44efa180a68f49b61fe5eea802", "submitter": { "id": 1202, "url": "https://patches.dpdk.org/api/people/1202/?format=api", "name": "Nithin Dabilpuram", "email": "ndabilpuram@marvell.com" }, "delegate": { "id": 24651, "url": "https://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20201105090423.11954-4-ndabilpuram@marvell.com/mbox/", "series": [ { "id": 13683, "url": "https://patches.dpdk.org/api/series/13683/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13683", "date": "2020-11-05T09:04:20", "name": "fix issue with partial DMA unmap", "version": 2, "mbox": "https://patches.dpdk.org/series/13683/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/83716/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/83716/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 15DB5A04B1;\n\tThu, 5 Nov 2020 10:05:53 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 581A6BE3F;\n\tThu, 5 Nov 2020 10:04:42 +0100 (CET)", "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id B7AA1AD6F\n for <dev@dpdk.org>; Thu, 5 Nov 2020 10:04:37 +0100 (CET)", "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n 0A58xwY3028563; Thu, 5 Nov 2020 01:04:36 -0800", "from sc-exch03.marvell.com ([199.233.58.183])\n by mx0a-0016f401.pphosted.com with ESMTP id 34mbfcrndv-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Thu, 05 Nov 2020 01:04:35 -0800", "from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com\n (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 5 Nov\n 2020 01:04:34 -0800", "from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH04.marvell.com\n (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Thu, 5 Nov 2020 01:04:34 -0800", "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Thu, 5 Nov 2020 01:04:35 -0800", "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id 471B23F7041;\n Thu, 5 Nov 2020 01:04:33 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-type; s=pfpt0220; bh=6hNBB/wiwCuiRJQE8WuZTFocKthDndR0igg245F8/xs=;\n b=ixf+dJBjYSgtCha1BrAxAdhSXqcFcZZ2Y0S8phayBy37JY9y7t+LeGuPk2gQqR7/CcKD\n /KF9UAqYJ9VNwIxdnsEO46zw1XKvhf4VdrDneke9YN6KueIzhpwoJNx5IAXTKOzhiVxz\n 2lPlTomqF9X0zcQmeK4GmIHm0tXpbOR8vd6mXhSa7mQAfZPSfsWOxQ0/xaCj8t2j7ylO\n saBtxG8B91cuNV4xIu307riZCLNjEEmdKUym20zQdqbp9mazmp9oauvCo09DtcvVYT4K\n 3g1oMx57+19x6Su869x8h6pBjjsoasI9XcGUoYeg1Z6r5sXr3Jke00/L/4fGoEtDa6v+ 0g==", "From": "Nithin Dabilpuram <ndabilpuram@marvell.com>", "To": "<anatoly.burakov@intel.com>", "CC": "<jerinj@marvell.com>, <dev@dpdk.org>, Nithin Dabilpuram\n <ndabilpuram@marvell.com>", "Date": "Thu, 5 Nov 2020 14:34:23 +0530", "Message-ID": "<20201105090423.11954-4-ndabilpuram@marvell.com>", "X-Mailer": "git-send-email 2.8.4", "In-Reply-To": "<20201105090423.11954-1-ndabilpuram@marvell.com>", "References": "<20201012081106.10610-1-ndabilpuram@marvell.com>\n <20201105090423.11954-1-ndabilpuram@marvell.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737\n definitions=2020-11-05_05:2020-11-05,\n 2020-11-05 signatures=0", "Subject": "[dpdk-dev] [PATCH v2 3/3] test: add test case to validate VFIO DMA\n\tmap/unmap", "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": "Test case mmap's system pages and tries to performs a user\nDMA map and unmap both partially and fully.\n\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\n---\n app/test/meson.build | 1 +\n app/test/test_vfio.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 104 insertions(+)\n create mode 100644 app/test/test_vfio.c", "diff": "diff --git a/app/test/meson.build b/app/test/meson.build\nindex 88c831a..b0411ee 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -139,6 +139,7 @@ test_sources = files('commands.c',\n \t'test_trace_register.c',\n \t'test_trace_perf.c',\n \t'test_version.c',\n+\t'test_vfio.c',\n \t'virtual_pmd.c'\n )\n \ndiff --git a/app/test/test_vfio.c b/app/test/test_vfio.c\nnew file mode 100644\nindex 0000000..00626d4\n--- /dev/null\n+++ b/app/test/test_vfio.c\n@@ -0,0 +1,103 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2020 Marvell.\n+ */\n+\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <string.h>\n+#include <sys/mman.h>\n+#include <unistd.h>\n+\n+#include <rte_common.h>\n+#include <rte_eal.h>\n+#include <rte_eal_paging.h>\n+#include <rte_errno.h>\n+#include <rte_memory.h>\n+#include <rte_vfio.h>\n+\n+#include \"test.h\"\n+\n+static int\n+test_memory_vfio_dma_map(void)\n+{\n+\tuint64_t sz1, sz2, sz = 2 * rte_mem_page_size();\n+\tuint64_t unmap1, unmap2;\n+\tuint8_t *mem;\n+\tint ret;\n+\n+\t/* Allocate twice size of page */\n+\tmem = mmap(NULL, sz, PROT_READ | PROT_WRITE,\n+\t\t MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n+\tif (mem == MAP_FAILED) {\n+\t\tprintf(\"Failed to allocate memory for external heap\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\t/* Force page allocation */\n+\tmemset(mem, 0, sz);\n+\n+\t/* map the whole region */\n+\tret = rte_vfio_container_dma_map(RTE_VFIO_DEFAULT_CONTAINER_FD,\n+\t\t\t\t\t (uintptr_t)mem, (rte_iova_t)mem, sz);\n+\tif (ret) {\n+\t\t/* Check if VFIO is not available or no device is probed */\n+\t\tif (rte_errno == ENOTSUP || rte_errno == ENODEV) {\n+\t\t\tret = 1;\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tprintf(\"Failed to dma map whole region, ret=%d(%s)\\n\",\n+\t\t ret, rte_strerror(rte_errno));\n+\t\tgoto fail;\n+\t}\n+\n+\tunmap1 = (uint64_t)mem + (sz / 2);\n+\tsz1 = sz / 2;\n+\tunmap2 = (uint64_t)mem;\n+\tsz2 = sz / 2;\n+\t/* unmap the partial region */\n+\tret = rte_vfio_container_dma_unmap(RTE_VFIO_DEFAULT_CONTAINER_FD,\n+\t\t\t\t\t unmap1, (rte_iova_t)unmap1, sz1);\n+\tif (ret) {\n+\t\tif (rte_errno == ENOTSUP) {\n+\t\t\tprintf(\"Partial dma unmap not supported\\n\");\n+\t\t\tunmap2 = (uint64_t)mem;\n+\t\t\tsz2 = sz;\n+\t\t} else {\n+\t\t\tprintf(\"Failed to unmap second half region, ret=%d(%s)\\n\",\n+\t\t\t ret, rte_strerror(rte_errno));\n+\t\t\tgoto fail;\n+\t\t}\n+\t}\n+\n+\t/* unmap the remaining region */\n+\tret = rte_vfio_container_dma_unmap(RTE_VFIO_DEFAULT_CONTAINER_FD,\n+\t\t\t\t\t unmap2, (rte_iova_t)unmap2, sz2);\n+\tif (ret) {\n+\t\tprintf(\"Failed to unmap remaining region, ret=%d(%s)\\n\", ret,\n+\t\t rte_strerror(rte_errno));\n+\t\tgoto fail;\n+\t}\n+\n+fail:\n+\tmunmap(mem, sz);\n+\treturn ret;\n+}\n+\n+static int\n+test_vfio(void)\n+{\n+\tint ret;\n+\n+\t/* test for vfio dma map/unmap */\n+\tret = test_memory_vfio_dma_map();\n+\tif (ret == 1) {\n+\t\tprintf(\"VFIO dma map/unmap unsupported\\n\");\n+\t} else if (ret < 0) {\n+\t\tprintf(\"Error vfio dma map/unmap, ret=%d\\n\", ret);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+REGISTER_TEST_COMMAND(vfio_autotest, test_vfio);\n", "prefixes": [ "v2", "3/3" ] }{ "id": 83716, "url": "