From patchwork Thu Jan 10 21:36:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Varghese, Vipin" X-Patchwork-Id: 49616 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 026B31B90C; Thu, 10 Jan 2019 16:40:13 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 804791B923 for ; Thu, 10 Jan 2019 16:40:11 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 07:40:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,461,1539673200"; d="scan'208";a="309300757" Received: from unknown (HELO saesrv02-S2600CWR.intel.com) ([10.224.122.203]) by fmsmga006.fm.intel.com with ESMTP; 10 Jan 2019 07:40:08 -0800 From: Vipin Varghese To: dev@dpdk.org, thomas@monjalon.net, john.mcnamara@intel.com Cc: konstantin.ananyev@intel.com, stephen@networkplumber.org, reshma.pattan@intel.com, jasvinder.singh@intel.com, stephen1.byrne@intel.com, amol.patel@intel.com, Vipin Varghese Date: Fri, 11 Jan 2019 03:06:43 +0530 Message-Id: <20190110213645.29901-5-vipin.varghese@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110213645.29901-1-vipin.varghese@intel.com> References: <20190107153829.34047-2-vipin.varghese@intel.com> <20190110213645.29901-1-vipin.varghese@intel.com> Subject: [dpdk-dev] [PATCH v9 4/6] app/procinfo: add support for debug ring X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Function show_ring is used for displaying information of RING instance of the primary process. Signed-off-by: Vipin Varghese Acked-by: Reshma Pattan Acked-by: John McNamara --- app/proc-info/main.c | 52 +++++++++++++++++++++++++++++++++- doc/guides/tools/proc_info.rst | 8 +++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 4f625a371..ed136d828 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -82,6 +82,9 @@ static uint32_t enable_shw_port; static uint32_t enable_shw_tm; /**< Enable show crypto. */ static uint32_t enable_shw_crypto; +/**< Enable show ring. */ +static uint32_t enable_shw_ring; +static char *ring_name; /**< display usage */ static void @@ -104,7 +107,8 @@ proc_info_usage(const char *prgname) " --host-id STRING: host id used to identify the system process is running on\n" " --show-port: to display ports information\n" " --show-tm: to display traffic manager information for ports\n" - " --show-crypto: to display crypto information\n", + " --show-crypto: to display crypto information\n" + " --show-ring[=name]: to display ring information\n", prgname); } @@ -214,6 +218,7 @@ proc_info_parse_args(int argc, char **argv) {"show-port", 0, NULL, 0}, {"show-tm", 0, NULL, 0}, {"show-crypto", 0, NULL, 0}, + {"show-ring", optional_argument, NULL, 0}, {NULL, 0, 0, 0} }; @@ -266,6 +271,11 @@ proc_info_parse_args(int argc, char **argv) else if (!strncmp(long_option[option_index].name, "show-crypto", MAX_LONG_OPT_SZ)) enable_shw_crypto = 1; + else if (!strncmp(long_option[option_index].name, + "show-ring", MAX_LONG_OPT_SZ)) { + enable_shw_ring = 1; + ring_name = optarg; + } break; case 1: /* Print xstat single value given by name*/ @@ -1070,6 +1080,44 @@ show_crypto(void) STATS_BDR_STR(50, ""); } +static void +show_ring(char *name) +{ + snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64, + rte_get_tsc_hz()); + STATS_BDR_STR(10, bdr_str); + + if (name != NULL) { + struct rte_ring *ptr = rte_ring_lookup(name); + if (ptr != NULL) { + printf(" - Name (%s) on socket (%d)\n" + " - flags:\n" + "\t -- Single Producer Enqueue (%u)\n" + "\t -- Single Consmer Dequeue (%u)\n", + ptr->name, + ptr->memzone->socket_id, + ptr->flags & RING_F_SP_ENQ, + ptr->flags & RING_F_SC_DEQ); + printf(" - size (%u) mask (0x%x) capacity (%u)\n", + ptr->size, + ptr->mask, + ptr->capacity); + printf(" - count (%u) free count (%u)\n", + rte_ring_count(ptr), + rte_ring_free_count(ptr)); + printf(" - full (%d) empty (%d)\n", + rte_ring_full(ptr), + rte_ring_empty(ptr)); + + STATS_BDR_STR(50, ""); + return; + } + } + + rte_ring_list_dump(stdout); + STATS_BDR_STR(50, ""); +} + int main(int argc, char **argv) { @@ -1157,6 +1205,8 @@ main(int argc, char **argv) show_tm(); if (enable_shw_crypto) show_crypto(); + if (enable_shw_ring) + show_ring(ring_name); ret = rte_eal_cleanup(); if (ret) diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst index 883864d18..ba5c3dbd1 100644 --- a/doc/guides/tools/proc_info.rst +++ b/doc/guides/tools/proc_info.rst @@ -18,7 +18,8 @@ The application has a number of command line options: .. code-block:: console ./$(RTE_TARGET)/app/dpdk-procinfo -- -m | [-p PORTMASK] [--stats | --xstats | - --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto ] + --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto | + --show-ring[=name] ] Parameters ~~~~~~~~~~ @@ -54,6 +55,11 @@ configurations and statistics. The show-crypto parameter displays available cryptodev configurations, settings and stats per node. +**--show-ring[=name]** +The show-ring pararmeter display current allocation of all ring with +debug information. Specifying the name allows to display details for specific +ring. For invalid or no ring name, whole list is dump. + Limitations -----------