get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52339,
    "url": "http://patches.dpdk.org/api/patches/52339/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190405132455.15468-5-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-5-marcinx.hajkowski@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190405132455.15468-5-marcinx.hajkowski@intel.com",
    "date": "2019-04-05T13:24:55",
    "name": "[v5,4/4] power: send confirmation cmd to vm guest",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "03ac4d9d410822556fd6154b031a10ebf7486465",
    "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-5-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/52339/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/52339/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 1E0EC1B505;\n\tFri,  5 Apr 2019 15:28:30 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id C23E61B4E3\n\tfor <dev@dpdk.org>; Fri,  5 Apr 2019 15:28:18 +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:18 -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:17 -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=\"158546494\"",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v5 4/4] power: send confirmation cmd to vm guest",
        "Date": "Fri,  5 Apr 2019 15:24:55 +0200",
        "Message-Id": "<20190405132455.15468-5-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\nUse new guest channel API to send confirmation\nmessage for received power command.\n\nSigned-off-by: Marcin Hajkowski <marcinx.hajkowski@intel.com>\n---\n examples/vm_power_manager/channel_monitor.c | 68 +++++++++++++++++++--\n 1 file changed, 62 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c\nindex 7892d75de..ed580b36a 100644\n--- a/examples/vm_power_manager/channel_monitor.c\n+++ b/examples/vm_power_manager/channel_monitor.c\n@@ -627,6 +627,41 @@ apply_policy(struct policy *pol)\n \t\tapply_workload_profile(pol);\n }\n \n+static int\n+write_binary_packet(struct channel_packet *pkt, struct channel_info *chan_info)\n+{\n+\tint ret, buffer_len = sizeof(*pkt);\n+\tvoid *buffer = pkt;\n+\n+\tif (chan_info->fd < 0) {\n+\t\tRTE_LOG(ERR, CHANNEL_MONITOR, \"Channel is not connected\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\twhile (buffer_len > 0) {\n+\t\tret = write(chan_info->fd, buffer, buffer_len);\n+\t\tif (ret == -1) {\n+\t\t\tif (errno == EINTR)\n+\t\t\t\tcontinue;\n+\t\t\tRTE_LOG(ERR, CHANNEL_MONITOR, \"Write function failed due to %s.\\n\",\n+\t\t\t\t\tstrerror(errno));\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbuffer = (char *)buffer + ret;\n+\t\tbuffer_len -= ret;\n+\t}\n+\treturn 0;\n+}\n+\n+static int\n+send_ack_for_received_cmd(struct channel_packet *pkt,\n+\t\tstruct channel_info *chan_info,\n+\t\tuint32_t command)\n+{\n+\tpkt->command = command;\n+\treturn write_binary_packet(pkt, chan_info);\n+}\n+\n static int\n process_request(struct channel_packet *pkt, struct channel_info *chan_info)\n {\n@@ -650,33 +685,54 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)\n \t\tRTE_LOG(DEBUG, CHANNEL_MONITOR, \"Processing requested cmd for cpu:%d\\n\",\n \t\t\tcore_num);\n \n+\t\tbool valid_unit = true;\n+\t\tint scale_res;\n+\n \t\tswitch (pkt->unit) {\n \t\tcase(CPU_POWER_SCALE_MIN):\n-\t\t\tpower_manager_scale_core_min(core_num);\n+\t\t\tscale_res = power_manager_scale_core_min(core_num);\n \t\t\tbreak;\n \t\tcase(CPU_POWER_SCALE_MAX):\n-\t\t\tpower_manager_scale_core_max(core_num);\n+\t\t\tscale_res = power_manager_scale_core_max(core_num);\n \t\t\tbreak;\n \t\tcase(CPU_POWER_SCALE_DOWN):\n-\t\t\tpower_manager_scale_core_down(core_num);\n+\t\t\tscale_res = power_manager_scale_core_down(core_num);\n \t\t\tbreak;\n \t\tcase(CPU_POWER_SCALE_UP):\n-\t\t\tpower_manager_scale_core_up(core_num);\n+\t\t\tscale_res = power_manager_scale_core_up(core_num);\n \t\t\tbreak;\n \t\tcase(CPU_POWER_ENABLE_TURBO):\n-\t\t\tpower_manager_enable_turbo_core(core_num);\n+\t\t\tscale_res = power_manager_enable_turbo_core(core_num);\n \t\t\tbreak;\n \t\tcase(CPU_POWER_DISABLE_TURBO):\n-\t\t\tpower_manager_disable_turbo_core(core_num);\n+\t\t\tscale_res = power_manager_disable_turbo_core(core_num);\n \t\t\tbreak;\n \t\tdefault:\n+\t\t\tvalid_unit = false;\n \t\t\tbreak;\n \t\t}\n+\n+\t\tif (valid_unit) {\n+\t\t\tret = send_ack_for_received_cmd(pkt,\n+\t\t\t\t\tchan_info,\n+\t\t\t\t\tscale_res > 0 ?\n+\t\t\t\t\t\tCPU_POWER_CMD_ACK :\n+\t\t\t\t\t\tCPU_POWER_CMD_NACK);\n+\t\t\tif (ret < 0)\n+\t\t\t\tRTE_LOG(DEBUG, CHANNEL_MONITOR, \"Error during sending ack command.\\n\");\n+\t\t} else\n+\t\t\tRTE_LOG(DEBUG, CHANNEL_MONITOR, \"Unexpected unit type.\\n\");\n+\n \t}\n \n \tif (pkt->command == PKT_POLICY) {\n \t\tRTE_LOG(INFO, CHANNEL_MONITOR, \"Processing policy request %s\\n\",\n \t\t\t\tpkt->vm_name);\n+\t\tint ret = send_ack_for_received_cmd(pkt,\n+\t\t\t\tchan_info,\n+\t\t\t\tCPU_POWER_CMD_ACK);\n+\t\tif (ret < 0)\n+\t\t\tRTE_LOG(DEBUG, CHANNEL_MONITOR, \"Error during sending ack command.\\n\");\n \t\tupdate_policy(pkt);\n \t\tpolicy_is_set = 1;\n \t}\n",
    "prefixes": [
        "v5",
        "4/4"
    ]
}