Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/71942/?format=api
http://patches.dpdk.org/api/patches/71942/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200622075529.24180-3-talshn@mellanox.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": "<20200622075529.24180-3-talshn@mellanox.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200622075529.24180-3-talshn@mellanox.com", "date": "2020-06-22T07:55:22", "name": "[v8,2/9] pci: use OS generic memory mapping functions", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "01d7926ecdce625dcbb13671235d40287183b525", "submitter": { "id": 1669, "url": "http://patches.dpdk.org/api/people/1669/?format=api", "name": "Tal Shnaiderman", "email": "talshn@mellanox.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/20200622075529.24180-3-talshn@mellanox.com/mbox/", "series": [ { "id": 10544, "url": "http://patches.dpdk.org/api/series/10544/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=10544", "date": "2020-06-22T07:55:23", "name": "Windows bus/pci support", "version": 8, "mbox": "http://patches.dpdk.org/series/10544/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/71942/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/71942/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 0CD1FA0350;\n\tMon, 22 Jun 2020 09:56:19 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0509E1D5C9;\n\tMon, 22 Jun 2020 09:55:50 +0200 (CEST)", "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 038EC1D575\n for <dev@dpdk.org>; Mon, 22 Jun 2020 09:55:42 +0200 (CEST)", "from Internal Mail-Server by MTLPINE1 (envelope-from\n talshn@mellanox.com) with SMTP; 22 Jun 2020 10:55:40 +0300", "from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx\n [10.237.1.5])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05M7tdC2017100;\n Mon, 22 Jun 2020 10:55:40 +0300" ], "From": "talshn@mellanox.com", "To": "dev@dpdk.org", "Cc": "thomas@monjalon.net, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com,\n david.marchand@redhat.com, grive@u256.net, ranjit.menon@intel.com,\n navasile@linux.microsoft.com, harini.ramakrishnan@microsoft.com,\n ocardona@microsoft.com, anatoly.burakov@intel.com, fady@mellanox.com,\n bruce.richardson@intel.com, Tal Shnaiderman <talshn@mellanox.com>", "Date": "Mon, 22 Jun 2020 10:55:22 +0300", "Message-Id": "<20200622075529.24180-3-talshn@mellanox.com>", "X-Mailer": "git-send-email 2.16.1.windows.4", "In-Reply-To": "<20200622075529.24180-1-talshn@mellanox.com>", "References": "<20200621102612.22740-2-talshn@mellanox.com>\n <20200622075529.24180-1-talshn@mellanox.com>", "Subject": "[dpdk-dev] [PATCH v8 2/9] pci: use OS generic memory mapping\n\tfunctions", "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": "From: Tal Shnaiderman <talshn@mellanox.com>\n\nChanging all of PCIs Unix memory mapping to the\nnew memory allocation API wrapper.\n\nChange all of PCI mapping function usage in\nbus/pci to support the new API.\n\nSigned-off-by: Tal Shnaiderman <talshn@mellanox.com>\n---\n drivers/bus/pci/bsd/pci.c | 2 +-\n drivers/bus/pci/linux/pci_uio.c | 2 +-\n drivers/bus/pci/linux/pci_vfio.c | 9 +++++----\n drivers/bus/pci/pci_common_uio.c | 2 +-\n lib/librte_eal/rte_eal_exports.def | 1 +\n lib/librte_pci/rte_pci.c | 19 ++++++++++---------\n lib/librte_pci/rte_pci.h | 2 +-\n 7 files changed, 20 insertions(+), 17 deletions(-)", "diff": "diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c\nindex 6ec27b4b5b..8bc473eb9a 100644\n--- a/drivers/bus/pci/bsd/pci.c\n+++ b/drivers/bus/pci/bsd/pci.c\n@@ -192,7 +192,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n \tmapaddr = pci_map_resource(NULL, fd, (off_t)offset,\n \t\t\t(size_t)dev->mem_resource[res_idx].len, 0);\n \tclose(fd);\n-\tif (mapaddr == MAP_FAILED)\n+\tif (mapaddr == NULL)\n \t\tgoto error;\n \n \tmaps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr;\ndiff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c\nindex 097dc19225..b622001539 100644\n--- a/drivers/bus/pci/linux/pci_uio.c\n+++ b/drivers/bus/pci/linux/pci_uio.c\n@@ -345,7 +345,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n \tmapaddr = pci_map_resource(pci_map_addr, fd, 0,\n \t\t\t(size_t)dev->mem_resource[res_idx].len, 0);\n \tclose(fd);\n-\tif (mapaddr == MAP_FAILED)\n+\tif (mapaddr == NULL)\n \t\tgoto error;\n \n \tpci_map_addr = RTE_PTR_ADD(mapaddr,\ndiff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex 64cd84a689..bde9ad56fd 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -14,6 +14,7 @@\n #include <rte_log.h>\n #include <rte_pci.h>\n #include <rte_bus_pci.h>\n+#include <rte_eal_paging.h>\n #include <rte_malloc.h>\n #include <rte_vfio.h>\n #include <rte_eal.h>\n@@ -524,11 +525,11 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,\n \t\t\tmap_addr = pci_map_resource(bar_addr, vfio_dev_fd,\n \t\t\t\t\t\t\tmemreg[0].offset,\n \t\t\t\t\t\t\tmemreg[0].size,\n-\t\t\t\t\t\t\tMAP_FIXED);\n+\t\t\t\t\t\t\tRTE_MAP_FORCE_ADDRESS);\n \t\t}\n \n \t\t/* if there's a second part, try to map it */\n-\t\tif (map_addr != MAP_FAILED\n+\t\tif (map_addr != NULL\n \t\t\t&& memreg[1].offset && memreg[1].size) {\n \t\t\tvoid *second_addr = RTE_PTR_ADD(bar_addr,\n \t\t\t\t\t\t(uintptr_t)(memreg[1].offset -\n@@ -537,10 +538,10 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,\n \t\t\t\t\t\t\tvfio_dev_fd,\n \t\t\t\t\t\t\tmemreg[1].offset,\n \t\t\t\t\t\t\tmemreg[1].size,\n-\t\t\t\t\t\t\tMAP_FIXED);\n+\t\t\t\t\t\t\tRTE_MAP_FORCE_ADDRESS);\n \t\t}\n \n-\t\tif (map_addr == MAP_FAILED || !map_addr) {\n+\t\tif (map_addr == NULL) {\n \t\t\tmunmap(bar_addr, bar->size);\n \t\t\tbar_addr = MAP_FAILED;\n \t\t\tRTE_LOG(ERR, EAL, \"Failed to map pci BAR%d\\n\",\ndiff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c\nindex f4dca9da91..793dfd0a7c 100644\n--- a/drivers/bus/pci/pci_common_uio.c\n+++ b/drivers/bus/pci/pci_common_uio.c\n@@ -58,7 +58,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)\n \t\t\t\t\t\"Cannot mmap device resource file %s to address: %p\\n\",\n \t\t\t\t\tuio_res->maps[i].path,\n \t\t\t\t\tuio_res->maps[i].addr);\n-\t\t\t\tif (mapaddr != MAP_FAILED) {\n+\t\t\t\tif (mapaddr != NULL) {\n \t\t\t\t\t/* unmap addrs correctly mapped */\n \t\t\t\t\tfor (j = 0; j < i; j++)\n \t\t\t\t\t\tpci_unmap_resource(\ndiff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def\nindex e2eb24f01b..7f0c8f5376 100644\n--- a/lib/librte_eal/rte_eal_exports.def\n+++ b/lib/librte_eal/rte_eal_exports.def\n@@ -46,6 +46,7 @@ EXPORTS\n \trte_memzone_reserve_aligned\n \trte_memzone_reserve_bounded\n \trte_memzone_walk\n+\trte_strerror\n \trte_vlog\n \trte_realloc\n \trte_zmalloc\ndiff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c\nindex 9c80c4b71d..2adee07aa4 100644\n--- a/lib/librte_pci/rte_pci.c\n+++ b/lib/librte_pci/rte_pci.c\n@@ -9,12 +9,12 @@\n #include <stdlib.h>\n #include <stdio.h>\n #include <sys/queue.h>\n-#include <sys/mman.h>\n \n #include <rte_errno.h>\n #include <rte_interrupts.h>\n #include <rte_log.h>\n #include <rte_bus.h>\n+#include <rte_eal_paging.h>\n #include <rte_per_lcore.h>\n #include <rte_memory.h>\n #include <rte_eal.h>\n@@ -154,14 +154,15 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,\n \tvoid *mapaddr;\n \n \t/* Map the PCI memory resource of device */\n-\tmapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE,\n-\t\t\tMAP_SHARED | additional_flags, fd, offset);\n-\tif (mapaddr == MAP_FAILED) {\n+\tmapaddr = rte_mem_map(requested_addr, size,\n+\t\tRTE_PROT_READ | RTE_PROT_WRITE,\n+\t\tRTE_MAP_SHARED | additional_flags, fd, offset);\n+\tif (mapaddr == NULL) {\n \t\tRTE_LOG(ERR, EAL,\n-\t\t\t\"%s(): cannot mmap(%d, %p, 0x%zx, 0x%llx): %s (%p)\\n\",\n+\t\t\t\"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\\n\",\n \t\t\t__func__, fd, requested_addr, size,\n \t\t\t(unsigned long long)offset,\n-\t\t\tstrerror(errno), mapaddr);\n+\t\t\trte_strerror(rte_errno), mapaddr);\n \t} else\n \t\tRTE_LOG(DEBUG, EAL, \" PCI memory mapped at %p\\n\", mapaddr);\n \n@@ -176,10 +177,10 @@ pci_unmap_resource(void *requested_addr, size_t size)\n \t\treturn;\n \n \t/* Unmap the PCI memory resource of device */\n-\tif (munmap(requested_addr, size)) {\n-\t\tRTE_LOG(ERR, EAL, \"%s(): cannot munmap(%p, %#zx): %s\\n\",\n+\tif (rte_mem_unmap(requested_addr, size)) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot mem unmap(%p, %#zx): %s\\n\",\n \t\t\t__func__, requested_addr, size,\n-\t\t\tstrerror(errno));\n+\t\t\trte_strerror(errno));\n \t} else\n \t\tRTE_LOG(DEBUG, EAL, \" PCI memory unmapped at %p\\n\",\n \t\t\t\trequested_addr);\ndiff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h\nindex 4087771c1e..b721bbf580 100644\n--- a/lib/librte_pci/rte_pci.h\n+++ b/lib/librte_pci/rte_pci.h\n@@ -159,7 +159,7 @@ int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr);\n * The additional flags for the mapping range.\n * @return\n * - On success, the function returns a pointer to the mapped area.\n- * - On error, the value MAP_FAILED is returned.\n+ * - On error, NULL is returned.\n */\n void *pci_map_resource(void *requested_addr, int fd, off_t offset,\n \t\tsize_t size, int additional_flags);\n", "prefixes": [ "v8", "2/9" ] }{ "id": 71942, "url": "