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 5965441EA6; Thu, 16 Mar 2023 02:11:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E91BE40EF1; Thu, 16 Mar 2023 02:11:00 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id AF3FB40DF6 for ; Thu, 16 Mar 2023 02:10:59 +0100 (CET) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PcTfc2xLxzHx3j; Thu, 16 Mar 2023 09:08:40 +0800 (CST) Received: from [10.67.100.224] (10.67.100.224) 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; Thu, 16 Mar 2023 09:10:51 +0800 Subject: Re: [PATCH] app/testpmd: dump private info in 'show port info' To: Ferruh Yigit , , Aman Singh , Yuying Zhang CC: References: <20230314115035.33356-1-fengchengwen@huawei.com> <20230315023328.35980-1-fengchengwen@huawei.com> <33a601b7-8e44-6dc7-923a-27d9a74c6993@amd.com> From: fengchengwen Message-ID: Date: Thu, 16 Mar 2023 09:10:51 +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: <33a601b7-8e44-6dc7-923a-27d9a74c6993@amd.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 On 2023/3/15 18:12, Ferruh Yigit wrote: > On 3/15/2023 2:33 AM, Chengwen Feng wrote: >> This patch adds dump private info in 'show port info [port_id]' cmd. >> >> Signed-off-by: Chengwen Feng >> --- >> app/test-pmd/config.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c >> index 018536f177..ab5199f223 100644 >> --- a/app/test-pmd/config.c >> +++ b/app/test-pmd/config.c >> @@ -938,6 +938,11 @@ port_infos_display(portid_t port_id) >> printf("unknown\n"); >> break; >> } >> + printf("Device private info:\n"); > > Not all drivers support device private info, above should print only > when it is supported. > >> + ret = rte_eth_dev_priv_dump(port_id, stdout); >> + if (ret < 0) >> + fprintf(stderr, " Failed to dump private info with error (%d): %s\n", >> + ret, strerror(-ret)); > > Similarly, if driver doesn't support '.eth_dev_priv_dump' it shouldn't > print the above error log. > Because we have no API to know the PMD whether impl specific ops, we could only knowed by invoking. Except above impl, I also consider the other two: 1. just invoke rte_eth_dev_priv_dump without previous printf("Device private info") and later error printf. and I think people may curious about the extra output without a prompt just like "Device private info". 2. use fmemopen (the below code), this way will perfect process the PMD which not imp ops. FILE *f = fmemopen(buf, max-size(e.g. 128KB)); ret = rte_eth_dev_priv_dump(port_id, f); if (ret == 0) { printf("Device private info:\n"); printf("%s", buf); } But the windows platform don't support fmemopen. Hope for more feedback. Thanks > . >