Show a patch.

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

{
    "id": 42598,
    "url": "http://patches.dpdk.org/api/patches/42598/",
    "web_url": "http://patches.dpdk.org/patch/42598/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1531116091-18030-3-git-send-email-jia.guo@intel.com>",
    "date": "2018-07-09T06:01:26",
    "name": "[v6,2/7] bus/pci: implement hotplug failure handler ops",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c457dd89661420ff5d339c6bb9546344bdc8c471",
    "submitter": {
        "id": 507,
        "url": "http://patches.dpdk.org/api/people/507/",
        "name": "Jeff Guo",
        "email": "jia.guo@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/42598/mbox/",
    "series": [
        {
            "id": 468,
            "url": "http://patches.dpdk.org/api/series/468/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=468",
            "date": "2018-07-09T06:01:24",
            "name": "hotplug failure handle mechanism",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/468/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42598/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/42598/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Mailer": "git-send-email 2.7.4",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1F6A01B04F;\n\tMon,  9 Jul 2018 08:04:00 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id EF34D1B149\n\tfor <dev@dpdk.org>; Mon,  9 Jul 2018 08:03:58 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Jul 2018 23:03:58 -0700",
            "from jeffguo-z170x-ud5.sh.intel.com (HELO localhost.localdomain)\n\t([10.67.104.10])\n\tby orsmga008.jf.intel.com with ESMTP; 08 Jul 2018 23:03:55 -0700"
        ],
        "References": "<1531116091-18030-1-git-send-email-jia.guo@intel.com>",
        "X-Amp-File-Uploaded": "False",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1531116091-18030-3-git-send-email-jia.guo@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,329,1526367600\"; d=\"scan'208\";a=\"55386235\"",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "From": "Jeff Guo <jia.guo@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<1531116091-18030-1-git-send-email-jia.guo@intel.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "stephen@networkplumber.org, bruce.richardson@intel.com,\n\tferruh.yigit@intel.com, konstantin.ananyev@intel.com,\n\tgaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net,\n\tmotih@mellanox.com, matan@mellanox.com, harry.van.haaren@intel.com,\n\tqi.z.zhang@intel.com, shaopeng.he@intel.com,\n\tbernard.iremonger@intel.com, arybchenko@solarflare.com",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Mon,  9 Jul 2018 14:01:26 +0800",
        "Cc": "jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org,\n\tjia.guo@intel.com, helin.zhang@intel.com",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v6 2/7] bus/pci: implement hotplug failure\n\thandler ops"
    },
    "content": "This patch implements the ops of hotplug failure handler for PCI bus,\nit is functional to remap a new dummy memory which overlap to the\nfailure memory to avoid MMIO read/write error.\n\nSigned-off-by: Jeff Guo <jia.guo@intel.com>\nAcked-by: Shaopeng He <shaopeng.he@intel.com>\n---\nv6->v5:\nrefine some typo\n---\n drivers/bus/pci/pci_common.c     | 28 ++++++++++++++++++++++++++++\n drivers/bus/pci/pci_common_uio.c | 33 +++++++++++++++++++++++++++++++++\n drivers/bus/pci/private.h        | 12 ++++++++++++\n 3 files changed, 73 insertions(+)",
    "diff": "diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c\nindex 94b0f41..d7abe6c 100644\n--- a/drivers/bus/pci/pci_common.c\n+++ b/drivers/bus/pci/pci_common.c\n@@ -408,6 +408,33 @@ pci_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,\n }\n \n static int\n+pci_hotplug_failure_handler(struct rte_device *dev)\n+{\n+\tstruct rte_pci_device *pdev = NULL;\n+\tint ret = 0;\n+\n+\tpdev = RTE_DEV_TO_PCI(dev);\n+\tif (!pdev)\n+\t\treturn -1;\n+\n+\tswitch (pdev->kdrv) {\n+\tcase RTE_KDRV_IGB_UIO:\n+\tcase RTE_KDRV_UIO_GENERIC:\n+\tcase RTE_KDRV_NIC_UIO:\n+\t\t/* mmio resource is invalid, remap it to be safe. */\n+\t\tret = pci_uio_remap_resource(pdev);\n+\t\tbreak;\n+\tdefault:\n+\t\tRTE_LOG(DEBUG, EAL,\n+\t\t\t\"Not managed by a supported kernel driver, skipped\\n\");\n+\t\tret = -1;\n+\t\tbreak;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int\n pci_plug(struct rte_device *dev)\n {\n \treturn pci_probe_all_drivers(RTE_DEV_TO_PCI(dev));\n@@ -437,6 +464,7 @@ struct rte_pci_bus rte_pci_bus = {\n \t\t.unplug = pci_unplug,\n \t\t.parse = pci_parse,\n \t\t.get_iommu_class = rte_pci_get_iommu_class,\n+\t\t.hotplug_failure_handler = pci_hotplug_failure_handler,\n \t},\n \t.device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list),\n \t.driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),\ndiff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c\nindex 54bc20b..7ea73db 100644\n--- a/drivers/bus/pci/pci_common_uio.c\n+++ b/drivers/bus/pci/pci_common_uio.c\n@@ -146,6 +146,39 @@ pci_uio_unmap(struct mapped_pci_resource *uio_res)\n \t}\n }\n \n+/* remap the PCI resource of a PCI device in anonymous virtual memory */\n+int\n+pci_uio_remap_resource(struct rte_pci_device *dev)\n+{\n+\tint i;\n+\tvoid *map_address;\n+\n+\tif (dev == NULL)\n+\t\treturn -1;\n+\n+\t/* Remap all BARs */\n+\tfor (i = 0; i != PCI_MAX_RESOURCE; i++) {\n+\t\t/* skip empty BAR */\n+\t\tif (dev->mem_resource[i].phys_addr == 0)\n+\t\t\tcontinue;\n+\t\tmap_address = mmap(dev->mem_resource[i].addr,\n+\t\t\t\t(size_t)dev->mem_resource[i].len,\n+\t\t\t\tPROT_READ | PROT_WRITE,\n+\t\t\t\tMAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);\n+\t\tif (map_address == MAP_FAILED) {\n+\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\"Cannot remap resource for device %s\\n\",\n+\t\t\t\tdev->name);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tRTE_LOG(INFO, EAL,\n+\t\t\t\"Successful remap resource for device %s\\n\",\n+\t\t\tdev->name);\n+\t}\n+\n+\treturn 0;\n+}\n+\n static struct mapped_pci_resource *\n pci_uio_find_resource(struct rte_pci_device *dev)\n {\ndiff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h\nindex 8ddd03e..6b312e5 100644\n--- a/drivers/bus/pci/private.h\n+++ b/drivers/bus/pci/private.h\n@@ -123,6 +123,18 @@ void pci_uio_free_resource(struct rte_pci_device *dev,\n \t\tstruct mapped_pci_resource *uio_res);\n \n /**\n+ * Remap the PCI resource of a PCI device in anonymous virtual memory.\n+ *\n+ * @param dev\n+ *   Point to the struct rte pci device.\n+ * @return\n+ *   - On success, zero.\n+ *   - On failure, a negative value.\n+ */\n+int\n+pci_uio_remap_resource(struct rte_pci_device *dev);\n+\n+/**\n  * Map device memory to uio resource\n  *\n  * This function is private to EAL.\n",
    "prefixes": [
        "v6",
        "2/7"
    ]
}