Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/80335/?format=api
https://patches.dpdk.org/api/patches/80335/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201012081106.10610-2-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": "<20201012081106.10610-2-ndabilpuram@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20201012081106.10610-2-ndabilpuram@marvell.com", "date": "2020-10-12T08:11:05", "name": "[1/2] test: add test case to validate VFIO DMA map/unmap", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "92c5d9b73c22373ebd189d8bab791b98186605fb", "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/20201012081106.10610-2-ndabilpuram@marvell.com/mbox/", "series": [ { "id": 12874, "url": "https://patches.dpdk.org/api/series/12874/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=12874", "date": "2020-10-12T08:11:04", "name": "fix issue with partial DMA unmap", "version": 1, "mbox": "https://patches.dpdk.org/series/12874/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/80335/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/80335/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 B88E2A04B6;\n\tMon, 12 Oct 2020 10:13:05 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 213551D62A;\n\tMon, 12 Oct 2020 10:12:49 +0200 (CEST)", "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 1117A1D625\n for <dev@dpdk.org>; Mon, 12 Oct 2020 10:12:45 +0200 (CEST)", "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 09C8BO8s002106; Mon, 12 Oct 2020 01:12:44 -0700", "from sc-exch01.marvell.com ([199.233.58.181])\n by mx0a-0016f401.pphosted.com with ESMTP id 343aand9gm-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Mon, 12 Oct 2020 01:12:44 -0700", "from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH01.marvell.com\n (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Mon, 12 Oct 2020 01:12:43 -0700", "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Mon, 12 Oct 2020 01:12:42 -0700", "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Mon, 12 Oct 2020 01:12:42 -0700", "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id F27083F7041;\n Mon, 12 Oct 2020 01:12:40 -0700 (PDT)" ], "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=BrXrRx2I1yTRHodasPH2Jg8cJ7EmlEFVrY/o3Ah+ngA=;\n b=Igh4wmcCtbvwlFcZlVkh7WABqUWZ2MZkWeyWYVT5xW7Ai51wdPvPjYI2H8OuvEH4E21X\n 8ujsXFLVs+c+jDIgo1O0lIM3wkaO4SLAqXgJFjYL9gQeRfR9BsUqcc+ABcTtf8rPGG3d\n 5YIlRnH4v/mBPHuelo4SAy6iIMydjxGkH9T2u6VO3XZrIrutAiSXPl2RV8K256QytEBG\n yuvzlWKvdimNF5Zm5OEehMFF4spJNkTZK7jZL6RH/HUcd0+dBz7jdr+ZCCctbTxx2ked\n e2OogvhFlWPVzIJ7SDONLqnVAbqJRhZVUnODNHcVCyySqg5nENzOHb3iBkImLZWZWmfw kg==", "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": "Mon, 12 Oct 2020 13:41:05 +0530", "Message-ID": "<20201012081106.10610-2-ndabilpuram@marvell.com>", "X-Mailer": "git-send-email 2.8.4", "In-Reply-To": "<20201012081106.10610-1-ndabilpuram@marvell.com>", "References": "<20201012081106.10610-1-ndabilpuram@marvell.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687\n definitions=2020-10-12_03:2020-10-12,\n 2020-10-12 signatures=0", "Subject": "[dpdk-dev] [PATCH 1/2] 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": "Add test case in test_memory to test VFIO DMA map/unmap.\n\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\n---\n app/test/test_memory.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 79 insertions(+)", "diff": "diff --git a/app/test/test_memory.c b/app/test/test_memory.c\nindex 7d5ae99..1c56455 100644\n--- a/app/test/test_memory.c\n+++ b/app/test/test_memory.c\n@@ -4,11 +4,16 @@\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_eal.h>\n+#include <rte_errno.h>\n #include <rte_memory.h>\n #include <rte_common.h>\n #include <rte_memzone.h>\n+#include <rte_vfio.h>\n \n #include \"test.h\"\n \n@@ -70,6 +75,71 @@ check_seg_fds(const struct rte_memseg_list *msl, const struct rte_memseg *ms,\n }\n \n static int\n+test_memory_vfio_dma_map(void)\n+{\n+\tuint64_t sz = 2 * sysconf(_SC_PAGESIZE), sz1, sz2;\n+\tuint64_t unmap1, unmap2;\n+\tuint8_t *mem;\n+\tint ret;\n+\n+\t/* Check if vfio is enabled in both kernel and eal */\n+\tret = rte_vfio_is_enabled(\"vfio\");\n+\tif (!ret)\n+\t\treturn 1;\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 (uint64_t)mem, (rte_iova_t)mem, sz);\n+\tif (ret) {\n+\t\tprintf(\"Failed to dma map whole region, ret=%d\\n\", ret);\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 send half region, ret=%d(%d)\\n\",\n+\t\t\t ret, 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(%d)\\n\", ret,\n+\t\t 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_memory(void)\n {\n \tuint64_t s;\n@@ -101,6 +171,15 @@ test_memory(void)\n \t\treturn -1;\n \t}\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", "prefixes": [ "1/2" ] }{ "id": 80335, "url": "