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 59C32439C1; Thu, 25 Jan 2024 14:01:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B674402AB; Thu, 25 Jan 2024 14:01:07 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2E3FC4029B for ; Thu, 25 Jan 2024 14:01:05 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4TLLWz2jn8zsWKh; Thu, 25 Jan 2024 20:59:59 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id A6329140410; Thu, 25 Jan 2024 21:01:03 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 25 Jan 2024 21:01:03 +0800 Subject: Re: [PATCH] app/testpmd: add command to get Tx queue used count To: , Aman Singh , Yuying Zhang CC: , , References: <1706098726-27359-1-git-send-email-skoteshwar@marvell.com> From: fengchengwen Message-ID: <2cdbe198-a099-c188-5984-fe839f4d0ddf@huawei.com> Date: Thu, 25 Jan 2024 21:01:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <1706098726-27359-1-git-send-email-skoteshwar@marvell.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) 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 Please doc this command in doc/guides/testpmd_app_ug/testpmd_funcs.rst Also why not extend "show port rxq xxx" command to support txq ? On 2024/1/24 20:18, skoteshwar@marvell.com wrote: > 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, >