From patchwork Tue Sep 3 03:39:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiran Kumar Kokkilagadda X-Patchwork-Id: 58441 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18CE81C114; Tue, 3 Sep 2019 05:39:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 275B11C113 for ; Tue, 3 Sep 2019 05:39:47 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x833buw9008987; Mon, 2 Sep 2019 20:39:47 -0700 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=pfpt0818; bh=ElBwfJWs7VOFtIDmP3jxyeBhNqXtPwEUqDCLFfJpQFs=; b=W0URjFbKXFjtoQQovARxGxUxNm+axxaaEkKLXdm0t9seTosn6Sit4kw7ES5QH2WdZiws TH647hytk0xcDXQAPPyBHnVUAWWuMEdp3M42rNhOLC1Su2SjDLx6Y4plXe7rqID3B/jv Rkjrjkzt4+8Ooit6lejn/4Q+IU58LLWZUbyZJUD49lRlH+aFBv3DsJ+pvBD7MqoBTC5j xjoQO+fsYwmNQTRNaftmNLiYdljqyQRRItzeoqTCEVPaTImkHKYzaXnCIQOdq48Y0KPi sp7wBMIRe1grjC5aaKuN8KM9WA9l1QIAi8q0FvCZUUvaQN4+OqW7/c8ORLtSutwsyxqg Zg== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2uqp8p8kx2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 02 Sep 2019 20:39:47 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 2 Sep 2019 20:39:45 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 2 Sep 2019 20:39:45 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id D37263F703F; Mon, 2 Sep 2019 20:39:42 -0700 (PDT) From: To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic CC: , Kiran Kumar K Date: Tue, 3 Sep 2019 09:09:27 +0530 Message-ID: <20190903033928.26123-1-kirankumark@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-02_10:2019-08-29,2019-09-02 signatures=0 Subject: [dpdk-dev] [PATCH] app/test-pmd: add support for tx and rx desc statu X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Kiran Kumar K Adding support to check TX and RX descriptor status. Signed-off-by: Kiran Kumar K --- app/test-pmd/cmdline.c | 111 ++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++ 2 files changed, 119 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b6bc34b4d..c22d041c3 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -18728,6 +18728,115 @@ cmdline_parse_inst_t cmd_show_tx_metadata = { }, }; +/* *** display rx/tx descriptor status *** */ +struct cmd_show_rx_tx_desc_status_result { + cmdline_fixed_string_t cmd_show; + cmdline_fixed_string_t cmd_port; + cmdline_fixed_string_t cmd_keyword; + cmdline_fixed_string_t cmd_status; + portid_t cmd_pid; + portid_t cmd_qid; + portid_t cmd_did; +}; + +static void +cmd_show_rx_tx_desc_status_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_show_rx_tx_desc_status_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; + } + + if (!strcmp(res->cmd_keyword, "rx")) { + rc = rte_eth_rx_descriptor_status(res->cmd_pid, res->cmd_qid, + res->cmd_did); + if (rc < 0) { + printf("Invalid queueid = %d\n", res->cmd_qid); + return; + } + if (rc == RTE_ETH_RX_DESC_AVAIL) + printf("Desc status = AVAILABLE\n"); + else if (rc == RTE_ETH_RX_DESC_DONE) + printf("Desc status = DONE\n"); + else + printf("Desc status = UNAVAILABLE\n"); + } else if (!strcmp(res->cmd_keyword, "tx")) { + rc = rte_eth_tx_descriptor_status(res->cmd_pid, res->cmd_qid, + res->cmd_did); + if (rc < 0) { + printf("Invalid queueid = %d\n", res->cmd_qid); + return; + } + if (rc == RTE_ETH_TX_DESC_FULL) + printf("Desc status = FULL\n"); + else if (rc == RTE_ETH_TX_DESC_DONE) + printf("Desc status = DONE\n"); + else + printf("Desc status = UNAVAILABLE\n"); + } +} + +cmdline_parse_token_string_t cmd_show_rx_tx_desc_status_show = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_tx_desc_status_result, + cmd_show, "show"); +cmdline_parse_token_string_t cmd_show_rx_tx_desc_status_port = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_tx_desc_status_result, + cmd_port, "port"); +cmdline_parse_token_num_t cmd_show_rx_tx_desc_status_pid = + TOKEN_NUM_INITIALIZER(struct cmd_show_rx_tx_desc_status_result, + cmd_pid, UINT16); +cmdline_parse_token_string_t cmd_show_rx_desc_status_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_tx_desc_status_result, + cmd_keyword, "rx"); +cmdline_parse_token_string_t cmd_show_tx_desc_status_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_tx_desc_status_result, + cmd_keyword, "tx"); +cmdline_parse_token_string_t cmd_show_rx_tx_desc_status_status = + TOKEN_STRING_INITIALIZER(struct cmd_show_rx_tx_desc_status_result, + cmd_status, "status"); +cmdline_parse_token_num_t cmd_show_rx_tx_desc_status_qid = + TOKEN_NUM_INITIALIZER(struct cmd_show_rx_tx_desc_status_result, + cmd_qid, UINT16); +cmdline_parse_token_num_t cmd_show_rx_tx_desc_status_did = + TOKEN_NUM_INITIALIZER(struct cmd_show_rx_tx_desc_status_result, + cmd_did, UINT16); +cmdline_parse_inst_t cmd_show_rx_desc_status = { + .f = cmd_show_rx_tx_desc_status_parsed, + .data = NULL, + .help_str = "show port rx status", + .tokens = { + (void *)&cmd_show_rx_tx_desc_status_show, + (void *)&cmd_show_rx_tx_desc_status_port, + (void *)&cmd_show_rx_tx_desc_status_pid, + (void *)&cmd_show_rx_desc_status_keyword, + (void *)&cmd_show_rx_tx_desc_status_qid, + (void *)&cmd_show_rx_tx_desc_status_did, + (void *)&cmd_show_rx_tx_desc_status_status, + NULL, + }, +}; + +cmdline_parse_inst_t cmd_show_tx_desc_status = { + .f = cmd_show_rx_tx_desc_status_parsed, + .data = NULL, + .help_str = "show port tx status", + .tokens = { + (void *)&cmd_show_rx_tx_desc_status_show, + (void *)&cmd_show_rx_tx_desc_status_port, + (void *)&cmd_show_rx_tx_desc_status_pid, + (void *)&cmd_show_tx_desc_status_keyword, + (void *)&cmd_show_rx_tx_desc_status_qid, + (void *)&cmd_show_rx_tx_desc_status_did, + (void *)&cmd_show_rx_tx_desc_status_status, + NULL, + }, +}; + /* ******************************************************************************** */ /* list of instructions */ @@ -19016,6 +19125,8 @@ cmdline_parse_ctx_t main_ctx[] = { #endif (cmdline_parse_inst_t *)&cmd_config_tx_metadata_specific, (cmdline_parse_inst_t *)&cmd_show_tx_metadata, + (cmdline_parse_inst_t *)&cmd_show_rx_desc_status, + (cmdline_parse_inst_t *)&cmd_show_tx_desc_status, (cmdline_parse_inst_t *)&cmd_set_raw, NULL, }; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 67f4339ca..a708c5ccf 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -254,6 +254,14 @@ Display information for a given port's RX/TX queue:: testpmd> show (rxq|txq) info (port_id) (queue_id) +show desc status(rxq|txq) +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Display information for a given port's RX/TX descriptor status:: + + testpmd> show port (port_id) (rx|tx) (queue_id) (desc_id) status + + show config ~~~~~~~~~~~