Show a patch.

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

{
    "id": 443,
    "url": "http://patches.dpdk.org/api/patches/443/",
    "web_url": "http://patches.dpdk.org/patch/443/",
    "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": "<1411410879-28872-7-git-send-email-alan.carew@intel.com>",
    "date": "2014-09-22T18:34:35",
    "name": "[dpdk-dev,06/10] Alternate implementation of librte_power for VM Power Management(Guest).",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a19d09ae3c3cf2f1cf866e0cfe620a28c957dbbc",
    "submitter": {
        "id": 72,
        "url": "http://patches.dpdk.org/api/people/72/",
        "name": "Alan Carew",
        "email": "alan.carew@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/patch/443/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/443/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/443/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "References": "<1411410879-28872-1-git-send-email-alan.carew@intel.com>",
        "X-Mailman-Version": "2.1.15",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,573,1406617200\"; d=\"scan'208\";a=\"606714512\"",
        "Date": "Mon, 22 Sep 2014 19:34:35 +0100",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1411410879-28872-7-git-send-email-alan.carew@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 28AE6B3B4;\n\tMon, 22 Sep 2014 20:29:45 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id A95F268FD\n\tfor <dev@dpdk.org>; Mon, 22 Sep 2014 20:29:38 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga101.jf.intel.com with ESMTP; 22 Sep 2014 11:35:26 -0700",
            "from sie-lab-212-143.ir.intel.com (HELO\n\tsilpixa00385294.ir.intel.com) ([10.237.212.143])\n\tby orsmga002.jf.intel.com with ESMTP; 22 Sep 2014 11:35:24 -0700"
        ],
        "List-Post": "<mailto:dev@dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH 06/10] Alternate implementation of librte_power\n\tfor VM Power Management(Guest).",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "X-Mailer": "git-send-email 1.9.3",
        "Precedence": "list",
        "From": "Alan Carew <alan.carew@intel.com>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "X-ExtLoop1": "1",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Delivered-To": "patchwork@dpdk.org",
        "In-Reply-To": "<1411410879-28872-1-git-send-email-alan.carew@intel.com>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "To": "dev@dpdk.org",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Re-using the host based librte_power API the alternate implementation uses\nthe guest channel API to forward request for frequency changes to the host\nmonitor.\nA subset of the librte_power API is supported:\n rte_power_init(unsigned lcore_id)\n rte_power_exit(unsigned lcore_id)\n rte_power_freq_up(unsigned lcore_id)\n rte_power_freq_down(unsigned lcore_id)\n rte_power_freq_min(unsigned lcore_id)\n rte_power_freq_max(unsigned lcore_id)\n\nThe other unsupported APIs from librte_power return -ENOTSUP.\n\nSigned-off-by: Alan Carew <alan.carew@intel.com>\n---\n lib/librte_power_vm/Makefile    |  49 ++++++++++++++\n lib/librte_power_vm/rte_power.c | 146 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 195 insertions(+)\n create mode 100644 lib/librte_power_vm/Makefile\n create mode 100644 lib/librte_power_vm/rte_power.c",
    "diff": "diff --git a/lib/librte_power_vm/Makefile b/lib/librte_power_vm/Makefile\nnew file mode 100644\nindex 0000000..284ec2c\n--- /dev/null\n+++ b/lib/librte_power_vm/Makefile\n@@ -0,0 +1,49 @@\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+include $(RTE_SDK)/mk/rte.vars.mk\n+\n+# library name\n+LIB = librte_power.a\n+\n+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing\n+CFLAGS += -I$(RTE_SDK)/lib/librte_power/\n+\n+# all source are stored in SRCS-y\n+SRCS-$(CONFIG_RTE_LIBRTE_POWER_VM) := guest_channel.c rte_power.c\n+\n+# install this header file\n+SYMLINK-y-include := ../librte_power/rte_power.h\n+\n+# this lib needs eal\n+DEPDIRS-$(CONFIG_RTE_LIBRTE_POWER) += lib/librte_eal\n+\n+include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_power_vm/rte_power.c b/lib/librte_power_vm/rte_power.c\nnew file mode 100644\nindex 0000000..1ce3fb0\n--- /dev/null\n+++ b/lib/librte_power_vm/rte_power.c\n@@ -0,0 +1,146 @@\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+#include <errno.h>\n+#include <string.h>\n+\n+#include <rte_log.h>\n+#include <rte_config.h>\n+\n+#include \"guest_channel.h\"\n+#include \"channel_commands.h\"\n+#include \"rte_power.h\"\n+\n+#define RTE_LOGTYPE_POWER_VM RTE_LOGTYPE_USER1\n+\n+#define FD_PATH \"/dev/virtio-ports/virtio.serial.port.poweragent\"\n+\n+static struct channel_packet pkt[RTE_MAX_LCORE];\n+\n+\n+int\n+rte_power_init(unsigned lcore_id)\n+{\n+\tpkt[lcore_id].command = CPU_POWER;\n+\tpkt[lcore_id].resource_id = lcore_id;\n+\treturn guest_channel_host_connect(FD_PATH, lcore_id);\n+}\n+\n+int\n+rte_power_exit(unsigned lcore_id)\n+{\n+\tguest_channel_host_disconnect(lcore_id);\n+\treturn 0;\n+}\n+\n+uint32_t\n+rte_power_freqs(__attribute__((unused)) unsigned lcore_id,\n+\t\t__attribute__((unused)) uint32_t *freqs,\n+\t\t__attribute__((unused)) uint32_t num)\n+{\n+\tRTE_LOG(ERR, POWER_VM, \"rte_power_freqs is not implemented \"\n+\t\t\t\"for Virtual Machine Power Management\\n\");\n+\treturn -ENOTSUP;\n+}\n+\n+uint32_t\n+rte_power_get_freq(__attribute__((unused)) unsigned lcore_id)\n+{\n+\tRTE_LOG(ERR, POWER_VM, \"rte_power_get_freq is not implemented \"\n+\t\t\t\"for Virtual Machine Power Management\\n\");\n+\treturn -ENOTSUP;\n+}\n+\n+int\n+rte_power_set_freq(__attribute__((unused)) unsigned lcore_id,\n+\t\t__attribute__((unused)) uint32_t index)\n+{\n+\tRTE_LOG(ERR, POWER_VM, \"rte_power_set_freq is not implemented \"\n+\t\t\t\"for Virtual Machine Power Management\\n\");\n+\treturn -ENOTSUP;\n+}\n+\n+int\n+rte_power_freq_up(unsigned lcore_id)\n+{\n+\tint ret;\n+\tpkt[lcore_id].unit = CPU_SCALE_UP;\n+\n+\tret = guest_channel_send_msg(&pkt[lcore_id], lcore_id);\n+\tif (ret <= 0)\n+\t\treturn ret;\n+\tif (ret > 0)\n+\t\tRTE_LOG(DEBUG, POWER_VM, \"Error sending message: %s\\n\", strerror(ret));\n+\treturn -1;\n+}\n+\n+int\n+rte_power_freq_down(__attribute__((unused)) unsigned lcore_id)\n+{\n+\tint ret;\n+\tpkt[lcore_id].unit = CPU_SCALE_DOWN;\n+\n+\tret = guest_channel_send_msg(&pkt[lcore_id], lcore_id);\n+\tif (ret <= 0)\n+\t\treturn ret;\n+\tif (ret > 0)\n+\t\tRTE_LOG(DEBUG, POWER_VM, \"Error sending message: %s\\n\", strerror(ret));\n+\treturn -1;\n+}\n+\n+int\n+rte_power_freq_max(__attribute__((unused)) unsigned lcore_id)\n+{\n+\tint ret;\n+\tpkt[lcore_id].unit = CPU_SCALE_MAX;\n+\n+\tret = guest_channel_send_msg(&pkt[lcore_id], lcore_id);\n+\tif (ret <= 0)\n+\t\treturn ret;\n+\tif (ret > 0)\n+\t\tRTE_LOG(DEBUG, POWER_VM, \"Error sending message: %s\\n\", strerror(ret));\n+\treturn -1;\n+}\n+\n+int\n+rte_power_freq_min(__attribute__((unused)) unsigned lcore_id)\n+{\n+\tint ret;\n+\tpkt[lcore_id].unit = CPU_SCALE_MIN;\n+\n+\tret = guest_channel_send_msg(&pkt[lcore_id], lcore_id);\n+\tif (ret <= 0)\n+\t\treturn ret;\n+\tif (ret > 0)\n+\t\tRTE_LOG(DEBUG, POWER_VM, \"Error sending message: %s\\n\", strerror(ret));\n+\treturn -1;\n+}\n",
    "prefixes": [
        "dpdk-dev",
        "06/10"
    ]
}