From patchwork Thu Feb 1 13:52:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satha Koteswara Rao Kottidi X-Patchwork-Id: 136284 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B2E5243A3A; Thu, 1 Feb 2024 14:53:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A563F42E3D; Thu, 1 Feb 2024 14:53:00 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 3850140275 for ; Thu, 1 Feb 2024 14:52:59 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4119tpiw001682; Thu, 1 Feb 2024 05:52:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=pfpt0220; bh=VAPgLohIFYDaJ6O3iHcfh q4rEV87pCC8wLCgOR28OPQ=; b=ZZSxGPcLyHWWKgf9cCcLuprJGeHyBR1g/2d0r o+yclzW5ygYs8z2LN2voArr8DQ11u7f4aqQGiOo2OYLUIZ/L/NrfkWggLL4WCQwR jrVLQ53xFQplIPazFEPesaEsnp12PsD5aJQPnH5+rgFvNWPnIk3CWH0PuKCZkDNP 4O8M1ApOQLtA95y1U3UNSCYCy52IBJHDyoYtPookj/Q+gFNyLbtd+GA9+pQRT+J0 rX3VFSIFDuLFhMiCowNs5d+i4lE7eRTph15QXpixA9SKdSCGprbLtZ5W3GRnAFet wyoVcfYLbymXspC7hDFMwTcw2U0Y59Zl/NJuHo8tmTjUnrOdg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3w0937gnpp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 01 Feb 2024 05:52:56 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 1 Feb 2024 05:52:54 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 1 Feb 2024 05:52:54 -0800 Received: from Cavium-PET630-BM22.localdomain (unknown [10.28.34.26]) by maili.marvell.com (Postfix) with ESMTP id 787183F7092; Thu, 1 Feb 2024 05:52:52 -0800 (PST) From: To: Aman Singh , Yuying Zhang CC: , , , Satha Rao Subject: [PATCH v2] app/testpmd: command to get descriptor used count Date: Thu, 1 Feb 2024 08:52:42 -0500 Message-ID: <1706795562-7099-1-git-send-email-skoteshwar@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1706098726-27359-1-git-send-email-skoteshwar@marvell.com> References: <1706098726-27359-1-git-send-email-skoteshwar@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: R2iH-R-GpmpRXPsevu1aFBxR-FwV8eQJ X-Proofpoint-GUID: R2iH-R-GpmpRXPsevu1aFBxR-FwV8eQJ 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-02-01_02,2024-01-31_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 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 --- 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 app/test-pmd/cmdline.c | 184 +++++++++++--------- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +- 2 files changed, 104 insertions(+), 90 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f704319771..c8c88f3236 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -12638,6 +12638,104 @@ static cmdline_parse_inst_t cmd_show_port_supported_ptypes = { }, }; +/* *** 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_dir; + cmdline_fixed_string_t cmd_desc; + cmdline_fixed_string_t cmd_used; + cmdline_fixed_string_t cmd_count; + portid_t cmd_pid; + portid_t cmd_qid; +}; + +static void +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_tx_queue_desc_used_count_result *res = parsed_result; + int rc; + + 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; + } + 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); + } +} + +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_show = + TOKEN_STRING_INITIALIZER + (struct cmd_show_rx_tx_queue_desc_used_count_result, + cmd_show, "show"); +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_port = + TOKEN_STRING_INITIALIZER + (struct cmd_show_rx_tx_queue_desc_used_count_result, + cmd_port, "port"); +static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_pid = + TOKEN_NUM_INITIALIZER + (struct cmd_show_rx_tx_queue_desc_used_count_result, + cmd_pid, RTE_UINT16); +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_dir = + TOKEN_STRING_INITIALIZER + (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_tx_queue_desc_used_count_result, + cmd_qid, RTE_UINT16); +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_desc = + TOKEN_STRING_INITIALIZER + (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_tx_queue_desc_used_count_result, + cmd_count, "used"); +static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_count = + TOKEN_STRING_INITIALIZER + (struct cmd_show_rx_tx_queue_desc_used_count_result, + cmd_count, "count"); +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 rxq|txq desc used count", + .tokens = { + (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, + }, +}; + /* *** display rx/tx descriptor status *** */ struct cmd_show_rx_tx_desc_status_result { cmdline_fixed_string_t cmd_show; @@ -12745,90 +12843,6 @@ static cmdline_parse_inst_t cmd_show_rx_tx_desc_status = { }, }; -/* *** display rx queue desc used count *** */ -struct cmd_show_rx_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_desc; - cmdline_fixed_string_t cmd_used; - cmdline_fixed_string_t cmd_count; - portid_t cmd_pid; - portid_t cmd_qid; -}; - -static void -cmd_show_rx_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; - 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; - } - - 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; - } - printf("Used desc count = %d\n", rc); -} - -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_show = - TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, - cmd_show, "show"); -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_port = - TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, - cmd_port, "port"); -static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_pid = - TOKEN_NUM_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, - cmd_pid, RTE_UINT16); -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_rxq = - 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 = - TOKEN_NUM_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, - cmd_qid, RTE_UINT16); -static cmdline_parse_token_string_t cmd_show_rx_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 = - TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_queue_desc_used_count_result, - cmd_count, "used"); -static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_count = - TOKEN_STRING_INITIALIZER - (struct cmd_show_rx_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, - .data = NULL, - .help_str = "show port rxq 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, - NULL, - }, -}; - /* Common result structure for set port ptypes */ struct cmd_set_port_ptypes_result { cmdline_fixed_string_t set; @@ -13345,7 +13359,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = { (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 ab18a80b30..6369ee337e 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 ~~~~~~~~~~~