Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/10030/?format=api
http://patches.dpdk.org/api/patches/10030/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1453374327-26635-4-git-send-email-harry.van.haaren@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": "<1453374327-26635-4-git-send-email-harry.van.haaren@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1453374327-26635-4-git-send-email-harry.van.haaren@intel.com", "date": "2016-01-21T11:05:27", "name": "[dpdk-dev,v2,3/3] keepalive: add rte_keepalive_xstats_get() and example", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "4d1b9f10a92b8b807a223ab6db58eceaa12e5b02", "submitter": { "id": 317, "url": "http://patches.dpdk.org/api/people/317/?format=api", "name": "Van Haaren, Harry", "email": "harry.van.haaren@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/1453374327-26635-4-git-send-email-harry.van.haaren@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/10030/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/10030/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 770458F9D;\n\tThu, 21 Jan 2016 12:06:24 +0100 (CET)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id A838D8E9A\n\tfor <dev@dpdk.org>; Thu, 21 Jan 2016 12:06:20 +0100 (CET)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga103.fm.intel.com with ESMTP; 21 Jan 2016 03:06:20 -0800", "from sie-lab-212-120.ir.intel.com (HELO\n\tsilpixa00394367.ir.intel.com) ([10.237.212.120])\n\tby fmsmga004.fm.intel.com with ESMTP; 21 Jan 2016 03:06:18 -0800" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.22,325,1449561600\"; d=\"scan'208\";a=\"33519395\"", "From": "Harry van Haaren <harry.van.haaren@intel.com>", "To": "remy.horton@intel.com", "Date": "Thu, 21 Jan 2016 11:05:27 +0000", "Message-Id": "<1453374327-26635-4-git-send-email-harry.van.haaren@intel.com>", "X-Mailer": "git-send-email 2.5.0", "In-Reply-To": "<1453374327-26635-1-git-send-email-harry.van.haaren@intel.com>", "References": "<1453305221-11125-1-git-send-email-harry.van.haaren@intel.com>\n\t<1453374327-26635-1-git-send-email-harry.van.haaren@intel.com>", "Cc": "dev@dpdk.org", "Subject": "[dpdk-dev] [PATCH v2 3/3] keepalive: add rte_keepalive_xstats_get()\n\tand example", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch adds a function that exposes keepalive statistics\nusing a rte_keepalive_xstats struct. The function provides\nthe client API the opportunity to read last-seen and status of\neach core.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n doc/guides/rel_notes/release_2_3.rst | 6 ++++\n doc/guides/sample_app_ug/keep_alive.rst | 11 ++++++\n examples/l2fwd-keepalive/main.c | 23 ++++++++++--\n lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 ++++\n lib/librte_eal/common/include/rte_keepalive.h | 28 ++++++++++++++-\n lib/librte_eal/common/rte_keepalive.c | 47 ++++++++++++++++++++++++-\n lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 ++++\n 7 files changed, 124 insertions(+), 5 deletions(-)", "diff": "diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst\nindex 99de186..c06e28c 100644\n--- a/doc/guides/rel_notes/release_2_3.rst\n+++ b/doc/guides/rel_notes/release_2_3.rst\n@@ -4,6 +4,12 @@ DPDK Release 2.3\n New Features\n ------------\n \n+* **Keep Alive xstats**\n+\n+ A function ``rte_keepalive_xstats_get()`` has been added to the\n+ keepalive header, allowing the retrieval of keepalive statistics\n+ such as last-alive-time and the status of each core registered\n+ for monitoring. The API reflects that of the existing xstats API.\n \n Resolved Issues\n ---------------\ndiff --git a/doc/guides/sample_app_ug/keep_alive.rst b/doc/guides/sample_app_ug/keep_alive.rst\nindex 1478faf..7c2d2a4 100644\n--- a/doc/guides/sample_app_ug/keep_alive.rst\n+++ b/doc/guides/sample_app_ug/keep_alive.rst\n@@ -190,3 +190,14 @@ The rte_keepalive_mark_alive function simply sets the core state to alive.\n {\n keepcfg->state_flags[rte_lcore_id()] = ALIVE;\n }\n+\n+Keepalive exposes its statistics using an API very similar to the xstats API.\n+This allows client code to call the function and retrieve the current status\n+of keepalive, providing information like last-alive time and status per-core.\n+\n+.. code-block:: c\n+\n+ nstats = rte_keepalive_xstats_get(rte_global_keepalive_info, xstats,\n+ nstats);\n+ for (i = 0; i < nstats; i++)\n+ printf(\"%s : %lu\\n\", xstats[i].name, xstats[i].value);\ndiff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c\nindex f4d52f2..34c6d62 100644\n--- a/examples/l2fwd-keepalive/main.c\n+++ b/examples/l2fwd-keepalive/main.c\n@@ -1,7 +1,7 @@\n /*-\n * BSD LICENSE\n *\n- * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n+ * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n@@ -66,6 +66,7 @@\n #include <rte_ether.h>\n #include <rte_ethdev.h>\n #include <rte_ring.h>\n+#include <rte_malloc.h>\n #include <rte_mempool.h>\n #include <rte_mbuf.h>\n #include <rte_timer.h>\n@@ -139,7 +140,7 @@ struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS];\n /* A tsc-based timer responsible for triggering statistics printout */\n #define TIMER_MILLISECOND 1\n #define MAX_TIMER_PERIOD 86400 /* 1 day max */\n-static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; /* 10 seconds */\n+static int64_t timer_period = 1 * TIMER_MILLISECOND * 1000; /* 1 second */\n static int64_t check_period = 5; /* default check cycle is 5ms */\n \n /* Keepalive structure */\n@@ -189,7 +190,23 @@ print_stats(__attribute__((unused)) struct rte_timer *ptr_timer,\n \t\t total_packets_tx,\n \t\t total_packets_rx,\n \t\t total_packets_dropped);\n-\tprintf(\"\\n====================================================\\n\");\n+\tprintf(\"\\nKeep Alive xstats ==================================\\n\");\n+\n+\t/* Keepalive Xstats */\n+\tunsigned nstats = rte_keepalive_xstats_get(rte_global_keepalive_info,\n+\t\t\t\t\t\t 0, 0);\n+\tstruct rte_keepalive_xstats *xstats =\n+\t\trte_zmalloc(\"RTE_KEEPALIVE_XSTATS\",\n+\t\t\t sizeof(struct rte_keepalive_xstats) * nstats,\n+\t\t\t RTE_CACHE_LINE_SIZE);\n+\n+\tnstats = rte_keepalive_xstats_get(rte_global_keepalive_info, xstats,\n+\t\t\t\t nstats);\n+\tunsigned i;\n+\tfor (i = 0; i < nstats; i++)\n+\t\tprintf(\"%s\\t%lu\\n\", xstats[i].name, xstats[i].value);\n+\tprintf(\"====================================================\\n\");\n+\trte_free(xstats);\n }\n \n /* Send the burst of packets on an output interface */\ndiff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\nindex 9d7adf1..ff1cbc7 100644\n--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n@@ -135,3 +135,10 @@ DPDK_2.2 {\n \trte_xen_dom0_supported;\n \n } DPDK_2.1;\n+\n+DPDK_2.3 {\n+\tglobal:\n+\n+\trte_keepalive_xstats_get;\n+\n+} DPDK_2.2;\ndiff --git a/lib/librte_eal/common/include/rte_keepalive.h b/lib/librte_eal/common/include/rte_keepalive.h\nindex 02472c0..f98b92c 100644\n--- a/lib/librte_eal/common/include/rte_keepalive.h\n+++ b/lib/librte_eal/common/include/rte_keepalive.h\n@@ -1,7 +1,7 @@\n /*-\n * BSD LICENSE\n *\n- * Copyright 2015 Intel Shannon Ltd. All rights reserved.\n+ * Copyright 2015-2016 Intel Shannon Ltd. 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@@ -48,6 +48,19 @@\n #define RTE_KEEPALIVE_MAXCORES RTE_MAX_LCORE\n #endif\n \n+#define RTE_KEEPALIVE_XSTATS_NAME_LEN 64\n+\n+/**\n+ * Keepalive extended statistic structure\n+ *\n+ * This structure is used by rte_keepalive_xstats_get() to provide\n+ * statistics that are not provided in the generic rte_eth_stats\n+ * structure.\n+ */\n+struct rte_keepalive_xstats {\n+\tchar name[RTE_KEEPALIVE_XSTATS_NAME_LEN];\n+\tuint64_t value;\n+};\n \n /**\n * Keepalive failure callback.\n@@ -127,6 +140,19 @@ void rte_keepalive_dispatch_pings(void *ptr_timer, void *ptr_data);\n void rte_keepalive_register_core(struct rte_keepalive *keepcfg,\n \tconst int id_core);\n \n+/**\n+ * Get statistics of the keepalive state. If xstats NULL or n is zero, the\n+ * function returns the number of xstats available. If xstats is a pointer to\n+ * array of size n, n items will be filled in, and then returned.\n+ * @param *keepcfg\n+ * Keepalive structure pointer\n+ * @param *xstats\n+ * An array of rte_eth_xstats, or NULL.\n+ * @param n\n+ * Size of the array of xstats being passed in\n+ */\n+int rte_keepalive_xstats_get(struct rte_keepalive *keepcfg,\n+\t\t\t struct rte_keepalive_xstats *xstats, unsigned n);\n \n /**\n * Per-core keepalive check.\ndiff --git a/lib/librte_eal/common/rte_keepalive.c b/lib/librte_eal/common/rte_keepalive.c\nindex 5358322..ec0f986 100644\n--- a/lib/librte_eal/common/rte_keepalive.c\n+++ b/lib/librte_eal/common/rte_keepalive.c\n@@ -1,7 +1,7 @@\n /*-\n * BSD LICENSE\n *\n- * Copyright 2015 Intel Shannon Ltd. All rights reserved.\n+ * Copyright 2015-2016 Intel Shannon Ltd. 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@@ -40,6 +40,8 @@\n #include <rte_malloc.h>\n #include <rte_cycles.h>\n \n+#define RTE_KEEPALIVE_NSTATS 2\n+\n static void\n print_trace(const char *msg, struct rte_keepalive *keepcfg, int idx_core)\n {\n@@ -114,3 +116,46 @@ rte_keepalive_register_core(struct rte_keepalive *keepcfg, const int id_core)\n \t\tkeepcfg->last_alive[id_core] = rte_rdtsc();\n \t}\n }\n+\n+int\n+rte_keepalive_xstats_get(struct rte_keepalive *ka,\n+\t\t\t struct rte_keepalive_xstats *xstats, unsigned n)\n+{\n+\tunsigned i, c, active = 0;\n+\tfor (i = 0; i < RTE_KEEPALIVE_MAXCORES; i++) {\n+\t\tif (ka->active_cores[i])\n+\t\t\tactive++;\n+\t}\n+\n+\tconst unsigned nstats = active * RTE_KEEPALIVE_NSTATS;\n+\n+\t/* Indicate number of ka-xstats */\n+\tif (n < nstats)\n+\t\treturn nstats;\n+\n+\tif (xstats == NULL)\n+\t\treturn nstats;\n+\n+\tuint64_t tsc = rte_rdtsc();\n+\ti = 0;\n+\tfor (c = 0; c < RTE_KEEPALIVE_MAXCORES; c++) {\n+\t\tif (ka->active_cores[c]) {\n+\t\t\tsnprintf(xstats[i].name,\n+\t\t\t\t RTE_KEEPALIVE_XSTATS_NAME_LEN,\n+\t\t\t\t \"%s%u%s\", \"keepalive_core\",\n+\t\t\t\t c, \"_last_time\");\n+\t\t\txstats[i].value = ((tsc - ka->last_alive[c])*1000) /\n+\t\t\t\trte_get_tsc_hz();\n+\t\t\ti++;\n+\n+\t\t\tsnprintf(xstats[i].name,\n+\t\t\t\t RTE_KEEPALIVE_XSTATS_NAME_LEN,\n+\t\t\t\t \"%s%u%s\\t\", \"keepalive_core\",\n+\t\t\t\t c, \"_status\");\n+\t\t\txstats[i].value = (uint32_t)ka->state_flags[c];\n+\t\t\ti++;\n+\t\t}\n+\t}\n+\n+\treturn nstats;\n+}\ndiff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\nindex cbe175f..088fc18 100644\n--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n@@ -138,3 +138,10 @@ DPDK_2.2 {\n \trte_xen_dom0_supported;\n \n } DPDK_2.1;\n+\n+DPDK_2.3 {\n+\tglobal:\n+\n+\trte_keepalive_xstats_get;\n+\n+} DPDK_2.2;\n", "prefixes": [ "dpdk-dev", "v2", "3/3" ] }{ "id": 10030, "url": "