Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Junchang Wang <junchangwang@gmail.com>
Subject: [PATCH net-next] net: export netdev_stats_to_stats64
Date: Mon, 05 Mar 2012 05:58:41 -0800	[thread overview]
Message-ID: <1330955921.2474.18.camel@edumazet-laptop> (raw)
In-Reply-To: <1330954326.2474.9.camel@edumazet-laptop>

Some drivers use internal netdev stats member to store part of their
stats, yet advertize ndo_get_stats64() to implement some 64bit fields.

Allow them to use netdev_stats_to_stats64() helper to make the copy of
netdev stats before they compute their 64bit counters.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
Also changed some incorrect spaces to tabs.

 net/core/dev.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 763a0ed..5ef3b65 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5834,12 +5834,12 @@ void netdev_run_todo(void)
 /* Convert net_device_stats to rtnl_link_stats64.  They have the same
  * fields in the same order, with only the type differing.
  */
-static void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
-				    const struct net_device_stats *netdev_stats)
+void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
+			     const struct net_device_stats *netdev_stats)
 {
 #if BITS_PER_LONG == 64
-        BUILD_BUG_ON(sizeof(*stats64) != sizeof(*netdev_stats));
-        memcpy(stats64, netdev_stats, sizeof(*stats64));
+	BUILD_BUG_ON(sizeof(*stats64) != sizeof(*netdev_stats));
+	memcpy(stats64, netdev_stats, sizeof(*stats64));
 #else
 	size_t i, n = sizeof(*stats64) / sizeof(u64);
 	const unsigned long *src = (const unsigned long *)netdev_stats;
@@ -5851,6 +5851,7 @@ static void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
 		dst[i] = src[i];
 #endif
 }
+EXPORT_SYMBOL(netdev_stats_to_stats64);
 
 /**
  *	dev_get_stats	- get network device statistics

  reply	other threads:[~2012-03-05 13:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05 11:33 [PATCH net-next] 8139too: Add 64bit statistics Junchang Wang
2012-03-05 13:32 ` Eric Dumazet
2012-03-05 13:58   ` Eric Dumazet [this message]
2012-03-05 14:20     ` [PATCH net-next] net: export netdev_stats_to_stats64 Eric Dumazet
2012-03-05 14:50     ` [PATCH net-next v2] " Eric Dumazet
2012-03-05 20:40       ` David Miller
2012-03-06  4:38     ` [PATCH net-next] " Junchang Wang
2012-03-06  4:43       ` Eric Dumazet
2012-03-06  4:44       ` Eric Dumazet
2012-03-06  5:00         ` Junchang Wang
2012-03-05 14:07   ` [PATCH net-next] 8139too: Add 64bit statistics Junchang Wang
2012-03-06  3:13   ` [PATCH net-next V2] " Junchang Wang
2012-03-06  5:05     ` David Miller

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=1330955921.2474.18.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=junchangwang@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox