lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 22 Jul 2017 23:57:46 +0000
From:   Salil Mehta <salil.mehta@...wei.com>
To:     Stephen Hemminger <stephen@...workplumber.org>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "Zhuangyuzeng (Yisen)" <yisen.zhuang@...wei.com>,
        huangdaode <huangdaode@...ilicon.com>,
        "lipeng (Y)" <lipeng321@...wei.com>,
        "mehta.salil.lnk@...il.com" <mehta.salil.lnk@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Linuxarm <linuxarm@...wei.com>
Subject: RE: [PATCH V2 net-next 1/8] net: hns3: Add support of HNS3 Ethernet
 Driver for hip08 SoC

Hi Stephen,

> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@...workplumber.org]
> Sent: Monday, June 19, 2017 4:48 PM
> To: Salil Mehta
> Cc: davem@...emloft.net; Zhuangyuzeng (Yisen); huangdaode; lipeng (Y);
> mehta.salil.lnk@...il.com; netdev@...r.kernel.org; linux-
> kernel@...r.kernel.org; Linuxarm
> Subject: Re: [PATCH V2 net-next 1/8] net: hns3: Add support of HNS3
> Ethernet Driver for hip08 SoC
> 
> On Wed, 14 Jun 2017 00:10:28 +0100
> Salil Mehta <salil.mehta@...wei.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.
Sure good point. This has changed in the V4 patch.

Thanks for guiding.
Salil

> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ