DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 11/11] testpmd: add several dump commands, useful for debug
Date: Fri, 28 Feb 2014 18:25:50 +0100	[thread overview]
Message-ID: <1393608350-4431-12-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1393608350-4431-1-git-send-email-olivier.matz@6wind.com>

Copy all the dump commands provided in app/test into app/testpmd. These
commands are useful to debug a problem when using testpmd.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/cmdline.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 37aa3d2..00f88f9 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -2,6 +2,7 @@
  *   BSD LICENSE
  * 
  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2014 6WIND S.A.
  *   All rights reserved.
  * 
  *   Redistribution and use in source and binary forms, with or without
@@ -72,6 +73,7 @@
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
+#include <rte_devargs.h>
 
 #include <cmdline_rdline.h>
 #include <cmdline_parse.h>
@@ -4998,6 +5000,116 @@ cmdline_parse_inst_t cmd_reset_mirror_rule = {
 
 /* ******************************************************************************** */
 
+struct cmd_dump_result {
+	cmdline_fixed_string_t dump;
+};
+
+static void
+dump_struct_sizes(void)
+{
+#define DUMP_SIZE(t) printf("sizeof(" #t ") = %u\n", (unsigned)sizeof(t));
+	DUMP_SIZE(struct rte_mbuf);
+	DUMP_SIZE(struct rte_pktmbuf);
+	DUMP_SIZE(struct rte_ctrlmbuf);
+	DUMP_SIZE(struct rte_mempool);
+	DUMP_SIZE(struct rte_ring);
+#undef DUMP_SIZE
+}
+
+static void cmd_dump_parsed(void *parsed_result,
+			    __attribute__((unused)) struct cmdline *cl,
+			    __attribute__((unused)) void *data)
+{
+	struct cmd_dump_result *res = parsed_result;
+
+	if (!strcmp(res->dump, "dump_physmem"))
+		rte_dump_physmem_layout();
+	else if (!strcmp(res->dump, "dump_memzone"))
+		rte_memzone_dump();
+	else if (!strcmp(res->dump, "dump_log_history"))
+		rte_log_dump_history();
+	else if (!strcmp(res->dump, "dump_struct_sizes"))
+		dump_struct_sizes();
+	else if (!strcmp(res->dump, "dump_ring"))
+		rte_ring_list_dump();
+	else if (!strcmp(res->dump, "dump_mempool"))
+		rte_mempool_list_dump();
+	else if (!strcmp(res->dump, "dump_devargs"))
+		rte_eal_devargs_dump();
+}
+
+cmdline_parse_token_string_t cmd_dump_dump =
+	TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump,
+		"dump_physmem#"
+		"dump_memzone#"
+		"dump_log_history#"
+		"dump_struct_sizes#"
+		"dump_ring#"
+		"dump_mempool#"
+		"dump_devargs");
+
+cmdline_parse_inst_t cmd_dump = {
+	.f = cmd_dump_parsed,  /* function to call */
+	.data = NULL,      /* 2nd arg of func */
+	.help_str = "dump status",
+	.tokens = {        /* token list, NULL terminated */
+		(void *)&cmd_dump_dump,
+		NULL,
+	},
+};
+
+/* ******************************************************************************** */
+
+struct cmd_dump_one_result {
+	cmdline_fixed_string_t dump;
+	cmdline_fixed_string_t name;
+};
+
+static void cmd_dump_one_parsed(void *parsed_result, struct cmdline *cl,
+				__attribute__((unused)) void *data)
+{
+	struct cmd_dump_one_result *res = parsed_result;
+
+	if (!strcmp(res->dump, "dump_ring")) {
+		struct rte_ring *r;
+		r = rte_ring_lookup(res->name);
+		if (r == NULL) {
+			cmdline_printf(cl, "Cannot find ring\n");
+			return;
+		}
+		rte_ring_dump(r);
+	}
+	else if (!strcmp(res->dump, "dump_mempool")) {
+		struct rte_mempool *mp;
+		mp = rte_mempool_lookup(res->name);
+		if (mp == NULL) {
+			cmdline_printf(cl, "Cannot find mempool\n");
+			return;
+		}
+		rte_mempool_dump(mp);
+	}
+}
+
+cmdline_parse_token_string_t cmd_dump_one_dump =
+	TOKEN_STRING_INITIALIZER(struct cmd_dump_one_result, dump,
+				 "dump_ring#dump_mempool");
+
+cmdline_parse_token_string_t cmd_dump_one_name =
+	TOKEN_STRING_INITIALIZER(struct cmd_dump_one_result, name, NULL);
+
+cmdline_parse_inst_t cmd_dump_one = {
+	.f = cmd_dump_one_parsed,  /* function to call */
+	.data = NULL,      /* 2nd arg of func */
+	.help_str = "dump one ring/mempool: dump_ring|dump_mempool <name>",
+	.tokens = {        /* token list, NULL terminated */
+		(void *)&cmd_dump_one_dump,
+		(void *)&cmd_dump_one_name,
+		NULL,
+	},
+};
+
+/* ******************************************************************************** */
+
 /* list of instructions */
 cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_help_brief,
@@ -5076,6 +5188,8 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_mirror_mask,
 	(cmdline_parse_inst_t *)&cmd_set_mirror_link,
 	(cmdline_parse_inst_t *)&cmd_reset_mirror_rule,
+	(cmdline_parse_inst_t *)&cmd_dump,
+	(cmdline_parse_inst_t *)&cmd_dump_one,
 	NULL,
 };
 
-- 
1.8.5.3

  parent reply	other threads:[~2014-02-28 17:24 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28 17:25 [dpdk-dev] [PATCH 00/11] eal: allow virtual pmd drivers as shared lib Olivier Matz
2014-02-28 17:25 ` [dpdk-dev] [PATCH 01/11] mk: use whole-archive option when creating dpdk binaries Olivier Matz
2014-04-10 13:58   ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 02/11] devices-args: introduce rte_devargs in eal Olivier Matz
2014-02-28 21:39   ` Stephen Hemminger
2014-03-01 12:02     ` Olivier MATZ
2014-03-01 12:14       ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 13:59         ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 03/11] devices-args: use rte_devargs and remove old whitelist code Olivier Matz
2014-03-01 12:14   ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 14:01     ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 04/11] devices-args: add a dump_devargs command in basic test application Olivier Matz
2014-04-10 14:02   ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 05/11] pci: rename device_list as pci_device_list Olivier Matz
2014-04-10 14:03   ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 06/11] vdev: rename eal_common_nonpci_devs.c as eal_common_vdev.c Olivier Matz
2014-04-10 14:39   ` Thomas Monjalon
2014-04-11  7:36     ` [dpdk-dev] [PATCH v2 06/11] vdev: rename nonpci_devs as vdev Olivier Matz
2014-04-11 11:25       ` Thomas Monjalon
2014-04-11 11:45         ` [dpdk-dev] [PATCH v3 " Olivier Matz
2014-04-11 12:37           ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 07/11] vdev: allow external registration of virtual device drivers Olivier Matz
2014-04-10 14:55   ` Thomas Monjalon
2014-04-11  7:36     ` [dpdk-dev] [PATCH v2 07/11 1/2] vdev: new registration API Olivier Matz
2014-04-11  7:36       ` [dpdk-dev] [PATCH v2 07/11 2/2] vdev: allow external registration of virtual device drivers Olivier Matz
2014-04-11 14:31         ` Thomas Monjalon
2014-04-11 10:49       ` [dpdk-dev] [PATCH v2 07/11 1/2] vdev: new registration API Neil Horman
2014-04-11 13:11         ` Thomas Monjalon
2014-04-11 15:50           ` Neil Horman
2014-04-11 16:18             ` Thomas Monjalon
2014-04-11 17:44               ` Neil Horman
2014-04-11 20:08                 ` Richardson, Bruce
2014-04-12  6:05                   ` Thomas Monjalon
2014-04-12 11:03                     ` Neil Horman
2014-04-12 11:23                       ` Richardson, Bruce
2014-04-12 14:06                         ` Neil Horman
2014-04-14 13:20                     ` John W. Linville
2014-04-14 13:45                       ` Thomas Monjalon
2014-04-14 13:54                         ` Neil Horman
2014-04-14 14:10                         ` John W. Linville
2014-04-14 14:39                           ` Thomas Monjalon
2014-04-11 14:31       ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 08/11] device-args: use a comma instead of semicolon to separate key/values Olivier Matz
2014-04-10 14:05   ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 09/11] device-args: replace use-device eal option by pci-whitelist and vdev Olivier Matz
2014-03-01 12:14   ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 14:06     ` Thomas Monjalon
2014-03-03 17:14   ` [dpdk-dev] [PATCH " Richardson, Bruce
2014-03-04 13:09     ` Olivier MATZ
2014-03-04 13:14       ` Richardson, Bruce
2014-03-24 22:39         ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 10/11] device-args: allow to provide per pci device command line arguments Olivier Matz
2014-03-01 12:14   ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 14:06     ` Thomas Monjalon
2014-02-28 17:25 ` Olivier Matz [this message]
2014-03-01 12:15   ` [dpdk-dev] [PATCH v2 11/11] testpmd: add several dump commands, useful for debug Olivier Matz
2014-04-10 14:08     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393608350-4431-12-git-send-email-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).