From: Satha Rao <skotesh...@marvell.com> Existing Rx desc used count command extended to get Tx queue used count. testpmd> show port 0 rxq 0 desc used count testpmd> show port 0 txq 0 desc used count
Signed-off-by: Satha Rao <skotesh...@marvell.com> --- Depends-on: series-30833 ("ethdev: support Tx queue used count") v2: extended rx_queue_desc_used_count command to support Tx updated testpmd_app_ug with new command v3: Updated help string, log message as per review comments app/test-pmd/cmdline.c | 116 ++++++++++++++++------------ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +-- 2 files changed, 70 insertions(+), 56 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f704319..d8ea2b7 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -237,9 +237,8 @@ static void cmd_help_long_parsed(void *parsed_result, "show port (port_id) rxq|txq (queue_id) desc (desc_id) status" " Show status of rx|tx descriptor.\n\n" - "show port (port_id) rxq (queue_id) desc used count\n" - " Show current number of filled receive" - " packet descriptors.\n\n" + "show port (port_id) rxq|txq (queue_id) desc used count\n" + " Show current number of used descriptor count for rx|tx.\n\n" "show port (port_id) macs|mcast_macs" " Display list of mac addresses added to port.\n\n" @@ -12745,11 +12744,11 @@ struct cmd_show_rx_tx_desc_status_result { }, }; -/* *** display rx queue desc used count *** */ -struct cmd_show_rx_queue_desc_used_count_result { +/* *** display rx/tx queue descriptor used count *** */ +struct cmd_show_rx_tx_queue_desc_used_count_result { cmdline_fixed_string_t cmd_show; cmdline_fixed_string_t cmd_port; - cmdline_fixed_string_t cmd_rxq; + cmdline_fixed_string_t cmd_dir; cmdline_fixed_string_t cmd_desc; cmdline_fixed_string_t cmd_used; cmdline_fixed_string_t cmd_count; @@ -12758,73 +12757,88 @@ struct cmd_show_rx_queue_desc_used_count_result { }; static void -cmd_show_rx_queue_desc_used_count_parsed(void *parsed_result, - __rte_unused struct cmdline *cl, - __rte_unused void *data) +cmd_show_rx_tx_queue_desc_used_count_parsed(void *parsed_result, __rte_unused struct cmdline *cl, + __rte_unused void *data) { - struct cmd_show_rx_queue_desc_used_count_result *res = parsed_result; + struct cmd_show_rx_tx_queue_desc_used_count_result *res = parsed_result; int rc; - if (rte_eth_rx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) { - fprintf(stderr, - "Invalid input: port id = %d, queue id = %d\n", - res->cmd_pid, res->cmd_qid); - return; - } + if (!strcmp(res->cmd_dir, "rxq")) { + if (rte_eth_rx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) { + fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n", + res->cmd_pid, res->cmd_qid); + return; + } - rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid); - if (rc < 0) { - fprintf(stderr, "Invalid queueid = %d\n", res->cmd_qid); - return; + rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid); + if (rc < 0) { + fprintf(stderr, "Rx queue count get failed rc=%d queue_id=%d\n", rc, + res->cmd_qid); + return; + } + printf("RxQ %d used desc count = %d\n", res->cmd_qid, rc); + } else if (!strcmp(res->cmd_dir, "txq")) { + if (rte_eth_tx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) { + fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n", + res->cmd_pid, res->cmd_qid); + return; + } + + rc = rte_eth_tx_queue_count(res->cmd_pid, res->cmd_qid); + if (rc < 0) { + fprintf(stderr, "Tx queue count get failed rc=%d queue_id=%d\n", rc, + res->cmd_qid); + return; + } + printf("TxQ %d used desc count = %d\n", res->cmd_qid, rc); } - printf("Used desc count = %d\n", rc); } -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_show = +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_show = TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, + (struct cmd_show_rx_tx_queue_desc_used_count_result, cmd_show, "show"); -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_port = +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_port = TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, + (struct cmd_show_rx_tx_queue_desc_used_count_result, cmd_port, "port"); -static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_pid = +static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_pid = TOKEN_NUM_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, + (struct cmd_show_rx_tx_queue_desc_used_count_result, cmd_pid, RTE_UINT16); -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_rxq = +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_dir = TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, - cmd_rxq, "rxq"); -static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_qid = + (struct cmd_show_rx_tx_queue_desc_used_count_result, + cmd_dir, "rxq#txq"); +static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_qid = TOKEN_NUM_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, + (struct cmd_show_rx_tx_queue_desc_used_count_result, cmd_qid, RTE_UINT16); -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_desc = +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_desc = TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, - cmd_count, "desc"); -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_used = + (struct cmd_show_rx_tx_queue_desc_used_count_result, + cmd_desc, "desc"); +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_used = TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, + (struct cmd_show_rx_tx_queue_desc_used_count_result, cmd_count, "used"); -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_count = +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_count = TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, + (struct cmd_show_rx_tx_queue_desc_used_count_result, cmd_count, "count"); -static cmdline_parse_inst_t cmd_show_rx_queue_desc_used_count = { - .f = cmd_show_rx_queue_desc_used_count_parsed, +static cmdline_parse_inst_t cmd_show_rx_tx_queue_desc_used_count = { + .f = cmd_show_rx_tx_queue_desc_used_count_parsed, .data = NULL, - .help_str = "show port <port_id> rxq <queue_id> desc used count", + .help_str = "show port <port_id> rxq|txq <queue_id> desc used count", .tokens = { - (void *)&cmd_show_rx_queue_desc_used_count_show, - (void *)&cmd_show_rx_queue_desc_used_count_port, - (void *)&cmd_show_rx_queue_desc_used_count_pid, - (void *)&cmd_show_rx_queue_desc_used_count_rxq, - (void *)&cmd_show_rx_queue_desc_used_count_qid, - (void *)&cmd_show_rx_queue_desc_used_count_desc, - (void *)&cmd_show_rx_queue_desc_used_count_used, - (void *)&cmd_show_rx_queue_desc_used_count_count, + (void *)&cmd_show_rx_tx_queue_desc_used_count_show, + (void *)&cmd_show_rx_tx_queue_desc_used_count_port, + (void *)&cmd_show_rx_tx_queue_desc_used_count_pid, + (void *)&cmd_show_rx_tx_queue_desc_used_count_dir, + (void *)&cmd_show_rx_tx_queue_desc_used_count_qid, + (void *)&cmd_show_rx_tx_queue_desc_used_count_desc, + (void *)&cmd_show_rx_tx_queue_desc_used_count_used, + (void *)&cmd_show_rx_tx_queue_desc_used_count_count, NULL, }, }; @@ -13345,7 +13359,7 @@ struct cmd_config_tx_affinity_map { (cmdline_parse_inst_t *)&cmd_config_tx_metadata_specific, (cmdline_parse_inst_t *)&cmd_show_tx_metadata, (cmdline_parse_inst_t *)&cmd_show_rx_tx_desc_status, - (cmdline_parse_inst_t *)&cmd_show_rx_queue_desc_used_count, + (cmdline_parse_inst_t *)&cmd_show_rx_tx_queue_desc_used_count, (cmdline_parse_inst_t *)&cmd_set_raw, (cmdline_parse_inst_t *)&cmd_show_set_raw, (cmdline_parse_inst_t *)&cmd_show_set_raw_all, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 53923ad..468f70b 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -264,13 +264,13 @@ Display information for a given port's RX/TX descriptor status:: testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status -show rxq desc used count -~~~~~~~~~~~~~~~~~~~~~~~~ +show desc used count(rxq|txq) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Display the number of receive packet descriptors currently filled by hardware -and ready to be processed by the driver on a given RX queue:: +Display the number of packet descriptors currently used by hardware for a given +port's RX/TX queue:: - testpmd> show port (port_id) rxq (queue_id) desc used count + testpmd> show port (port_id) (rxq|txq) (queue_id) desc used count show config ~~~~~~~~~~~ -- 1.8.3.1