get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52219,
    "url": "http://patches.dpdk.org/api/patches/52219/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190403171601.9788-4-marcinx.hajkowski@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": "<20190403171601.9788-4-marcinx.hajkowski@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190403171601.9788-4-marcinx.hajkowski@intel.com",
    "date": "2019-04-03T17:15:59",
    "name": "[3/4] power: add mechanism to disable queries",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b9d1b1f3fd2addedc75286de3953a91d0d359ef9",
    "submitter": {
        "id": 1246,
        "url": "http://patches.dpdk.org/api/people/1246/?format=api",
        "name": "Marcin Hajkowski",
        "email": "marcinx.hajkowski@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/20190403171601.9788-4-marcinx.hajkowski@intel.com/mbox/",
    "series": [
        {
            "id": 4096,
            "url": "http://patches.dpdk.org/api/series/4096/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4096",
            "date": "2019-04-03T17:15:56",
            "name": "Frequency list query",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4096/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/52219/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/52219/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 0351F1B559;\n\tWed,  3 Apr 2019 19:16:46 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 790FB1B513\n\tfor <dev@dpdk.org>; Wed,  3 Apr 2019 19:16:23 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t03 Apr 2019 10:16:23 -0700",
            "from mhajkowx-mobl.ger.corp.intel.com ([10.104.116.180])\n\tby fmsmga001.fm.intel.com with ESMTP; 03 Apr 2019 10:16:22 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.60,305,1549958400\"; d=\"scan'208\";a=\"161086738\"",
        "From": "Hajkowski <marcinx.hajkowski@intel.com>",
        "To": "david.hunt@intel.com",
        "Cc": "dev@dpdk.org,\n\tMarcin Hajkowski <marcinx.hajkowski@intel.com>",
        "Date": "Wed,  3 Apr 2019 19:15:59 +0200",
        "Message-Id": "<20190403171601.9788-4-marcinx.hajkowski@intel.com>",
        "X-Mailer": "git-send-email 2.20.1.windows.1",
        "In-Reply-To": "<20190403171601.9788-1-marcinx.hajkowski@intel.com>",
        "References": "<20190403171601.9788-1-marcinx.hajkowski@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 3/4] power: add mechanism to disable queries",
        "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": "From: Marcin Hajkowski <marcinx.hajkowski@intel.com>\n\nAdd new command which gives possibility to enable/disable queries\nform VM guest.\n\nSigned-off-by: Marcin Hajkowski <marcinx.hajkowski@intel.com>\n---\n examples/vm_power_manager/channel_manager.c | 20 +++++++++\n examples/vm_power_manager/channel_manager.h | 18 ++++++++\n examples/vm_power_manager/channel_monitor.c |  3 ++\n examples/vm_power_manager/vm_power_cli.c    | 48 +++++++++++++++++++++\n 4 files changed, 89 insertions(+)",
    "diff": "diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c\nindex 09bfa5c0d..7c852360a 100644\n--- a/examples/vm_power_manager/channel_manager.c\n+++ b/examples/vm_power_manager/channel_manager.c\n@@ -57,6 +57,7 @@ struct virtual_machine_info {\n \tvirDomainPtr domainPtr;\n \tvirDomainInfo info;\n \trte_spinlock_t config_spinlock;\n+\tint allow_query;\n \tLIST_ENTRY(virtual_machine_info) vms_info;\n };\n \n@@ -344,6 +345,23 @@ setup_channel_info(struct virtual_machine_info **vm_info_dptr,\n \treturn 0;\n }\n \n+int\n+set_query_status(char *vm_name,\n+\t\tbool allow_query)\n+{\n+\tstruct virtual_machine_info *vm_info;\n+\n+\tvm_info = find_domain_by_name(vm_name);\n+\tif (vm_info == NULL) {\n+\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"VM '%s' not found\\n\", vm_name);\n+\t\treturn -1;\n+\t}\n+\trte_spinlock_lock(&(vm_info->config_spinlock));\n+\tvm_info->allow_query = allow_query ? 1 : 0;\n+\trte_spinlock_unlock(&(vm_info->config_spinlock));\n+\treturn 0;\n+}\n+\n static void\n fifo_path(char *dst, unsigned int len)\n {\n@@ -752,6 +770,7 @@ get_info_vm(const char *vm_name, struct vm_info *info)\n \t\tchannel_num++;\n \t}\n \n+\tinfo->allow_query = vm_info->allow_query;\n \tinfo->num_channels = channel_num;\n \tinfo->num_vcpus = vm_info->info.nrVirtCpu;\n \trte_spinlock_unlock(&(vm_info->config_spinlock));\n@@ -828,6 +847,7 @@ add_vm(const char *vm_name)\n \telse\n \t\tnew_domain->status = CHANNEL_MGR_VM_ACTIVE;\n \n+\tnew_domain->allow_query = 0;\n \trte_spinlock_init(&(new_domain->config_spinlock));\n \tLIST_INSERT_HEAD(&vm_list_head, new_domain, vms_info);\n \treturn 0;\ndiff --git a/examples/vm_power_manager/channel_manager.h b/examples/vm_power_manager/channel_manager.h\nindex c3cdce492..6b032a79f 100644\n--- a/examples/vm_power_manager/channel_manager.h\n+++ b/examples/vm_power_manager/channel_manager.h\n@@ -12,6 +12,7 @@ extern \"C\" {\n #include <linux/limits.h>\n #include <sys/un.h>\n #include <rte_atomic.h>\n+#include <stdbool.h>\n \n /* Maximum number of CPUs */\n #define CHANNEL_CMDS_MAX_CPUS        256\n@@ -82,6 +83,7 @@ struct vm_info {\n \tunsigned num_vcpus;                           /**< number of vCPUS */\n \tstruct channel_info channels[CHANNEL_MGR_MAX_CHANNELS]; /**< Array of channel_info */\n \tunsigned num_channels;                        /**< Number of channels */\n+\tint allow_query;                              /**< is query allowed */\n };\n \n /**\n@@ -146,6 +148,22 @@ uint16_t get_pcpu(struct channel_info *chan_info, unsigned int vcpu);\n  */\n int set_pcpu(char *vm_name, unsigned int vcpu, unsigned int pcpu);\n \n+/**\n+ * Allow or disallow queries for specified VM.\n+ * It is thread-safe.\n+ *\n+ * @param name\n+ *  Virtual Machine name to lookup.\n+ *\n+ * @param allow_query\n+ *  Query status to be set.\n+ *\n+ * @return\n+ *  - 0 on success.\n+ *  - Negative on error.\n+ */\n+int set_query_status(char *vm_name, bool allow_query);\n+\n /**\n  * Add a VM as specified by name to the Channel Manager. The name must\n  * correspond to a valid libvirt domain name.\ndiff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c\nindex 69934d4e6..71fd8952b 100644\n--- a/examples/vm_power_manager/channel_monitor.c\n+++ b/examples/vm_power_manager/channel_monitor.c\n@@ -672,6 +672,9 @@ send_freq(struct channel_packet *pkt,\n \tif (!freq_list && vcore_id >= MAX_VCPU_PER_VM)\n \t\treturn -1;\n \n+\tif (!info.allow_query)\n+\t\treturn -1;\n+\n \tchannel_pkt_freq_list.command = CPU_POWER_FREQ_LIST;\n \tchannel_pkt_freq_list.num_vcpu = info.num_vcpus;\n \ndiff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c\nindex 41e89ff20..463ea02f8 100644\n--- a/examples/vm_power_manager/vm_power_cli.c\n+++ b/examples/vm_power_manager/vm_power_cli.c\n@@ -293,6 +293,53 @@ cmdline_parse_inst_t cmd_channels_op_set = {\n \t},\n };\n \n+struct cmd_set_query_result {\n+\tcmdline_fixed_string_t set_query;\n+\tcmdline_fixed_string_t vm_name;\n+\tcmdline_fixed_string_t query_status;\n+};\n+\n+static void\n+cmd_set_query_parsed(void *parsed_result,\n+\t\t__rte_unused struct cmdline *cl,\n+\t\t__rte_unused void *data)\n+{\n+\tstruct cmd_set_query_result *res = parsed_result;\n+\n+\tif (!strcmp(res->query_status, \"enable\")) {\n+\t\tif (set_query_status(res->vm_name, true) < 0)\n+\t\t\tcmdline_printf(cl, \"Unable to allow query for VM '%s'\\n\",\n+\t\t\t\t\tres->vm_name);\n+\t} else if (!strcmp(res->query_status, \"disable\")) {\n+\t\tif (set_query_status(res->vm_name, false) < 0)\n+\t\t\tcmdline_printf(cl, \"Unable to disallow query for VM '%s'\\n\",\n+\t\t\t\t\tres->vm_name);\n+\t}\n+}\n+\n+cmdline_parse_token_string_t cmd_set_query =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_query_result,\n+\t\t\tset_query, \"set_query\");\n+cmdline_parse_token_string_t cmd_set_query_vm_name =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_query_result,\n+\t\t\tvm_name, NULL);\n+cmdline_parse_token_string_t cmd_set_query_status =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_query_result,\n+\t\t\tquery_status, \"enable#disable\");\n+\n+cmdline_parse_inst_t cmd_set_query_set = {\n+\t.f = cmd_set_query_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set_query <vm_name> <enable|disable>, allow or disallow queries\"\n+\t\t\t\" for the specified VM\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_query,\n+\t\t(void *)&cmd_set_query_vm_name,\n+\t\t(void *)&cmd_set_query_status,\n+\t\tNULL,\n+\t},\n+};\n+\n struct cmd_channels_status_op_result {\n \tcmdline_fixed_string_t op;\n \tcmdline_fixed_string_t vm_name;\n@@ -484,6 +531,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t\t(cmdline_parse_inst_t *)&cmd_show_cpu_freq_set,\n \t\t(cmdline_parse_inst_t *)&cmd_set_cpu_freq_set,\n \t\t(cmdline_parse_inst_t *)&cmd_set_pcpu_set,\n+\t\t(cmdline_parse_inst_t *)&cmd_set_query_set,\n \t\tNULL,\n };\n \n",
    "prefixes": [
        "3/4"
    ]
}