get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2432,
    "url": "https://patches.dpdk.org/api/patches/2432/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421873870-21754-7-git-send-email-nhorman@tuxdriver.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": "<1421873870-21754-7-git-send-email-nhorman@tuxdriver.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1421873870-21754-7-git-send-email-nhorman@tuxdriver.com",
    "date": "2015-01-21T20:57:31",
    "name": "[dpdk-dev,v7,07/26] vfio: avoid enabling while the module is not loaded",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "b01ab5466ec011c16b3a0c4924ad2aaef5bfdd2d",
    "submitter": {
        "id": 32,
        "url": "https://patches.dpdk.org/api/people/32/?format=api",
        "name": "Neil Horman",
        "email": "nhorman@tuxdriver.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421873870-21754-7-git-send-email-nhorman@tuxdriver.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2432/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2432/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 5D7B85AAF;\n\tWed, 21 Jan 2015 21:58:25 +0100 (CET)",
            "from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58])\n\tby dpdk.org (Postfix) with ESMTP id 3B3CB5A97\n\tfor <dev@dpdk.org>; Wed, 21 Jan 2015 21:58:15 +0100 (CET)",
            "from hmsreliant.think-freely.org\n\t([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost)\n\tby smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63)\n\t(envelope-from <nhorman@tuxdriver.com>)\n\tid 1YE2Lq-00079k-FT; Wed, 21 Jan 2015 15:58:13 -0500"
        ],
        "From": "Neil Horman <nhorman@tuxdriver.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 21 Jan 2015 15:57:31 -0500",
        "Message-Id": "<1421873870-21754-7-git-send-email-nhorman@tuxdriver.com>",
        "X-Mailer": "git-send-email 2.1.0",
        "In-Reply-To": "<1421873870-21754-1-git-send-email-nhorman@tuxdriver.com>",
        "References": "<1419109299-9603-1-git-send-email-nhorman@tuxdriver.com>\n\t<1421873870-21754-1-git-send-email-nhorman@tuxdriver.com>",
        "X-Spam-Score": "-2.9 (--)",
        "X-Spam-Status": "No",
        "Subject": "[dpdk-dev] [PATCH v7 07/26] vfio: avoid enabling while the module\n\tis not loaded",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Michael Qiu <michael.qiu@intel.com>\n\nWhen vfio module is not loaded when kernel support vfio feature,\nthe routine still try to open the container to get file\ndescription.\n\nThis action is not safe, and of course got error messages:\n\nEAL: Detected 40 lcore(s)\nEAL:   unsupported IOMMU type!\nEAL: VFIO support could not be initialized\nEAL: Setting up memory...\n\nThis may make user confuse, this patch make it reasonable\nand much more smooth to user.\n\nSigned-off-by: Michael Qiu <michael.qiu@intel.com>\nAcked-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/eal_private.h        | 14 ++++++++++++++\n lib/librte_eal/linuxapp/eal/eal.c          | 27 +++++++++++++++++++++++++++\n lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 24 ++++++++++++++++++++++--\n 3 files changed, 63 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex 232fcec..159cd66 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -203,4 +203,18 @@ int rte_eal_alarm_init(void);\n  */\n int rte_eal_dev_init(void);\n \n+/**\n+ * Function is to check if the kernel module(like, vfio, vfio_iommu_type1,\n+ * etc.) loaded.\n+ *\n+ * @param module_name\n+ *\tThe module's name which need to be checked\n+ *\n+ * @return\n+ *\t-1 means some error happens(NULL pointer or open failure)\n+ *\t0  means the module not loaded\n+ *\t1  means the module loaded\n+ */\n+int rte_eal_check_module(const char *module_name);\n+\n #endif /* _EAL_PRIVATE_H_ */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 2fb1acc..648ef81 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -859,3 +859,30 @@ int rte_eal_has_hugepages(void)\n {\n \treturn ! internal_config.no_hugetlbfs;\n }\n+\n+int\n+rte_eal_check_module(const char *module_name)\n+{\n+\tchar mod_name[30]; /* Any module names can be longer than 30 bytes? */\n+\tint ret = 0;\n+\n+\tif (NULL == module_name)\n+\t\treturn -1;\n+\n+\tFILE *fd = fopen(\"/proc/modules\", \"r\");\n+\tif (NULL == fd) {\n+\t\tRTE_LOG(ERR, EAL, \"Open /proc/modules failed!\"\n+\t\t\t\" error %i (%s)\\n\", errno, strerror(errno));\n+\t\treturn -1;\n+\t}\n+\twhile (!feof(fd)) {\n+\t\tfscanf(fd, \"%29s %*[^\\n]\", mod_name);\n+\t\tif (!strcmp(mod_name, module_name)) {\n+\t\t\tret = 1;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tfclose(fd);\n+\n+\treturn ret;\n+}\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c\nindex c1246e8..20e0977 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c\n@@ -44,6 +44,7 @@\n #include <rte_tailq.h>\n #include <rte_eal_memconfig.h>\n #include <rte_malloc.h>\n+#include <eal_private.h>\n \n #include \"eal_filesystem.h\"\n #include \"eal_pci_init.h\"\n@@ -340,9 +341,11 @@ pci_vfio_get_container_fd(void)\n \t\tif (ret != 1) {\n \t\t\tif (ret < 0)\n \t\t\t\tRTE_LOG(ERR, EAL, \"  could not get IOMMU type, \"\n-\t\t\t\t\t\t\"error %i (%s)\\n\", errno, strerror(errno));\n+\t\t\t\t\t\"error %i (%s)\\n\", errno,\n+\t\t\t\t\tstrerror(errno));\n \t\t\telse\n-\t\t\t\tRTE_LOG(ERR, EAL, \"  unsupported IOMMU type!\\n\");\n+\t\t\t\tRTE_LOG(ERR, EAL, \"  unsupported IOMMU type \"\n+\t\t\t\t\t\"detected in VFIO\\n\");\n \t\t\tclose(vfio_container_fd);\n \t\t\treturn -1;\n \t\t}\n@@ -783,11 +786,28 @@ pci_vfio_enable(void)\n {\n \t/* initialize group list */\n \tint i;\n+\tint module_vfio_type1;\n \n \tfor (i = 0; i < VFIO_MAX_GROUPS; i++) {\n \t\tvfio_cfg.vfio_groups[i].fd = -1;\n \t\tvfio_cfg.vfio_groups[i].group_no = -1;\n \t}\n+\n+\tmodule_vfio_type1 = rte_eal_check_module(\"vfio_iommu_type1\");\n+\n+\t/* return error directly */\n+\tif (module_vfio_type1 == -1) {\n+\t\tRTE_LOG(INFO, EAL, \"Could not get loaded module details!\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\t/* return 0 if VFIO modules not loaded */\n+\tif (module_vfio_type1 == 0) {\n+\t\tRTE_LOG(INFO, EAL, \"VFIO modules not all loaded, \"\n+\t\t\t\"skip VFIO support...\\n\");\n+\t\treturn 0;\n+\t}\n+\n \tvfio_cfg.vfio_container_fd = pci_vfio_get_container_fd();\n \n \t/* check if we have VFIO driver enabled */\n",
    "prefixes": [
        "dpdk-dev",
        "v7",
        "07/26"
    ]
}