get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 53913,
    "url": "http://patches.dpdk.org/api/patches/53913/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190530161517.11916-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": "<20190530161517.11916-4-marcinx.hajkowski@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190530161517.11916-4-marcinx.hajkowski@intel.com",
    "date": "2019-05-30T16:15:17",
    "name": "[3/3] examples/power_guest: send request for specified core capabilities",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "131dd4c453d17cc686460871795373d6f7dcccdc",
    "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/20190530161517.11916-4-marcinx.hajkowski@intel.com/mbox/",
    "series": [
        {
            "id": 4828,
            "url": "http://patches.dpdk.org/api/series/4828/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4828",
            "date": "2019-05-30T16:15:14",
            "name": "Core capabilities query",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4828/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/53913/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/53913/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 A59B21B952;\n\tThu, 30 May 2019 18:16:19 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id C53774CA6\n\tfor <dev@dpdk.org>; Thu, 30 May 2019 18:16:14 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 May 2019 09:16:14 -0700",
            "from mhajkowx-mobl.ger.corp.intel.com ([10.104.14.177])\n\tby orsmga001.jf.intel.com with ESMTP; 30 May 2019 09:16:12 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Hajkowski <marcinx.hajkowski@intel.com>",
        "To": "david.hunt@intel.com",
        "Cc": "dev@dpdk.org,\n\tMarcin Hajkowski <marcinx.hajkowski@intel.com>",
        "Date": "Thu, 30 May 2019 18:15:17 +0200",
        "Message-Id": "<20190530161517.11916-4-marcinx.hajkowski@intel.com>",
        "X-Mailer": "git-send-email 2.20.1.windows.1",
        "In-Reply-To": "<20190530161517.11916-1-marcinx.hajkowski@intel.com>",
        "References": "<20190530161517.11916-1-marcinx.hajkowski@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 3/3] examples/power_guest: send request for\n\tspecified core capabilities",
        "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\nSend request to power manager for core id provided\nby user to get related capabilities.\n\nSigned-off-by: Marcin Hajkowski <marcinx.hajkowski@intel.com>\n---\n .../guest_cli/vm_power_cli_guest.c            | 119 +++++++++++++++++-\n 1 file changed, 117 insertions(+), 2 deletions(-)",
    "diff": "diff --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 848230248..de85c1406 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@@ -132,7 +132,7 @@ struct cmd_freq_list_result {\n };\n \n static int\n-query_freq_list(struct channel_packet *pkt, unsigned int lcore_id)\n+query_data(struct channel_packet *pkt, unsigned int lcore_id)\n {\n \tint ret;\n \tret = rte_power_guest_channel_send_msg(pkt, lcore_id);\n@@ -206,7 +206,7 @@ cmd_query_freq_list_parsed(void *parsed_result,\n \t\tpkt.resource_id = lcore_id;\n \t}\n \n-\tret = query_freq_list(&pkt, lcore_id);\n+\tret = query_data(&pkt, lcore_id);\n \tif (ret < 0) {\n \t\tcmdline_printf(cl, \"Error during sending frequency list query.\\n\");\n \t\treturn;\n@@ -248,6 +248,120 @@ cmdline_parse_inst_t cmd_query_freq_list = {\n \t},\n };\n \n+struct cmd_query_caps_result {\n+\tcmdline_fixed_string_t query_caps;\n+\tcmdline_fixed_string_t cpu_num;\n+};\n+\n+static int\n+receive_capabilities(struct channel_packet_caps_list *pkt_caps_list,\n+\t\tunsigned int lcore_id)\n+{\n+\tint ret;\n+\n+\tret = rte_power_guest_channel_receive_msg(pkt_caps_list,\n+\t\tsizeof(struct channel_packet_caps_list),\n+\t\tlcore_id);\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, GUEST_CLI, \"Error receiving message.\\n\");\n+\t\treturn -1;\n+\t}\n+\tif (pkt_caps_list->command != CPU_POWER_CAPS_LIST) {\n+\t\tRTE_LOG(ERR, GUEST_CLI, \"Unexpected message received.\\n\");\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n+static void\n+cmd_query_caps_list_parsed(void *parsed_result,\n+\t\t__rte_unused struct cmdline *cl,\n+\t\t__rte_unused void *data)\n+{\n+\tstruct cmd_query_caps_result *res = parsed_result;\n+\tunsigned int lcore_id;\n+\tstruct channel_packet_caps_list pkt_caps_list;\n+\tstruct channel_packet pkt;\n+\tbool query_list = false;\n+\tint ret;\n+\tchar *ep;\n+\n+\tmemset(&pkt, 0, sizeof(struct channel_packet));\n+\tmemset(&pkt_caps_list, 0, sizeof(struct channel_packet_caps_list));\n+\n+\tif (!strcmp(res->cpu_num, \"all\")) {\n+\n+\t\t/* Get first enabled lcore. */\n+\t\tlcore_id = rte_get_next_lcore(-1,\n+\t\t\t\t0,\n+\t\t\t\t0);\n+\t\tif (lcore_id == RTE_MAX_LCORE) {\n+\t\t\tcmdline_printf(cl, \"Enabled core not found.\\n\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tpkt.command = CPU_POWER_QUERY_CAPS_LIST;\n+\t\tstrcpy(pkt.vm_name, policy.vm_name);\n+\t\tquery_list = true;\n+\t} else {\n+\t\terrno = 0;\n+\t\tlcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);\n+\t\tif (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||\n+\t\t\tep == res->cpu_num) {\n+\t\t\tcmdline_printf(cl, \"Invalid parameter provided.\\n\");\n+\t\t\treturn;\n+\t\t}\n+\t\tpkt.command = CPU_POWER_QUERY_CAPS;\n+\t\tstrcpy(pkt.vm_name, policy.vm_name);\n+\t\tpkt.resource_id = lcore_id;\n+\t}\n+\n+\tret = query_data(&pkt, lcore_id);\n+\tif (ret < 0) {\n+\t\tcmdline_printf(cl, \"Error during sending capabilities query.\\n\");\n+\t\treturn;\n+\t}\n+\n+\tret = receive_capabilities(&pkt_caps_list, lcore_id);\n+\tif (ret < 0) {\n+\t\tcmdline_printf(cl, \"Error during capabilities reception.\\n\");\n+\t\treturn;\n+\t}\n+\tif (query_list) {\n+\t\tunsigned int i;\n+\t\tfor (i = 0; i < pkt_caps_list.num_vcpu; ++i)\n+\t\t\tcmdline_printf(cl, \"Capabilities of [%d] vcore are:\"\n+\t\t\t\t\t\" turbo possibility: %ld, is priority core: %ld.\\n\",\n+\t\t\t\t\ti,\n+\t\t\t\t\tpkt_caps_list.turbo[i],\n+\t\t\t\t\tpkt_caps_list.priority[i]);\n+\t} else {\n+\t\tcmdline_printf(cl, \"Capabilities of [%d] vcore are:\"\n+\t\t\t\t\" turbo possibility: %ld, is priority core: %ld.\\n\",\n+\t\t\t\tlcore_id,\n+\t\t\t\tpkt_caps_list.turbo[lcore_id],\n+\t\t\t\tpkt_caps_list.priority[lcore_id]);\n+\t}\n+}\n+\n+cmdline_parse_token_string_t cmd_query_caps_token =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_query_caps_result, query_caps, \"query_cpu_caps\");\n+cmdline_parse_token_string_t cmd_query_caps_cpu_num_token =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_query_caps_result, cpu_num, NULL);\n+\n+cmdline_parse_inst_t cmd_query_caps_list = {\n+\t.f = cmd_query_caps_list_parsed,  /* function to call */\n+\t.data = NULL,      /* 2nd arg of func */\n+\t.help_str = \"query_cpu_caps <core_num>|all, request\"\n+\t\t\t\t\" information regarding virtual core capabilities.\"\n+\t\t\t\t\" The keyword 'all' will query list of all vcores for the VM\",\n+\t.tokens = {        /* token list, NULL terminated */\n+\t\t(void *)&cmd_query_caps_token,\n+\t\t(void *)&cmd_query_caps_cpu_num_token,\n+\t\tNULL,\n+\t},\n+};\n+\n static int\n check_response_cmd(unsigned int lcore_id, int *result)\n {\n@@ -407,6 +521,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t\t(cmdline_parse_inst_t *)&cmd_send_policy_set,\n \t\t(cmdline_parse_inst_t *)&cmd_set_cpu_freq_set,\n \t\t(cmdline_parse_inst_t *)&cmd_query_freq_list,\n+\t\t(cmdline_parse_inst_t *)&cmd_query_caps_list,\n \t\tNULL,\n };\n \n",
    "prefixes": [
        "3/3"
    ]
}