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); Thanks for the note, Igor