DPDK patches and discussions
 help / color / mirror / Atom feed
From: fengchengwen <fengchengwen@huawei.com>
To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Cc: Ferruh Yigit <ferruh.yigit@amd.com>, <thomas@monjalon.net>,
	Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>, <dev@dpdk.org>
Subject: Re: [PATCH] app/testpmd: dump private info in 'show port info'
Date: Thu, 16 Mar 2023 17:43:48 +0800	[thread overview]
Message-ID: <6c198db8-9b0e-3929-fc54-097db956d4d8@huawei.com> (raw)
In-Reply-To: <CAEYuUWB1Qc4jHbgrXe-kxco3BuBqpY=+ab4iDx6pkmXemKywLg@mail.gmail.com>

On 2023/3/16 17:19, Dmitry Kozlyuk wrote:
> On Thu, Mar 16, 2023 at 4:11 AM fengchengwen <fengchengwen@huawei.com> wrote:
>> 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.
> 
> What if rte_eth_dev_priv_dump() was a documented no-op when "f == NULL"?
> This can be implemented in ethdev layer:
> 1) if not implemented, return ENOTSUP
> 2) if f == NULL, return 0
> 3) else call PMD
> Technically, even now a null device handle can be used, but this is
> cumbersome and wastes resources for running the API twice.

Thanks your advise.
V2 has sent which adopt Thomas's comment:
	printf("Device private info:\n");
	ret = rte_eth_dev_priv_dump(port_id, stdout);
	if (ret == -ENOTSUP)
		printf("  none\n");
	else if (ret < 0)
		fprintf(stderr, "  Failed to dump private info with error (%d): %s\n",
			ret, strerror(-ret));
which seem simpler.

> .
> 

  reply	other threads:[~2023-03-16  9:44 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
2023-03-16  9:39         ` fengchengwen
2023-03-16  9:19       ` Dmitry Kozlyuk
2023-03-16  9:43         ` fengchengwen [this message]
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=6c198db8-9b0e-3929-fc54-097db956d4d8@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=ferruh.yigit@amd.com \
    --cc=thomas@monjalon.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).