Show a patch.

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

{
    "id": 43062,
    "url": "http://patches.dpdk.org/api/patches/43062/",
    "web_url": "http://patches.dpdk.org/patch/43062/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20180713142302.34576-9-david.hunt@intel.com>",
    "date": "2018-07-13T14:23:01",
    "name": "[v4,8/9] examples/vm_power: add cli args to guest app",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "0e7740de03416e5d3fe31f7536c1175b78b1fae3",
    "submitter": {
        "id": 342,
        "url": "http://patches.dpdk.org/api/people/342/",
        "name": "David Hunt",
        "email": "david.hunt@intel.com"
    },
    "delegate": {
        "id": 22,
        "url": "http://patches.dpdk.org/api/users/22/",
        "username": "pdelarag",
        "first_name": "Pablo",
        "last_name": "de Lara Guarch",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "mbox": "http://patches.dpdk.org/patch/43062/mbox/",
    "series": [
        {
            "id": 568,
            "url": "http://patches.dpdk.org/api/series/568/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=568",
            "date": "2018-07-13T14:22:53",
            "name": "examples/vm_power: 100% Busy Polling",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/568/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43062/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43062/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Mailer": "git-send-email 2.17.1",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9BC644B4B;\n\tFri, 13 Jul 2018 16:23:37 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 676532BAE\n\tfor <dev@dpdk.org>; Fri, 13 Jul 2018 16:23:28 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Jul 2018 07:23:27 -0700",
            "from silpixa00399952.ir.intel.com (HELO\n\tsilpixa00399952.ger.corp.intel.com) ([10.237.223.64])\n\tby orsmga007.jf.intel.com with ESMTP; 13 Jul 2018 07:23:26 -0700"
        ],
        "References": "<20180626092317.11031-2-david.hunt@intel.com>\n\t<20180713142302.34576-1-david.hunt@intel.com>",
        "X-Amp-File-Uploaded": "False",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<20180713142302.34576-9-david.hunt@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,347,1526367600\"; d=\"scan'208\";a=\"56278226\"",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "From": "David Hunt <david.hunt@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<20180713142302.34576-1-david.hunt@intel.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Fri, 13 Jul 2018 15:23:01 +0100",
        "Cc": "david.hunt@intel.com,\n\tthomas@monjalon.net",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v4 8/9] examples/vm_power: add cli args to guest\n\tapp"
    },
    "content": "Add new command line arguments to the guest app to make\n    testing and validation of the policy usage easier.\n    These arguments are mainly around setting up the power\n    management policy that is sent from the guest vm to\n    to the vm_power_manager in the host\n\n    New command line parameters:\n    -n or --vm-name\n       sets the name of the vm to be used by the host OS.\n    -b or --busy-hours\n       sets the list of hours that are predicted to be busy\n    -q or --quiet-hours\n       sets the list of hours that are predicted to be quiet\n    -l or --vcpu-list\n       sets the list of vcpus to monitor\n    -p or --port-list\n       sets the list of posts to monitor when using a\n       workload policy.\n    -o or --policy\n       sets the default policy type\n          TIME\n          WORKLOAD\n          TRAFFIC\n          BRANCH_RATIO\n\n    The format of the hours or list paramers is a comma-separated\n    list of integers, which can take the form of\n       a. x    e.g. --vcpu-list=1\n       b. x,y  e.g. --quiet-hours=3,4\n       c. x-y  e.g. --busy-hours=9-12\n       d. combination of above (e.g. --busy-hours=4,5-7,9)\n\nSigned-off-by: David Hunt <david.hunt@intel.com>\nAcked-by: Radu Nicolau <radu.nicolau@intel.com>\n---\n examples/vm_power_manager/guest_cli/Makefile  |   2 +-\n examples/vm_power_manager/guest_cli/main.c    | 151 +++++++++++++++++-\n examples/vm_power_manager/guest_cli/parse.c   |  82 ++++++++++\n examples/vm_power_manager/guest_cli/parse.h   |  19 +++\n .../guest_cli/vm_power_cli_guest.c            | 113 +++++++------\n .../guest_cli/vm_power_cli_guest.h            |   6 +\n 6 files changed, 319 insertions(+), 54 deletions(-)\n create mode 100644 examples/vm_power_manager/guest_cli/parse.c\n create mode 100644 examples/vm_power_manager/guest_cli/parse.h",
    "diff": "diff --git a/examples/vm_power_manager/guest_cli/Makefile b/examples/vm_power_manager/guest_cli/Makefile\nindex d710e22d9..8b1db861e 100644\n--- a/examples/vm_power_manager/guest_cli/Makefile\n+++ b/examples/vm_power_manager/guest_cli/Makefile\n@@ -14,7 +14,7 @@ include $(RTE_SDK)/mk/rte.vars.mk\n APP = guest_vm_power_mgr\n \n # all source are stored in SRCS-y\n-SRCS-y := main.c vm_power_cli_guest.c\n+SRCS-y := main.c vm_power_cli_guest.c parse.c\n \n CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/\n CFLAGS += $(WERROR_FLAGS)\ndiff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c\nindex b17936d6b..36365b124 100644\n--- a/examples/vm_power_manager/guest_cli/main.c\n+++ b/examples/vm_power_manager/guest_cli/main.c\n@@ -2,23 +2,20 @@\n  * Copyright(c) 2010-2014 Intel Corporation\n  */\n \n-/*\n #include <stdio.h>\n-#include <string.h>\n-#include <stdint.h>\n-#include <sys/epoll.h>\n-#include <fcntl.h>\n-#include <unistd.h>\n #include <stdlib.h>\n-#include <errno.h>\n-*/\n #include <signal.h>\n+#include <getopt.h>\n+#include <string.h>\n \n #include <rte_lcore.h>\n #include <rte_power.h>\n #include <rte_debug.h>\n+#include <rte_eal.h>\n+#include <rte_log.h>\n \n #include \"vm_power_cli_guest.h\"\n+#include \"parse.h\"\n \n static void\n sig_handler(int signo)\n@@ -32,6 +29,136 @@ sig_handler(int signo)\n \n }\n \n+#define MAX_HOURS 24\n+\n+/* Parse the argument given in the command line of the application */\n+static int\n+parse_args(int argc, char **argv)\n+{\n+\tint opt, ret;\n+\tchar **argvopt;\n+\tint option_index;\n+\tchar *prgname = argv[0];\n+\tconst struct option lgopts[] = {\n+\t\t{ \"vm-name\", required_argument, 0, 'n'},\n+\t\t{ \"busy-hours\", required_argument, 0, 'b'},\n+\t\t{ \"quiet-hours\", required_argument, 0, 'q'},\n+\t\t{ \"port-list\", required_argument, 0, 'p'},\n+\t\t{ \"vcpu-list\", required_argument, 0, 'l'},\n+\t\t{ \"policy\", required_argument, 0, 'o'},\n+\t\t{NULL, 0, 0, 0}\n+\t};\n+\tstruct channel_packet *policy;\n+\tunsigned short int hours[MAX_HOURS];\n+\tunsigned short int cores[MAX_VCPU_PER_VM];\n+\tunsigned short int ports[MAX_VCPU_PER_VM];\n+\tint i, cnt, idx;\n+\n+\tpolicy = get_policy();\n+\tset_policy_defaults(policy);\n+\n+\targvopt = argv;\n+\n+\twhile ((opt = getopt_long(argc, argvopt, \"n:b:q:p:\",\n+\t\t\t\t  lgopts, &option_index)) != EOF) {\n+\n+\t\tswitch (opt) {\n+\t\t/* portmask */\n+\t\tcase 'n':\n+\t\t\tstrcpy(policy->vm_name, optarg);\n+\t\t\tprintf(\"Setting VM Name to [%s]\\n\", policy->vm_name);\n+\t\t\tbreak;\n+\t\tcase 'b':\n+\t\tcase 'q':\n+\t\t\t//printf(\"***Processing set using [%s]\\n\", optarg);\n+\t\t\tcnt = parse_set(optarg, hours, MAX_HOURS);\n+\t\t\tif (cnt < 0) {\n+\t\t\t\tprintf(\"Invalid value passed to quiet/busy hours - [%s]\\n\",\n+\t\t\t\t\t\toptarg);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tidx = 0;\n+\t\t\tfor (i = 0; i < MAX_HOURS; i++) {\n+\t\t\t\tif (hours[i]) {\n+\t\t\t\t\tif (opt == 'b') {\n+\t\t\t\t\t\tprintf(\"***Busy Hour %d\\n\", i);\n+\t\t\t\t\t\tpolicy->timer_policy.busy_hours\n+\t\t\t\t\t\t\t[idx++] = i;\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\tprintf(\"***Quiet Hour %d\\n\", i);\n+\t\t\t\t\t\tpolicy->timer_policy.quiet_hours\n+\t\t\t\t\t\t\t[idx++] = i;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase 'l':\n+\t\t\tcnt = parse_set(optarg, cores, MAX_VCPU_PER_VM);\n+\t\t\tif (cnt < 0) {\n+\t\t\t\tprintf(\"Invalid value passed to vcpu-list - [%s]\\n\",\n+\t\t\t\t\t\toptarg);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tidx = 0;\n+\t\t\tfor (i = 0; i < MAX_VCPU_PER_VM; i++) {\n+\t\t\t\tif (cores[i]) {\n+\t\t\t\t\tprintf(\"***Using core %d\\n\", i);\n+\t\t\t\t\tpolicy->vcpu_to_control[idx++] = i;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tpolicy->num_vcpu = idx;\n+\t\t\tprintf(\"Total cores: %d\\n\", idx);\n+\t\t\tbreak;\n+\t\tcase 'p':\n+\t\t\tcnt = parse_set(optarg, ports, MAX_VCPU_PER_VM);\n+\t\t\tif (cnt < 0) {\n+\t\t\t\tprintf(\"Invalid value passed to port-list - [%s]\\n\",\n+\t\t\t\t\t\toptarg);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tidx = 0;\n+\t\t\tfor (i = 0; i < MAX_VCPU_PER_VM; i++) {\n+\t\t\t\tif (ports[i]) {\n+\t\t\t\t\tprintf(\"***Using port %d\\n\", i);\n+\t\t\t\t\tset_policy_mac(i, idx++);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tpolicy->nb_mac_to_monitor = idx;\n+\t\t\tprintf(\"Total Ports: %d\\n\", idx);\n+\t\t\tbreak;\n+\t\tcase 'o':\n+\t\t\tif (!strcmp(optarg, \"TRAFFIC\"))\n+\t\t\t\tpolicy->policy_to_use = TRAFFIC;\n+\t\t\telse if (!strcmp(optarg, \"TIME\"))\n+\t\t\t\tpolicy->policy_to_use = TIME;\n+\t\t\telse if (!strcmp(optarg, \"WORKLOAD\"))\n+\t\t\t\tpolicy->policy_to_use = WORKLOAD;\n+\t\t\telse if (!strcmp(optarg, \"BRANCH_RATIO\"))\n+\t\t\t\tpolicy->policy_to_use = BRANCH_RATIO;\n+\t\t\telse {\n+\t\t\t\tprintf(\"Invalid policy specified: %s\\n\",\n+\t\t\t\t\t\toptarg);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\t/* long options */\n+\n+\t\tcase 0:\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n+\tif (optind >= 0)\n+\t\targv[optind-1] = prgname;\n+\n+\tret = optind-1;\n+\toptind = 0; /* reset getopt lib */\n+\treturn ret;\n+}\n+\n int\n main(int argc, char **argv)\n {\n@@ -45,6 +172,14 @@ main(int argc, char **argv)\n \tsignal(SIGINT, sig_handler);\n \tsignal(SIGTERM, sig_handler);\n \n+\targc -= ret;\n+\targv += ret;\n+\n+\t/* parse application arguments (after the EAL ones) */\n+\tret = parse_args(argc, argv);\n+\tif (ret < 0)\n+\t\trte_exit(EXIT_FAILURE, \"Invalid arguments\\n\");\n+\n \trte_power_set_env(PM_ENV_KVM_VM);\n \tRTE_LCORE_FOREACH(lcore_id) {\n \t\trte_power_init(lcore_id);\ndiff --git a/examples/vm_power_manager/guest_cli/parse.c b/examples/vm_power_manager/guest_cli/parse.c\nnew file mode 100644\nindex 000000000..528df6d6f\n--- /dev/null\n+++ b/examples/vm_power_manager/guest_cli/parse.c\n@@ -0,0 +1,82 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation.\n+ * Copyright(c) 2014 6WIND S.A.\n+ */\n+\n+#include <stdlib.h>\n+#include <string.h>\n+#include <rte_log.h>\n+#include \"parse.h\"\n+\n+/*\n+ * Parse elem, the elem could be single number/range or group\n+ * 1) A single number elem, it's just a simple digit. e.g. 9\n+ * 2) A single range elem, two digits with a '-' between. e.g. 2-6\n+ * 3) A group elem, combines multiple 1) or 2) e.g 0,2-4,6\n+ *    Within group, '-' used for a range separator;\n+ *                       ',' used for a single number.\n+ */\n+int\n+parse_set(const char *input, uint16_t set[], unsigned int num)\n+{\n+\tunsigned int idx;\n+\tconst char *str = input;\n+\tchar *end = NULL;\n+\tunsigned int min, max;\n+\n+\tmemset(set, 0, num * sizeof(uint16_t));\n+\n+\twhile (isblank(*str))\n+\t\tstr++;\n+\n+\t/* only digit or left bracket is qualify for start point */\n+\tif (!isdigit(*str) || *str == '\\0')\n+\t\treturn -1;\n+\n+\twhile (isblank(*str))\n+\t\tstr++;\n+\tif (*str == '\\0')\n+\t\treturn -1;\n+\n+\tmin = num;\n+\tdo {\n+\n+\t\t/* go ahead to the first digit */\n+\t\twhile (isblank(*str))\n+\t\t\tstr++;\n+\t\tif (!isdigit(*str))\n+\t\t\treturn -1;\n+\n+\t\t/* get the digit value */\n+\t\terrno = 0;\n+\t\tidx = strtoul(str, &end, 10);\n+\t\tif (errno || end == NULL || idx >= num)\n+\t\t\treturn -1;\n+\n+\t\t/* go ahead to separator '-' and ',' */\n+\t\twhile (isblank(*end))\n+\t\t\tend++;\n+\t\tif (*end == '-') {\n+\t\t\tif (min == num)\n+\t\t\t\tmin = idx;\n+\t\t\telse /* avoid continuous '-' */\n+\t\t\t\treturn -1;\n+\t\t} else if ((*end == ',') || (*end == '\\0')) {\n+\t\t\tmax = idx;\n+\n+\t\t\tif (min == num)\n+\t\t\t\tmin = idx;\n+\n+\t\t\tfor (idx = RTE_MIN(min, max);\n+\t\t\t\t\tidx <= RTE_MAX(min, max); idx++) {\n+\t\t\t\tset[idx] = 1;\n+\t\t\t}\n+\t\t\tmin = num;\n+\t\t} else\n+\t\t\treturn -1;\n+\n+\t\tstr = end + 1;\n+\t} while (*end != '\\0');\n+\n+\treturn str - input;\n+}\ndiff --git a/examples/vm_power_manager/guest_cli/parse.h b/examples/vm_power_manager/guest_cli/parse.h\nnew file mode 100644\nindex 000000000..c8aa0ea50\n--- /dev/null\n+++ b/examples/vm_power_manager/guest_cli/parse.h\n@@ -0,0 +1,19 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#ifndef PARSE_H_\n+#define PARSE_H_\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+int\n+parse_set(const char *, uint16_t [], unsigned int);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* PARSE_H_ */\ndiff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c\nindex 43bdeacef..0db1b804f 100644\n--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c\n+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c\n@@ -33,6 +33,71 @@ struct cmd_quit_result {\n \tcmdline_fixed_string_t quit;\n };\n \n+union PFID {\n+\tstruct ether_addr addr;\n+\tuint64_t pfid;\n+};\n+\n+static struct channel_packet policy;\n+\n+struct channel_packet *\n+get_policy(void)\n+{\n+\treturn &policy;\n+}\n+\n+int\n+set_policy_mac(int port, int idx)\n+{\n+\tstruct channel_packet *policy;\n+\tunion PFID pfid;\n+\n+\t/* Use port MAC address as the vfid */\n+\trte_eth_macaddr_get(port, &pfid.addr);\n+\n+\tprintf(\"Port %u MAC: %02\" PRIx8 \":%02\" PRIx8 \":%02\" PRIx8 \":\"\n+\t\t\t\"%02\" PRIx8 \":%02\" PRIx8 \":%02\" PRIx8 \"\\n\",\n+\t\t\tport,\n+\t\t\tpfid.addr.addr_bytes[0], pfid.addr.addr_bytes[1],\n+\t\t\tpfid.addr.addr_bytes[2], pfid.addr.addr_bytes[3],\n+\t\t\tpfid.addr.addr_bytes[4], pfid.addr.addr_bytes[5]);\n+\tpolicy = get_policy();\n+\tpolicy->vfid[idx] = pfid.pfid;\n+\treturn 0;\n+}\n+\n+void\n+set_policy_defaults(struct channel_packet *pkt)\n+{\n+\tset_policy_mac(0, 0);\n+\tpkt->nb_mac_to_monitor = 1;\n+\n+\tpkt->t_boost_status.tbEnabled = false;\n+\n+\tpkt->vcpu_to_control[0] = 0;\n+\tpkt->vcpu_to_control[1] = 1;\n+\tpkt->num_vcpu = 2;\n+\t/* Dummy Population. */\n+\tpkt->traffic_policy.min_packet_thresh = 96000;\n+\tpkt->traffic_policy.avg_max_packet_thresh = 1800000;\n+\tpkt->traffic_policy.max_max_packet_thresh = 2000000;\n+\n+\tpkt->timer_policy.busy_hours[0] = 3;\n+\tpkt->timer_policy.busy_hours[1] = 4;\n+\tpkt->timer_policy.busy_hours[2] = 5;\n+\tpkt->timer_policy.quiet_hours[0] = 11;\n+\tpkt->timer_policy.quiet_hours[1] = 12;\n+\tpkt->timer_policy.quiet_hours[2] = 13;\n+\n+\tpkt->timer_policy.hours_to_use_traffic_profile[0] = 8;\n+\tpkt->timer_policy.hours_to_use_traffic_profile[1] = 10;\n+\n+\tpkt->workload = LOW;\n+\tpkt->policy_to_use = TIME;\n+\tpkt->command = PKT_POLICY;\n+\tstrcpy(pkt->vm_name, \"ubuntu2\");\n+}\n+\n static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,\n \t\t\t\t__attribute__((unused)) struct cmdline *cl,\n \t\t\t    __attribute__((unused)) void *data)\n@@ -118,54 +183,12 @@ struct cmd_send_policy_result {\n \tcmdline_fixed_string_t cmd;\n };\n \n-union PFID {\n-\tstruct ether_addr addr;\n-\tuint64_t pfid;\n-};\n-\n static inline int\n-send_policy(void)\n+send_policy(struct channel_packet *pkt)\n {\n-\tstruct channel_packet pkt;\n \tint ret;\n \n-\tunion PFID pfid;\n-\t/* Use port MAC address as the vfid */\n-\trte_eth_macaddr_get(0, &pfid.addr);\n-\tprintf(\"Port %u MAC: %02\" PRIx8 \":%02\" PRIx8 \":%02\" PRIx8 \":\"\n-\t\t\t\"%02\" PRIx8 \":%02\" PRIx8 \":%02\" PRIx8 \"\\n\",\n-\t\t\t1,\n-\t\t\tpfid.addr.addr_bytes[0], pfid.addr.addr_bytes[1],\n-\t\t\tpfid.addr.addr_bytes[2], pfid.addr.addr_bytes[3],\n-\t\t\tpfid.addr.addr_bytes[4], pfid.addr.addr_bytes[5]);\n-\tpkt.vfid[0] = pfid.pfid;\n-\n-\tpkt.nb_mac_to_monitor = 1;\n-\tpkt.t_boost_status.tbEnabled = false;\n-\n-\tpkt.vcpu_to_control[0] = 0;\n-\tpkt.vcpu_to_control[1] = 1;\n-\tpkt.num_vcpu = 2;\n-\t/* Dummy Population. */\n-\tpkt.traffic_policy.min_packet_thresh = 96000;\n-\tpkt.traffic_policy.avg_max_packet_thresh = 1800000;\n-\tpkt.traffic_policy.max_max_packet_thresh = 2000000;\n-\n-\tpkt.timer_policy.busy_hours[0] = 3;\n-\tpkt.timer_policy.busy_hours[1] = 4;\n-\tpkt.timer_policy.busy_hours[2] = 5;\n-\tpkt.timer_policy.quiet_hours[0] = 11;\n-\tpkt.timer_policy.quiet_hours[1] = 12;\n-\tpkt.timer_policy.quiet_hours[2] = 13;\n-\n-\tpkt.timer_policy.hours_to_use_traffic_profile[0] = 8;\n-\tpkt.timer_policy.hours_to_use_traffic_profile[1] = 10;\n-\n-\tpkt.workload = LOW;\n-\tpkt.policy_to_use = TIME;\n-\tpkt.command = PKT_POLICY;\n-\tstrcpy(pkt.vm_name, \"ubuntu2\");\n-\tret = rte_power_guest_channel_send_msg(&pkt, 1);\n+\tret = rte_power_guest_channel_send_msg(pkt, 1);\n \tif (ret == 0)\n \t\treturn 1;\n \tRTE_LOG(DEBUG, POWER, \"Error sending message: %s\\n\",\n@@ -182,7 +205,7 @@ cmd_send_policy_parsed(void *parsed_result, struct cmdline *cl,\n \n \tif (!strcmp(res->cmd, \"now\")) {\n \t\tprintf(\"Sending Policy down now!\\n\");\n-\t\tret = send_policy();\n+\t\tret = send_policy(&policy);\n \t}\n \tif (ret != 1)\n \t\tcmdline_printf(cl, \"Error sending message: %s\\n\",\ndiff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h\nindex 75a262967..fd77f6a69 100644\n--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h\n+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h\n@@ -11,6 +11,12 @@ extern \"C\" {\n \n #include \"channel_commands.h\"\n \n+struct channel_packet *get_policy(void);\n+\n+int set_policy_mac(int port, int idx);\n+\n+void set_policy_defaults(struct channel_packet *pkt);\n+\n void run_cli(__attribute__((unused)) void *arg);\n \n #ifdef __cplusplus\n",
    "prefixes": [
        "v4",
        "8/9"
    ]
}