From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id CB4F5C35A for ; Mon, 20 Jul 2015 14:19:28 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 20 Jul 2015 05:19:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,507,1432623600"; d="scan'208";a="767620956" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 20 Jul 2015 05:19:27 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t6KCJQqQ022603; Mon, 20 Jul 2015 13:19:26 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t6KCJPUL006279; Mon, 20 Jul 2015 13:19:25 +0100 Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with id t6KCJPZW006275; Mon, 20 Jul 2015 13:19:25 +0100 From: Konstantin Ananyev To: dev@dpdk.org Date: Mon, 20 Jul 2015 13:19:10 +0100 Message-Id: <1437394750-5965-6-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1437394750-5965-1-git-send-email-konstantin.ananyev@intel.com> References: <1437394750-5965-1-git-send-email-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX queue information 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: Mon, 20 Jul 2015 12:19:29 -0000 Signed-off-by: Konstantin Ananyev --- app/test-pmd/cmdline.c | 48 ++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 2 ++ 3 files changed, 117 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 8ab4687..29180de 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -5304,6 +5304,53 @@ cmdline_parse_inst_t cmd_showport = { }, }; +/* *** SHOW QUEUE INFO *** */ +struct cmd_showqueue_result { + cmdline_fixed_string_t show; + cmdline_fixed_string_t type; + cmdline_fixed_string_t what; + uint8_t portnum; + uint16_t queuenum; +}; + +static void +cmd_showqueue_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_showqueue_result *res = parsed_result; + + if (!strcmp(res->type, "rxq")) + rx_queue_infos_display(res->portnum, res->queuenum); + else if (!strcmp(res->type, "txq")) + tx_queue_infos_display(res->portnum, res->queuenum); +} + +cmdline_parse_token_string_t cmd_showqueue_show = + TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, show, "show"); +cmdline_parse_token_string_t cmd_showqueue_type = + TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, type, "rxq#txq"); +cmdline_parse_token_string_t cmd_showqueue_what = + TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, what, "info"); +cmdline_parse_token_num_t cmd_showqueue_portnum = + TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result, portnum, UINT8); +cmdline_parse_token_num_t cmd_showqueue_queuenum = + TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result, queuenum, UINT16); + +cmdline_parse_inst_t cmd_showqueue = { + .f = cmd_showqueue_parsed, + .data = NULL, + .help_str = "show rxq|txq info ", + .tokens = { + (void *)&cmd_showqueue_show, + (void *)&cmd_showqueue_type, + (void *)&cmd_showqueue_what, + (void *)&cmd_showqueue_portnum, + (void *)&cmd_showqueue_queuenum, + NULL, + }, +}; + /* *** READ PORT REGISTER *** */ struct cmd_read_reg_result { cmdline_fixed_string_t read; @@ -8913,6 +8960,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_help_long, (cmdline_parse_inst_t *)&cmd_quit, (cmdline_parse_inst_t *)&cmd_showport, + (cmdline_parse_inst_t *)&cmd_showqueue, (cmdline_parse_inst_t *)&cmd_showportall, (cmdline_parse_inst_t *)&cmd_showcfg, (cmdline_parse_inst_t *)&cmd_start, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 1d29146..f1fd6b1 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -293,6 +293,73 @@ nic_stats_mapping_display(portid_t port_id) } void +rx_queue_infos_display(portid_t port_id, uint16_t queue_id) +{ + struct rte_eth_rxq_info qinfo; + int32_t rc; + static const char *info_border = "*********************"; + + rc = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo); + if (rc != 0) { + printf("Failed to retrieve inforamtion for port: %hhu, " + "RX queue: %hu\nerror desc: %s(%d)\n", + port_id, queue_id, strerror(-rc), rc); + return; + } + + printf("\n%s Infos for port %-2u, RX queue %-2u %s", + info_border, port_id, queue_id, info_border); + + printf("\nMempool: %s", (qinfo.mp == NULL) ? "NULL" : qinfo.mp->name); + printf("\nRX prefetch threshold: %hhu", qinfo.conf.rx_thresh.pthresh); + printf("\nRX host threshold: %hhu", qinfo.conf.rx_thresh.hthresh); + printf("\nRX writeback threshold: %hhu", qinfo.conf.rx_thresh.wthresh); + printf("\nRX free threshold: %hu", qinfo.conf.rx_free_thresh); + printf("\nRX drop packets: %s", + (qinfo.conf.rx_drop_en != 0) ? "on" : "off"); + printf("\nRX deferred start: %s", + (qinfo.conf.rx_deferred_start != 0) ? "on" : "off"); + printf("\nRX scattered packets: %s", + (qinfo.scattered_rx != 0) ? "on" : "off"); + printf("\nNumber of RXDs: %hu", qinfo.nb_desc); + printf("\nMax possible number of RXDs: %hu", qinfo.max_desc); + printf("\nMin possible number of RXDs: %hu", qinfo.min_desc); + printf("\n"); +} + +void +tx_queue_infos_display(portid_t port_id, uint16_t queue_id) +{ + struct rte_eth_txq_info qinfo; + int32_t rc; + static const char *info_border = "*********************"; + + rc = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo); + if (rc != 0) { + printf("Failed to retrieve inforamtion for port: %hhu, " + "TX queue: %hu\nerror desc: %s(%d)\n", + port_id, queue_id, strerror(-rc), rc); + return; + } + + printf("\n%s Infos for port %-2u, TX queue %-2u %s", + info_border, port_id, queue_id, info_border); + + printf("\nTX prefetch threshold: %hhu", qinfo.conf.tx_thresh.pthresh); + printf("\nTX host threshold: %hhu", qinfo.conf.tx_thresh.hthresh); + printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh); + printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh); + printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh); + printf("\nTX flags: %#x", qinfo.conf.txq_flags); + printf("\nTX deferred start: %s", + (qinfo.conf.tx_deferred_start != 0) ? "on" : "off"); + printf("\nNumber of TXDs: %hu", qinfo.nb_desc); + printf("\nMax possible number of TXDs: %hu", qinfo.max_desc); + printf("\nMin possible number of TXDs: %hu", qinfo.min_desc); + printf("\n"); +} + +void port_infos_display(portid_t port_id) { struct rte_port *port; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index e91e077..a41f51a 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -479,6 +479,8 @@ void nic_xstats_display(portid_t port_id); void nic_xstats_clear(portid_t port_id); void nic_stats_mapping_display(portid_t port_id); void port_infos_display(portid_t port_id); +void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id); +void tx_queue_infos_display(portid_t port_idi, uint16_t queue_id); void fwd_lcores_config_display(void); void fwd_config_display(void); void rxtx_config_display(void); -- 1.8.3.1