get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42777,
    "url": "http://patches.dpdk.org/api/patches/42777/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180711030917.181098-19-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": "<20180711030917.181098-19-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180711030917.181098-19-qi.z.zhang@intel.com",
    "date": "2018-07-11T03:09:16",
    "name": "[v11,18/19] examples/multi_process: add hotplug sample",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7bc181896e65a939bc56e7c128ecf64f512410ad",
    "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/20180711030917.181098-19-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 508,
            "url": "http://patches.dpdk.org/api/series/508/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=508",
            "date": "2018-07-11T03:08:59",
            "name": "enable hotplug on multi-process",
            "version": 11,
            "mbox": "http://patches.dpdk.org/series/508/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42777/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42777/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 9CA441B51E;\n\tWed, 11 Jul 2018 05:09:51 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id DFA801B464\n\tfor <dev@dpdk.org>; Wed, 11 Jul 2018 05:09:09 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t10 Jul 2018 20:09:09 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby fmsmga001.fm.intel.com with ESMTP; 10 Jul 2018 20:09:07 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,336,1526367600\"; d=\"scan'208\";a=\"71306967\"",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.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": "Wed, 11 Jul 2018 11:09:16 +0800",
        "Message-Id": "<20180711030917.181098-19-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "In-Reply-To": "<20180711030917.181098-1-qi.z.zhang@intel.com>",
        "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>\n\t<20180711030917.181098-1-qi.z.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v11 18/19] 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 af_packet vdev */\n>attach net_af_packet,iface=eth0\n\n/* detach port 0 */\n>detach 0\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 | 197 +++++++++++++++++++++++++++\n examples/multi_process/hotplug_mp/commands.h |  10 ++\n examples/multi_process/hotplug_mp/main.c     |  41 ++++++\n 5 files changed, 272 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..fb7198d51\n--- /dev/null\n+++ b/examples/multi_process/hotplug_mp/commands.c\n@@ -0,0 +1,197 @@\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 <port_id>\\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 device;\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+\tuint16_t port_id;\n+\n+\tif (!rte_eth_dev_attach(res->device, &port_id))\n+\t\tcmdline_printf(cl, \"attached device %s at port %d\\n\",\n+\t\t\tres->device, port_id);\n+\telse\n+\t\tcmdline_printf(cl, \"failed to attached device %s\\n\",\n+\t\t\tres->device);\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_device =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_dev_attach_result, device, 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_device,\n+\t\tNULL,\n+\t},\n+};\n+\n+/**********************************************************/\n+\n+struct cmd_dev_detach_result {\n+\tcmdline_fixed_string_t detach;\n+\tuint16_t port_id;\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+\tuint16_t port_id = res->port_id;\n+\tchar dev_name[RTE_DEV_NAME_MAX_LEN];\n+\n+\tprintf(\"detaching...\\n\");\n+\tif (!rte_eth_dev_detach(port_id, dev_name))\n+\t\tcmdline_printf(cl, \"detached device at port %d\\n\",\n+\t\t\tport_id);\n+\telse\n+\t\tcmdline_printf(cl, \"failed to dettached at port %d\\n\",\n+\t\t\tport_id);\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+cmdline_parse_token_num_t cmd_dev_detach_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_dev_detach_result, port_id, UINT16);\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_port_id,\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": [
        "v11",
        "18/19"
    ]
}