From: Long Li <longli@microsoft.com>
To: Ferruh Yigit <ferruh.yigit@xilinx.com>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: "longli@linuxonhyperv.com" <longli@linuxonhyperv.com>,
"dev@dpdk.org" <dev@dpdk.org>,
Stephen Hemminger <sthemmin@microsoft.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [Patch v2] net/netvsc: report correct stats values
Date: Tue, 10 May 2022 05:33:07 +0000 [thread overview]
Message-ID: <PH7PR21MB3263DF595C237B69FA629CFECEC99@PH7PR21MB3263.namprd21.prod.outlook.com> (raw)
In-Reply-To: <973e1c08-6fca-7664-72a3-0a25f5b73686@xilinx.com>
> Subject: Re: [Patch v2] net/netvsc: report correct stats values
>
> On 5/5/2022 5:40 PM, Stephen Hemminger wrote:
> > On Thu, 5 May 2022 17:28:38 +0100
> > Ferruh Yigit <ferruh.yigit@xilinx.com> wrote:
> >
> >> On 5/4/2022 7:38 PM, Long Li wrote:
> >>>> Subject: Re: [Patch v2] net/netvsc: report correct stats values
> >>>>
> >>>> On 5/3/2022 9:48 PM, Long Li wrote:
> >>>>>> Subject: Re: [Patch v2] net/netvsc: report correct stats values
> >>>>>>
> >>>>>> On 5/3/2022 8:14 PM, Long Li wrote:
> >>>>>>>> Subject: Re: [Patch v2] net/netvsc: report correct stats values
> >>>>>>>>
> >>>>>>>> On 5/3/2022 7:18 PM, Long Li wrote:
> >>>>>>>>>> Subject: Re: [Patch v2] net/netvsc: report correct stats
> >>>>>>>>>> values
> >>>>>>>>>>
> >>>>>>>>>> On Tue, 26 Apr 2022 22:56:14 +0100 Ferruh Yigit
> >>>>>>>>>> <ferruh.yigit@xilinx.com> wrote:
> >>>>>>>>>>
> >>>>>>>>>>>> if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
> >>>>>>>>>>>> - stats->q_opackets[i] = txq->stats.packets;
> >>>>>>>>>>>> - stats->q_obytes[i] = txq->stats.bytes;
> >>>>>>>>>>>> + stats->q_opackets[i] += txq-
> >stats.packets;
> >>>>>>>>>>>> + stats->q_obytes[i] += txq->stats.bytes;
> >>>>>>>>>>>
> >>>>>>>>>>> This is per queue stats, 'stats->q_opackets[i]', in next
> >>>>>>>>>>> iteration of the loop, 'i' will be increased and 'txq' will
> >>>>>>>>>>> be updated, so as far as I can see the above change has no affect.
> >>>>>>>>>>
> >>>>>>>>>> Agree, that is why it was just assignment originally.
> >>>>>>>>>
> >>>>>>>>> The condition here is a little different. NETVSC is a master
> >>>>>>>>> device with
> >>>>>>>> another PMD running as a slave. When reporting stats values, it
> >>>>>>>> needs to add the values from the slave PMD. The original code
> >>>>>>>> just overwrites the values from its slave PMD.
> >>>>>>>>
> >>>>>>>> Where the initial values are coming from, 'hn_vf_stats_get()'?
> >>>>>>>>
> >>>>>>>> If 'hn_vf_stats_get()' fills the stats, what are the values
> >>>>>>>> kept in
> >>>>>>>> 'txq-
> >>>>>>> stats.*'
> >>>>>>>> in above updated loop?
> >>>>>>>
> >>>>>>> Yes, hn_vf_stats_get() fills in the stats from the slave PMD.
> >>>>>>> txq->stats
> >>>>>> values are from the master PMD. Those values are different and
> >>>>>> accounted separated from the values from the slave PMD.
> >>>>>>
> >>>>>> I see, since this is a little different than what most of the
> >>>>>> PMDs do, can you please put a little more info to the commit log?
> >>>>>> Or perhaps can add some comments to the code.
> >>>>>
> >>>>> Ok, will do.
> >>>>>
> >>>>>>
> >>>>>> And still 'stats->rx_nombuf' change is not required right? If so
> >>>>>> can you remove it in the next version?
> >>>>>
> >>>>> It is still needed. NETVSC unconditionally calls the slave PMD to
> >>>>> receive
> >>>> packets, even if it can't allocate a mbuf to receive a synthetic
> >>>> packet itself. The accounting of rx_nombuf is valid because the
> >>>> synthetic packets (to NETVSC) and VF packets (to slave PMD) are routed
> separately from Hyper-V.
> >>>>
> >>>> I am not referring to the "+=" update, my comment was because
> >>>> 'stats-
> >>>>> rx_nombuf' is overwritten in 'rte_eth_stats_get()' [1].
> >>>> Is it still required?
> >>>
> >>> Yes, it is still needed. NETVSC calls the rte_eth_stats_get() on its slave PMD
> first, and stats->rx_nombuf is updated (overwritten) for its slave PMD. Afte that,
> it needs to add to its own dev->data->rx_mbuf_alloc_failed back to stats-
> >rx_nombuf.
> >>>
> >>
> >> But its own stat also will be overwritten (not in PMD function, but
> >> in ethdev layer).
> >> 'stats->rx_nombuf' assignment in the PMD seems has no effect and can
> >> be removed.
> >>
> >> I can't see how it is needed, can you please put a call stack to describe?
> >
> > This here:
> >
> >
> > int
> > rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats) {
> > struct rte_eth_dev *dev;
> >
> > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> > dev = &rte_eth_devices[port_id];
> >
> > if (stats == NULL) {
> > RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u stats to
> NULL\n",
> > port_id);
> > return -EINVAL;
> > }
> >
> > memset(stats, 0, sizeof(*stats));
> >
> > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
> > stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
> > return eth_err(port_id, (*dev->dev_ops->stats_get)(dev, stats)); }
> >
> > Will fill in rx_nombuf from the current rx_mbuf_alloc_failed.
> > But it happens before the PMD specific stats function.
> >
>
> I keep seeing the ethdev assignment as *after* the dev_ops, but it is not [1], so
> code is OK as it is.
Hi Ferruh,
Do you still want me to send a v3, or this patch is good as it is?
Long
>
>
> [1]
> It seems assignment was after but it is fixed on the way:
> Commit 53ecfa24fbcd ("ethdev: fix overwriting driver-specific stats")
next prev parent reply other threads:[~2022-05-10 5:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 17:45 longli
2022-04-26 21:56 ` Ferruh Yigit
2022-04-26 22:45 ` Stephen Hemminger
2022-05-03 18:18 ` Long Li
2022-05-03 19:03 ` Ferruh Yigit
2022-05-03 19:14 ` Long Li
2022-05-03 19:55 ` Ferruh Yigit
2022-05-03 20:48 ` Long Li
2022-05-04 12:33 ` Ferruh Yigit
2022-05-04 18:38 ` Long Li
2022-05-05 16:28 ` Ferruh Yigit
2022-05-05 16:40 ` Stephen Hemminger
2022-05-05 16:57 ` Ferruh Yigit
2022-05-10 5:33 ` Long Li [this message]
2022-05-10 11:29 ` Ferruh Yigit
2022-05-10 18:03 ` Long Li
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=PH7PR21MB3263DF595C237B69FA629CFECEC99@PH7PR21MB3263.namprd21.prod.outlook.com \
--to=longli@microsoft.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@xilinx.com \
--cc=longli@linuxonhyperv.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=sthemmin@microsoft.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).