From: "Morten Brørup" <mb@smartsharesystems.com>
To: "fengchengwen" <fengchengwen@huawei.com>,
"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
"Stephen Hemminger" <stephen@networkplumber.org>
Cc: <thomas@monjalon.net>, <ferruh.yigit@xilinx.com>,
<ndabilpuram@marvell.com>, <kirankumark@marvell.com>,
<skori@marvell.com>, <skoteshwar@marvell.com>, <dev@dpdk.org>
Subject: RE: [PATCH 1/3] ethdev: fix telemetry xstats return null with some PMDs
Date: Thu, 28 Apr 2022 15:53:52 +0200 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D8700D@smartserver.smartshare.dk> (raw)
In-Reply-To: <4aeb8f6a-0537-2f14-240c-bddc74977b7e@huawei.com>
> From: fengchengwen [mailto:fengchengwen@huawei.com]
> Sent: Thursday, 28 April 2022 15.39
>
> On 2022/4/25 18:16, Morten Brørup wrote:
> >> From: fengchengwen [mailto:fengchengwen@huawei.com]
> >> Sent: Sunday, 24 April 2022 05.45
> >>
> >> The root cause is: when the xstats is NULL and n less than required
> >> number of
> >> elements is zero, the return value of rte_eth_xstats_get is
> ambiguous
> >> from
> >> rte_ethdev.h's declaration.
> >>
> >> But the implementation of rte_eth_xstats_get return required number
> of
> >> elements
> >> when xstats is NULL and n less than required number of elements.
> >>
> >> There are two modification schemes:
> >> a) the value of xstats cannot be NULL, and the value of n must be
> >> greater than
> >> or equal to the required number, otherwise, an error code is
> >> returned.
> >> b) define the behavior as the same as rte_eth_xstats_get_names,
> which
> >> means return
> >> required number of elelement when xstats is NULL and n less than
> >> required number
> >> of elements.
> >>
> >> I prefer the scheme a because rte_eth_xstats_get and
> >> rte_eth_xstats_get_name are
> >> symbiotic, and it's not necessary to both implement the same logic.
> >>
> >> Also for scheme a, there is no need to modify the PMD
> implementation.
> >>
> >> What about your opinions ?
> >
> > This is an excellent proposal.
> >
> > And if the documentation for rte_eth_xstats_get() refers to
> rte_eth_xstats_get_names() for getting the number of elements, it is
> perfect.
>
> Hi Morten,
>
> I did a deepin review and found that many application use
> rte_eth_xstats_get(port_id, NULL, 0),
> and also many PMD already support return required number of entries
> when xstats is NULL. So in
> the v2, I use the modified hns3/ipn3ke/mvpp2/axgbe PMD method and
> explicit return value when xstats
> is NULL of rte_eth_xstats-get().
Instead of modifying the drivers, consider copying this code from rte_eth_xstats_get_names() to rte_eth_xstats_get():
cnt_expected_entries = eth_dev_get_xstats_count(port_id);
if (xstats_names == NULL || cnt_expected_entries < 0 ||
(int)size < cnt_expected_entries)
return cnt_expected_entries;
Just a suggestion. Either solution is fine with me.
>
> Thanks.
>
> >
> >>
> >> On 2022/4/21 14:49, Andrew Rybchenko wrote:
> >>> On 4/16/22 04:38, Stephen Hemminger wrote:
> >>>> On Sat, 16 Apr 2022 09:07:45 +0800
> >>>> Chengwen Feng <fengchengwen@huawei.com> wrote:
> >>>>
> >>>>> Currently the telemetry xstats uses rte_eth_xstats_get() to
> >> retrieve
> >>>>> the number of elements. But the value to be returned when the
> >> parameter
> >>>>> 'xstats' is NULL is not specified, some PMDs (eg.
> >> hns3/ipn3ke/mvpp2/
> >>>>> axgbe) return zero while others return the required number of
> >> elements.
> >>>>
> >>>> Lets fix the PMD's this impacts other code as well.
> >>>
> >>> +1
> >>>
> >>> .
> >>
> >
>
next prev parent reply other threads:[~2022-04-28 13:53 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-16 1:07 [PATCH 0/3] bugfix for ethdev telemetry Chengwen Feng
2022-04-16 1:07 ` [PATCH 1/3] ethdev: fix telemetry xstats return null with some PMDs Chengwen Feng
2022-04-16 1:38 ` Stephen Hemminger
2022-04-21 6:49 ` Andrew Rybchenko
2022-04-24 3:44 ` fengchengwen
2022-04-25 10:16 ` Morten Brørup
2022-04-28 13:38 ` fengchengwen
2022-04-28 13:53 ` Morten Brørup [this message]
2022-04-16 1:07 ` [PATCH 2/3] ethdev: fix memory leak when telemetry xstats Chengwen Feng
2022-04-21 6:51 ` Andrew Rybchenko
2022-04-21 8:09 ` David Marchand
2022-04-21 9:03 ` Bruce Richardson
2022-04-22 8:14 ` David Marchand
2022-04-16 1:07 ` [PATCH 3/3] net/cnxk: fix telemetry possible null pointer access Chengwen Feng
2022-04-28 13:15 ` [PATCH v2 0/9] bugfix for ethdev telemetry Chengwen Feng
2022-04-28 13:15 ` [PATCH v2 1/9] ethdev: define retval when xstats is null of get xstats Chengwen Feng
2022-05-04 10:32 ` Andrew Rybchenko
2022-04-28 13:15 ` [PATCH v2 2/9] net/hns3: adjust " Chengwen Feng
2022-05-06 7:56 ` Min Hu (Connor)
2022-04-28 13:15 ` [PATCH v2 3/9] net/ipn3ke: " Chengwen Feng
2022-04-28 13:15 ` [PATCH v2 4/9] net/mvpp2: " Chengwen Feng
2022-04-28 13:15 ` [PATCH v2 5/9] net/axgbe: " Chengwen Feng
2022-04-28 13:15 ` [PATCH v2 6/9] ethdev: fix memory leak when telemetry xstats Chengwen Feng
2022-04-28 13:15 ` [PATCH v2 7/9] ethdev: support auto-filled flag when telemetry stats Chengwen Feng
2022-04-28 13:15 ` [PATCH v2 8/9] ethdev: fix possible null pointer access Chengwen Feng
2022-04-28 13:16 ` [PATCH v2 9/9] net/cnxk: fix telemetry " Chengwen Feng
2022-05-05 8:02 ` [PATCH v3 00/10] bugfix for ethdev telemetry Chengwen Feng
2022-05-05 8:02 ` [PATCH v3 01/10] ethdev: define retval when xstats is null of get xstats Chengwen Feng
2022-05-05 8:02 ` [PATCH v3 02/10] ethdev: optimize xstats-get API's implementation Chengwen Feng
2022-05-12 10:31 ` Andrew Rybchenko
2022-05-05 8:02 ` [PATCH v3 03/10] net/hns3: adjust retval when xstats is null of get xstats Chengwen Feng
2022-05-12 9:51 ` Andrew Rybchenko
2022-05-05 8:02 ` [PATCH v3 04/10] net/ipn3ke: " Chengwen Feng
2022-05-05 8:02 ` [PATCH v3 05/10] net/mvpp2: " Chengwen Feng
2022-05-05 8:02 ` [PATCH v3 06/10] net/axgbe: " Chengwen Feng
2022-05-12 10:00 ` Andrew Rybchenko
2022-05-05 8:02 ` [PATCH v3 07/10] ethdev: fix memory leak when telemetry xstats Chengwen Feng
2022-05-05 8:02 ` [PATCH v3 08/10] ethdev: support auto-filled flag when telemetry stats Chengwen Feng
2022-05-12 10:26 ` Andrew Rybchenko
2022-05-05 8:02 ` [PATCH v3 09/10] ethdev: fix possible null pointer access Chengwen Feng
2022-05-12 10:29 ` Andrew Rybchenko
2022-05-05 8:02 ` [PATCH v3 10/10] net/cnxk: fix telemetry " Chengwen Feng
2022-05-12 10:30 ` Andrew Rybchenko
2022-05-13 2:53 ` [PATCH v4 0/9] bugfix for ethdev telemetry Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 1/9] ethdev: specify return value of xstats-get API Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 2/9] ethdev: optimize xstats-get API's implementation Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 3/9] net/hns3: adjust return value of xstats-get ops Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 4/9] net/ipn3ke: " Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 5/9] net/mvpp2: " Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 6/9] net/axgbe: " Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 7/9] ethdev: fix memory leak when telemetry xstats Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 8/9] ethdev: fix possible null pointer access Chengwen Feng
2022-05-13 2:53 ` [PATCH v4 9/9] net/cnxk: fix telemetry " Chengwen Feng
2022-05-16 8:43 ` [PATCH v4 0/9] bugfix for ethdev telemetry Morten Brørup
2022-05-20 14:50 ` Andrew Rybchenko
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=98CBD80474FA8B44BF855DF32C47DC35D8700D@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@xilinx.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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).