From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 68391439B5; Wed, 24 Jan 2024 13:19:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 578F9427E1; Wed, 24 Jan 2024 13:19:30 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 327D040294 for ; Wed, 24 Jan 2024 13:19:28 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O8DO3s001724; Wed, 24 Jan 2024 04:19:26 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= pfpt0220; bh=6dfPADSBMl2IkaptYK+uS0j+6Lxs89t2vlyhiq0cZvo=; b=VYG 7qcLB4eOReiz5JHSxpywSCyBuqIMiRFYnhfLZ9R1WeJJjFVXeYq0j5+egykFNeq7 sPKB6Gs9FoNhqiskAzTLYDKwNrPMKbq6YBRNjwiiQUlZYLMLa0LRuejtnkQLQjvW X/ikAz+G/t5fzscMpRfwU8uvSy7qy3gEbyNLxHe8c1PrQpKwhmCGvbaBFcdkr5Sj hrmJOzLsMXFOyM7cAO1DNjbBLZfyKJt5VOB+tXvzCfImAB0xEM/BcJ9+DVY6Fhs7 k89v6ODZA6tJI02qCi8hy0givu5a1vaknl7TT9tqndA3/UiwX31VY2B1ldoMNd4T EWiyppE6sCZKDykMV9A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vtxun8nwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 24 Jan 2024 04:19:26 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 24 Jan 2024 04:19:24 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 24 Jan 2024 04:19:24 -0800 Received: from Cavium-PET630-BM22.localdomain (unknown [10.28.34.26]) by maili.marvell.com (Postfix) with ESMTP id 31D683F704F; Wed, 24 Jan 2024 04:19:21 -0800 (PST) From: To: Aman Singh , Yuying Zhang CC: , , , Satha Rao Subject: [PATCH] app/testpmd: add command to get Tx queue used count Date: Wed, 24 Jan 2024 07:18:45 -0500 Message-ID: <1706098726-27359-1-git-send-email-skoteshwar@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: A7TCOPC6ULNFZUMyV5chs_oZwEz2mvIE X-Proofpoint-GUID: A7TCOPC6ULNFZUMyV5chs_oZwEz2mvIE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-24_06,2024-01-24_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Satha Rao Fastpath API to get txq used count. testpmd> show port 0 txq 0 desc count Signed-off-by: Satha Rao --- app/test-pmd/cmdline.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f704319..1d09633 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -12638,6 +12638,83 @@ struct cmd_show_port_supported_ptypes_result { }, }; +/* *** display tx queue desc used count *** */ +struct cmd_show_tx_queue_desc_count_result { + cmdline_fixed_string_t cmd_show; + cmdline_fixed_string_t cmd_port; + cmdline_fixed_string_t cmd_txq; + cmdline_fixed_string_t cmd_desc; + cmdline_fixed_string_t cmd_count; + portid_t cmd_pid; + portid_t cmd_qid; +}; + +static void +cmd_show_tx_queue_desc_count_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_show_tx_queue_desc_count_result *res = parsed_result; + int rc; + + 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); +} + +static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_show = + TOKEN_STRING_INITIALIZER + (struct cmd_show_tx_queue_desc_count_result, + cmd_show, "show"); +static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_port = + TOKEN_STRING_INITIALIZER + (struct cmd_show_tx_queue_desc_count_result, + cmd_port, "port"); +static cmdline_parse_token_num_t cmd_show_tx_queue_desc_count_pid = + TOKEN_NUM_INITIALIZER + (struct cmd_show_tx_queue_desc_count_result, + cmd_pid, RTE_UINT16); +static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_txq = + TOKEN_STRING_INITIALIZER + (struct cmd_show_tx_queue_desc_count_result, + cmd_txq, "txq"); +static cmdline_parse_token_num_t cmd_show_tx_queue_desc_count_qid = + TOKEN_NUM_INITIALIZER + (struct cmd_show_tx_queue_desc_count_result, + cmd_qid, RTE_UINT16); +static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_desc = + TOKEN_STRING_INITIALIZER + (struct cmd_show_tx_queue_desc_count_result, + cmd_desc, "desc"); +static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_count = + TOKEN_STRING_INITIALIZER + (struct cmd_show_tx_queue_desc_count_result, + cmd_count, "count"); +static cmdline_parse_inst_t cmd_show_tx_queue_desc_count = { + .f = cmd_show_tx_queue_desc_count_parsed, + .data = NULL, + .help_str = "show port txq desc count", + .tokens = { + (void *)&cmd_show_tx_queue_desc_count_show, + (void *)&cmd_show_tx_queue_desc_count_port, + (void *)&cmd_show_tx_queue_desc_count_pid, + (void *)&cmd_show_tx_queue_desc_count_txq, + (void *)&cmd_show_tx_queue_desc_count_qid, + (void *)&cmd_show_tx_queue_desc_count_desc, + (void *)&cmd_show_tx_queue_desc_count_count, + NULL, + }, +}; + /* *** display rx/tx descriptor status *** */ struct cmd_show_rx_tx_desc_status_result { cmdline_fixed_string_t cmd_show; @@ -13346,6 +13423,7 @@ struct cmd_config_tx_affinity_map { (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_tx_queue_desc_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, -- 1.8.3.1