get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43667,
    "url": "http://patches.dpdk.org/api/patches/43667/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180810004213.44497-7-qi.z.zhang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20180810004213.44497-7-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180810004213.44497-7-qi.z.zhang@intel.com",
    "date": "2018-08-10T00:42:13",
    "name": "[v14,6/6] examples/multi_process: add hotplug sample",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c8e8a1a04a63f060d7621ffb6ee54ffd6a7179df",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180810004213.44497-7-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 956,
            "url": "http://patches.dpdk.org/api/series/956/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=956",
            "date": "2018-08-10T00:42:07",
            "name": "enable hotplug on multi-process",
            "version": 14,
            "mbox": "http://patches.dpdk.org/series/956/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43667/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43667/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 DCC2E49E1;\n\tFri, 10 Aug 2018 02:41:46 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 8C24537B4\n\tfor <dev@dpdk.org>; Fri, 10 Aug 2018 02:41:44 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t09 Aug 2018 17:41:44 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby fmsmga008.fm.intel.com with ESMTP; 09 Aug 2018 17:41:42 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,217,1531810800\"; d=\"scan'208\";a=\"62025593\"",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "thomas@monjalon.net, gaetan.rivet@6wind.com, anatoly.burakov@intel.com, \n\tarybchenko@solarflare.com",
        "Cc": "konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, \n\tferruh.yigit@intel.com, benjamin.h.shelton@intel.com,\n\tnarender.vangati@intel.com, Qi Zhang <qi.z.zhang@intel.com>",
        "Date": "Fri, 10 Aug 2018 08:42:13 +0800",
        "Message-Id": "<20180810004213.44497-7-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "In-Reply-To": "<20180810004213.44497-1-qi.z.zhang@intel.com>",
        "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>\n\t<20180810004213.44497-1-qi.z.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v14 6/6] examples/multi_process: add hotplug\n\tsample",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The sample code demonstrates device (ethdev only) management\nat a multi-process environment. The user can attach/detach a\ndevice on primary process and see it is synced on secondary\nprocess automatically.\n\nHow to start?\n./hotplug_mp --proc-type=auto\n\nCommand Line Example:\n\n>help\n>list\n\n/* attach a pci device */\n> attach 0000:81:00.0\n\n/* detach the pci device */\n> detach 0000:81:00.0\n\n/* attach a vdev af_packet device */\n> attach net_af_packet,iface=eth0\n\n/* detach the vdev af_packet device */\n> detach net_af_packet\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n examples/multi_process/Makefile              |   1 +\n examples/multi_process/hotplug_mp/Makefile   |  23 +++\n examples/multi_process/hotplug_mp/commands.c | 214 +++++++++++++++++++++++++++\n examples/multi_process/hotplug_mp/commands.h |  10 ++\n examples/multi_process/hotplug_mp/main.c     |  41 +++++\n 5 files changed, 289 insertions(+)\n create mode 100644 examples/multi_process/hotplug_mp/Makefile\n create mode 100644 examples/multi_process/hotplug_mp/commands.c\n create mode 100644 examples/multi_process/hotplug_mp/commands.h\n create mode 100644 examples/multi_process/hotplug_mp/main.c",
    "diff": "diff --git a/examples/multi_process/Makefile b/examples/multi_process/Makefile\nindex a6708b7e4..b76b02fcb 100644\n--- a/examples/multi_process/Makefile\n+++ b/examples/multi_process/Makefile\n@@ -13,5 +13,6 @@ include $(RTE_SDK)/mk/rte.vars.mk\n DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += client_server_mp\n DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += simple_mp\n DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += symmetric_mp\n+DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += hotplug_mp\n \n include $(RTE_SDK)/mk/rte.extsubdir.mk\ndiff --git a/examples/multi_process/hotplug_mp/Makefile b/examples/multi_process/hotplug_mp/Makefile\nnew file mode 100644\nindex 000000000..bc36aeaed\n--- /dev/null\n+++ b/examples/multi_process/hotplug_mp/Makefile\n@@ -0,0 +1,23 @@\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2018 Intel Corporation\n+\n+ifeq ($(RTE_SDK),)\n+$(error \"Please define RTE_SDK environment variable\")\n+endif\n+\n+# Default target, can be overridden by command line or environment\n+RTE_TARGET ?= x86_64-native-linuxapp-gcc\n+\n+include $(RTE_SDK)/mk/rte.vars.mk\n+\n+# binary name\n+APP = hotplug_mp\n+\n+# all source are stored in SRCS-y\n+SRCS-y := main.c commands.c\n+\n+CFLAGS += -O3\n+CFLAGS += $(WERROR_FLAGS)\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n+\n+include $(RTE_SDK)/mk/rte.extapp.mk\ndiff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c\nnew file mode 100644\nindex 000000000..b06859393\n--- /dev/null\n+++ b/examples/multi_process/hotplug_mp/commands.c\n@@ -0,0 +1,214 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation.\n+ */\n+\n+#include <cmdline_rdline.h>\n+#include <cmdline_parse.h>\n+#include <cmdline_parse_ipaddr.h>\n+#include <cmdline_parse_num.h>\n+#include <cmdline_parse_string.h>\n+#include <cmdline.h>\n+#include <rte_ethdev.h>\n+\n+/**********************************************************/\n+\n+struct cmd_help_result {\n+\tcmdline_fixed_string_t help;\n+};\n+\n+static void cmd_help_parsed(__attribute__((unused)) void *parsed_result,\n+\t\t\t    struct cmdline *cl,\n+\t\t\t    __attribute__((unused)) void *data)\n+{\n+\tcmdline_printf(cl,\n+\t\t       \"commands:\\n\"\n+\t\t       \"- attach <devargs>\\n\"\n+\t\t       \"- detach <devargs>\\n\"\n+\t\t       \"- list\\n\\n\");\n+}\n+\n+cmdline_parse_token_string_t cmd_help_help =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_help_result, help, \"help\");\n+\n+cmdline_parse_inst_t cmd_help = {\n+\t.f = cmd_help_parsed,  /* function to call */\n+\t.data = NULL,      /* 2nd arg of func */\n+\t.help_str = \"show help\",\n+\t.tokens = {        /* token list, NULL terminated */\n+\t\t(void *)&cmd_help_help,\n+\t\tNULL,\n+\t},\n+};\n+\n+/**********************************************************/\n+\n+struct cmd_quit_result {\n+\tcmdline_fixed_string_t quit;\n+};\n+\n+static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,\n+\t\t\t    struct cmdline *cl,\n+\t\t\t    __attribute__((unused)) void *data)\n+{\n+\tcmdline_quit(cl);\n+}\n+\n+cmdline_parse_token_string_t cmd_quit_quit =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_quit_result, quit, \"quit\");\n+\n+cmdline_parse_inst_t cmd_quit = {\n+\t.f = cmd_quit_parsed,  /* function to call */\n+\t.data = NULL,      /* 2nd arg of func */\n+\t.help_str = \"quit\",\n+\t.tokens = {        /* token list, NULL terminated */\n+\t\t(void *)&cmd_quit_quit,\n+\t\tNULL,\n+\t},\n+};\n+\n+/**********************************************************/\n+\n+struct cmd_list_result {\n+\tcmdline_fixed_string_t list;\n+};\n+\n+static void cmd_list_parsed(__attribute__((unused)) void *parsed_result,\n+\t\t\t    struct cmdline *cl,\n+\t\t\t    __attribute__((unused)) void *data)\n+{\n+\tuint16_t port_id;\n+\tchar dev_name[RTE_DEV_NAME_MAX_LEN];\n+\n+\tcmdline_printf(cl, \"list all etherdev\\n\");\n+\n+\tRTE_ETH_FOREACH_DEV(port_id) {\n+\t\trte_eth_dev_get_name_by_port(port_id, dev_name);\n+\t\tif (strlen(dev_name) > 0)\n+\t\t\tcmdline_printf(cl, \"%d\\t%s\\n\", port_id, dev_name);\n+\t\telse\n+\t\t\tprintf(\"empty dev_name is not expected!\\n\");\n+\t}\n+}\n+\n+cmdline_parse_token_string_t cmd_list_list =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_list_result, list, \"list\");\n+\n+cmdline_parse_inst_t cmd_list = {\n+\t.f = cmd_list_parsed,  /* function to call */\n+\t.data = NULL,      /* 2nd arg of func */\n+\t.help_str = \"list all devices\",\n+\t.tokens = {        /* token list, NULL terminated */\n+\t\t(void *)&cmd_list_list,\n+\t\tNULL,\n+\t},\n+};\n+\n+/**********************************************************/\n+\n+struct cmd_dev_attach_result {\n+\tcmdline_fixed_string_t attach;\n+\tcmdline_fixed_string_t devargs;\n+};\n+\n+static void cmd_dev_attach_parsed(void *parsed_result,\n+\t\t\t\t  struct cmdline *cl,\n+\t\t\t\t  __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_dev_attach_result *res = parsed_result;\n+\tstruct rte_devargs da;\n+\n+\tmemset(&da, 0, sizeof(da));\n+\n+\tif (rte_devargs_parsef(&da, \"%s\", res->devargs)) {\n+\t\tcmdline_printf(cl, \"cannot parse devargs\\n\");\n+\t\tif (da.args)\n+\t\t\tfree(da.args);\n+\t\treturn;\n+\t}\n+\n+\tif (!rte_eal_hotplug_add(da.bus->name, da.name, da.args))\n+\t\tcmdline_printf(cl, \"attached device %s\\n\", da.name);\n+\telse\n+\t\tcmdline_printf(cl, \"failed to attached device %s\\n\",\n+\t\t\t\tda.name);\n+}\n+\n+cmdline_parse_token_string_t cmd_dev_attach_attach =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_dev_attach_result, attach,\n+\t\t\t\t \"attach\");\n+cmdline_parse_token_string_t cmd_dev_attach_devargs =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_dev_attach_result, devargs, NULL);\n+\n+cmdline_parse_inst_t cmd_attach_device = {\n+\t.f = cmd_dev_attach_parsed,  /* function to call */\n+\t.data = NULL,      /* 2nd arg of func */\n+\t.help_str = \"attach a device\",\n+\t.tokens = {        /* token list, NULL terminated */\n+\t\t(void *)&cmd_dev_attach_attach,\n+\t\t(void *)&cmd_dev_attach_devargs,\n+\t\tNULL,\n+\t},\n+};\n+\n+/**********************************************************/\n+\n+struct cmd_dev_detach_result {\n+\tcmdline_fixed_string_t detach;\n+\tcmdline_fixed_string_t devargs;\n+};\n+\n+static void cmd_dev_detach_parsed(void *parsed_result,\n+\t\t\t\t   struct cmdline *cl,\n+\t\t\t\t   __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_dev_detach_result *res = parsed_result;\n+\tstruct rte_devargs da;\n+\n+\tmemset(&da, 0, sizeof(da));\n+\n+\tif (rte_devargs_parsef(&da, \"%s\", res->devargs)) {\n+\t\tcmdline_printf(cl, \"cannot parse devargs\\n\");\n+\t\tif (da.args)\n+\t\t\tfree(da.args);\n+\t\treturn;\n+\t}\n+\n+\tprintf(\"detaching...\\n\");\n+\tif (!rte_eal_hotplug_remove(da.bus->name, da.name))\n+\t\tcmdline_printf(cl, \"detached device %s\\n\",\n+\t\t\tda.name);\n+\telse\n+\t\tcmdline_printf(cl, \"failed to dettach device %s\\n\",\n+\t\t\tda.name);\n+}\n+\n+cmdline_parse_token_string_t cmd_dev_detach_detach =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_dev_detach_result, detach,\n+\t\t\t\t \"detach\");\n+\n+cmdline_parse_token_string_t cmd_dev_detach_devargs =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_dev_detach_result, devargs, NULL);\n+\n+cmdline_parse_inst_t cmd_detach_device = {\n+\t.f = cmd_dev_detach_parsed,  /* function to call */\n+\t.data = NULL,      /* 2nd arg of func */\n+\t.help_str = \"detach a device\",\n+\t.tokens = {        /* token list, NULL terminated */\n+\t\t(void *)&cmd_dev_detach_detach,\n+\t\t(void *)&cmd_dev_detach_devargs,\n+\t\tNULL,\n+\t},\n+};\n+\n+/**********************************************************/\n+/**********************************************************/\n+/****** CONTEXT (list of instruction) */\n+\n+cmdline_parse_ctx_t main_ctx[] = {\n+\t(cmdline_parse_inst_t *)&cmd_help,\n+\t(cmdline_parse_inst_t *)&cmd_quit,\n+\t(cmdline_parse_inst_t *)&cmd_list,\n+\t(cmdline_parse_inst_t *)&cmd_attach_device,\n+\t(cmdline_parse_inst_t *)&cmd_detach_device,\n+\tNULL,\n+};\ndiff --git a/examples/multi_process/hotplug_mp/commands.h b/examples/multi_process/hotplug_mp/commands.h\nnew file mode 100644\nindex 000000000..afcf177db\n--- /dev/null\n+++ b/examples/multi_process/hotplug_mp/commands.h\n@@ -0,0 +1,10 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#ifndef _COMMANDS_H_\n+#define _COMMANDS_H_\n+\n+extern cmdline_parse_ctx_t main_ctx[];\n+\n+#endif /* _COMMANDS_H_ */\ndiff --git a/examples/multi_process/hotplug_mp/main.c b/examples/multi_process/hotplug_mp/main.c\nnew file mode 100644\nindex 000000000..d66858078\n--- /dev/null\n+++ b/examples/multi_process/hotplug_mp/main.c\n@@ -0,0 +1,41 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#include <stdio.h>\n+#include <string.h>\n+#include <stdint.h>\n+#include <errno.h>\n+#include <termios.h>\n+#include <sys/queue.h>\n+\n+#include <cmdline_rdline.h>\n+#include <cmdline_parse.h>\n+#include <cmdline_socket.h>\n+#include <cmdline.h>\n+\n+#include <rte_memory.h>\n+#include <rte_eal.h>\n+#include <rte_debug.h>\n+\n+#include \"commands.h\"\n+\n+int main(int argc, char **argv)\n+{\n+\tint ret;\n+\tstruct cmdline *cl;\n+\n+\tret = rte_eal_init(argc, argv);\n+\tif (ret < 0)\n+\t\trte_panic(\"Cannot init EAL\\n\");\n+\n+\tcl = cmdline_stdin_new(main_ctx, \"example> \");\n+\tif (cl == NULL)\n+\t\trte_panic(\"Cannot create cmdline instance\\n\");\n+\tcmdline_interact(cl);\n+\tcmdline_stdin_exit(cl);\n+\n+\trte_eal_cleanup();\n+\n+\treturn 0;\n+}\n",
    "prefixes": [
        "v14",
        "6/6"
    ]
}