Show a patch.

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

{
    "id": 44726,
    "url": "http://patches.dpdk.org/api/patches/44726/",
    "web_url": "http://patches.dpdk.org/patch/44726/",
    "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": "<20180914135406.52190-6-david.hunt@intel.com>",
    "date": "2018-09-14T13:54:03",
    "name": "[v3,5/8] examples/power: add json string handling",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0249fc1f2823f98eb3616588780680dd06fd24b3",
    "submitter": {
        "id": 342,
        "url": "http://patches.dpdk.org/api/people/342/",
        "name": "David Hunt",
        "email": "david.hunt@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/patch/44726/mbox/",
    "series": [
        {
            "id": 1322,
            "url": "http://patches.dpdk.org/api/series/1322/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1322",
            "date": "2018-09-14T13:53:58",
            "name": "add json power policy interface for containers",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/1322/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44726/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44726/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Mailer": "git-send-email 2.17.1",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 253045F2D;\n\tFri, 14 Sep 2018 15:54:25 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id 64A145F1C\n\tfor <dev@dpdk.org>; Fri, 14 Sep 2018 15:54:19 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t14 Sep 2018 06:54:19 -0700",
            "from silpixa00399952.ir.intel.com (HELO\n\tsilpixa00399952.ger.corp.intel.com) ([10.237.223.64])\n\tby orsmga005.jf.intel.com with ESMTP; 14 Sep 2018 06:54:17 -0700"
        ],
        "References": "<20180912144930.50578-1-david.hunt@intel.com>\n\t<20180914135406.52190-1-david.hunt@intel.com>",
        "X-Amp-File-Uploaded": "False",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<20180914135406.52190-6-david.hunt@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,373,1531810800\"; d=\"scan'208\";a=\"257257221\"",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "From": "David Hunt <david.hunt@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<20180914135406.52190-1-david.hunt@intel.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Fri, 14 Sep 2018 14:54:03 +0100",
        "Cc": "john.mcnamara@intel.com, stephen@networkplumber.org, lei.a.yao@intel.com,\n\tbruce.richardson@intel.com, David Hunt <david.hunt@intel.com>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v3 5/8] examples/power: add json string handling"
    },
    "content": "Add JSON string handling to vm_power_manager for JSON strings received\nthrough the fifo. The format of the JSON strings are detailed in the\nnext patch, the vm_power_manager user guide documentation updates.\n\nThis patch introduces a new dependency on Jansson, a C library for\nencoding, decoding and manipulating JSON data. To compile the sample app\nyou now need to have installed libjansson4 and libjansson-dev (these may\nbe named slightly differently depending on your Operating System)\n\nSigned-off-by: David Hunt <david.hunt@intel.com>\n---\n examples/vm_power_manager/Makefile          |   6 +\n examples/vm_power_manager/channel_monitor.c | 297 +++++++++++++++++---\n 2 files changed, 258 insertions(+), 45 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/Makefile b/examples/vm_power_manager/Makefile\nindex 13a5205ba..50147c05d 100644\n--- a/examples/vm_power_manager/Makefile\n+++ b/examples/vm_power_manager/Makefile\n@@ -31,6 +31,12 @@ CFLAGS += $(WERROR_FLAGS)\n \n LDLIBS += -lvirt\n \n+JANSSON := $(shell pkg-config --exists jansson; echo $$?)\n+ifeq ($(JANSSON), 0)\n+LDLIBS += $(shell pkg-config --libs jansson)\n+CFLAGS += -DUSE_JANSSON\n+endif\n+\n ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)\n \n ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)\ndiff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c\nindex 17383e9d2..655f5e279 100644\n--- a/examples/vm_power_manager/channel_monitor.c\n+++ b/examples/vm_power_manager/channel_monitor.c\n@@ -9,11 +9,18 @@\n #include <signal.h>\n #include <errno.h>\n #include <string.h>\n+#include <fcntl.h>\n #include <sys/types.h>\n #include <sys/epoll.h>\n #include <sys/queue.h>\n #include <sys/time.h>\n-\n+#include <sys/socket.h>\n+#include <sys/select.h>\n+#ifdef USE_JANSSON\n+#include <jansson.h>\n+#else\n+#pragma message \"Jansson dev libs unavailable, not including JSON parsing\"\n+#endif\n #include <rte_log.h>\n #include <rte_memory.h>\n #include <rte_malloc.h>\n@@ -35,6 +42,8 @@\n \n uint64_t vsi_pkt_count_prev[384];\n uint64_t rdtsc_prev[384];\n+#define MAX_JSON_STRING_LEN 1024\n+char json_data[MAX_JSON_STRING_LEN];\n \n double time_period_ms = 1;\n static volatile unsigned run_loop = 1;\n@@ -43,6 +52,132 @@ static unsigned int policy_is_set;\n static struct epoll_event *global_events_list;\n static struct policy policies[MAX_VMS];\n \n+#ifdef USE_JANSSON\n+static int\n+parse_json_to_pkt(json_t *element, struct channel_packet *pkt)\n+{\n+\tconst char *key;\n+\tjson_t *value;\n+\tint ret;\n+\n+\tmemset(pkt, 0, sizeof(struct channel_packet));\n+\n+\tpkt->nb_mac_to_monitor = 0;\n+\tpkt->t_boost_status.tbEnabled = false;\n+\tpkt->workload = LOW;\n+\tpkt->policy_to_use = TIME;\n+\tpkt->command = PKT_POLICY;\n+\tpkt->core_type = CORE_TYPE_PHYSICAL;\n+\n+\tjson_object_foreach(element, key, value) {\n+\t\tif (!strcmp(key, \"policy\")) {\n+\t\t\t/* Recurse in to get the contents of profile */\n+\t\t\tret = parse_json_to_pkt(value, pkt);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t} else if (!strcmp(key, \"instruction\")) {\n+\t\t\t/* Recurse in to get the contents of instruction */\n+\t\t\tret = parse_json_to_pkt(value, pkt);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t} else if (!strcmp(key, \"name\")) {\n+\t\t\tstrcpy(pkt->vm_name, json_string_value(value));\n+\t\t} else if (!strcmp(key, \"command\")) {\n+\t\t\tchar command[32];\n+\t\t\tsnprintf(command, 32, \"%s\", json_string_value(value));\n+\t\t\tif (!strcmp(command, \"power\")) {\n+\t\t\t\tpkt->command = CPU_POWER;\n+\t\t\t} else if (!strcmp(command, \"create\")) {\n+\t\t\t\tpkt->command = PKT_POLICY;\n+\t\t\t} else if (!strcmp(command, \"destroy\")) {\n+\t\t\t\tpkt->command = PKT_POLICY_REMOVE;\n+\t\t\t} else {\n+\t\t\t\tRTE_LOG(ERR, CHANNEL_MONITOR,\n+\t\t\t\t\t\"Invalid command received in JSON\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t} else if (!strcmp(key, \"policy_type\")) {\n+\t\t\tchar command[32];\n+\t\t\tsnprintf(command, 32, \"%s\", json_string_value(value));\n+\t\t\tif (!strcmp(command, \"TIME\")) {\n+\t\t\t\tpkt->policy_to_use = TIME;\n+\t\t\t} else if (!strcmp(command, \"TRAFFIC\")) {\n+\t\t\t\tpkt->policy_to_use = TRAFFIC;\n+\t\t\t} else if (!strcmp(command, \"WORKLOAD\")) {\n+\t\t\t\tpkt->policy_to_use = WORKLOAD;\n+\t\t\t} else if (!strcmp(command, \"BRANCH_RATIO\")) {\n+\t\t\t\tpkt->policy_to_use = BRANCH_RATIO;\n+\t\t\t} else {\n+\t\t\t\tRTE_LOG(ERR, CHANNEL_MONITOR,\n+\t\t\t\t\t\"Wrong policy_type received in JSON\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t} else if (!strcmp(key, \"busy_hours\")) {\n+\t\t\tunsigned int i;\n+\t\t\tsize_t size = json_array_size(value);\n+\n+\t\t\tfor (i = 0; i < size; i++) {\n+\t\t\t\tint hour = (int)json_integer_value(\n+\t\t\t\t\t\tjson_array_get(value, i));\n+\t\t\t\tpkt->timer_policy.busy_hours[i] = hour;\n+\t\t\t}\n+\t\t} else if (!strcmp(key, \"quiet_hours\")) {\n+\t\t\tunsigned int i;\n+\t\t\tsize_t size = json_array_size(value);\n+\n+\t\t\tfor (i = 0; i < size; i++) {\n+\t\t\t\tint hour = (int)json_integer_value(\n+\t\t\t\t\t\tjson_array_get(value, i));\n+\t\t\t\tpkt->timer_policy.quiet_hours[i] = hour;\n+\t\t\t}\n+\t\t} else if (!strcmp(key, \"core_list\")) {\n+\t\t\tunsigned int i;\n+\t\t\tsize_t size = json_array_size(value);\n+\n+\t\t\tfor (i = 0; i < size; i++) {\n+\t\t\t\tint core = (int)json_integer_value(\n+\t\t\t\t\t\tjson_array_get(value, i));\n+\t\t\t\tpkt->vcpu_to_control[i] = core;\n+\t\t\t}\n+\t\t\tpkt->num_vcpu = size;\n+\t\t} else if (!strcmp(key, \"avg_packet_thresh\")) {\n+\t\t\tpkt->traffic_policy.avg_max_packet_thresh =\n+\t\t\t\t\t(uint32_t)json_integer_value(value);\n+\t\t} else if (!strcmp(key, \"max_packet_thresh\")) {\n+\t\t\tpkt->traffic_policy.max_max_packet_thresh =\n+\t\t\t\t\t(uint32_t)json_integer_value(value);\n+\t\t} else if (!strcmp(key, \"unit\")) {\n+\t\t\tchar unit[32];\n+\t\t\tsnprintf(unit, 32, \"%s\", json_string_value(value));\n+\t\t\tif (!strcmp(unit, \"SCALE_UP\")) {\n+\t\t\t\tpkt->unit = CPU_POWER_SCALE_UP;\n+\t\t\t} else if (!strcmp(unit, \"SCALE_DOWN\")) {\n+\t\t\t\tpkt->unit = CPU_POWER_SCALE_DOWN;\n+\t\t\t} else if (!strcmp(unit, \"SCALE_MAX\")) {\n+\t\t\t\tpkt->unit = CPU_POWER_SCALE_MAX;\n+\t\t\t} else if (!strcmp(unit, \"SCALE_MIN\")) {\n+\t\t\t\tpkt->unit = CPU_POWER_SCALE_MIN;\n+\t\t\t} else if (!strcmp(unit, \"ENABLE_TURBO\")) {\n+\t\t\t\tpkt->unit = CPU_POWER_ENABLE_TURBO;\n+\t\t\t} else if (!strcmp(unit, \"DISABLE_TURBO\")) {\n+\t\t\t\tpkt->unit = CPU_POWER_DISABLE_TURBO;\n+\t\t\t} else {\n+\t\t\t\tRTE_LOG(ERR, CHANNEL_MONITOR,\n+\t\t\t\t\t\"Invalid command received in JSON\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t} else if (!strcmp(key, \"resource_id\")) {\n+\t\t\tpkt->resource_id = (uint32_t)json_integer_value(value);\n+\t\t} else {\n+\t\t\tRTE_LOG(ERR, CHANNEL_MONITOR,\n+\t\t\t\t\"Unknown key received in JSON string: %s\\n\",\n+\t\t\t\tkey);\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+#endif\n+\n void channel_monitor_exit(void)\n {\n \trun_loop = 0;\n@@ -124,18 +259,11 @@ get_pcpu_to_control(struct policy *pol)\n \n \tci = get_core_info();\n \n-\tRTE_LOG(INFO, CHANNEL_MONITOR,\n-\t\t\t\"Looking for pcpu for %s\\n\", pol->pkt.vm_name);\n-\n \t/*\n \t * So now that we're handling virtual and physical cores, we need to\n \t * differenciate between them when adding them to the branch monitor.\n \t * Virtual cores need to be converted to physical cores.\n \t */\n-\n-\n-\n-\n \tif (pol->pkt.core_type == CORE_TYPE_VIRTUAL) {\n \t\t/*\n \t\t * If the cores in the policy are virtual, we need to map them\n@@ -295,8 +423,6 @@ apply_traffic_profile(struct policy *pol)\n \n \tdiff = get_pkt_diff(pol);\n \n-\tRTE_LOG(INFO, CHANNEL_MONITOR, \"Applying traffic profile\\n\");\n-\n \tif (diff >= (pol->pkt.traffic_policy.max_max_packet_thresh)) {\n \t\tfor (count = 0; count < pol->pkt.num_vcpu; count++) {\n \t\t\tif (pol->core_share[count].status != 1)\n@@ -340,9 +466,6 @@ apply_time_profile(struct policy *pol)\n \t\t\t\tif (pol->core_share[count].status != 1) {\n \t\t\t\t\tpower_manager_scale_core_max(\n \t\t\t\t\t\tpol->core_share[count].pcpu);\n-\t\t\t\tRTE_LOG(INFO, CHANNEL_MONITOR,\n-\t\t\t\t\t\"Scaling up core %d to max\\n\",\n-\t\t\t\t\tpol->core_share[count].pcpu);\n \t\t\t\t}\n \t\t\t}\n \t\t\tbreak;\n@@ -352,9 +475,6 @@ apply_time_profile(struct policy *pol)\n \t\t\t\tif (pol->core_share[count].status != 1) {\n \t\t\t\t\tpower_manager_scale_core_min(\n \t\t\t\t\t\tpol->core_share[count].pcpu);\n-\t\t\t\tRTE_LOG(INFO, CHANNEL_MONITOR,\n-\t\t\t\t\t\"Scaling down core %d to min\\n\",\n-\t\t\t\t\tpol->core_share[count].pcpu);\n \t\t\t}\n \t\t}\n \t\t\tbreak;\n@@ -416,8 +536,6 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)\n \tif (chan_info == NULL)\n \t\treturn -1;\n \n-\tRTE_LOG(INFO, CHANNEL_MONITOR, \"Processing Request %s\\n\", pkt->vm_name);\n-\n \tif (rte_atomic32_cmpset(&(chan_info->status), CHANNEL_MGR_CHANNEL_CONNECTED,\n \t\t\tCHANNEL_MGR_CHANNEL_PROCESSING) == 0)\n \t\treturn -1;\n@@ -486,8 +604,8 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)\n \t}\n \n \tif (pkt->command == PKT_POLICY) {\n-\t\tRTE_LOG(INFO, CHANNEL_MONITOR,\n-\t\t\t\t\"\\nProcessing Policy request\\n\");\n+\t\tRTE_LOG(INFO, CHANNEL_MONITOR, \"Processing policy request %s\\n\",\n+\t\t\t\tpkt->vm_name);\n \t\tupdate_policy(pkt);\n \t\tpolicy_is_set = 1;\n \t}\n@@ -559,6 +677,103 @@ channel_monitor_init(void)\n \treturn 0;\n }\n \n+static void\n+read_binary_packet(struct channel_info *chan_info)\n+{\n+\tstruct channel_packet pkt;\n+\tvoid *buffer = &pkt;\n+\tint buffer_len = sizeof(pkt);\n+\tint n_bytes, err = 0;\n+\n+\twhile (buffer_len > 0) {\n+\t\tn_bytes = read(chan_info->fd,\n+\t\t\t\tbuffer, buffer_len);\n+\t\tif (n_bytes == buffer_len)\n+\t\t\tbreak;\n+\t\tif (n_bytes == -1) {\n+\t\t\terr = errno;\n+\t\t\tRTE_LOG(DEBUG, CHANNEL_MONITOR,\n+\t\t\t\t\"Received error on \"\n+\t\t\t\t\"channel '%s' read: %s\\n\",\n+\t\t\t\tchan_info->channel_path,\n+\t\t\t\tstrerror(err));\n+\t\t\tremove_channel(&chan_info);\n+\t\t\tbreak;\n+\t\t}\n+\t\tbuffer = (char *)buffer + n_bytes;\n+\t\tbuffer_len -= n_bytes;\n+\t}\n+\tif (!err)\n+\t\tprocess_request(&pkt, chan_info);\n+}\n+\n+#ifdef USE_JANSSON\n+static void\n+read_json_packet(struct channel_info *chan_info)\n+{\n+\tstruct channel_packet pkt;\n+\tint n_bytes, ret;\n+\tjson_t *root;\n+\tjson_error_t error;\n+\n+\t/* read opening brace to closing brace */\n+\tdo {\n+\t\tint idx = 0;\n+\t\tint indent = 0;\n+\t\tdo {\n+\t\t\tn_bytes = read(chan_info->fd, &json_data[idx], 1);\n+\t\t\tif (n_bytes == 0)\n+\t\t\t\tbreak;\n+\t\t\tif (json_data[idx] == '{')\n+\t\t\t\tindent++;\n+\t\t\tif (json_data[idx] == '}')\n+\t\t\t\tindent--;\n+\t\t\tif ((indent > 0) || (idx >> 0))\n+\t\t\t\tidx++;\n+\t\t\tif (indent == 0)\n+\t\t\t\tjson_data[idx] = 0;\n+\t\t\tif (idx >= MAX_JSON_STRING_LEN)\n+\t\t\t\tbreak;\n+\t\t} while (indent > 0);\n+\n+\t\tif (indent > 0)\n+\t\t\t/*\n+\t\t\t * We've broken out of the read loop without getting\n+\t\t\t * a closing brace, so throw away the datai\n+\t\t\t */\n+\t\t\tjson_data[idx] = 0;\n+\n+\t\tif (strlen(json_data) == 0)\n+\t\t\tcontinue;\n+\n+\t\tprintf(\"got [%s]\\n\", json_data);\n+\n+\t\troot = json_loads(json_data, 0, &error);\n+\n+\t\tif (root) {\n+\t\t\t/*\n+\t\t\t * Because our data is now in the json\n+\t\t\t * object, we can overwrite the pkt\n+\t\t\t * with a channel_packet struct, using\n+\t\t\t * parse_json_to_pkt()\n+\t\t\t */\n+\t\t\tret = parse_json_to_pkt(root, &pkt);\n+\t\t\tjson_decref(root);\n+\t\t\tif (ret) {\n+\t\t\t\tRTE_LOG(ERR, CHANNEL_MONITOR,\n+\t\t\t\t\t\"Error validating JSON profile data\\n\");\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tprocess_request(&pkt, chan_info);\n+\t\t} else {\n+\t\t\tRTE_LOG(ERR, CHANNEL_MONITOR,\n+\t\t\t\t\t\"JSON error on line %d: %s\\n\",\n+\t\t\t\t\terror.line, error.text);\n+\t\t}\n+\t} while (n_bytes > 0);\n+}\n+#endif\n+\n void\n run_channel_monitor(void)\n {\n@@ -570,11 +785,16 @@ run_channel_monitor(void)\n \t\tif (!run_loop)\n \t\t\tbreak;\n \t\tfor (i = 0; i < n_events; i++) {\n+\t\t\tif (!global_events_list[i].data.ptr) {\n+\t\t\t\tfflush(stdout);\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tstruct channel_info *chan_info = (struct channel_info *)\n \t\t\t\t\tglobal_events_list[i].data.ptr;\n \t\t\tif ((global_events_list[i].events & EPOLLERR) ||\n \t\t\t\t(global_events_list[i].events & EPOLLHUP)) {\n-\t\t\t\tRTE_LOG(DEBUG, CHANNEL_MONITOR, \"Remote closed connection for \"\n+\t\t\t\tRTE_LOG(INFO, CHANNEL_MONITOR,\n+\t\t\t\t\t\t\"Remote closed connection for \"\n \t\t\t\t\t\t\"channel '%s'\\n\",\n \t\t\t\t\t\tchan_info->channel_path);\n \t\t\t\tremove_channel(&chan_info);\n@@ -582,31 +802,18 @@ run_channel_monitor(void)\n \t\t\t}\n \t\t\tif (global_events_list[i].events & EPOLLIN) {\n \n-\t\t\t\tint n_bytes, err = 0;\n-\t\t\t\tstruct channel_packet pkt;\n-\t\t\t\tvoid *buffer = &pkt;\n-\t\t\t\tint buffer_len = sizeof(pkt);\n-\n-\t\t\t\twhile (buffer_len > 0) {\n-\t\t\t\t\tn_bytes = read(chan_info->fd,\n-\t\t\t\t\t\t\tbuffer, buffer_len);\n-\t\t\t\t\tif (n_bytes == buffer_len)\n-\t\t\t\t\t\tbreak;\n-\t\t\t\t\tif (n_bytes == -1) {\n-\t\t\t\t\t\terr = errno;\n-\t\t\t\t\t\tRTE_LOG(DEBUG, CHANNEL_MONITOR,\n-\t\t\t\t\t\t\t\"Received error on \"\n-\t\t\t\t\t\t\t\"channel '%s' read: %s\\n\",\n-\t\t\t\t\t\t\tchan_info->channel_path,\n-\t\t\t\t\t\t\tstrerror(err));\n-\t\t\t\t\t\tremove_channel(&chan_info);\n-\t\t\t\t\t\tbreak;\n-\t\t\t\t\t}\n-\t\t\t\t\tbuffer = (char *)buffer + n_bytes;\n-\t\t\t\t\tbuffer_len -= n_bytes;\n+\t\t\t\tswitch (chan_info->type) {\n+\t\t\t\tcase CHANNEL_TYPE_BINARY:\n+\t\t\t\t\tread_binary_packet(chan_info);\n+\t\t\t\t\tbreak;\n+#ifdef USE_JANSSON\n+\t\t\t\tcase CHANNEL_TYPE_JSON:\n+\t\t\t\t\tread_json_packet(chan_info);\n+\t\t\t\t\tbreak;\n+#endif\n+\t\t\t\tdefault:\n+\t\t\t\t\tbreak;\n \t\t\t\t}\n-\t\t\t\tif (!err)\n-\t\t\t\t\tprocess_request(&pkt, chan_info);\n \t\t\t}\n \t\t}\n \t\trte_delay_us(time_period_ms*1000);\n",
    "prefixes": [
        "v3",
        "5/8"
    ]
}