From: Stephen Hemminger <shemminger@vyatta•com>
To: "David S. Miller" <davem@davemloft•net>
Cc: netdev@vger•kernel.org
Subject: [PATCH 3/9] veth: convert to 64 bit statistics
Date: Wed, 08 Jun 2011 17:53:59 -0700 [thread overview]
Message-ID: <20110609005417.449670103@vyatta.com> (raw)
In-Reply-To: 20110609005356.160260858@vyatta.com
[-- Attachment #1: veth-stats64.patch --]
[-- Type: text/plain, Size: 2294 bytes --]
Not much change, device was already keeping per cpu statistics.
Use recent 64 statistics interface.
Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
--- a/drivers/net/veth.c 2011-06-07 20:04:42.221679879 +0900
+++ b/drivers/net/veth.c 2011-06-07 20:10:04.259276778 +0900
@@ -24,12 +24,12 @@
#define MAX_MTU 65535 /* Max L3 MTU (arbitrary) */
struct veth_net_stats {
- unsigned long rx_packets;
- unsigned long tx_packets;
- unsigned long rx_bytes;
- unsigned long tx_bytes;
- unsigned long tx_dropped;
- unsigned long rx_dropped;
+ u64 rx_packets;
+ u64 tx_packets;
+ u64 rx_bytes;
+ u64 tx_bytes;
+ u64 tx_dropped;
+ u64 rx_dropped;
};
struct veth_priv {
@@ -159,32 +159,27 @@ rx_drop:
* general routines
*/
-static struct net_device_stats *veth_get_stats(struct net_device *dev)
+static struct rtnl_link_stats64 *veth_get_stats64(struct net_device *dev,
+ struct rtnl_link_stats64 *tot)
{
struct veth_priv *priv;
int cpu;
- struct veth_net_stats *stats, total = {0};
+ struct veth_net_stats *stats;
priv = netdev_priv(dev);
for_each_possible_cpu(cpu) {
stats = per_cpu_ptr(priv->stats, cpu);
- total.rx_packets += stats->rx_packets;
- total.tx_packets += stats->tx_packets;
- total.rx_bytes += stats->rx_bytes;
- total.tx_bytes += stats->tx_bytes;
- total.tx_dropped += stats->tx_dropped;
- total.rx_dropped += stats->rx_dropped;
+ tot->rx_packets += stats->rx_packets;
+ tot->tx_packets += stats->tx_packets;
+ tot->rx_bytes += stats->rx_bytes;
+ tot->tx_bytes += stats->tx_bytes;
+ tot->tx_dropped += stats->tx_dropped;
+ tot->rx_dropped += stats->rx_dropped;
}
- dev->stats.rx_packets = total.rx_packets;
- dev->stats.tx_packets = total.tx_packets;
- dev->stats.rx_bytes = total.rx_bytes;
- dev->stats.tx_bytes = total.tx_bytes;
- dev->stats.tx_dropped = total.tx_dropped;
- dev->stats.rx_dropped = total.rx_dropped;
- return &dev->stats;
+ return tot;
}
static int veth_open(struct net_device *dev)
@@ -254,7 +249,7 @@ static const struct net_device_ops veth_
.ndo_stop = veth_close,
.ndo_start_xmit = veth_xmit,
.ndo_change_mtu = veth_change_mtu,
- .ndo_get_stats = veth_get_stats,
+ .ndo_get_stats64 = veth_get_stats64,
.ndo_set_mac_address = eth_mac_addr,
};
next prev parent reply other threads:[~2011-06-09 1:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-09 0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
2011-06-09 0:53 ` [PATCH 1/9] vmxnet3: convert to 64 bit stats interface Stephen Hemminger
2011-06-09 5:17 ` [Pv-drivers] " Scott Goldman
2011-06-09 0:53 ` [PATCH 2/9] xen: " Stephen Hemminger
2011-06-09 1:56 ` Ben Hutchings
2011-06-14 21:07 ` Konrad Rzeszutek Wilk
2011-06-15 8:38 ` [Xen-devel] " Ian Campbell
2011-06-09 0:53 ` Stephen Hemminger [this message]
2011-06-09 2:00 ` [PATCH 3/9] veth: convert to 64 bit statistics Ben Hutchings
2011-06-09 3:22 ` Stephen Hemminger
2011-06-10 16:34 ` Ben Hutchings
2011-06-09 6:26 ` David Miller
2011-06-09 0:54 ` [PATCH 4/9] ifb: convert to 64 bit stats Stephen Hemminger
2011-06-09 3:29 ` Eric Dumazet
2011-06-09 3:32 ` Stephen Hemminger
2011-06-09 3:37 ` Eric Dumazet
2011-06-09 0:54 ` [PATCH 5/9] netxen: convert to 64 bit statistics Stephen Hemminger
2011-06-09 6:13 ` Amit Salecha
2011-06-09 6:27 ` David Miller
2011-06-09 0:54 ` [PATCH 6/9] enic: update to support 64 bit stats Stephen Hemminger
2011-06-09 6:27 ` David Miller
2011-06-09 17:43 ` roprabhu
2011-06-09 0:54 ` [PATCH 7/9] myricom: update to " Stephen Hemminger
2011-06-09 6:27 ` David Miller
2011-06-09 0:54 ` [PATCH 8/9] niu: support 64 bit stats interface Stephen Hemminger
2011-06-09 6:27 ` David Miller
2011-06-09 0:54 ` [PATCH 9/9] s2io: implement 64 bit stats Stephen Hemminger
2011-06-09 1:52 ` Ben Hutchings
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=20110609005417.449670103@vyatta.com \
--to=shemminger@vyatta$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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