DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
To: "Min Hu (Connor)" <humin29@huawei.com>, <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <thomas@monjalon.net>
Subject: Re: [PATCH 2/7] net/hns3: fix MAC and queues HW statistics reversion
Date: Tue, 3 May 2022 20:05:13 +0100	[thread overview]
Message-ID: <23022ec8-6908-252c-cb47-e8dd5531c677@xilinx.com> (raw)
In-Reply-To: <20220406092240.52900-3-humin29@huawei.com>

On 4/6/2022 10:22 AM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> The MAC and queues statistics aren't 64-bit registers in hardware. If
> hardware statistics are not obtained for a long time, these statistics will
> be reversed. 

I think using 'overflow' instead of 'reversed' is more clear.

As far as I can see from code, these are 32 bit values, can be good to 
mention in the commit log.

> So PF and VF driver have to periodically obtain and save these
> statistics. Since the periodical task and the stats API are in different
> threads, we introduce a statistics lock to protect the statistics.
> 
> Fixes: 8839c5e202f3 ("net/hns3: support device stats")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

<...>

> @@ -604,16 +626,15 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats)
>   	struct hns3_tqp_stats *stats = &hw->tqp_stats;
>   	struct hns3_rx_queue *rxq;
>   	struct hns3_tx_queue *txq;
> -	uint64_t cnt;
>   	uint16_t i;
>   	int ret;
>   
> +	rte_spinlock_lock(&hw->stats_lock);

The lock covers most of the 'stats_get()' function, but only Rx/Tx queue 
stats needs to be protected, you may consider reducing the scope of the 
lock. Same for below functions.

<...>

> @@ -1453,6 +1464,7 @@ int
>   hns3_dev_xstats_reset(struct rte_eth_dev *dev)
>   {
>   	struct hns3_adapter *hns = dev->data->dev_private;
> +	struct hns3_hw *hw = &hns->hw;
>   	int ret;
>   
>   	/* Clear tqp stats */
> @@ -1460,20 +1472,22 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev)
>   	if (ret)
>   		return ret;
>   
> +	rte_spinlock_unlock(&hw->stats_lock);

I guess this should be 'rte_spinlock_lock()'

  reply	other threads:[~2022-05-03 19:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  9:22 [PATCH 0/7] bugfix for hns3 PMD Min Hu (Connor)
2022-04-06  9:22 ` [PATCH 1/7] net/hns3: fix order of clearing imissed register in PF Min Hu (Connor)
2022-04-06  9:22 ` [PATCH 2/7] net/hns3: fix MAC and queues HW statistics reversion Min Hu (Connor)
2022-05-03 19:05   ` Ferruh Yigit [this message]
2022-04-06  9:22 ` [PATCH 3/7] net/hns3: fix pseudo-sharing between threads Min Hu (Connor)
2022-05-03 19:05   ` Ferruh Yigit
2022-04-06  9:22 ` [PATCH 4/7] net/hns3: fix more mbufs are freed when Tx done cleanup Min Hu (Connor)
2022-04-06  9:22 ` [PATCH 5/7] net/hns3: fix RSS disable Min Hu (Connor)
2022-05-03 19:05   ` Ferruh Yigit
2022-04-06  9:22 ` [PATCH 6/7] net/hns3: fix undo rollback when update RSS hash Min Hu (Connor)
2022-04-06  9:22 ` [PATCH 7/7] net/hns3: remove redundant RSS tuple field Min Hu (Connor)
2022-05-03 19:06   ` Ferruh Yigit
2022-04-25  7:03 ` [PATCH 0/7] bugfix for hns3 PMD Min Hu (Connor)
2022-05-03 19:07 ` Ferruh Yigit
2022-05-05 12:27 ` [PATCH v2 " Min Hu (Connor)
2022-05-05 12:27   ` [PATCH v2 1/7] net/hns3: fix order of clearing imissed register in PF Min Hu (Connor)
2022-05-05 12:27   ` [PATCH v2 2/7] net/hns3: fix MAC and queues HW statistics overflow Min Hu (Connor)
2022-05-05 12:27   ` [PATCH v2 3/7] net/hns3: fix pseudo-sharing between threads Min Hu (Connor)
2022-05-05 12:27   ` [PATCH v2 4/7] net/hns3: fix more mbufs are freed when Tx done cleanup Min Hu (Connor)
2022-05-05 12:27   ` [PATCH v2 5/7] net/hns3: fix RSS disable Min Hu (Connor)
2022-05-05 12:27   ` [PATCH v2 6/7] net/hns3: fix undo rollback when update RSS hash Min Hu (Connor)
2022-05-05 12:27   ` [PATCH v2 7/7] net/hns3: remove redundant RSS tuple field Min Hu (Connor)
2022-05-12  9:51   ` [PATCH v2 0/7] bugfix for hns3 PMD Ferruh Yigit
2022-05-05 12:29 ` [PATCH " Min Hu (Connor)

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=23022ec8-6908-252c-cb47-e8dd5531c677@xilinx.com \
    --to=ferruh.yigit@xilinx.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=humin29@huawei.com \
    --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).