get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 36979,
    "url": "https://patches.dpdk.org/api/patches/36979/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1522779443-1932-5-git-send-email-jia.guo@intel.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": "<1522779443-1932-5-git-send-email-jia.guo@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1522779443-1932-5-git-send-email-jia.guo@intel.com",
    "date": "2018-04-03T18:17:22",
    "name": "[dpdk-dev,V18,4/5] eal: add driver auto bind for hot insertion",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "141929c8abb8bb6046e9a1d4d920b3e73b304ee7",
    "submitter": {
        "id": 507,
        "url": "https://patches.dpdk.org/api/people/507/?format=api",
        "name": "Guo, Jia",
        "email": "jia.guo@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1522779443-1932-5-git-send-email-jia.guo@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/36979/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/36979/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F2AD51B87B;\n\tTue,  3 Apr 2018 20:18:39 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 604F41B85C\n\tfor <dev@dpdk.org>; Tue,  3 Apr 2018 20:18:38 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t03 Apr 2018 11:18:37 -0700",
            "from jeffguo-z170x-ud5.sh.intel.com (HELO localhost.localdomain)\n\t([10.67.104.10])\n\tby orsmga004.jf.intel.com with ESMTP; 03 Apr 2018 11:18:35 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.48,402,1517904000\"; d=\"scan'208\";a=\"188366587\"",
        "From": "Jeff Guo <jia.guo@intel.com>",
        "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, harry.van.haaren@intel.com, jianfeng.tan@intel.com",
        "Cc": "jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org,\n\tjia.guo@intel.com, helin.zhang@intel.com",
        "Date": "Wed,  4 Apr 2018 02:17:22 +0800",
        "Message-Id": "<1522779443-1932-5-git-send-email-jia.guo@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1522779443-1932-1-git-send-email-jia.guo@intel.com>",
        "References": "<1522779443-1932-1-git-send-email-jia.guo@intel.com>",
        "Subject": "[dpdk-dev] [PATCH V18 4/5] eal: add driver auto bind for hot\n\tinsertion",
        "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://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": "<https://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": "Normally we use driverctl or dpdk-devbind.py to bind kernel driver before\napplication running, but lack of an function to automatically bind driver\nat runtime. This patch introduce a new API (rte_dev_bind_kernel_driver),\naim to let user call it to bind the specific kernel driver according\ntheir own policy, that would preparing for the next step of attach device,\nlet app running smoothly when hotplug behavior occur.\n\nSigned-off-by: Jeff Guo <jia.guo@intel.com>\n---\nv16->v15:\nadd document.\n---\n doc/guides/rel_notes/release_18_05.rst  |  6 ++--\n lib/librte_eal/bsdapp/eal/eal_dev.c     |  7 +++++\n lib/librte_eal/common/include/rte_dev.h | 16 ++++++++++\n lib/librte_eal/linuxapp/eal/eal_dev.c   | 54 +++++++++++++++++++++++++++++++++\n lib/librte_eal/rte_eal_version.map      |  1 +\n 5 files changed, 82 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst\nindex 3aacbf1..36e505c 100644\n--- a/doc/guides/rel_notes/release_18_05.rst\n+++ b/doc/guides/rel_notes/release_18_05.rst\n@@ -51,11 +51,13 @@ New Features\n   * ``rte_dev_event_callback_register`` and ``rte_dev_event_callback_unregister``\n     are for the user's callbacks register and unregister.\n \n-* **Added hot plug failure handler.**\n+* **Added hot plug failure handler and kernel driver auto-bind func**\n \n-  Added a failure handler machenism to handle hot plug removal.\n+  Added a failure handler machenism to handle hot plug removal, and added an kernel driver\n+  auto bind function for hot plug insertion. The list of new APIs:\n \n   * ``rte_dev_handle_hot_unplug`` for handle hot plug removel failure.\n+  * ``rte_dev_bind_kernel_driver`` for hot plug insertion.\n \n API Changes\n -----------\ndiff --git a/lib/librte_eal/bsdapp/eal/eal_dev.c b/lib/librte_eal/bsdapp/eal/eal_dev.c\nindex 1c6c51b..e953a87 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_dev.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_dev.c\n@@ -19,3 +19,10 @@ rte_dev_event_monitor_stop(void)\n \tRTE_LOG(ERR, EAL, \"Device event is not supported for FreeBSD\\n\");\n \treturn -1;\n }\n+\n+int __rte_experimental\n+rte_dev_bind_driver(const char *dev_name, enum rte_kernel_driver kdrv_type)\n+{\n+\tRTE_LOG(ERR, EAL, \"Bind driver is not supported for FreeBSD\\n\");\n+\treturn -1;\n+}\ndiff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h\nindex 7075e56..6829514 100644\n--- a/lib/librte_eal/common/include/rte_dev.h\n+++ b/lib/librte_eal/common/include/rte_dev.h\n@@ -380,4 +380,20 @@ rte_dev_event_monitor_stop(void);\n  */\n int __rte_experimental\n rte_dev_handle_hot_unplug(void);\n+\n+/**\n+ * It can be used to bind a device to a specific type of kernel driver.\n+ *\n+ * @param dev_name\n+ *  The device name.\n+ * @param kdrv_type\n+ *  The specific kernel driver's type.\n+ *\n+ * @return\n+ *  - On success, zero.\n+ *  - On failure, a negative value.\n+ */\n+int __rte_experimental\n+rte_dev_bind_kernel_driver(const char *dev_name,\n+\t\t\t   enum rte_kernel_driver kdrv_type);\n #endif /* _RTE_DEV_H_ */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c\nindex fabb37a..eb8275f 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_dev.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_dev.c\n@@ -4,6 +4,7 @@\n \n #include <string.h>\n #include <unistd.h>\n+#include <fcntl.h>\n #include <signal.h>\n #include <setjmp.h>\n #include <pthread.h>\n@@ -326,3 +327,56 @@ rte_dev_event_monitor_stop(void)\n \n \treturn 0;\n }\n+\n+int __rte_experimental\n+rte_dev_bind_kernel_driver(const char *dev_name,\n+\t\t\t   enum rte_kernel_driver kdrv_type)\n+{\n+\tconst char *kdrv_name = NULL;\n+\tchar drv_override_path[1024];\n+\tint drv_override_fd = -1;\n+\n+\tif (!dev_name || !kdrv_type)\n+\t\treturn -1;\n+\n+\tswitch (kdrv_type) {\n+\tcase RTE_KDRV_IGB_UIO:\n+\t\tkdrv_name = \"igb_uio\";\n+\t\tbreak;\n+\tcase RTE_KDRV_VFIO:\n+\t\tkdrv_name = \"vfio-pci\";\n+\t\tbreak;\n+\tcase RTE_KDRV_UIO_GENERIC:\n+\t\tkdrv_name = \"uio_pci_generic\";\n+\t\tbreak;\n+\tcase RTE_KDRV_NIC_UIO:\n+\t\tRTE_LOG(ERR, EAL, \"Don't support to bind nic uio driver.\\n\");\n+\t\tgoto err;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\n+\tsnprintf(drv_override_path, sizeof(drv_override_path),\n+\t\t\"/sys/bus/pci/devices/%s/driver_override\", dev_name);\n+\n+\t/* specify the driver for a device by writing to driver_override */\n+\tdrv_override_fd = open(drv_override_path, O_WRONLY);\n+\tif (drv_override_fd < 0) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot open %s: %s\\n\",\n+\t\t\tdrv_override_path, strerror(errno));\n+\t\tgoto err;\n+\t}\n+\n+\tif (write(drv_override_fd, kdrv_name, sizeof(kdrv_name)) < 0) {\n+\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\"Error: bind failed - Cannot write \"\n+\t\t\t\"driver %s to device %s\\n\", kdrv_name, dev_name);\n+\t\tgoto err;\n+\t}\n+\n+\tclose(drv_override_fd);\n+\treturn 0;\n+err:\n+\tclose(drv_override_fd);\n+\treturn -1;\n+}\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex d37dd29..0c2ee3f 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -263,5 +263,6 @@ EXPERIMENTAL {\n         rte_dev_event_callback_register;\n         rte_dev_event_callback_unregister;\n \trte_dev_handle_hot_unplug;\n+\trte_dev_bind_kernel_driver;\n \n } DPDK_18.05;\n",
    "prefixes": [
        "dpdk-dev",
        "V18",
        "4/5"
    ]
}