All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn-yOkvZcmFvRU@public.gmane.org>
To: Greg Ungerer <gerg-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
Cc: oneukum-IBi9RG/b67k@public.gmane.org,
	eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCHv3] net: usbnet: support 64bit stats in qmi_wwan driver
Date: Fri, 31 Mar 2017 15:35:46 +0200	[thread overview]
Message-ID: <24368A4E-6CB6-4646-B5EE-84831CC7F4BD@mork.no> (raw)
In-Reply-To: <cb2bbda4-fddd-ab70-7bdf-4ef43c9e9535-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>



On March 31, 2017 3:27:59 PM CEST, Greg Ungerer <gerg@linux-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

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2017-03-31 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  6:26 [PATCHv3] net: usbnet: support 64bit stats in qmi_wwan driver Greg Ungerer
2017-03-31  8:48 ` Bjørn Mork
     [not found]   ` <8737dt25od.fsf-3F4PFWf5pNjpjLOzFPqGjWGXanvQGlWp@public.gmane.org>
2017-03-31  9:39     ` Oliver Neukum
2017-03-31 13:29       ` Greg Ungerer
2017-03-31 13:27   ` Greg Ungerer
     [not found]     ` <cb2bbda4-fddd-ab70-7bdf-4ef43c9e9535-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2017-03-31 13:35       ` Bjørn Mork [this message]

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=24368A4E-6CB6-4646-B5EE-84831CC7F4BD@mork.no \
    --to=bjorn-yokvzcmfvru@public.gmane.org \
    --cc=eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=gerg-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=oneukum-IBi9RG/b67k@public.gmane.org \
    --cc=stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.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.