Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/52337/?format=api
https://patches.dpdk.org/api/patches/52337/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190405132455.15468-3-marcinx.hajkowski@intel.com/", "project": { "id": 1, "url": "https://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-3-marcinx.hajkowski@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190405132455.15468-3-marcinx.hajkowski@intel.com", "date": "2019-04-05T13:24:53", "name": "[v5,2/4] power: extend guest channel API for reading", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "ab1c06ddd0f6ff04256125f8fec92f22b2127875", "submitter": { "id": 1246, "url": "https://patches.dpdk.org/api/people/1246/?format=api", "name": "Marcin Hajkowski", "email": "marcinx.hajkowski@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190405132455.15468-3-marcinx.hajkowski@intel.com/mbox/", "series": [ { "id": 4136, "url": "https://patches.dpdk.org/api/series/4136/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=4136", "date": "2019-04-05T13:24:51", "name": "bidirect guest channel", "version": 5, "mbox": "https://patches.dpdk.org/series/4136/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/52337/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/52337/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 125C71B4F7;\n\tFri, 5 Apr 2019 15:28:25 +0200 (CEST)", "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 642B61B4C8\n\tfor <dev@dpdk.org>; Fri, 5 Apr 2019 15:28:16 +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:15 -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:15 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.60,312,1549958400\"; d=\"scan'208\";a=\"158546461\"", "From": "Hajkowski <marcinx.hajkowski@intel.com>", "To": "david.hunt@intel.com", "Cc": "dev@dpdk.org,\n\tMarcin Hajkowski <marcinx.hajkowski@intel.com>", "Date": "Fri, 5 Apr 2019 15:24:53 +0200", "Message-Id": "<20190405132455.15468-3-marcinx.hajkowski@intel.com>", "X-Mailer": "git-send-email 2.20.1.windows.1", "In-Reply-To": "<20190405132455.15468-1-marcinx.hajkowski@intel.com>", "References": "<20190405132455.15468-1-marcinx.hajkowski@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v5 2/4] power: extend guest channel API for\n\treading", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "Reply-To": "20190402082121.5472-1-marcinx.hajkowski@intel.com", "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\nAdded new experimental API rte_power_guest_channel_receive_msg\nwhich gives possibility to receive messages send to guest.\n\nSigned-off-by: Marcin Hajkowski <marcinx.hajkowski@intel.com>\n---\n lib/librte_power/channel_commands.h | 5 +++\n lib/librte_power/guest_channel.c | 60 ++++++++++++++++++++++++++\n lib/librte_power/guest_channel.h | 35 +++++++++++++++\n lib/librte_power/rte_power_version.map | 1 +\n 4 files changed, 101 insertions(+)", "diff": "diff --git a/lib/librte_power/channel_commands.h b/lib/librte_power/channel_commands.h\nindex e7b93a797..33fd53a6d 100644\n--- a/lib/librte_power/channel_commands.h\n+++ b/lib/librte_power/channel_commands.h\n@@ -28,6 +28,11 @@ extern \"C\" {\n #define CPU_POWER_SCALE_MIN 4\n #define CPU_POWER_ENABLE_TURBO 5\n #define CPU_POWER_DISABLE_TURBO 6\n+\n+/* Generic Power Command Response */\n+#define CPU_POWER_CMD_ACK 1\n+#define CPU_POWER_CMD_NACK 2\n+\n #define HOURS 24\n \n #define MAX_VFS 10\ndiff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c\nindex 9cf7d2cb2..888423891 100644\n--- a/lib/librte_power/guest_channel.c\n+++ b/lib/librte_power/guest_channel.c\n@@ -10,6 +10,7 @@\n #include <fcntl.h>\n #include <string.h>\n #include <errno.h>\n+#include <poll.h>\n \n \n #include <rte_log.h>\n@@ -19,6 +20,9 @@\n \n #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1\n \n+/* Timeout for incoming message in milliseconds. */\n+#define TIMEOUT 10\n+\n static int global_fds[RTE_MAX_LCORE] = { [0 ... RTE_MAX_LCORE-1] = -1 };\n \n int\n@@ -125,6 +129,62 @@ int rte_power_guest_channel_send_msg(struct channel_packet *pkt,\n \treturn guest_channel_send_msg(pkt, lcore_id);\n }\n \n+int power_guest_channel_read_msg(struct channel_packet *pkt,\n+\t\t\tunsigned int lcore_id)\n+{\n+\tint ret;\n+\tstruct pollfd fds;\n+\tvoid *buffer = pkt;\n+\tint buffer_len = sizeof(*pkt);\n+\n+\tfds.fd = global_fds[lcore_id];\n+\tfds.events = POLLIN;\n+\n+\tret = poll(&fds, 1, TIMEOUT);\n+\tif (ret == 0) {\n+\t\tRTE_LOG(DEBUG, GUEST_CHANNEL, \"Timeout occurred during poll function.\\n\");\n+\t\treturn -1;\n+\t} else if (ret < 0) {\n+\t\tRTE_LOG(ERR, GUEST_CHANNEL, \"Error occurred during poll function: %s\\n\",\n+\t\t\t\tstrerror(ret));\n+\t\treturn -1;\n+\t}\n+\n+\tif (lcore_id >= RTE_MAX_LCORE) {\n+\t\tRTE_LOG(ERR, GUEST_CHANNEL, \"Channel(%u) is out of range 0...%d\\n\",\n+\t\t\t\tlcore_id, RTE_MAX_LCORE-1);\n+\t\treturn -1;\n+\t}\n+\n+\tif (global_fds[lcore_id] < 0) {\n+\t\tRTE_LOG(ERR, GUEST_CHANNEL, \"Channel is not connected\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\twhile (buffer_len > 0) {\n+\t\tret = read(global_fds[lcore_id],\n+\t\t\t\tbuffer, buffer_len);\n+\t\tif (ret < 0) {\n+\t\t\tif (errno == EINTR)\n+\t\t\t\tcontinue;\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (ret == 0) {\n+\t\t\tRTE_LOG(ERR, GUEST_CHANNEL, \"Expected more data, but connection has been closed.\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbuffer = (char *)buffer + ret;\n+\t\tbuffer_len -= ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int rte_power_guest_channel_receive_msg(struct channel_packet *pkt,\n+\t\t\tunsigned int lcore_id)\n+{\n+\treturn power_guest_channel_read_msg(pkt, lcore_id);\n+}\n \n void\n guest_channel_host_disconnect(unsigned int lcore_id)\ndiff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h\nindex 373d39898..7c385df39 100644\n--- a/lib/librte_power/guest_channel.h\n+++ b/lib/librte_power/guest_channel.h\n@@ -68,6 +68,41 @@ int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);\n int rte_power_guest_channel_send_msg(struct channel_packet *pkt,\n \t\t\tunsigned int lcore_id);\n \n+/**\n+ * Read a message contained in pkt over the Virtio-Serial\n+ * from the host endpoint.\n+ *\n+ * @param pkt\n+ * Pointer to a populated struct channel_packet\n+ *\n+ * @param lcore_id\n+ * lcore_id.\n+ *\n+ * @return\n+ * - 0 on success.\n+ * - Negative on error.\n+ */\n+int power_guest_channel_read_msg(struct channel_packet *pkt,\n+\t\tunsigned int lcore_id);\n+\n+/**\n+ * Receive a message contained in pkt over the Virtio-Serial\n+ * from the host endpoint.\n+ *\n+ * @param pkt\n+ * Pointer to a populated struct channel_packet\n+ *\n+ * @param lcore_id\n+ * lcore_id.\n+ *\n+ * @return\n+ * - 0 on success.\n+ * - Negative on error.\n+ */\n+int __rte_experimental\n+rte_power_guest_channel_receive_msg(struct channel_packet *pkt,\n+\t\t\tunsigned int lcore_id);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_power/rte_power_version.map b/lib/librte_power/rte_power_version.map\nindex 042917360..69f5ea3f4 100644\n--- a/lib/librte_power/rte_power_version.map\n+++ b/lib/librte_power/rte_power_version.map\n@@ -44,4 +44,5 @@ EXPERIMENTAL {\n \trte_power_empty_poll_stat_update;\n \trte_power_poll_stat_fetch;\n \trte_power_poll_stat_update;\n+\trte_power_guest_channel_receive_msg;\n };\n", "prefixes": [ "v5", "2/4" ] }{ "id": 52337, "url": "