netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Salil Mehta <salil.mehta@huawei.com>
Cc: <davem@davemloft.net>, <yisen.zhuang@huawei.com>,
	<huangdaode@hisilicon.com>, <lipeng321@huawei.com>,
	<mehta.salil.lnk@gmail.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>
Subject: Re: [PATCH V2 net-next 1/8] net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC
Date: Mon, 19 Jun 2017 08:48:01 -0700	[thread overview]
Message-ID: <20170619084801.7920e30d@xeon-e3> (raw)
In-Reply-To: <20170613231035.494020-2-salil.mehta@huawei.com>

On Wed, 14 Jun 2017 00:10:28 +0100
Salil Mehta <salil.mehta@huawei.com> wrote:

> +hns3_nic_get_stats64(struct net_device *ndev, struct rtnl_link_stats64 *stats)
> +{
> +	struct hns3_nic_priv *priv = netdev_priv(ndev);
> +	int queue_num = priv->ae_handle->kinfo.num_tqps;
> +	u64 tx_bytes = 0;
> +	u64 rx_bytes = 0;
> +	u64 tx_pkts = 0;
> +	u64 rx_pkts = 0;
> +	int idx = 0;
unnecessary initialization

> +
> +	for (idx = 0; idx < queue_num; idx++) {
> +		tx_bytes += priv->ring_data[idx].ring->stats.tx_bytes;
> +		tx_pkts += priv->ring_data[idx].ring->stats.tx_pkts;
> +		rx_bytes +=
> +			priv->ring_data[idx + queue_num].ring->stats.rx_bytes;
> +		rx_pkts += priv->ring_data[idx + queue_num].ring->stats.rx_pkts;
> +	}
> +

Since rx_bytes and other statistics are 64 bit values. You need to use
something to ensure that updates to these values are atomic on 32 bit
platforms.  The most common way to handle this is with the u64_stats_sync
mechanism which is a nop on 64 bit architectures, and uses a seqcount
to do updates on 32 bit CPU's.

  

  parent reply	other threads:[~2017-06-19 15:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 23:10 [PATCH V2 net-next 0/8] Hisilicon Network Subsystem 3 Ethernet Driver Salil Mehta
2017-06-13 23:10 ` [PATCH V2 net-next 1/8] net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC Salil Mehta
2017-06-13 23:53   ` Stephen Hemminger
2017-06-17 10:47     ` Salil Mehta
2017-06-19 15:48   ` Stephen Hemminger [this message]
2017-07-22 23:57     ` Salil Mehta
2017-06-13 23:10 ` [PATCH V2 net-next 2/8] net: hns3: Add support of the HNAE3 framework Salil Mehta
2017-06-14  1:32   ` Andrew Lunn
2017-06-17 11:12     ` Salil Mehta
2017-06-14  1:37   ` Andrew Lunn
2017-06-17 11:18     ` Salil Mehta
2017-06-17 12:11       ` Andrew Lunn
2017-06-18 14:53   ` Andrew Lunn
2017-07-22 23:31     ` Salil Mehta
2017-06-13 23:10 ` [PATCH V2 net-next 3/8] net: hns3: Add HNS3 IMP(Integrated Mgmt Proc) Cmd Interface Support Salil Mehta
2017-06-13 23:10 ` [PATCH V2 net-next 4/8] net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support Salil Mehta
2017-06-13 23:10 ` [PATCH V2 net-next 5/8] net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver Salil Mehta
2017-06-13 23:10 ` [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta
2017-06-13 23:46   ` Florian Fainelli
2017-06-17 10:40     ` Salil Mehta
2017-06-14  2:42   ` Andrew Lunn
2017-06-17 11:56     ` Salil Mehta
2017-06-14  2:55   ` Andrew Lunn
2017-06-17 11:56     ` Salil Mehta
2017-06-13 23:10 ` [PATCH V2 net-next 7/8] net: hns3: Add Ethtool support to HNS3 driver Salil Mehta
2017-06-13 23:55   ` Stephen Hemminger
2017-06-17 11:05     ` Salil Mehta
2017-06-14  2:19   ` Andrew Lunn
2017-06-17 11:20     ` Salil Mehta
2017-06-14  2:32   ` Andrew Lunn
2017-06-17 11:54     ` Salil Mehta
2017-06-13 23:10 ` [PATCH V2 net-next 8/8] net: hns3: Add HNS3 driver to kernel build framework & MAINTAINERS Salil Mehta
2017-06-14 10:52   ` kbuild test robot
2017-06-14 15:37   ` kbuild test robot

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=20170619084801.7920e30d@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=huangdaode@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=mehta.salil.lnk@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.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).