get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 78046,
    "url": "https://patches.dpdk.org/api/patches/78046/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200917112823.10534-4-david.marchand@redhat.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": "<20200917112823.10534-4-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200917112823.10534-4-david.marchand@redhat.com",
    "date": "2020-09-17T11:28:20",
    "name": "[v3,3/6] pci: move resource mapping to the PCI bus",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ebe13dc4cd94de93637b7c443c47445d03548cd0",
    "submitter": {
        "id": 1173,
        "url": "https://patches.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.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/20200917112823.10534-4-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 12319,
            "url": "https://patches.dpdk.org/api/series/12319/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=12319",
            "date": "2020-09-17T11:28:17",
            "name": "20.11 announced cleanups",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/12319/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/78046/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/78046/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 695ACA04AF;\n\tThu, 17 Sep 2020 13:29:44 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 667D81D63F;\n\tThu, 17 Sep 2020 13:29:13 +0200 (CEST)",
            "from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com\n [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id B21341D638\n for <dev@dpdk.org>; Thu, 17 Sep 2020 13:29:09 +0200 (CEST)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-230-LIVoNymAM-izrBzXtTt24w-1; Thu, 17 Sep 2020 07:28:59 -0400",
            "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com\n [10.5.11.14])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C70416408A;\n Thu, 17 Sep 2020 11:28:57 +0000 (UTC)",
            "from dmarchan.remote.csb (unknown [10.40.193.44])\n by smtp.corp.redhat.com (Postfix) with ESMTP id F1BC85DEBB;\n Thu, 17 Sep 2020 11:28:54 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1600342149;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=OW1t+ujpJGxPo2IFyVhUtY2BePUCh18tkEKfUjoh4gg=;\n b=GssYnJdYEGYIy/UiQIe7z9v4GAG4vLkoie7kd1ZJYkKkFPUbIn6QbLs5QyNgCguj6yCHvu\n 3sc+jYeh8Z4Bf+d96HNgGR14XkmSf6NKR6MEE2qkNnlGwwW3DoCJeM2U3Xo5GPUX4o96Bp\n XjWFcRyn+kcOCY+nZmlM2PF0iq2Dew8=",
        "X-MC-Unique": "LIVoNymAM-izrBzXtTt24w-1",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "arybchenko@solarflare.com, Ray Kinsella <mdr@ashroe.eu>,\n Neil Horman <nhorman@tuxdriver.com>,\n John McNamara <john.mcnamara@intel.com>,\n Marko Kovacevic <marko.kovacevic@intel.com>,\n Ferruh Yigit <ferruh.yigit@intel.com>, Gaetan Rivet <grive@u256.net>",
        "Date": "Thu, 17 Sep 2020 13:28:20 +0200",
        "Message-Id": "<20200917112823.10534-4-david.marchand@redhat.com>",
        "In-Reply-To": "<20200917112823.10534-1-david.marchand@redhat.com>",
        "References": "<20200914081727.12215-1-david.marchand@redhat.com>\n <20200917112823.10534-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=US-ASCII",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 3/6] pci: move resource mapping to the PCI bus",
        "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": "As reported during 20.08 work for Windows, the pci_map_resource API was\nbuilt with the assumption that its flags would be passed to mmap().\n\nThis introduced a regression when adding the rte_mem_map API as reported\nin the workaround commit 9d2b24593724 (\"pci: keep API compatibility with\nmmap values\").\n\nThis API was only used in the PCI bus code, so move it there.\n\nThere is no code change happening during the move.\nThe only change is in the pci_map_resource description where the\nadditional flags are now documented as rte_mem_map API flags:\n- *      The additional flags for the mapping range.\n+ *      The additional rte_mem_map() flags for the mapping range.\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\nAcked-by: Andrew Rybchenko <arybchenko@solarflare.com>\n---\n doc/guides/rel_notes/deprecation.rst   | 11 -----\n doc/guides/rel_notes/release_20_11.rst |  6 +++\n drivers/bus/pci/linux/pci_init.h       |  2 +\n drivers/bus/pci/linux/pci_uio.c        |  1 +\n drivers/bus/pci/pci_common.c           | 41 ++++++++++++++++\n drivers/bus/pci/private.h              | 65 +++++++++++++++++++++++++\n lib/librte_pci/rte_pci.c               | 42 ----------------\n lib/librte_pci/rte_pci.h               | 66 --------------------------\n lib/librte_pci/rte_pci_version.map     |  2 -\n 9 files changed, 115 insertions(+), 121 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst\nindex 83ba567632..8fca461045 100644\n--- a/doc/guides/rel_notes/deprecation.rst\n+++ b/doc/guides/rel_notes/deprecation.rst\n@@ -113,17 +113,6 @@ Deprecation Notices\n   us extending existing enum/define.\n   One solution can be using a fixed size array instead of ``.*MAX.*`` value.\n \n-* pci: The PCI resources map API (``pci_map_resource`` and\n-  ``pci_unmap_resource``) was not abstracting the Unix mmap flags (see the\n-  workaround for Windows support implemented in the commit\n-  9d2b24593724 (\"pci: keep API compatibility with mmap values\")).\n-  This API will be removed from the public API in 20.11 and moved to the PCI\n-  bus driver along with the PCI resources lists and associated structures\n-  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and\n-  ``mapped_pci_res_list``).\n-  With this removal, there won't be a need for the mentioned workaround which\n-  will be reverted.\n-\n * mbuf: Some fields will be converted to dynamic API in DPDK 20.11\n   in order to reserve more space for the dynamic fields, as explained in\n   `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.\ndiff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst\nindex a76e7a2941..185eeae731 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -90,6 +90,12 @@ API Changes\n * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and\n   replaced with a private enum in the PCI subsystem.\n \n+* pci: Removed the PCI resources map API from the public API\n+  (``pci_map_resource`` and ``pci_unmap_resource``) and moved it to the\n+  PCI bus driver along with the PCI resources lists and associated structures\n+  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and\n+  ``mapped_pci_res_list``).\n+\n * mbuf: Removed the unioned field ``refcnt_atomic`` from\n   the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.\n   The field ``refcnt`` is remaining from the old unions.\ndiff --git a/drivers/bus/pci/linux/pci_init.h b/drivers/bus/pci/linux/pci_init.h\nindex c2e603a374..dcea726186 100644\n--- a/drivers/bus/pci/linux/pci_init.h\n+++ b/drivers/bus/pci/linux/pci_init.h\n@@ -7,6 +7,8 @@\n \n #include <rte_vfio.h>\n \n+#include \"private.h\"\n+\n /** IO resource type: */\n #define IORESOURCE_IO         0x00000100\n #define IORESOURCE_MEM        0x00000200\ndiff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c\nindex a354920d5f..9ab20a0b25 100644\n--- a/drivers/bus/pci/linux/pci_uio.c\n+++ b/drivers/bus/pci/linux/pci_uio.c\n@@ -25,6 +25,7 @@\n \n #include \"eal_filesystem.h\"\n #include \"pci_init.h\"\n+#include \"private.h\"\n \n void *pci_map_addr = NULL;\n \ndiff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c\nindex dddf2b2aad..3a2ae07958 100644\n--- a/drivers/bus/pci/pci_common.c\n+++ b/drivers/bus/pci/pci_common.c\n@@ -19,6 +19,7 @@\n #include <rte_per_lcore.h>\n #include <rte_memory.h>\n #include <rte_eal.h>\n+#include <rte_eal_paging.h>\n #include <rte_string_fns.h>\n #include <rte_common.h>\n #include <rte_devargs.h>\n@@ -79,6 +80,46 @@ pci_name_set(struct rte_pci_device *dev)\n \t\tdev->device.name = dev->name;\n }\n \n+/* map a particular resource from a file */\n+void *\n+pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,\n+\t\t int additional_flags)\n+{\n+\tvoid *mapaddr;\n+\n+\t/* Map the PCI memory resource of device */\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 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\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+\n+\treturn mapaddr;\n+}\n+\n+/* unmap a particular resource */\n+void\n+pci_unmap_resource(void *requested_addr, size_t size)\n+{\n+\tif (requested_addr == NULL)\n+\t\treturn;\n+\n+\t/* Unmap the PCI memory resource of device */\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\trte_strerror(rte_errno));\n+\t} else\n+\t\tRTE_LOG(DEBUG, EAL, \"  PCI memory unmapped at %p\\n\",\n+\t\t\t\trequested_addr);\n+}\n /*\n  * Match the PCI Driver and Device using the ID Table\n  */\ndiff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h\nindex 367cdd9a65..7c89744b66 100644\n--- a/drivers/bus/pci/private.h\n+++ b/drivers/bus/pci/private.h\n@@ -81,6 +81,71 @@ void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev,\n  */\n int pci_update_device(const struct rte_pci_addr *addr);\n \n+/**\n+ * A structure describing a PCI mapping.\n+ */\n+struct pci_map {\n+\tvoid *addr;\n+\tchar *path;\n+\tuint64_t offset;\n+\tuint64_t size;\n+\tuint64_t phaddr;\n+};\n+\n+struct pci_msix_table {\n+\tint bar_index;\n+\tuint32_t offset;\n+\tuint32_t size;\n+};\n+\n+/**\n+ * A structure describing a mapped PCI resource.\n+ * For multi-process we need to reproduce all PCI mappings in secondary\n+ * processes, so save them in a tailq.\n+ */\n+struct mapped_pci_resource {\n+\tTAILQ_ENTRY(mapped_pci_resource) next;\n+\n+\tstruct rte_pci_addr pci_addr;\n+\tchar path[PATH_MAX];\n+\tint nb_maps;\n+\tstruct pci_map maps[PCI_MAX_RESOURCE];\n+\tstruct pci_msix_table msix_table;\n+};\n+\n+/** mapped pci device list */\n+TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);\n+\n+/**\n+ * Map a particular resource from a file.\n+ *\n+ * @param requested_addr\n+ *      The starting address for the new mapping range.\n+ * @param fd\n+ *      The file descriptor.\n+ * @param offset\n+ *      The offset for the mapping range.\n+ * @param size\n+ *      The size for the mapping range.\n+ * @param additional_flags\n+ *      The additional rte_mem_map() flags for the mapping range.\n+ * @return\n+ *   - On success, the function returns a pointer to the mapped area.\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+\n+/**\n+ * Unmap a particular resource.\n+ *\n+ * @param requested_addr\n+ *      The address for the unmapping range.\n+ * @param size\n+ *      The size for the unmapping range.\n+ */\n+void pci_unmap_resource(void *requested_addr, size_t size);\n+\n /**\n  * Map the PCI resource of a PCI device in virtual memory\n  *\ndiff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c\nindex 1d1cbc75ac..c91be8b167 100644\n--- a/lib/librte_pci/rte_pci.c\n+++ b/lib/librte_pci/rte_pci.c\n@@ -144,45 +144,3 @@ rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr)\n \t\treturn 0;\n \treturn -1;\n }\n-\n-\n-/* map a particular resource from a file */\n-void *\n-pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,\n-\t\t int additional_flags)\n-{\n-\tvoid *mapaddr;\n-\n-\t/* Map the PCI memory resource of device */\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 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\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-\n-\treturn mapaddr;\n-}\n-\n-/* unmap a particular resource */\n-void\n-pci_unmap_resource(void *requested_addr, size_t size)\n-{\n-\tif (requested_addr == NULL)\n-\t\treturn;\n-\n-\t/* Unmap the PCI memory resource of device */\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\trte_strerror(rte_errno));\n-\t} else\n-\t\tRTE_LOG(DEBUG, EAL, \"  PCI memory unmapped at %p\\n\",\n-\t\t\t\trequested_addr);\n-}\ndiff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h\nindex a03235da1f..567c8cd68d 100644\n--- a/lib/librte_pci/rte_pci.h\n+++ b/lib/librte_pci/rte_pci.h\n@@ -64,42 +64,6 @@ struct rte_pci_addr {\n #define PCI_ANY_ID (0xffff)\n #define RTE_CLASS_ANY_ID (0xffffff)\n \n-/**\n- * A structure describing a PCI mapping.\n- */\n-struct pci_map {\n-\tvoid *addr;\n-\tchar *path;\n-\tuint64_t offset;\n-\tuint64_t size;\n-\tuint64_t phaddr;\n-};\n-\n-struct pci_msix_table {\n-\tint bar_index;\n-\tuint32_t offset;\n-\tuint32_t size;\n-};\n-\n-/**\n- * A structure describing a mapped PCI resource.\n- * For multi-process we need to reproduce all PCI mappings in secondary\n- * processes, so save them in a tailq.\n- */\n-struct mapped_pci_resource {\n-\tTAILQ_ENTRY(mapped_pci_resource) next;\n-\n-\tstruct rte_pci_addr pci_addr;\n-\tchar path[PATH_MAX];\n-\tint nb_maps;\n-\tstruct pci_map maps[PCI_MAX_RESOURCE];\n-\tstruct pci_msix_table msix_table;\n-};\n-\n-\n-/** mapped pci device list */\n-TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);\n-\n /**\n  * Utility function to write a pci device name, this device name can later be\n  * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*\n@@ -145,36 +109,6 @@ int rte_pci_addr_cmp(const struct rte_pci_addr *addr,\n  */\n int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr);\n \n-/**\n- * Map a particular resource from a file.\n- *\n- * @param requested_addr\n- *      The starting address for the new mapping range.\n- * @param fd\n- *      The file descriptor.\n- * @param offset\n- *      The offset for the mapping range.\n- * @param size\n- *      The size for the mapping range.\n- * @param additional_flags\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, 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-\n-/**\n- * Unmap a particular resource.\n- *\n- * @param requested_addr\n- *      The address for the unmapping range.\n- * @param size\n- *      The size for the unmapping range.\n- */\n-void pci_unmap_resource(void *requested_addr, size_t size);\n-\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_pci/rte_pci_version.map b/lib/librte_pci/rte_pci_version.map\nindex cd77c9dc9e..1db19a5122 100644\n--- a/lib/librte_pci/rte_pci_version.map\n+++ b/lib/librte_pci/rte_pci_version.map\n@@ -1,8 +1,6 @@\n DPDK_21 {\n \tglobal:\n \n-\tpci_map_resource;\n-\tpci_unmap_resource;\n \trte_pci_addr_cmp;\n \trte_pci_addr_parse;\n \trte_pci_device_name;\n",
    "prefixes": [
        "v3",
        "3/6"
    ]
}