From patchwork Thu Feb 11 19:44:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Richardson X-Patchwork-Id: 87878 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 A07C7A0547; Thu, 11 Feb 2021 20:44:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F4EE22A244; Thu, 11 Feb 2021 20:44:48 +0100 (CET) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mails.dpdk.org (Postfix) with ESMTP id 9367B40147 for ; Thu, 11 Feb 2021 20:44:47 +0100 (CET) Received: by mail-pj1-f44.google.com with SMTP id d2so4021801pjs.4 for ; Thu, 11 Feb 2021 11:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:mime-version; bh=5ZvMeAFGtbwOQ4c+xtzOsrx/OvWy+3JHAqU1qkMdCSg=; b=g67jKvs+220uNWb40zFllB/Gqmz1f2ZCRY+yNDnrWrdHYMc81wSS7YkySzF/8s4txr a+JVCZXQJvcAGDIMA7DMawK3BPPUKjsFuu4pJXjER8uwo2pZXeUQFnuADzEBLvG7c1/3 JU1D6VOF186DCaIy/HsXzqr+foaVTCSfRlST8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=5ZvMeAFGtbwOQ4c+xtzOsrx/OvWy+3JHAqU1qkMdCSg=; b=HaTgp3N6tcrrO3A6n0PLQPp+O7h0xpoTTdVJRUTG3mlyMme3pQD15PhVCINBnvBunv cm+ykQ+uPFRuC5nM5GPcrFFvvqpq/1HSsHtV054CzIMJyTAcJ48kVpBEITslPOIyFTBK tBjAv8fskIZkfB0HuDOoq8x1eqRiKLkcVU2UHjzye2DrwSDbuGPhpmm+dkdrUi7pR1Ub whKQ7dnj9L9u7wUASZOnHxXn/vemry/FFZNxFHOf9jSY7W2YTb8ELCiQORarz2KnXQPr JS2HZ2BXLQ2N4E65TN58rP9g76AN0iVWbbN7jvES9n40E5Iwn301tdhjF54QEf4+nYWQ qE6Q== X-Gm-Message-State: AOAM532NxPTAja1a85rwhYzpt2hireV4ozN47g4PivvS5/VyKQcY4Bb/ sZDuTt+yene1pnjnBmav/SMhAQ== X-Google-Smtp-Source: ABdhPJwlHZmIzUvC1Y1xOiPcLSdXv4ii4Oyy3+hES8GmrIQpM6CpCyPQvjX/Mjxhv+EjLk80TEMGPA== X-Received: by 2002:a17:90a:e508:: with SMTP id t8mr5462025pjy.106.1613072686647; Thu, 11 Feb 2021 11:44:46 -0800 (PST) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id g65sm6281041pfb.20.2021.02.11.11.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 11:44:42 -0800 (PST) From: Lance Richardson To: Xiaoyun Li Cc: dev@dpdk.org Date: Thu, 11 Feb 2021 14:44:34 -0500 Message-Id: <20210211194434.172212-1-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count 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 Sender: "dev" Add support for querying receive queue count in order to allow the rte_eth_dev rx_queue_count() API to be exercised and tested. Signed-off-by: Lance Richardson --- app/test-pmd/cmdline.c | 65 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 ++ 2 files changed, 71 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 59722d268..6e2fe57a6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16699,6 +16699,70 @@ cmdline_parse_inst_t cmd_show_rx_tx_desc_status = { }, }; +/* *** display rx queue count *** */ +struct cmd_show_rx_queue_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_count; + portid_t cmd_pid; + portid_t cmd_qid; +}; + +static void +cmd_show_rx_queue_count_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_show_rx_queue_count_result *res = parsed_result; + int rc; + + if (!rte_eth_dev_is_valid_port(res->cmd_pid)) { + printf("invalid port id %u\n", res->cmd_pid); + return; + } + + rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid); + if (rc < 0) { + printf("Invalid queueid = %d\n", res->cmd_qid); + return; + } + printf("Used desc count = %d\n", rc); +} + +cmdline_parse_token_string_t cmd_show_rx_queue_count_show = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_queue_count_result, + cmd_show, "show"); +cmdline_parse_token_string_t cmd_show_rx_queue_count_port = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_queue_count_result, + cmd_port, "port"); +cmdline_parse_token_num_t cmd_show_rx_queue_count_pid = + TOKEN_NUM_INITIALIZER(struct cmd_show_rx_queue_count_result, + cmd_pid, RTE_UINT16); +cmdline_parse_token_string_t cmd_show_rx_queue_count_rxq = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_queue_count_result, + cmd_rxq, "rxq"); +cmdline_parse_token_num_t cmd_show_rx_queue_count_qid = + TOKEN_NUM_INITIALIZER(struct cmd_show_rx_queue_count_result, + cmd_qid, RTE_UINT16); +cmdline_parse_token_string_t cmd_show_rx_queue_count_count = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_queue_count_result, + cmd_count, "count"); +cmdline_parse_inst_t cmd_show_rx_queue_count = { + .f = cmd_show_rx_queue_count_parsed, + .data = NULL, + .help_str = "show port rxq count", + .tokens = { + (void *)&cmd_show_rx_queue_count_show, + (void *)&cmd_show_rx_queue_count_port, + (void *)&cmd_show_rx_queue_count_pid, + (void *)&cmd_show_rx_queue_count_rxq, + (void *)&cmd_show_rx_queue_count_qid, + (void *)&cmd_show_rx_queue_count_count, + NULL, + }, +}; + /* Common result structure for set port ptypes */ struct cmd_set_port_ptypes_result { cmdline_fixed_string_t set; @@ -17098,6 +17162,7 @@ cmdline_parse_ctx_t main_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_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 a45910b81..789ee7d27 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -266,6 +266,12 @@ 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 count +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Display the number of ready descriptors on a given RX queue:: + + testpmd> show port (port_id) rxq (queue_id) count show config ~~~~~~~~~~~