Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/40852/?format=api
https://patches.dpdk.org/api/patches/40852/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180608163053.37891-1-kevin.laatz@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": "<20180608163053.37891-1-kevin.laatz@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180608163053.37891-1-kevin.laatz@intel.com", "date": "2018-06-08T16:30:53", "name": "[dpdk-dev] examples/ip_pipeline: add link show to the cli", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "de8f79e9f7bb65d949cfbe8fe905eacfde07ecfe", "submitter": { "id": 921, "url": "https://patches.dpdk.org/api/people/921/?format=api", "name": "Kevin Laatz", "email": "kevin.laatz@intel.com" }, "delegate": { "id": 10018, "url": "https://patches.dpdk.org/api/users/10018/?format=api", "username": "cristian_dumitrescu", "first_name": "Cristian", "last_name": "Dumitrescu", "email": "cristian.dumitrescu@intel.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180608163053.37891-1-kevin.laatz@intel.com/mbox/", "series": [ { "id": 56, "url": "https://patches.dpdk.org/api/series/56/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=56", "date": "2018-06-08T16:30:53", "name": "[dpdk-dev] examples/ip_pipeline: add link show to the cli", "version": 1, "mbox": "https://patches.dpdk.org/series/56/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/40852/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/40852/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 3A9315F1C;\n\tFri, 8 Jun 2018 18:31:08 +0200 (CEST)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id EF4CE4CBB\n\tfor <dev@dpdk.org>; Fri, 8 Jun 2018 18:31:06 +0200 (CEST)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Jun 2018 09:31:04 -0700", "from silpixa00397517.ir.intel.com (HELO\n\tsilpixa00397517.ger.corp.intel.com) ([10.237.222.54])\n\tby orsmga003.jf.intel.com with ESMTP; 08 Jun 2018 09:31:03 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.49,490,1520924400\"; d=\"scan'208\";a=\"57654267\"", "From": "Kevin Laatz <kevin.laatz@intel.com>", "To": "dev@dpdk.org", "Cc": "cristian.dumitrescu@intel.com, jasvinder.singh@intel.com,\n\tKevin Laatz <kevin.laatz@intel.com>", "Date": "Fri, 8 Jun 2018 17:30:53 +0100", "Message-Id": "<20180608163053.37891-1-kevin.laatz@intel.com>", "X-Mailer": "git-send-email 2.9.5", "Subject": "[dpdk-dev] [PATCH] examples/ip_pipeline: add link show to the cli", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://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": "<https://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": "Add the functionality to track links in the application. This enables the\nuser to print the name, mac address and per-port statistics for each link\nin the application.\n\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\n---\n examples/ip_pipeline/cli.c | 103 ++++++++++++++++++++++++++++++++++++++++++++\n examples/ip_pipeline/link.c | 6 +++\n examples/ip_pipeline/link.h | 3 ++\n 3 files changed, 112 insertions(+)", "diff": "diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c\nindex c9587f5..b7fba3b 100644\n--- a/examples/ip_pipeline/cli.c\n+++ b/examples/ip_pipeline/cli.c\n@@ -9,6 +9,7 @@\n \n #include <rte_common.h>\n #include <rte_cycles.h>\n+#include <rte_ethdev.h>\n \n #include \"cli.h\"\n #include \"kni.h\"\n@@ -4355,6 +4356,103 @@ cmd_thread_pipeline_disable(char **tokens,\n \t}\n }\n \n+/* Print the link stats and info */\n+static void\n+print_link_info(struct link *link, char *out, size_t out_size)\n+{\n+\tstruct rte_eth_stats stats;\n+\tstruct ether_addr mac_addr;\n+\tstruct rte_eth_link eth_link;\n+\n+\tmemset(&stats, 0, sizeof(stats));\n+\trte_eth_stats_get(link->port_id, &stats);\n+\n+\trte_eth_macaddr_get(link->port_id, &mac_addr);\n+\trte_eth_link_get(link->port_id, ð_link);\n+\n+\tsnprintf(out, out_size,\n+\t\t\"\\n\"\n+\t\t\"Link name: %s\\n\"\n+\t\t\"\\tPort %u MAC: %02\"PRIx8\":%02\"PRIx8\":%02\"PRIx8\n+\t\t\":%02\"PRIx8\":%02\"PRIx8\":%02\"PRIx8\"\\n\"\n+\t\t\"\\tLink Status: %s\\n\"\n+\t\t\"\\tLink Speed: %u\\n\"\n+\t\t\"\\n\"\n+\t\t\"\\tRX info:\\n\"\n+\t\t\"\\t\\tQueues: %u\\n\"\n+\t\t\"\\t\\tPackets: %\" PRIu64\n+\t\t\"\\t\\tBytes: %\" PRIu64\"\\n\"\n+\t\t\"\\t\\tErrors: %\" PRIu64\n+\t\t\"\\t\\tMissed: %\" PRIu64\n+\t\t\"\\t\\tNo-mbuf: %\" PRIu64\"\\n\"\n+\t\t\"\\tTX info:\\n\"\n+\t\t\"\\t\\tQueues: %u\\n\"\n+\t\t\"\\t\\tPackets: %\" PRIu64\n+\t\t\"\\t\\tBytes: %\" PRIu64\"\\n\"\n+\t\t\"\\t\\tErrors: %\" PRIu64\"\\n\",\n+\t\tlink->name,\n+\t\tlink->port_id,\n+\t\tmac_addr.addr_bytes[0], mac_addr.addr_bytes[1],\n+\t\tmac_addr.addr_bytes[2], mac_addr.addr_bytes[3],\n+\t\tmac_addr.addr_bytes[4], mac_addr.addr_bytes[5],\n+\t\teth_link.link_status == 1 ? \"UP\" : \"DOWN\",\n+\t\teth_link.link_speed,\n+\t\tlink->n_rxq,\n+\t\tstats.ipackets,\n+\t\tstats.ibytes,\n+\t\tstats.ierrors,\n+\t\tstats.imissed,\n+\t\tstats.rx_nombuf,\n+\t\tlink->n_txq,\n+\t\tstats.opackets,\n+\t\tstats.obytes,\n+\t\tstats.oerrors);\n+}\n+\n+/*\n+ * link show [<link_name>]\n+ */\n+static void\n+cmd_link_show(char **tokens, uint32_t n_tokens, char *out, size_t out_size)\n+{\n+\tstruct link *link;\n+\tstruct link_list *link_list;\n+\tchar *link_name;\n+\tuint32_t i = 0;\n+\n+\tif (n_tokens != 2 && n_tokens != 3) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tlink_list = links_get();\n+\n+\tif (TAILQ_EMPTY(link_list)) {\n+\t\tsnprintf(out, out_size, \"No links - nothing to show\\n\");\n+\t\treturn;\n+\t}\n+\n+\tif (n_tokens == 2) {\n+\t\tTAILQ_FOREACH(link, link_list, node) {\n+\t\t\tsize_t os = out_size - (i * strlen(out));\n+\t\t\tchar *o = &out[i * strlen(out)];\n+\n+\t\t\tif (os == 0) {\n+\t\t\t\tsnprintf(out, out_size, MSG_CMD_FAIL,\n+\t\t\t\t\t\t\"Output buffer too small\");\n+\t\t\t\treturn;\n+\t\t\t}\n+\n+\t\t\tprint_link_info(link, o, os);\n+\t\t\ti++;\n+\t\t}\n+\t} else {\n+\t\tlink_name = tokens[2];\n+\t\tlink = link_find(link_name);\n+\t\tprint_link_info(link, out, out_size);\n+\t}\n+}\n+\n void\n cli_process(char *in, char *out, size_t out_size)\n {\n@@ -4380,6 +4478,11 @@ cli_process(char *in, char *out, size_t out_size)\n \t}\n \n \tif (strcmp(tokens[0], \"link\") == 0) {\n+\t\tif (strcmp(tokens[1], \"show\") == 0) {\n+\t\t\tcmd_link_show(tokens, n_tokens, out, out_size);\n+\t\t\treturn;\n+\t\t}\n+\n \t\tcmd_link(tokens, n_tokens, out, out_size);\n \t\treturn;\n \t}\ndiff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c\nindex b8a431f..b11f0c1 100644\n--- a/examples/ip_pipeline/link.c\n+++ b/examples/ip_pipeline/link.c\n@@ -36,6 +36,12 @@ link_find(const char *name)\n \treturn NULL;\n }\n \n+struct link_list *\n+links_get(void)\n+{\n+\treturn &link_list;\n+}\n+\n static struct rte_eth_conf port_conf_default = {\n \t.link_speeds = 0,\n \t.rxmode = {\ndiff --git a/examples/ip_pipeline/link.h b/examples/ip_pipeline/link.h\nindex 37d3dc4..10f9d51 100644\n--- a/examples/ip_pipeline/link.h\n+++ b/examples/ip_pipeline/link.h\n@@ -30,6 +30,9 @@ link_init(void);\n struct link *\n link_find(const char *name);\n \n+struct link_list *\n+links_get(void);\n+\n struct link_params_rss {\n \tuint32_t queue_id[LINK_RXQ_RSS_MAX];\n \tuint32_t n_queues;\n", "prefixes": [ "dpdk-dev" ] }{ "id": 40852, "url": "