get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 73741,
    "url": "http://patchwork.dpdk.org/api/patches/73741/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200710115324.3902559-1-thomas@monjalon.net/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20200710115324.3902559-1-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200710115324.3902559-1-thomas@monjalon.net",
    "date": "2020-07-10T11:53:24",
    "name": "pci: keep API compatibility with mmap values",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7499ceecb4a8c9d722c2f4f385bae837d3020704",
    "submitter": {
        "id": 685,
        "url": "http://patchwork.dpdk.org/api/people/685/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas@monjalon.net"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20200710115324.3902559-1-thomas@monjalon.net/mbox/",
    "series": [
        {
            "id": 10947,
            "url": "http://patchwork.dpdk.org/api/series/10947/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10947",
            "date": "2020-07-10T11:53:24",
            "name": "pci: keep API compatibility with mmap values",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/10947/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/73741/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/73741/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 988E4A052A;\n\tFri, 10 Jul 2020 13:53:41 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A1C9C1DB60;\n\tFri, 10 Jul 2020 13:53:40 +0200 (CEST)",
            "from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com\n [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id 8A3081DB53\n for <dev@dpdk.org>; Fri, 10 Jul 2020 13:53:39 +0200 (CEST)",
            "from compute7.internal (compute7.nyi.internal [10.202.2.47])\n by mailnew.nyi.internal (Postfix) with ESMTP id DCAEB580534;\n Fri, 10 Jul 2020 07:53:38 -0400 (EDT)",
            "from mailfrontend2 ([10.202.2.163])\n by compute7.internal (MEProxy); Fri, 10 Jul 2020 07:53:38 -0400",
            "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n by mail.messagingengine.com (Postfix) with ESMTPA id 520BB306005F;\n Fri, 10 Jul 2020 07:53:36 -0400 (EDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding; s=fm1; bh=ZDayVWP3uBmcFE1vmMkC465R78\n ljEfaxwEsrq2l5r7Y=; b=fGJW6OKboq3e/hqK+j0P3a0r51FsOjaJw+R3p+CUCS\n dC6w1DRZFr2Lu5mVN/rsfw1LmNh/peWf/Wq279NZOvDkCDoPU6ISn9gy8aH8Hfnd\n rmRAm529JKHjtNJJ9kJfz/R7JSQv94CeNEeq05z2hhEnVL0A8gNJCDBFVJ7l465s\n +vWzke8UOdlcRaLaReXL4PF3tPrDxUxGvSaJNiXy7YoHI8+NE0M5Q75lm4cusWWS\n lJ03AUNw8VmdkuF1jOgbhJN7tAXI1uBOKb8r3R3HmxTFrxpD0cBO6xzssr4DZA9b\n nDqTjflWDpqDdcS5abtfY6UyAVrK4fifbyN7LXFPoTGg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:content-transfer-encoding:date:from\n :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy\n :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=ZDayVWP3uBmcFE1vm\n MkC465R78ljEfaxwEsrq2l5r7Y=; b=QdN9/VQjCEeRn6BHXkGozFc7QWpNwPVNd\n OCqSlzS/z4L9EXvSR9rNpuyU2efosRNVsJRnmGmY1Hki/n4FaHkw2BS8/G8bqxH/\n 1j8cfbJDqtdXTnTHpDnP9qXzcDAJKMYojX2amrxaK9glMaboxAAcVAiii8dJbEri\n vP3+BRe5FnbiMuaJbH1hlYrKYcvQTH9WG4EfmqDXdb5bJhkLxRFG++X5DZ/BtOII\n w0sPi2bevYIl5qXysIKNcncZFOb15ubGvSmJsjA07fLIKFElzrWGvOkBDbTir292\n O3YgIzlPwlsj2vllH6u6yGGp8GAU4YEC7W9xH2neFdMsl3b51woDA=="
        ],
        "X-ME-Sender": "<xms:wVYIX4sHHlwgcUrRzDQd7mFaiDSkcxWkLb2EidZOlwqeRZ-XmzFE2w>",
        "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgeduiedrvddugdegkecutefuodetggdotefrodftvf\n curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu\n uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertd\n dtnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhn\n jhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepvdelvdduhedvudduveeuvdevhe\n egudelgeeigfejheduhedttdegudffjeeihffgnecukfhppeejjedrudefgedrvddtfedr\n udekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe\n hthhhomhgrshesmhhonhhjrghlohhnrdhnvght",
        "X-ME-Proxy": "<xmx:wVYIX1c0qvnkbk2j4u8p0-45PEW7wBpnI3Xf2wQUZJib9UqKNAZLdA>\n <xmx:wVYIXzzLEuJ2emmz_keuNFBZMEpM9USp0M6bd934u-VNIJ1s8-25Cg>\n <xmx:wVYIX7Pcy8wgEpYxhhh3nyWPXdLO5gAuYhNG3fUwbByGYu2ftB09tw>\n <xmx:wlYIX53iEGKg7Xp-AQ5jD34lbf3IQ1P2ORmchIWPEbq4O2j9sd2g_Q>",
        "From": "Thomas Monjalon <thomas@monjalon.net>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, ferruh.yigit@intel.com, grive@u256.net,\n alvinx.zhang@intel.com, beilei.xing@intel.com, jia.guo@intel.com,\n anatoly.burakov@intel.com, bruce.richardson@intel.com,\n dmitry.kozliuk@gmail.com, navasile@linux.microsoft.com,\n dmitrym@microsoft.com, pallavi.kadam@intel.com, talshn@mellanox.com",
        "Date": "Fri, 10 Jul 2020 13:53:24 +0200",
        "Message-Id": "<20200710115324.3902559-1-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.27.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH] pci: keep API compatibility with mmap values",
        "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": "The function pci_map_resource() returns MAP_FAILED in case of error.\nWhen replacing the call to mmap() by rte_mem_map(),\nthe error code became NULL, breaking the API.\nThis function is probably not used outside of DPDK,\nbut it is still a problem for two reasons:\n\t- the deprecation process was not followed\n\t- the Linux function pci_vfio_mmap_bar() is broken for i40e\n\nThe error code is reverted to the Unix value MAP_FAILED.\nWindows needs to define this special value (-1 as in Unix).\nAfter proper deprecation process, the API could be changed again\nif really needed.\n\nBecause of the switch from mmap() to rte_mem_map(),\nanother part of the API was changed: \"int additional_flags\"\nare defined as \"additional flags for the mapping range\"\nwithout mentioning it was directly used in mmap().\nCurrently it is directly used in rte_mem_map(),\nthat's why the values rte_map_flags must be mapped (sic) on the mmap ones\nin case of Unix OS.\n\nThese are side effects of a badly defined API using Unix values.\n\nBugzilla ID: 503\nFixes: 2fd3567e5425 (\"pci: use OS generic memory mapping functions\")\nCc: talshn@mellanox.com\n\nReported-by: David Marchand <david.marchand@redhat.com>\nSigned-off-by: Thomas Monjalon <thomas@monjalon.net>\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          | 4 ++--\n drivers/bus/pci/pci_common_uio.c          | 2 +-\n lib/librte_eal/include/rte_eal_paging.h   | 8 ++++++++\n lib/librte_eal/windows/include/sys/mman.h | 9 +++++++++\n lib/librte_pci/rte_pci.c                  | 1 +\n lib/librte_pci/rte_pci.h                  | 2 +-\n 8 files changed, 24 insertions(+), 6 deletions(-)\n create mode 100644 lib/librte_eal/windows/include/sys/mman.h",
    "diff": "diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c\nindex 8bc473eb9a..6ec27b4b5b 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 == NULL)\n+\tif (mapaddr == MAP_FAILED)\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 b622001539..097dc19225 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 == NULL)\n+\tif (mapaddr == MAP_FAILED)\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 fdeb9a8caf..07e072e13f 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -566,7 +566,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,\n \t\t}\n \n \t\t/* if there's a second part, try to map it */\n-\t\tif (map_addr != NULL\n+\t\tif (map_addr != MAP_FAILED\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@@ -578,7 +578,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,\n \t\t\t\t\t\t\tRTE_MAP_FORCE_ADDRESS);\n \t\t}\n \n-\t\tif (map_addr == NULL) {\n+\t\tif (map_addr == NULL || map_addr == MAP_FAILED) {\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 793dfd0a7c..f4dca9da91 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 != NULL) {\n+\t\t\t\tif (mapaddr != MAP_FAILED) {\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/include/rte_eal_paging.h b/lib/librte_eal/include/rte_eal_paging.h\nindex ed98e70e9e..680a7f2505 100644\n--- a/lib/librte_eal/include/rte_eal_paging.h\n+++ b/lib/librte_eal/include/rte_eal_paging.h\n@@ -3,6 +3,7 @@\n  */\n \n #include <stdint.h>\n+#include <sys/mman.h>\n \n #include <rte_compat.h>\n \n@@ -22,6 +23,7 @@ enum rte_mem_prot {\n \n /** Additional flags for memory mapping. */\n enum rte_map_flags {\n+#ifdef RTE_EXEC_ENV_WINDOWS\n \t/** Changes to the mapped memory are visible to other processes. */\n \tRTE_MAP_SHARED = 1 << 0,\n \t/** Mapping is not backed by a regular file. */\n@@ -35,6 +37,12 @@ enum rte_map_flags {\n \t * it is not required to do so, thus mapping with this flag may fail.\n \t */\n \tRTE_MAP_FORCE_ADDRESS = 1 << 3\n+#else /* map mmap flags because they are exposed in pci_map_resource() API */\n+\tRTE_MAP_SHARED = MAP_SHARED,\n+\tRTE_MAP_ANONYMOUS = MAP_ANONYMOUS,\n+\tRTE_MAP_PRIVATE = MAP_PRIVATE,\n+\tRTE_MAP_FORCE_ADDRESS = MAP_FIXED,\n+#endif\n };\n \n /**\ndiff --git a/lib/librte_eal/windows/include/sys/mman.h b/lib/librte_eal/windows/include/sys/mman.h\nnew file mode 100644\nindex 0000000000..0b4b10df1f\n--- /dev/null\n+++ b/lib/librte_eal/windows/include/sys/mman.h\n@@ -0,0 +1,9 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2020 Mellanox Technologies, Ltd\n+ */\n+\n+/*\n+ * The syscall mmap does not exist on Windows,\n+ * but this error code is used in a badly defined DPDK API for PCI mapping.\n+ */\n+#define MAP_FAILED ((void *) -1)\ndiff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c\nindex d8272b9076..1d1cbc75ac 100644\n--- a/lib/librte_pci/rte_pci.c\n+++ b/lib/librte_pci/rte_pci.c\n@@ -163,6 +163,7 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,\n \t\t\t__func__, fd, requested_addr, size,\n \t\t\t(unsigned long long)offset,\n \t\t\trte_strerror(rte_errno), mapaddr);\n+\t\tmapaddr = MAP_FAILED; /* API uses mmap error code */\n \t} else\n \t\tRTE_LOG(DEBUG, EAL, \"  PCI memory mapped at %p\\n\", mapaddr);\n \ndiff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h\nindex 104b2bb858..a03235da1f 100644\n--- a/lib/librte_pci/rte_pci.h\n+++ b/lib/librte_pci/rte_pci.h\n@@ -160,7 +160,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, NULL is returned.\n+ *   - On error, MAP_FAILED 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": []
}