From: Thomas Monjalon <thomas@monjalon.net>
To: Ferruh Yigit <ferruh.yigit@amd.com>,
Aman Singh <aman.deep.singh@intel.com>,
Yuying Zhang <yuying.zhang@intel.com>,
fengchengwen <fengchengwen@huawei.com>
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 [thread overview]
Message-ID: <12167900.O9o76ZdvQC@thomas> (raw)
In-Reply-To: <eac32a1a-ab49-2e04-d7f1-62f0df1e848b@huawei.com>
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 <fengchengwen@huawei.com>
> >> ---
> >> 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.
next prev parent reply other threads:[~2023-03-16 7:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 11:50 [PATCH] app/testpmd: support dump ethdev private cmd Chengwen Feng
2023-03-14 13:45 ` Ferruh Yigit
2023-03-15 2:02 ` fengchengwen
2023-03-15 2:33 ` [PATCH] app/testpmd: dump private info in 'show port info' Chengwen Feng
2023-03-15 8:28 ` Singh, Aman Deep
2023-03-15 10:12 ` Ferruh Yigit
2023-03-16 1:10 ` fengchengwen
2023-03-16 7:55 ` Thomas Monjalon [this message]
2023-03-16 9:39 ` fengchengwen
2023-03-16 9:19 ` Dmitry Kozlyuk
2023-03-16 9:43 ` fengchengwen
2023-03-16 10:46 ` Ferruh Yigit
2023-03-16 15:16 ` Thomas Monjalon
2023-03-16 9:32 ` [PATCH v2] " Chengwen Feng
2023-03-16 11:42 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12167900.O9o76ZdvQC@thomas \
--to=thomas@monjalon.net \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@amd.com \
--cc=yuying.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.