get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52338,
    "url": "http://patches.dpdk.org/api/patches/52338/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190405132455.15468-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": "<20190405132455.15468-4-marcinx.hajkowski@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190405132455.15468-4-marcinx.hajkowski@intel.com",
    "date": "2019-04-05T13:24:54",
    "name": "[v5,3/4] power: process incoming confirmation cmds",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "94c17fc8db75d59c9bfe17c0e2c4c33957932f9b",
    "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/20190405132455.15468-4-marcinx.hajkowski@intel.com/mbox/",
    "series": [
        {
            "id": 4136,
            "url": "http://patches.dpdk.org/api/series/4136/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4136",
            "date": "2019-04-05T13:24:51",
            "name": "bidirect guest channel",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/4136/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/52338/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/52338/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "X-BeenThere": "dev@dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "MIME-Version": "1.0",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "From": "Hajkowski <marcinx.hajkowski@intel.com>",
        "To": "david.hunt@intel.com",
        "Delivered-To": "patchwork@dpdk.org",
        "X-Amp-File-Uploaded": "False",
        "References": "<20190405132455.15468-1-marcinx.hajkowski@intel.com>",
        "In-Reply-To": "<20190405132455.15468-1-marcinx.hajkowski@intel.com>",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "X-Mailer": "git-send-email 2.20.1.windows.1",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id AD9951B4FE;\n\tFri,  5 Apr 2019 15:28:27 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 8E4BC1B4E3\n\tfor <dev@dpdk.org>; Fri,  5 Apr 2019 15:28:17 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Apr 2019 06:28:17 -0700",
            "from mhajkowx-mobl.ger.corp.intel.com ([10.104.116.181])\n\tby fmsmga002.fm.intel.com with ESMTP; 05 Apr 2019 06:28:16 -0700"
        ],
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Content-Transfer-Encoding": "8bit",
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Reply-To": "20190402082121.5472-1-marcinx.hajkowski@intel.com",
        "X-IronPort-AV": "E=Sophos;i=\"5.60,312,1549958400\"; d=\"scan'208\";a=\"158546478\"",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v5 3/4] power: process incoming confirmation cmds",
        "Date": "Fri,  5 Apr 2019 15:24:54 +0200",
        "Message-Id": "<20190405132455.15468-4-marcinx.hajkowski@intel.com>",
        "Precedence": "list",
        "Cc": "dev@dpdk.org,\n\tMarcin Hajkowski <marcinx.hajkowski@intel.com>"
    },
    "content": "From: Marcin Hajkowski <marcinx.hajkowski@intel.com>\n\nExtend vm_power_guest to check incoming confirmations\nof messages previously sent to host.\n\nSigned-off-by: Marcin Hajkowski <marcinx.hajkowski@intel.com>\n---\n examples/vm_power_manager/guest_cli/Makefile  |  1 +\n .../guest_cli/vm_power_cli_guest.c            | 73 +++++++++++++++----\n 2 files changed, 61 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/guest_cli/Makefile b/examples/vm_power_manager/guest_cli/Makefile\nindex e35a68d0f..67cf08193 100644\n--- a/examples/vm_power_manager/guest_cli/Makefile\n+++ b/examples/vm_power_manager/guest_cli/Makefile\n@@ -18,6 +18,7 @@ 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)\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n \n # workaround for a gcc bug with noreturn attribute\n # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603\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 2d9e7689a..49ed7b208 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@@ -27,7 +27,7 @@\n #define CHANNEL_PATH \"/dev/virtio-ports/virtio.serial.port.poweragent\"\n \n \n-#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1\n+#define RTE_LOGTYPE_GUEST_CLI RTE_LOGTYPE_USER1\n \n struct cmd_quit_result {\n \tcmdline_fixed_string_t quit;\n@@ -132,6 +132,32 @@ struct cmd_set_cpu_freq_result {\n \tcmdline_fixed_string_t cmd;\n };\n \n+static int\n+check_response_cmd(unsigned int lcore_id, int *result)\n+{\n+\tstruct channel_packet pkt;\n+\tint ret;\n+\n+\tret = rte_power_guest_channel_receive_msg(&pkt, lcore_id);\n+\tif (ret < 0)\n+\t\treturn -1;\n+\n+\tswitch (pkt.command) {\n+\tcase(CPU_POWER_CMD_ACK):\n+\t\t*result = 1;\n+\t\tbreak;\n+\tcase(CPU_POWER_CMD_NACK):\n+\t\t*result = 0;\n+\t\tbreak;\n+\tdefault:\n+\t\tRTE_LOG(ERR, GUEST_CLI,\n+\t\t\t\t\"Received invalid response from host, expecting ACK/NACK.\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\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@@ -139,20 +165,31 @@ cmd_set_cpu_freq_parsed(void *parsed_result, struct cmdline *cl,\n \tint ret = -1;\n \tstruct cmd_set_cpu_freq_result *res = parsed_result;\n \n-\tif (!strcmp(res->cmd , \"up\"))\n+\tif (!strcmp(res->cmd, \"up\"))\n \t\tret = rte_power_freq_up(res->lcore_id);\n-\telse if (!strcmp(res->cmd , \"down\"))\n+\telse if (!strcmp(res->cmd, \"down\"))\n \t\tret = rte_power_freq_down(res->lcore_id);\n-\telse if (!strcmp(res->cmd , \"min\"))\n+\telse if (!strcmp(res->cmd, \"min\"))\n \t\tret = rte_power_freq_min(res->lcore_id);\n-\telse if (!strcmp(res->cmd , \"max\"))\n+\telse if (!strcmp(res->cmd, \"max\"))\n \t\tret = rte_power_freq_max(res->lcore_id);\n \telse if (!strcmp(res->cmd, \"enable_turbo\"))\n \t\tret = rte_power_freq_enable_turbo(res->lcore_id);\n \telse if (!strcmp(res->cmd, \"disable_turbo\"))\n \t\tret = rte_power_freq_disable_turbo(res->lcore_id);\n-\tif (ret != 1)\n+\n+\tif (ret != 1) {\n \t\tcmdline_printf(cl, \"Error sending message: %s\\n\", strerror(ret));\n+\t\treturn;\n+\t}\n+\tint result;\n+\tret = check_response_cmd(res->lcore_id, &result);\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, GUEST_CLI, \"No confirmation for sent message received\\n\");\n+\t} else {\n+\t\tcmdline_printf(cl, \"%s received for message sent to host.\\n\",\n+\t\t\t\tresult == 1 ? \"ACK\" : \"NACK\");\n+\t}\n }\n \n cmdline_parse_token_string_t cmd_set_cpu_freq =\n@@ -185,16 +222,26 @@ struct cmd_send_policy_result {\n };\n \n static inline int\n-send_policy(struct channel_packet *pkt)\n+send_policy(struct channel_packet *pkt, struct cmdline *cl)\n {\n \tint ret;\n \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-\t\t\tret > 0 ? strerror(ret) : \"channel not connected\");\n-\treturn -1;\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, GUEST_CLI, \"Error sending message: %s\\n\",\n+\t\t\t\tret > 0 ? strerror(ret) : \"channel not connected\");\n+\t\treturn -1;\n+\t}\n+\n+\tint result;\n+\tret = check_response_cmd(1, &result);\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, GUEST_CLI, \"No confirmation for sent policy received\\n\");\n+\t} else {\n+\t\tcmdline_printf(cl, \"%s for sent policy received.\\n\",\n+\t\t\t\tresult == 1 ? \"ACK\" : \"NACK\");\n+\t}\n+\treturn 1;\n }\n \n static void\n@@ -206,7 +253,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(&policy);\n+\t\tret = send_policy(&policy, cl);\n \t}\n \tif (ret != 1)\n \t\tcmdline_printf(cl, \"Error sending message: %s\\n\",\n",
    "prefixes": [
        "v5",
        "3/4"
    ]
}