From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id DE7F08E8C for ; Sat, 31 Oct 2015 16:58:07 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 31 Oct 2015 08:58:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,224,1444719600"; d="scan'208";a="591622764" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 31 Oct 2015 08:58:01 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t9VFvu4G001295; Sat, 31 Oct 2015 23:57:56 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t9VFvrwG029724; Sat, 31 Oct 2015 23:57:55 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t9VFvqWU029720; Sat, 31 Oct 2015 23:57:52 +0800 From: Jingjing Wu To: dev@dpdk.org Date: Sat, 31 Oct 2015 23:57:31 +0800 Message-Id: <1446307051-29283-10-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1446307051-29283-1-git-send-email-jingjing.wu@intel.com> References: <1446108827-7907-1-git-send-email-jingjing.wu@intel.com> <1446307051-29283-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH v3 9/9] app/testpmd: add command to display DCB info 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: Sat, 31 Oct 2015 15:58:08 -0000 This patch adds a command to display DCB info in ports. Signed-off-by: Jingjing Wu --- app/test-pmd/cmdline.c | 15 ++++++---- app/test-pmd/config.c | 43 +++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 ++++---- 4 files changed, 61 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0254628..410f149 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -182,7 +182,7 @@ static void cmd_help_long_parsed(void *parsed_result, "Display:\n" "--------\n\n" - "show port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\n" + "show port (info|stats|xstats|fdir|stat_qmap|dcb_tc) (port_id|all)\n" " Display information for port_id, or all.\n\n" "show port X rss reta (size) (mask0,mask1,...)\n" @@ -5235,6 +5235,9 @@ static void cmd_showportall_parsed(void *parsed_result, else if (!strcmp(res->what, "stat_qmap")) FOREACH_PORT(i, ports) nic_stats_mapping_display(i); + else if (!strcmp(res->what, "dcb_tc")) + FOREACH_PORT(i, ports) + port_dcb_info_display(i); } cmdline_parse_token_string_t cmd_showportall_show = @@ -5244,13 +5247,13 @@ cmdline_parse_token_string_t cmd_showportall_port = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port"); cmdline_parse_token_string_t cmd_showportall_what = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what, - "info#stats#xstats#fdir#stat_qmap"); + "info#stats#xstats#fdir#stat_qmap#dcb_tc"); cmdline_parse_token_string_t cmd_showportall_all = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all"); cmdline_parse_inst_t cmd_showportall = { .f = cmd_showportall_parsed, .data = NULL, - .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap all", + .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all", .tokens = { (void *)&cmd_showportall_show, (void *)&cmd_showportall_port, @@ -5288,6 +5291,8 @@ static void cmd_showport_parsed(void *parsed_result, fdir_get_infos(res->portnum); else if (!strcmp(res->what, "stat_qmap")) nic_stats_mapping_display(res->portnum); + else if (!strcmp(res->what, "dcb_tc")) + port_dcb_info_display(res->portnum); } cmdline_parse_token_string_t cmd_showport_show = @@ -5297,14 +5302,14 @@ cmdline_parse_token_string_t cmd_showport_port = TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port"); cmdline_parse_token_string_t cmd_showport_what = TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what, - "info#stats#xstats#fdir#stat_qmap"); + "info#stats#xstats#fdir#stat_qmap#dcb_tc"); cmdline_parse_token_num_t cmd_showport_portnum = TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT8); cmdline_parse_inst_t cmd_showport = { .f = cmd_showport_parsed, .data = NULL, - .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap X (X = port number)", + .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X (X = port number)", .tokens = { (void *)&cmd_showport_show, (void *)&cmd_showport_port, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ef87581..1b0d5d5 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2285,3 +2285,46 @@ mcast_addr_remove(uint8_t port_id, struct ether_addr *mc_addr) mcast_addr_pool_remove(port, i); eth_port_multicast_addr_list_set(port_id); } + +void +port_dcb_info_display(uint8_t port_id) +{ + struct rte_eth_dcb_info dcb_info; + uint16_t i; + int ret; + static const char *border = "================"; + + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info); + if (ret) { + printf("\n Failed to get dcb infos on port %-2d\n", + port_id); + return; + } + printf("\n %s DCB infos for port %-2d %s\n", border, port_id, border); + printf(" TC NUMBER: %d\n", dcb_info.nb_tcs); + printf("\n TC : "); + for (i = 0; i < dcb_info.nb_tcs; i++) + printf("\t%4d", i); + printf("\n Priority : "); + for (i = 0; i < dcb_info.nb_tcs; i++) + printf("\t%4d", dcb_info.prio_tc[i]); + printf("\n BW percent :"); + for (i = 0; i < dcb_info.nb_tcs; i++) + printf("\t%4d%%", dcb_info.tc_bws[i]); + printf("\n RXQ base : "); + for (i = 0; i < dcb_info.nb_tcs; i++) + printf("\t%4d", dcb_info.tc_queue.tc_rxq[0][i].base); + printf("\n RXQ number :"); + for (i = 0; i < dcb_info.nb_tcs; i++) + printf("\t%4d", dcb_info.tc_queue.tc_rxq[0][i].nb_queue); + printf("\n TXQ base : "); + for (i = 0; i < dcb_info.nb_tcs; i++) + printf("\t%4d", dcb_info.tc_queue.tc_txq[0][i].base); + printf("\n TXQ number :"); + for (i = 0; i < dcb_info.nb_tcs; i++) + printf("\t%4d", dcb_info.tc_queue.tc_txq[0][i].nb_queue); + printf("\n"); +} diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3661755..ecb411d 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -557,6 +557,7 @@ int tx_queue_id_is_invalid(queueid_t txq_id); /* Functions to manage the set of filtered Multicast MAC addresses */ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr); void mcast_addr_remove(uint8_t port_id, struct ether_addr *mc_addr); +void port_dcb_info_display(uint8_t port_id); enum print_warning { ENABLED_WARN = 0, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 71d831b..b7659d0 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -50,10 +50,10 @@ If you type a partial command and hit ```` you get a list of the available testpmd> show port - info [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap X - info [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap all - stats [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap X - stats [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap all + info [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap|dcb_tc X + info [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap|dcb_tc all + stats [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap|dcb_tc X + stats [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap|dcb_tc all ... @@ -128,7 +128,7 @@ show port Display information for a given port or all ports:: - testpmd> show port (info|stats|fdir|stat_qmap) (port_id|all) + testpmd> show port (info|stats|fdir|stat_qmap|dcb_tc) (port_id|all) The available information categories are: @@ -140,6 +140,8 @@ The available information categories are: * ``stat_qmap``: Queue statistics mapping. +* ``dcb_tc``: DCB information such as TC mapping. + For example: .. code-block:: console -- 2.4.0