DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCHv7 8/9] testpmd: add new command to display RX/TX queue information
Date: Tue, 27 Oct 2015 12:51:50 +0000	[thread overview]
Message-ID: <1445950311-20497-9-git-send-email-konstantin.ananyev@intel.com> (raw)
In-Reply-To: <1445950311-20497-1-git-send-email-konstantin.ananyev@intel.com>
In-Reply-To: <1445515592-25920-2-git-send-email-konstantin.ananyev@intel.com>

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 app/test-pmd/cmdline.c | 48 +++++++++++++++++++++++++++++++
 app/test-pmd/config.c  | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h |  2 ++
 3 files changed, 127 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..ea2b8a8 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5305,6 +5305,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 <port number> <queue_number>",
+	.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;
@@ -8910,6 +8957,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 cf2aa6e..aad2ab6 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -293,6 +293,69 @@ 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 information 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("\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 information 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("\n");
+}
+
+void
 port_infos_display(portid_t port_id)
 {
 	struct rte_port *port;
@@ -380,6 +443,20 @@ port_infos_display(portid_t port_id)
 			printf("  %s\n", (p ? p : "unknown"));
 		}
 	}
+
+	printf("Max possible RX queues: %u\n", dev_info.max_rx_queues);
+	printf("Max possible number of RXDs per queue: %hu\n",
+		dev_info.rx_desc_lim.nb_max);
+	printf("Min possible number of RXDs per queue: %hu\n",
+		dev_info.rx_desc_lim.nb_min);
+	printf("RXDs number alignment: %hu\n", dev_info.rx_desc_lim.nb_align);
+
+	printf("Max possible TX queues: %u\n", dev_info.max_tx_queues);
+	printf("Max possible number of TXDs per queue: %hu\n",
+		dev_info.tx_desc_lim.nb_max);
+	printf("Min possible number of TXDs per queue: %hu\n",
+		dev_info.tx_desc_lim.nb_min);
+	printf("TXDs number alignment: %hu\n", dev_info.tx_desc_lim.nb_align);
 }
 
 int
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index f925df7..5ea773f 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.5.3

  parent reply	other threads:[~2015-10-27 12:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22 12:06 [dpdk-dev] [PATCHv6 0/9] ethdev: add new API to retrieve " Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 1/9] " Konstantin Ananyev
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 0/9] " Konstantin Ananyev
2015-10-28  9:55     ` Remy Horton
2015-11-01 23:17       ` Thomas Monjalon
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 1/9] " Konstantin Ananyev
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 2/9] i40e: add support for eth_(rxq|txq)_info_get and (rx|tx)_desc_lim Konstantin Ananyev
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 3/9] ixgbe: " Konstantin Ananyev
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 4/9] e1000: " Konstantin Ananyev
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 5/9] fm10k: add HW specific desc_lim data into dev_info Konstantin Ananyev
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 6/9] cxgbe: " Konstantin Ananyev
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 7/9] vmxnet3: " Konstantin Ananyev
2015-10-31  8:54     ` Yong Wang
2015-11-02 10:33       ` Ananyev, Konstantin
2015-10-27 12:51   ` Konstantin Ananyev [this message]
2015-11-01 23:16     ` [dpdk-dev] [PATCHv7 8/9] testpmd: add new command to display RX/TX queue information Thomas Monjalon
2015-11-02 13:33       ` Ananyev, Konstantin
2015-10-27 12:51   ` [dpdk-dev] [PATCHv7 9/9] doc: release notes update for queue_info_get() and (rx|tx)_desc_limit Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 2/9] i40e: add support for eth_(rxq|txq)_info_get and (rx|tx)_desc_lim Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 3/9] ixgbe: " Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 4/9] e1000: " Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 5/9] fm10k: add HW specific desc_lim data into dev_info Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 6/9] cxgbe: " Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 7/9] vmxnet3: " Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 8/9] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
2015-10-22 12:06 ` [dpdk-dev] [PATCHv6 9/9] doc: release notes update for queue_info_get() Konstantin Ananyev

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=1445950311-20497-9-git-send-email-konstantin.ananyev@intel.com \
    --to=konstantin.ananyev@intel.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).