get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 478,
    "url": "http://patches.dpdk.org/api/patches/478/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1411579576-21786-3-git-send-email-alan.carew@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": "<1411579576-21786-3-git-send-email-alan.carew@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1411579576-21786-3-git-send-email-alan.carew@intel.com",
    "date": "2014-09-24T17:26:08",
    "name": "[dpdk-dev,v2,02/10] VM Power Management CLI(Host).",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f81665e65825e2a1380633ffa90f50425e9a92e1",
    "submitter": {
        "id": 72,
        "url": "http://patches.dpdk.org/api/people/72/?format=api",
        "name": "Alan Carew",
        "email": "alan.carew@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1411579576-21786-3-git-send-email-alan.carew@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/478/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/478/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 38389B39F;\n\tWed, 24 Sep 2014 19:20:32 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 4BFFC1F5\n\tfor <dev@dpdk.org>; Wed, 24 Sep 2014 19:20:28 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga102.fm.intel.com with ESMTP; 24 Sep 2014 10:26:41 -0700",
            "from sie-lab-212-143.ir.intel.com (HELO\n\tsilpixa00385294.ir.intel.com) ([10.237.212.143])\n\tby fmsmga001.fm.intel.com with ESMTP; 24 Sep 2014 10:26:39 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,590,1406617200\"; d=\"scan'208\";a=\"596286376\"",
        "From": "Alan Carew <alan.carew@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 24 Sep 2014 18:26:08 +0100",
        "Message-Id": "<1411579576-21786-3-git-send-email-alan.carew@intel.com>",
        "X-Mailer": "git-send-email 1.9.3",
        "In-Reply-To": "<1411579576-21786-1-git-send-email-alan.carew@intel.com>",
        "References": "<1411410879-28872-1-git-send-email-alan.carew@intel.com>\n\t<1411579576-21786-1-git-send-email-alan.carew@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 02/10] VM Power Management CLI(Host).",
        "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": "The CLI is used for administrating the channel monitor and manager and\nmanually setting the CPU frequency on the host.\n\nSupports the following commands:\n add_vm [Mul-choice STRING]: add_vm|rm_vm <name>, add a VM for subsequent\n  operations with the CLI or remove a previously added VM from the VM Power\n  Manager\n\n rm_vm [Mul-choice STRING]: add_vm|rm_vm <name>, add a VM for subsequent\n  operations with the CLI or remove a previously added VM from the VM Power\n  Manager\n\n add_channels [Fixed STRING]: add_channels <vm_name> <list>|all, add\n  communication channels for the specified VM, the virtio channels must be\n  enabled in the VM configuration(qemu/libvirt) and the associated VM must be\n  active. <list> is a comma-separated list of channel numbers to add, using the\n  keyword 'all' will attempt to add all channels for the VM\n\n set_channel_status [Fixed STRING]:\n  set_channel_status <vm_name> <list>|all enabled|disabled,  enable or disable\n  the communication channels in list(comma-seperated) for the specified VM,\n  alternatively list can be replaced with keyword 'all'. Disabled channels will\n  still receive packets on the host, however the commands they specify will be\n  ignored. Set status to 'enabled' to begin processing requests again.\n\n show_vm [Fixed STRING]: show_vm <vm_name>, prints the information on the\n  specified VM(s), the information lists the number of vCPUS, the pinning to\n  pCPU(s) as a bit mask, along with any communication channels associated with\n  each VM\n\n show_cpu_freq_mask [Fixed STRING]: show_cpu_freq_mask <mask>, Get the current\n  frequency for each core specified in the mask\n\n set_cpu_freq_mask [Fixed STRING]: set_cpu_freq <core_mask> <up|down|min|max>,\n  Set the current frequency for the cores specified in <core_mask> by scaling\n  each up/down/min/max.\n\n show_cpu_freq [Fixed STRING]: Get the current frequency for the specified core\n\n set_cpu_freq [Fixed STRING]: set_cpu_freq <core_num> <up|down|min|max>,\n  Set the current frequency for the specified core by scaling up/down/min/max\n\n quit [Fixed STRING]: close the application\n\nSigned-off-by: Alan Carew <alan.carew@intel.com>\n---\n examples/vm_power_manager/vm_power_cli.c | 568 +++++++++++++++++++++++++++++++\n examples/vm_power_manager/vm_power_cli.h |  47 +++\n 2 files changed, 615 insertions(+)\n create mode 100644 examples/vm_power_manager/vm_power_cli.c\n create mode 100644 examples/vm_power_manager/vm_power_cli.h",
    "diff": "diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c\nnew file mode 100644\nindex 0000000..33a4bcf\n--- /dev/null\n+++ b/examples/vm_power_manager/vm_power_cli.c\n@@ -0,0 +1,568 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <stdlib.h>\n+#include <stdint.h>\n+#include <inttypes.h>\n+#include <stdio.h>\n+#include <string.h>\n+#include <termios.h>\n+#include <errno.h>\n+\n+#include <cmdline_rdline.h>\n+#include <cmdline_parse.h>\n+#include <cmdline_parse_string.h>\n+#include <cmdline_parse_num.h>\n+#include <cmdline_socket.h>\n+#include <cmdline.h>\n+#include <rte_config.h>\n+\n+#include \"vm_power_cli.h\"\n+#include \"channel_manager.h\"\n+#include \"channel_monitor.h\"\n+#include \"power_manager.h\"\n+#include \"channel_commands.h\"\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\tstruct cmdline *cl,\n+\t\t__attribute__((unused)) void *data)\n+{\n+\tchannel_monitor_exit();\n+\tchannel_manager_exit();\n+\tpower_manager_exit();\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 = \"close the application\",\n+\t.tokens = {        /* token list, NULL terminated */\n+\t\t(void *)&cmd_quit_quit,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** VM operations *** */\n+struct cmd_show_vm_result {\n+\tcmdline_fixed_string_t show_vm;\n+\tcmdline_fixed_string_t vm_name;\n+};\n+\n+static void\n+cmd_show_vm_parsed(void *parsed_result, struct cmdline *cl,\n+\t\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_vm_result *res = parsed_result;\n+\tstruct vm_info info;\n+\tunsigned i;\n+\n+\tif (get_info_vm(res->vm_name, &info) != 0)\n+\t\treturn;\n+\tcmdline_printf(cl, \"VM: '%s', status = \", info.name);\n+\tif (info.status == VM_ACTIVE)\n+\t\tcmdline_printf(cl, \"ACTIVE\\n\");\n+\telse\n+\t\tcmdline_printf(cl, \"INACTIVE\\n\");\n+\tcmdline_printf(cl, \"Channels %u\\n\", info.num_channels);\n+\tfor (i = 0; i < info.num_channels; i++) {\n+\t\tcmdline_printf(cl, \"  [%u]: %s, status = \", i,\n+\t\t\t\tinfo.channels[i].channel_path);\n+\t\tswitch (info.channels[i].status) {\n+\t\tcase CHANNEL_CONNECTED:\n+\t\t\tcmdline_printf(cl, \"CONNECTED\\n\");\n+\t\t\tbreak;\n+\t\tcase CHANNEL_DISCONNECTED:\n+\t\t\tcmdline_printf(cl, \"DISCONNECTED\\n\");\n+\t\t\tbreak;\n+\t\tcase CHANNEL_DISABLED:\n+\t\t\tcmdline_printf(cl, \"DISABLED\\n\");\n+\t\t\tbreak;\n+\t\tcase CHANNEL_PROCESSING:\n+\t\t\tcmdline_printf(cl, \"PROCESSING\\n\");\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tcmdline_printf(cl, \"UNKNOWN\\n\");\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tcmdline_printf(cl, \"Virtual CPU(s): %u\\n\", info.num_vcpus);\n+\tfor (i = 0; i < info.num_vcpus; i++) {\n+\t\tcmdline_printf(cl, \"  [%u]: Physical CPU Mask 0x%\"PRIx64\"\\n\", i,\n+\t\t\t\tinfo.pcpu_mask[i]);\n+\t}\n+}\n+\n+cmdline_parse_token_string_t cmd_vm_show =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_vm_result,\n+\t\t\t\tshow_vm, \"show_vm\");\n+cmdline_parse_token_string_t cmd_show_vm_name =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_vm_result,\n+\t\t\tvm_name, NULL);\n+\n+cmdline_parse_inst_t cmd_show_vm_set = {\n+\t.f = cmd_show_vm_parsed,\n+\t.data = NULL,\n+\t.help_str = \"show_vm <vm_name>, prints the information on the \"\n+\t\t\t\"specified VM(s), the information lists the number of vCPUS, the \"\n+\t\t\t\"pinning to pCPU(s) as a bit mask, along with any communication \"\n+\t\t\t\"channels associated with each VM\",\n+\t.tokens = {\n+\t\t(void *)&cmd_vm_show,\n+\t\t(void *)&cmd_show_vm_name,\n+\t\tNULL,\n+\t},\n+};\n+\n+struct cmd_vm_op_result {\n+\tcmdline_fixed_string_t op_vm;\n+\tcmdline_fixed_string_t vm_name;\n+};\n+\n+static void\n+cmd_vm_op_parsed(void *parsed_result, struct cmdline *cl,\n+\t\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_vm_op_result *res = parsed_result;\n+\n+\tif (!strcmp(res->op_vm, \"add_vm\")) {\n+\t\tif (add_vm(res->vm_name) < 0)\n+\t\t\tcmdline_printf(cl, \"Unable to add VM '%s'\\n\", res->vm_name);\n+\t} else if (remove_vm(res->vm_name) < 0)\n+\t\tcmdline_printf(cl, \"Unable to remove VM '%s'\\n\", res->vm_name);\n+}\n+\n+cmdline_parse_token_string_t cmd_vm_op =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_vm_op_result,\n+\t\t\top_vm, \"add_vm#rm_vm\");\n+cmdline_parse_token_string_t cmd_vm_name =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_vm_op_result,\n+\t\t\tvm_name, NULL);\n+\n+cmdline_parse_inst_t cmd_vm_op_set = {\n+\t.f = cmd_vm_op_parsed,\n+\t.data = NULL,\n+\t.help_str = \"add_vm|rm_vm <name>, add a VM for \"\n+\t\t\t\"subsequent operations with the CLI or remove a previously added \"\n+\t\t\t\"VM from the VM Power Manager\",\n+\t.tokens = {\n+\t\t(void *)&cmd_vm_op,\n+\t\t(void *)&cmd_vm_name,\n+\tNULL,\n+\t},\n+};\n+\n+/* *** VM channel operations *** */\n+struct cmd_channels_op_result {\n+\tcmdline_fixed_string_t op;\n+\tcmdline_fixed_string_t vm_name;\n+\tcmdline_fixed_string_t channel_list;\n+};\n+static void\n+cmd_channels_op_parsed(void *parsed_result, struct cmdline *cl,\n+\t\t\t__attribute__((unused)) void *data)\n+{\n+\tunsigned num_channels = 0, channel_num, i;\n+\tint channels_added;\n+\tunsigned channel_list[MAX_VM_CHANNELS];\n+\tchar *token, *remaining, *tail_ptr;\n+\tstruct cmd_channels_op_result *res = parsed_result;\n+\n+\tif (!strcmp(res->channel_list, \"all\")) {\n+\t\tchannels_added = add_all_channels(res->vm_name);\n+\t\tcmdline_printf(cl, \"Added %d channels for VM '%s'\\n\",\n+\t\t\t\tchannels_added, res->vm_name);\n+\t\treturn;\n+\t}\n+\n+\tremaining = res->channel_list;\n+\twhile (1) {\n+\t\tif (remaining == NULL || remaining[0] == '\\0')\n+\t\t\tbreak;\n+\n+\t\ttoken = strsep(&remaining, \",\");\n+\t\tif (token == NULL)\n+\t\t\tbreak;\n+\t\terrno = 0;\n+\t\tchannel_num = (unsigned)strtol(token, &tail_ptr, 10);\n+\t\tif ((errno != 0) || (*tail_ptr != '\\0') || tail_ptr == NULL)\n+\t\t\tbreak;\n+\n+\t\tif (channel_num == MAX_VM_CHANNELS) {\n+\t\t\tcmdline_printf(cl, \"Channel number '%u' exceeds the maximum number \"\n+\t\t\t\t\t\"of allowable channels(%u) for VM '%s'\\n\", channel_num,\n+\t\t\t\t\tMAX_VM_CHANNELS, res->vm_name);\n+\t\t\treturn;\n+\t\t}\n+\t\tchannel_list[num_channels++] = channel_num;\n+\t}\n+\tfor (i = 0; i < num_channels; i++)\n+\t\tcmdline_printf(cl, \"[%u]: Adding channel %u\\n\", i, channel_list[i]);\n+\n+\tchannels_added = add_channels(res->vm_name, channel_list,\n+\t\t\tnum_channels);\n+\tcmdline_printf(cl, \"Enabled %d channels for '%s'\\n\", channels_added,\n+\t\t\tres->vm_name);\n+}\n+\n+cmdline_parse_token_string_t cmd_channels_op =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_channels_op_result,\n+\t\t\t\top, \"add_channels\");\n+cmdline_parse_token_string_t cmd_channels_vm_name =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_channels_op_result,\n+\t\t\tvm_name, NULL);\n+cmdline_parse_token_string_t cmd_channels_list =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_channels_op_result,\n+\t\t\tchannel_list, NULL);\n+\n+cmdline_parse_inst_t cmd_channels_op_set = {\n+\t.f = cmd_channels_op_parsed,\n+\t.data = NULL,\n+\t.help_str = \"add_channels <vm_name> <list>|all, add \"\n+\t\t\t\"communication channels for the specified VM, the \"\n+\t\t\t\"virtio channels must be enabled in the VM \"\n+\t\t\t\"configuration(qemu/libvirt) and the associated VM must be active. \"\n+\t\t\t\"<list> is a comma-seperated list of channel numbers to add, using \"\n+\t\t\t\"the keyword 'all' will attempt to add all channels for the VM\",\n+\t.tokens = {\n+\t\t(void *)&cmd_channels_op,\n+\t\t(void *)&cmd_channels_vm_name,\n+\t\t(void *)&cmd_channels_list,\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+\tcmdline_fixed_string_t channel_list;\n+\tcmdline_fixed_string_t status;\n+};\n+\n+static void\n+cmd_channels_status_op_parsed(void *parsed_result, struct cmdline *cl,\n+\t\t       __attribute__((unused)) void *data)\n+{\n+\tunsigned num_channels = 0, channel_num;\n+\tint changed;\n+\tunsigned channel_list[MAX_VM_CHANNELS];\n+\tchar *token, *remaining, *tail_ptr;\n+\tstruct cmd_channels_status_op_result *res = parsed_result;\n+\tenum channel_status status;\n+\n+\tif (!strcmp(res->status, \"enabled\"))\n+\t\tstatus = CHANNEL_CONNECTED;\n+\telse\n+\t\tstatus = CHANNEL_DISABLED;\n+\n+\tif (!strcmp(res->channel_list, \"all\")) {\n+\t\tchanged = set_channel_status_all(res->vm_name, status);\n+\t\tcmdline_printf(cl, \"Updated status of %d channels \"\n+\t\t\t\t\"for VM '%s'\\n\", changed, res->vm_name);\n+\t\treturn;\n+\t}\n+\tremaining = res->channel_list;\n+\twhile (1) {\n+\t\tif (remaining == NULL || remaining[0] == '\\0')\n+\t\t\tbreak;\n+\t\ttoken = strsep(&remaining, \",\");\n+\t\tif (token == NULL)\n+\t\t\tbreak;\n+\t\terrno = 0;\n+\t\tchannel_num = (unsigned)strtol(token, &tail_ptr, 10);\n+\t\tif ((errno != 0) || (*tail_ptr != '\\0') || tail_ptr == NULL)\n+\t\t\tbreak;\n+\n+\t\tif (channel_num == MAX_VM_CHANNELS) {\n+\t\t\tcmdline_printf(cl, \"%u exceeds the maximum number of allowable \"\n+\t\t\t\t\t\"channels(%u) for VM '%s'\\n\", channel_num, MAX_VM_CHANNELS,\n+\t\t\t\t\tres->vm_name);\n+\t\t\treturn;\n+\t\t}\n+\t\tchannel_list[num_channels++] = channel_num;\n+\t}\n+\tchanged = set_channel_status(res->vm_name, channel_list, num_channels,\n+\t\t\tstatus);\n+\tcmdline_printf(cl, \"Updated status of %d channels \"\n+\t\t\t\t\t\"for VM '%s'\\n\", changed, res->vm_name);\n+}\n+\n+cmdline_parse_token_string_t cmd_channels_status_op =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_channels_status_op_result,\n+\t\t\t\top, \"set_channel_status\");\n+cmdline_parse_token_string_t cmd_channels_status_vm_name =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_channels_status_op_result,\n+\t\t\tvm_name, NULL);\n+cmdline_parse_token_string_t cmd_channels_status_list =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_channels_status_op_result,\n+\t\t\tchannel_list, NULL);\n+cmdline_parse_token_string_t cmd_channels_status =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_channels_status_op_result,\n+\t\t\tstatus, \"enabled#disabled\");\n+\n+cmdline_parse_inst_t cmd_channels_status_op_set = {\n+\t.f = cmd_channels_status_op_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set_channel_status <vm_name> <list>|all enabled|disabled, \"\n+\t\t\t\" enable or disable the communication channels in \"\n+\t\t\t\"list(comma-seperated) for the specified VM, alternatively list can\"\n+\t\t\t\" be replaced with keyword 'all'. Disabled channels will still \"\n+\t\t\t\"receive packets on the host, however the commands they specify \"\n+\t\t\t\"will be ignored. Set status to 'enabled' to begin processing \"\n+\t\t\t\"requests again.\",\n+\t.tokens = {\n+\t\t(void *)&cmd_channels_status_op,\n+\t\t(void *)&cmd_channels_status_vm_name,\n+\t\t(void *)&cmd_channels_status_list,\n+\t\t(void *)&cmd_channels_status,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** CPU Frequency operations *** */\n+struct cmd_show_cpu_freq_mask_result {\n+\tcmdline_fixed_string_t show_cpu_freq_mask;\n+\tuint64_t core_mask;\n+};\n+\n+static void\n+cmd_show_cpu_freq_mask_parsed(void *parsed_result, struct cmdline *cl,\n+\t\t       __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_cpu_freq_mask_result *res = parsed_result;\n+\tunsigned i;\n+\tuint64_t mask = res->core_mask;\n+\tuint32_t freq;\n+\tfor (i = 0; mask; mask &= ~(1ULL << i++)) {\n+\t\tif ((mask >> i) & 1) {\n+\t\t\tfreq = power_manager_get_current_frequency(i);\n+\t\t\tif (freq > 0)\n+\t\t\t\tcmdline_printf(cl, \"Core %u: %\"PRId32\"\\n\", i, freq);\n+\t\t}\n+\t}\n+}\n+\n+cmdline_parse_token_string_t cmd_show_cpu_freq_mask =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_cpu_freq_mask_result,\n+\t\t\tshow_cpu_freq_mask, \"show_cpu_freq_mask\");\n+cmdline_parse_token_num_t cmd_show_cpu_freq_mask_core_mask =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_show_cpu_freq_mask_result,\n+\t\t\tcore_mask, UINT64);\n+\n+cmdline_parse_inst_t cmd_show_cpu_freq_mask_set = {\n+\t.f = cmd_show_cpu_freq_mask_parsed,\n+\t.data = NULL,\n+\t.help_str = \"show_cpu_freq_mask <mask>, Get the current frequency for each \"\n+\t\t\t\"core specified in the mask\",\n+\t.tokens = {\n+\t\t(void *)&cmd_show_cpu_freq_mask,\n+\t\t(void *)&cmd_show_cpu_freq_mask_core_mask,\n+\t\tNULL,\n+\t},\n+};\n+\n+struct cmd_set_cpu_freq_mask_result {\n+\tcmdline_fixed_string_t set_cpu_freq_mask;\n+\tuint64_t core_mask;\n+\tcmdline_fixed_string_t cmd;\n+};\n+\n+static void\n+cmd_set_cpu_freq_mask_parsed(void *parsed_result, struct cmdline *cl,\n+\t\t\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_set_cpu_freq_mask_result *res = parsed_result;\n+\tint ret = -1;\n+\n+\tif (!strcmp(res->cmd , \"up\"))\n+\t\tret = power_manager_scale_mask_up(res->core_mask);\n+\telse if (!strcmp(res->cmd , \"down\"))\n+\t\tret = power_manager_scale_mask_down(res->core_mask);\n+\telse if (!strcmp(res->cmd , \"min\"))\n+\t\tret = power_manager_scale_mask_min(res->core_mask);\n+\telse if (!strcmp(res->cmd , \"max\"))\n+\t\tret = power_manager_scale_mask_max(res->core_mask);\n+\tif (ret != 0) {\n+\t\tcmdline_printf(cl, \"Error scaling core_mask(0x%\"PRIx64\") '%s' , not \"\n+\t\t\t\t\"all cores specified have been scaled\\n\",\n+\t\t\t\tres->core_mask, res->cmd);\n+\t};\n+}\n+\n+cmdline_parse_token_string_t cmd_set_cpu_freq_mask =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_mask_result,\n+\t\t\tset_cpu_freq_mask, \"set_cpu_freq_mask\");\n+cmdline_parse_token_num_t cmd_set_cpu_freq_mask_core_mask =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_cpu_freq_mask_result,\n+\t\t\tcore_mask, UINT64);\n+cmdline_parse_token_string_t cmd_set_cpu_freq_mask_result =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_mask_result,\n+\t\t\tcmd, \"up#down#min#max\");\n+\n+cmdline_parse_inst_t cmd_set_cpu_freq_mask_set = {\n+\t.f = cmd_set_cpu_freq_mask_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set_cpu_freq <core_mask> <up|down|min|max>, Set the current \"\n+\t\t\t\"frequency for the cores specified in <core_mask> by scaling \"\n+\t\t\t\"each up/down/min/max.\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_cpu_freq_mask,\n+\t\t(void *)&cmd_set_cpu_freq_mask_core_mask,\n+\t\t(void *)&cmd_set_cpu_freq_mask_result,\n+\t\tNULL,\n+\t},\n+};\n+\n+\n+\n+struct cmd_show_cpu_freq_result {\n+\tcmdline_fixed_string_t show_cpu_freq;\n+\tuint8_t core_num;\n+};\n+\n+static void\n+cmd_show_cpu_freq_parsed(void *parsed_result, struct cmdline *cl,\n+\t\t       __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_cpu_freq_result *res = parsed_result;\n+\tuint32_t curr_freq = power_manager_get_current_frequency(res->core_num);\n+\tif (curr_freq == 0) {\n+\t\tcmdline_printf(cl, \"Unable to get frequency for core %u\\n\",\n+\t\t\t\tres->core_num);\n+\t\treturn;\n+\t}\n+\tcmdline_printf(cl, \"Core %u frequency: %\"PRId32\"\\n\", res->core_num,\n+\t\t\tcurr_freq);\n+}\n+\n+cmdline_parse_token_string_t cmd_show_cpu_freq =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_cpu_freq_result,\n+\t\t\tshow_cpu_freq, \"show_cpu_freq\");\n+\n+cmdline_parse_token_num_t cmd_show_cpu_freq_core_num =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_show_cpu_freq_result,\n+\t\t\tcore_num, UINT8);\n+\n+cmdline_parse_inst_t cmd_show_cpu_freq_set = {\n+\t.f = cmd_show_cpu_freq_parsed,\n+\t.data = NULL,\n+\t.help_str = \"Get the current frequency for the specified core\",\n+\t.tokens = {\n+\t\t(void *)&cmd_show_cpu_freq,\n+\t\t(void *)&cmd_show_cpu_freq_core_num,\n+\t\tNULL,\n+\t},\n+};\n+\n+struct cmd_set_cpu_freq_result {\n+\tcmdline_fixed_string_t set_cpu_freq;\n+\tuint8_t core_num;\n+\tcmdline_fixed_string_t cmd;\n+};\n+\n+static void\n+cmd_set_cpu_freq_parsed(void *parsed_result, struct cmdline *cl,\n+\t\t       __attribute__((unused)) void *data)\n+{\n+\tint ret = -1;\n+\tstruct cmd_set_cpu_freq_result *res = parsed_result;\n+\n+\tif (!strcmp(res->cmd , \"up\"))\n+\t\tret = power_manager_scale_core_up(res->core_num);\n+\telse if (!strcmp(res->cmd , \"down\"))\n+\t\tret = power_manager_scale_core_down(res->core_num);\n+\telse if (!strcmp(res->cmd , \"min\"))\n+\t\tret = power_manager_scale_core_min(res->core_num);\n+\telse if (!strcmp(res->cmd , \"max\"))\n+\t\tret = power_manager_scale_core_max(res->core_num);\n+\tif (ret != 0) {\n+\t\tcmdline_printf(cl, \"Error scaling core(%u) '%s'\\n\", res->core_num,\n+\t\t\t\tres->cmd);\n+\t}\n+}\n+\n+cmdline_parse_token_string_t cmd_set_cpu_freq =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_result,\n+\t\t\tset_cpu_freq, \"set_cpu_freq\");\n+cmdline_parse_token_string_t cmd_set_cpu_freq_core_num =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_cpu_freq_result,\n+\t\t\tcore_num, UINT8);\n+cmdline_parse_token_string_t cmd_set_cpu_freq_cmd_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_cpu_freq_result,\n+\t\t\tcmd, \"up#down#min#max\");\n+\n+cmdline_parse_inst_t cmd_set_cpu_freq_set = {\n+\t.f = cmd_set_cpu_freq_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set_cpu_freq <core_num> <up|down|min|max>, Set the current \"\n+\t\t\t\"frequency for the specified core by scaling up/down/min/max\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_cpu_freq,\n+\t\t(void *)&cmd_set_cpu_freq_core_num,\n+\t\t(void *)&cmd_set_cpu_freq_cmd_cmd,\n+\t\tNULL,\n+\t},\n+};\n+\n+cmdline_parse_ctx_t main_ctx[] = {\n+\t\t(cmdline_parse_inst_t *)&cmd_quit,\n+\t\t(cmdline_parse_inst_t *)&cmd_vm_op_set,\n+\t\t(cmdline_parse_inst_t *)&cmd_channels_op_set,\n+\t\t(cmdline_parse_inst_t *)&cmd_channels_status_op_set,\n+\t\t(cmdline_parse_inst_t *)&cmd_show_vm_set,\n+\t\t(cmdline_parse_inst_t *)&cmd_show_cpu_freq_mask_set,\n+\t\t(cmdline_parse_inst_t *)&cmd_set_cpu_freq_mask_set,\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\tNULL,\n+};\n+\n+void\n+run_cli(__attribute__((unused)) void *arg)\n+{\n+\tstruct cmdline *cl;\n+\tpower_manager_init();\n+\tcl = cmdline_stdin_new(main_ctx, \"vmpower> \");\n+\tif (cl == NULL)\n+\t\treturn;\n+\n+\tcmdline_interact(cl);\n+\tcmdline_stdin_exit(cl);\n+}\ndiff --git a/examples/vm_power_manager/vm_power_cli.h b/examples/vm_power_manager/vm_power_cli.h\nnew file mode 100644\nindex 0000000..deccd51\n--- /dev/null\n+++ b/examples/vm_power_manager/vm_power_cli.h\n@@ -0,0 +1,47 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef VM_POWER_CLI_H_\n+#define VM_POWER_CLI_H_\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+void run_cli(__attribute__((unused)) void *arg);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* VM_POWER_CLI_H_ */\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "02/10"
    ]
}