From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f179.google.com (mail-we0-f179.google.com [74.125.82.179]) by dpdk.org (Postfix) with ESMTP id EA45A6AA8 for ; Fri, 28 Feb 2014 18:24:59 +0100 (CET) Received: by mail-we0-f179.google.com with SMTP id x48so801779wes.38 for ; Fri, 28 Feb 2014 09:26:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EKys5bTEpWq0H+j0LioN6WPUKBVVXM2YvqfwE9W+YYo=; b=FdOSjPmEvNlIbK1TPjwV5C8iyhts6CMyD+XAMWT/5Dh7TOihxqRfc1cGou2fG3Db1o cqzcNgb9dv2hzTu7UBy3kdiQoedqMdL5NdmkJ9AgRE7rbzEl/FgmE0vO0usKXyBLm3gP H0lvYlRgEW4PbttfIRudPm/bJuLAhk6yq+Z2gQnS9VytKEwQYaG9e6Aj4wQlBViu3e9M IdFqk4hP8zVHTOwbYzdJF7oWiXJ80x582GZm5rlB146bTFfNUDtPvq4LfHy37ipDHiLA Nl/Ccgx5h4TleVbe3zYPCnISqN8yAXfrbJRvsNWpRtBixdj13QiQY1qWoQ+ij97J4FNU K/0Q== X-Gm-Message-State: ALoCoQnnF5SgJ9+lyjFSrLixMSWsynr3mjyQje2bvyiBYSgcBPuWTxQHBFOuT064q+BDlQvAEDS6 X-Received: by 10.195.13.234 with SMTP id fb10mr3922934wjd.50.1393608386915; Fri, 28 Feb 2014 09:26:26 -0800 (PST) Received: from glumotte.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id hy8sm5908439wjb.2.2014.02.28.09.26.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Feb 2014 09:26:26 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Fri, 28 Feb 2014 18:25:50 +0100 Message-Id: <1393608350-4431-12-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1393608350-4431-1-git-send-email-olivier.matz@6wind.com> References: <1393608350-4431-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH 11/11] testpmd: add several dump commands, useful for debug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Feb 2014 17:25:00 -0000 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 --- 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 #include #include +#include #include #include @@ -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 ", + .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