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 2EA0A41E28; Tue, 14 Mar 2023 12:57:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CB9D40F18; Tue, 14 Mar 2023 12:57:12 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 01A0640A7E for ; Tue, 14 Mar 2023 12:57:10 +0100 (CET) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PbX4M1TRmznX20; Tue, 14 Mar 2023 19:54:11 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) 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.21; Tue, 14 Mar 2023 19:57:07 +0800 From: Chengwen Feng To: , , Aman Singh , Yuying Zhang CC: Subject: [PATCH] app/testpmd: support dump ethdev private cmd Date: Tue, 14 Mar 2023 11:50:35 +0000 Message-ID: <20230314115035.33356-1-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 This patch adds 'dump_eth_priv [port_id]' which could used to dump the specific ethdev port private info. Signed-off-by: Chengwen Feng --- app/test-pmd/cmdline.c | 43 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++++ 2 files changed, 50 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6fa870dc32..3ac7e78aff 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -8439,6 +8439,48 @@ static cmdline_parse_inst_t cmd_dump_one = { }, }; +/* ******************************************************************************** */ + +struct cmd_dump_eth_priv_result { + cmdline_fixed_string_t dump; + portid_t port_id; +}; + +static cmdline_parse_token_string_t cmd_dump_eth_priv_dump = + TOKEN_STRING_INITIALIZER(struct cmd_dump_one_result, dump, + "dump_eth_priv"); +static cmdline_parse_token_num_t cmd_dump_eth_priv_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_dump_eth_priv_result, + port_id, RTE_UINT16); + +static void cmd_dump_eth_priv_parsed(void *parsed_result, struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_dump_eth_priv_result *res = parsed_result; + int ret; + + if (!rte_eth_dev_is_valid_port(res->port_id)) { + cmdline_printf(cl, "Invalid port id %u\n", res->port_id); + return; + } + + ret = rte_eth_dev_priv_dump(res->port_id, stdout); + if (ret < 0) + cmdline_printf(cl, "Failed to dump port id %u private info with error (%d): %s\n", + res->port_id, ret, strerror(-ret)); +} + +static cmdline_parse_inst_t cmd_dump_eth_priv = { + .f = cmd_dump_eth_priv_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = "dump_eth_priv : Dump one ethdev port private info", + .tokens = { /* token list, NULL terminated */ + (void *)&cmd_dump_eth_priv_dump, + (void *)&cmd_dump_eth_priv_port_id, + NULL, + }, +}; + /* *** Filters Control *** */ #define IPV4_ADDR_TO_UINT(ip_addr, ip) \ @@ -12854,6 +12896,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = { (cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs, (cmdline_parse_inst_t *)&cmd_dump, (cmdline_parse_inst_t *)&cmd_dump_one, + (cmdline_parse_inst_t *)&cmd_dump_eth_priv, (cmdline_parse_inst_t *)&cmd_flow, (cmdline_parse_inst_t *)&cmd_show_port_meter_cap, (cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 8f23847859..211f41f86d 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -605,6 +605,13 @@ Dumps the log level for all the dpdk modules:: testpmd> dump_log_types +dump ethdev private +~~~~~~~~~~~~~~~~~~~ + +Dumps the specific ethdev port private info:: + + testpmd> dump_eth_priv [port_id] + show (raw_encap|raw_decap) ~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.17.1