get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 73780,
    "url": "http://patchwork.dpdk.org/api/patches/73780/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200710204034.4158330-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": "<20200710204034.4158330-1-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200710204034.4158330-1-thomas@monjalon.net",
    "date": "2020-07-10T20:40:34",
    "name": "[v2] pci: keep API compatibility with mmap values",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "1b19cc1f4c58c759ae367996896025124e228dee",
    "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/20200710204034.4158330-1-thomas@monjalon.net/mbox/",
    "series": [
        {
            "id": 10959,
            "url": "http://patchwork.dpdk.org/api/series/10959/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10959",
            "date": "2020-07-10T20:40:34",
            "name": "[v2] pci: keep API compatibility with mmap values",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/10959/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/73780/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/73780/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 06F17A052A;\n\tFri, 10 Jul 2020 22:40:47 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A6DBC1DE49;\n\tFri, 10 Jul 2020 22:40:46 +0200 (CEST)",
            "from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com\n [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id 51B051DE21\n for <dev@dpdk.org>; Fri, 10 Jul 2020 22:40:43 +0200 (CEST)",
            "from compute7.internal (compute7.nyi.internal [10.202.2.47])\n by mailnew.nyi.internal (Postfix) with ESMTP id E4D48580473;\n Fri, 10 Jul 2020 16:40:42 -0400 (EDT)",
            "from mailfrontend2 ([10.202.2.163])\n by compute7.internal (MEProxy); Fri, 10 Jul 2020 16:40:42 -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 BFE6B30600A6;\n Fri, 10 Jul 2020 16:40:40 -0400 (EDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding; s=fm1; bh=sx0iGa5Aacvbv\n tvuj6hc7JFBY2C+er9WRyiR9gRNtlU=; b=wVZ1ItsJ25UYqoF94x/v44aHs3Gzm\n MqD8x289sknt9xW39lySVFJN1VK/isBogdUVWsjRbvf6Y9rF4ZDgcak/ByliMwF/\n so4W5blgWaC+qOPi4DRF84ee+JtxfDtIFf7FnrUYm2ZDpJZYk7VLJMHBBUmnkcY8\n PgT14YnmF8RIaqVCmPS5Qeu+1f7ywhq5ORD6EQJwnaMw1CgoJQBTnzUKZrZEICGg\n 6fgRCu2gyDDYIJtvabBLC9cJw2LU9EH48IJqXyb64JI9QmbB3okq8Wnuw6YfAr+V\n K3GpapOdRpbRJ6DTLCfvZfAT+dolVwIdEU6KwyOY7OXMHjZ/pIxZb3LUw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:content-transfer-encoding:date:from\n :in-reply-to:message-id:mime-version:references:subject:to\n :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=\n fm3; bh=sx0iGa5Aacvbvtvuj6hc7JFBY2C+er9WRyiR9gRNtlU=; b=OC6JzCum\n P/52mx3NjIaFtifug36k3VsPd5sKqEd1hUNDHY8GP3aRYUXdOHQ3xs9PMQxGmukB\n 0+tj9gHZfRBVXrB46182z5AXFG3QHEvKTAFlq4qTHxo9My4QsTJx0I0ZiPngqWg7\n ts3Lh2wuj2jf+YxsfTlFNDhC2mOF/pa1yep/DgIxchIzDqmDyMHd2DpGQ2FR1yBX\n eBlYAxzcLOVrFmuzK+rq6coAN1tRRHEKXWyAVSkFSBc+bpnHqxmZfkarK49mkWzW\n CHSmXjNkN09oURlGFaAKJRnGMgqOPXxwc+322Ugzpox+QcIvTCNUQZRw+IhcTVXL\n esSe0hZFOB4ivw=="
        ],
        "X-ME-Sender": "<xms:StIIXwS51EFpT7p4_UyLoNPQ1eo-mITrQBqyyXRWbdf2uMKhZ3Zl1A>",
        "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgeduiedrvddugdduheejucetufdoteggodetrfdotf\n fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen\n uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre\n dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes\n mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedvhefgiedvjeegtdevhe\n efhfetleefgfeivefgffevfeejgedtgfeutdehtdegveenucfkphepjeejrddufeegrddv\n tdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh\n homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth",
        "X-ME-Proxy": "<xmx:StIIX9x6cnU5mo-dgwmHZLTwgl3fqc4a9gZS3GBp-Bzu5RI55jo3iw>\n <xmx:StIIX91PUN6AmIP3l5pFFVZoAwfoq0BtIlhQ-d-k-jZP8yUf6S2C3w>\n <xmx:StIIX0D7kVpFfpe0Ke7Bo8tgQq3xyXC0Wy-66K4StnON8G0tIM3jVA>\n <xmx:StIIX-amuhjAuudej_2I7CpMjQV4utDdt9QW9u8P-AtsCXwcxPOCiQ>",
        "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 22:40:34 +0200",
        "Message-Id": "<20200710204034.4158330-1-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200710115324.3902559-1-thomas@monjalon.net>",
        "References": "<20200710115324.3902559-1-thomas@monjalon.net>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2] 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---\nv2: move MAP_FAILED from sys/mman.h to rte_os.h\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 | 10 ++++++++++\n lib/librte_eal/windows/include/rte_os.h |  6 ++++++\n lib/librte_pci/rte_pci.c                |  1 +\n lib/librte_pci/rte_pci.h                |  2 +-\n 8 files changed, 23 insertions(+), 6 deletions(-)",
    "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..429f896c8c 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,9 @@\n  */\n \n #include <stdint.h>\n+#ifndef RTE_EXEC_ENV_WINDOWS\n+#include <sys/mman.h>\n+#endif\n \n #include <rte_compat.h>\n \n@@ -22,6 +25,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 +39,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/rte_os.h b/lib/librte_eal/windows/include/rte_os.h\nindex 569ed92d51..2881bf2224 100644\n--- a/lib/librte_eal/windows/include/rte_os.h\n+++ b/lib/librte_eal/windows/include/rte_os.h\n@@ -25,6 +25,12 @@ extern \"C\" {\n #define PATH_MAX _MAX_PATH\n #endif\n \n+/* sys/mman.h\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)\n+\n #define sleep(x) Sleep(1000 * (x))\n \n #define strerror_r(a, b, c) strerror_s(b, c, a)\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": [
        "v2"
    ]
}