All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Igor Russkikh <Igor.Russkikh@aquantia.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Nikita Danilov <Nikita.Danilov@aquantia.com>,
	Dmitry Bogdanov <Dmitry.Bogdanov@aquantia.com>
Subject: Re: [PATCH v3 net-next 14/15] net: aquantia: fixups on 64bit dma counters
Date: Sat, 27 Apr 2019 17:35:56 +0200	[thread overview]
Message-ID: <20190427153556.GK14432@lunn.ch> (raw)
In-Reply-To: <14845b14-a05e-9c1c-b43b-7b9b70729808@aquantia.com>

On Sat, Apr 27, 2019 at 06:28:12AM +0000, Igor Russkikh wrote:
> 
> 
> On 27.04.2019 0:36, Andrew Lunn wrote:
> >> +	self->curr_stats.dma_pkt_rc = hw_atl_stats_rx_dma_good_pkt_counterlsw_get(self) +
> >> +				      ((u64)hw_atl_stats_rx_dma_good_pkt_countermsw_get(self) << 32);
> > 
> > Don't you need to do something to avoid issue with overflow from lsw
> > into msw? I've often seen code get the msw, the lsw and then the msm
> > again. If the two msw reads are different, it repeats it all again.
> 
> Hardware latches msw when host reads lsw register. So thats safe.
> 
> However looking into spec it says to always read lsw first.
> The syntax above does not guarantee that in general.
> I'll change that with something like
> 
> dma_pkt_rc = hw_atl_stats_rx_dma_good_pkt_counterlsw_get(self);
> dma_pkt_rc |= ((u64)hw_atl_stats_rx_dma_good_pkt_countermsw_get(self) << 32);

Hi Igor

I think i would probably have a hw_atl_stats_rx_dma_good_pkt_counter()
which returns a u64.

Under that, have a aq_hw_read_reg64() which does things in the correct
ordering, and a comment about reading the lsw latches the msw.

	Andrew

  reply	other threads:[~2019-04-27 15:36 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26  9:47 [PATCH v3 net-next 00/15] net: atlantic: Aquantia driver updates 2019-04 Igor Russkikh
2019-04-26  9:47 ` [PATCH v3 net-next 01/15] net: aquantia: add infrastructure to readout chip temperature Igor Russkikh
2019-04-26 21:00   ` Andrew Lunn
2019-04-26  9:47 ` [PATCH v3 net-next 02/15] net: aquantia: implement hwmon api for " Igor Russkikh
2019-04-26 21:06   ` Andrew Lunn
2019-04-27  6:02     ` Igor Russkikh
2019-04-26  9:47 ` [PATCH v3 net-next 03/15] net: aquantia: add link interrupt fields Igor Russkikh
2019-04-26 21:07   ` Andrew Lunn
2019-04-26  9:47 ` [PATCH v3 net-next 04/15] net: aquantia: link interrupt handling function Igor Russkikh
2019-04-26 21:10   ` Andrew Lunn
2019-04-27  6:10     ` Igor Russkikh
2019-04-26  9:47 ` [PATCH v3 net-next 05/15] net: aquantia: create global service workqueue Igor Russkikh
2019-04-26 21:11   ` Andrew Lunn
2019-04-26  9:47 ` [PATCH v3 net-next 06/15] net: aquantia: link status irq handling Igor Russkikh
2019-04-26 21:16   ` Andrew Lunn
2019-04-26  9:47 ` [PATCH v3 net-next 07/15] net: aquantia: improve ifup link detection Igor Russkikh
2019-04-26  9:47 ` [PATCH v3 net-next 08/15] net: aquantia: use macros for better visibility Igor Russkikh
2019-04-26 21:17   ` Andrew Lunn
2019-04-26  9:48 ` [PATCH v3 net-next 09/15] net: aquantia: user correct MSI irq type Igor Russkikh
2019-04-26 21:18   ` Andrew Lunn
2019-04-26  9:48 ` [PATCH v3 net-next 10/15] net: aquantia: introduce fwreq mutex Igor Russkikh
2019-04-26 21:20   ` Andrew Lunn
2019-04-27  6:33     ` Igor Russkikh
2019-04-26  9:48 ` [PATCH v3 net-next 11/15] net: aquantia: extract timer cb into work job Igor Russkikh
2019-04-26  9:48 ` [PATCH v3 net-next 12/15] net: aquantia: fetch up to date statistics on ethtool request Igor Russkikh
2019-04-26 18:50   ` Jakub Kicinski
2019-04-26  9:48 ` [PATCH v3 net-next 13/15] net: aquantia: get total counters from DMA block Igor Russkikh
2019-04-26  9:48 ` [PATCH v3 net-next 14/15] net: aquantia: fixups on 64bit dma counters Igor Russkikh
2019-04-26 21:36   ` Andrew Lunn
2019-04-27  6:28     ` Igor Russkikh
2019-04-27 15:35       ` Andrew Lunn [this message]
2019-04-26  9:48 ` [PATCH v3 net-next 15/15] net: aquantia: remove outdated device ids Igor Russkikh
2019-04-26 21:37   ` Andrew Lunn

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=20190427153556.GK14432@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Dmitry.Bogdanov@aquantia.com \
    --cc=Igor.Russkikh@aquantia.com \
    --cc=Nikita.Danilov@aquantia.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.