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 D206E41EAC; Thu, 16 Mar 2023 08:56:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 69A8740FDF; Thu, 16 Mar 2023 08:56:05 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id 0676A40EF1 for ; Thu, 16 Mar 2023 08:56:03 +0100 (CET) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 344D25C00A7; Thu, 16 Mar 2023 03:56:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 16 Mar 2023 03:56:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1678953362; x=1679039762; bh=LIX2G1qlDrS9vaSkO1LSN+GuEcK51w+e1Fm 8oQI+3O4=; b=1xr8J37uYTI2JshBF8k9YGWlEa0tpcvnWbxySfK6M61BUZGz4Yh drlWcStfbFEIwO7qqOSgJCiFA3oaMXDunGgX1gpBeqd3x9LeH976+7P451f8ePrH Zhi0giHQ52SsEJX2gu9NvgqZlDIScxsDGAu+NBG2IbzlRiQDx54MwaQnOjk+C91w ncGdJE70ZAP9zVI6sx5+CNVYJHMWl3HCjdKAC7F1SVlgooPMFNY/jkmbQB+ShTOg pVD2vCwCy5HytEURkf3zICEm+41/CvoiUV69Cx61SeKiBxrKGplfOf1SiX3RMCrr FuDvkTk3GYyf2mgETmvaJyblpGrH/c0VhIg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1678953362; x=1679039762; bh=LIX2G1qlDrS9vaSkO1LSN+GuEcK51w+e1Fm 8oQI+3O4=; b=sayb5JMrD8cdgZpB2HYobFYqS6p96JDaINOWHvcaOqIPrCk/E7C by15C0YJjUHfTSMu2mjuLdvySk60OPuXAF0b9hOQQX2eMQuoZ5eYZ25Jf4Sq2+Mr b+2Mp8QuhElzXMn9zX9OOBE4VG4bF1gGIZkczISMyKovPJBn05mLcyRmR0CBwdhB 8jb1xkjxIZ+JePZsnFJlqnXN5LuBBdjh1iL1JzA9UnUMlo1I/lVBX4UQ8567xSK6 BBuyDvGF07JaEDEw/W/VV16I+drGG6R6zXFf86No9YJsNh7M547/UTVhEjQh3tRk QdI1+RtSXudKf8prqEdN2EV3q01IhU8vSmQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvledgudduhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnheptdejieeifeehtdffgfdvleetueeffeehueejgfeuteeftddt ieekgfekudehtdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Mar 2023 03:56:00 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit , Aman Singh , Yuying Zhang , fengchengwen Cc: dev@dpdk.org Subject: Re: [PATCH] app/testpmd: dump private info in 'show port info' Date: Thu, 16 Mar 2023 08:55:58 +0100 Message-ID: <12167900.O9o76ZdvQC@thomas> In-Reply-To: References: <20230314115035.33356-1-fengchengwen@huawei.com> <33a601b7-8e44-6dc7-923a-27d9a74c6993@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 16/03/2023 02:10, fengchengwen: > 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". You can print the error only if the return is not ENOTSUP. You can keep the first print and then print "none" if ENOTSUP. > 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. That's also a good solution but we need to support Windows.