diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-06-08 10:53:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-09 02:26:32 -0400 |
commit | 6311cc44a23bb42636f5076fef0a67859d0a0102 (patch) | |
tree | 31d07fc06aa8f561d3dd4547bf9232f1705926f4 /drivers/net/veth.c | |
parent | 95305f6c3b4e8c0bdd5044604c418a8ad2defc4e (diff) |
veth: convert to 64 bit statistics
Not much change, device was already keeping per cpu statistics.
Use recent 64 statistics interface.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/veth.c')
-rw-r--r-- | drivers/net/veth.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 8461576fa015..8730d6494633 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -24,12 +24,12 @@ | |||
24 | #define MAX_MTU 65535 /* Max L3 MTU (arbitrary) */ | 24 | #define MAX_MTU 65535 /* Max L3 MTU (arbitrary) */ |
25 | 25 | ||
26 | struct veth_net_stats { | 26 | struct veth_net_stats { |
27 | unsigned long rx_packets; | 27 | u64 rx_packets; |
28 | unsigned long tx_packets; | 28 | u64 tx_packets; |
29 | unsigned long rx_bytes; | 29 | u64 rx_bytes; |
30 | unsigned long tx_bytes; | 30 | u64 tx_bytes; |
31 | unsigned long tx_dropped; | 31 | u64 tx_dropped; |
32 | unsigned long rx_dropped; | 32 | u64 rx_dropped; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | struct veth_priv { | 35 | struct veth_priv { |
@@ -159,32 +159,27 @@ rx_drop: | |||
159 | * general routines | 159 | * general routines |
160 | */ | 160 | */ |
161 | 161 | ||
162 | static struct net_device_stats *veth_get_stats(struct net_device *dev) | 162 | static struct rtnl_link_stats64 *veth_get_stats64(struct net_device *dev, |
163 | struct rtnl_link_stats64 *tot) | ||
163 | { | 164 | { |
164 | struct veth_priv *priv; | 165 | struct veth_priv *priv; |
165 | int cpu; | 166 | int cpu; |
166 | struct veth_net_stats *stats, total = {0}; | 167 | struct veth_net_stats *stats; |
167 | 168 | ||
168 | priv = netdev_priv(dev); | 169 | priv = netdev_priv(dev); |
169 | 170 | ||
170 | for_each_possible_cpu(cpu) { | 171 | for_each_possible_cpu(cpu) { |
171 | stats = per_cpu_ptr(priv->stats, cpu); | 172 | stats = per_cpu_ptr(priv->stats, cpu); |
172 | 173 | ||
173 | total.rx_packets += stats->rx_packets; | 174 | tot->rx_packets += stats->rx_packets; |
174 | total.tx_packets += stats->tx_packets; | 175 | tot->tx_packets += stats->tx_packets; |
175 | total.rx_bytes += stats->rx_bytes; | 176 | tot->rx_bytes += stats->rx_bytes; |
176 | total.tx_bytes += stats->tx_bytes; | 177 | tot->tx_bytes += stats->tx_bytes; |
177 | total.tx_dropped += stats->tx_dropped; | 178 | tot->tx_dropped += stats->tx_dropped; |
178 | total.rx_dropped += stats->rx_dropped; | 179 | tot->rx_dropped += stats->rx_dropped; |
179 | } | 180 | } |
180 | dev->stats.rx_packets = total.rx_packets; | 181 | |
181 | dev->stats.tx_packets = total.tx_packets; | 182 | return tot; |
182 | dev->stats.rx_bytes = total.rx_bytes; | ||
183 | dev->stats.tx_bytes = total.tx_bytes; | ||
184 | dev->stats.tx_dropped = total.tx_dropped; | ||
185 | dev->stats.rx_dropped = total.rx_dropped; | ||
186 | |||
187 | return &dev->stats; | ||
188 | } | 183 | } |
189 | 184 | ||
190 | static int veth_open(struct net_device *dev) | 185 | static int veth_open(struct net_device *dev) |
@@ -254,7 +249,7 @@ static const struct net_device_ops veth_netdev_ops = { | |||
254 | .ndo_stop = veth_close, | 249 | .ndo_stop = veth_close, |
255 | .ndo_start_xmit = veth_xmit, | 250 | .ndo_start_xmit = veth_xmit, |
256 | .ndo_change_mtu = veth_change_mtu, | 251 | .ndo_change_mtu = veth_change_mtu, |
257 | .ndo_get_stats = veth_get_stats, | 252 | .ndo_get_stats64 = veth_get_stats64, |
258 | .ndo_set_mac_address = eth_mac_addr, | 253 | .ndo_set_mac_address = eth_mac_addr, |
259 | }; | 254 | }; |
260 | 255 | ||