[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <24368A4E-6CB6-4646-B5EE-84831CC7F4BD@mork.no>
Date: Fri, 31 Mar 2017 15:35:46 +0200
From: Bjørn Mork <bjorn@...k.no>
To: Greg Ungerer <gerg@...ux-m68k.org>
CC: oneukum@...e.com, eric.dumazet@...il.com,
stephen@...workplumber.org, netdev@...r.kernel.org,
linux-usb@...r.kernel.org
Subject: Re: [PATCHv3] net: usbnet: support 64bit stats in qmi_wwan driver
On March 31, 2017 3:27:59 PM CEST, Greg Ungerer <gerg@...ux-m68k.org> wrote:
>On 31/03/17 18:48, Bjørn Mork wrote:
>
>>> +void usbnet_get_stats64(struct net_device *net, struct
>rtnl_link_stats64 *stats)
>>> +{
>>> + struct usbnet *dev = netdev_priv(net);
>>> + unsigned int start;
>>> + int cpu;
>>> +
>>> + netdev_stats_to_stats64(stats, &net->stats);
>>> +
>>> + for_each_possible_cpu(cpu) {
>>> + struct pcpu_sw_netstats *stats64;
>>> + u64 rx_packets, rx_bytes;
>>> + u64 tx_packets, tx_bytes;
>>> +
>>> + stats64 = per_cpu_ptr(dev->stats64, cpu);
>>> +
>>> + do {
>>> + start = u64_stats_fetch_begin_irq(&stats64->syncp);
>>> + rx_packets = stats64->rx_packets;
>>> + rx_bytes = stats64->rx_bytes;
>>> + tx_packets = stats64->tx_packets;
>>> + tx_bytes = stats64->tx_bytes;
>>> + } while (u64_stats_fetch_retry_irq(&stats64->syncp, start));
>>> +
>>> + stats->rx_packets += rx_packets;
>>> + stats->rx_bytes += rx_bytes;
>>> + stats->tx_packets += tx_packets;
>>> + stats->tx_bytes += tx_bytes;
>>> + }
>>> +}
>>
>> So we only count packets and bytes. No errors. Why?
>
>All stats are counted. That call to netdev_stats_to_stats64() transfers
>all other stats struct fields (errors, etc) to the stats64 struct.
>No error counts are lost (though they are only stored as 32bits values
>on 32bit machines).
Ah, right. Thanks for explaining and sorry for being so slow. Then I have no objection to the patch as it is.
Bjørn
Powered by blists - more mailing lists