aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/sit.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2012-04-12 02:31:16 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-14 14:47:05 -0400
commit87b6d218f3adb00e6b58c7f96f8b5a74ff91abb4 (patch)
tree0a8108621afcaf9549a05a33ca08adb4a810b257 /net/ipv6/sit.c
parent64d683c5825003ffb3b127057a165e6bfc26691e (diff)
tunnel: implement 64 bits statistics
Convert the per-cpu statistics kept for GRE, IPIP, and SIT tunnels to use 64 bit statistics. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/sit.c')
-rw-r--r--net/ipv6/sit.c52
1 files changed, 34 insertions, 18 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index f9608db9dcfb..e5fef943e30a 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -87,31 +87,47 @@ struct sit_net {
87 87
88/* often modified stats are per cpu, other are shared (netdev->stats) */ 88/* often modified stats are per cpu, other are shared (netdev->stats) */
89struct pcpu_tstats { 89struct pcpu_tstats {
90 unsigned long rx_packets; 90 u64 rx_packets;
91 unsigned long rx_bytes; 91 u64 rx_bytes;
92 unsigned long tx_packets; 92 u64 tx_packets;
93 unsigned long tx_bytes; 93 u64 tx_bytes;
94} __attribute__((aligned(4*sizeof(unsigned long)))); 94 struct u64_stats_sync syncp;
95};
95 96
96static struct net_device_stats *ipip6_get_stats(struct net_device *dev) 97static struct rtnl_link_stats64 *ipip6_get_stats64(struct net_device *dev,
98 struct rtnl_link_stats64 *tot)
97{ 99{
98 struct pcpu_tstats sum = { 0 };
99 int i; 100 int i;
100 101
101 for_each_possible_cpu(i) { 102 for_each_possible_cpu(i) {
102 const struct pcpu_tstats *tstats = per_cpu_ptr(dev->tstats, i); 103 const struct pcpu_tstats *tstats = per_cpu_ptr(dev->tstats, i);
103 104 u64 rx_packets, rx_bytes, tx_packets, tx_bytes;
104 sum.rx_packets += tstats->rx_packets; 105 unsigned int start;
105 sum.rx_bytes += tstats->rx_bytes; 106
106 sum.tx_packets += tstats->tx_packets; 107 do {
107 sum.tx_bytes += tstats->tx_bytes; 108 start = u64_stats_fetch_begin_bh(&tstats->syncp);
109 rx_packets = tstats->rx_packets;
110 tx_packets = tstats->tx_packets;
111 rx_bytes = tstats->rx_bytes;
112 tx_bytes = tstats->tx_bytes;
113 } while (u64_stats_fetch_retry_bh(&tstats->syncp, start));
114
115 tot->rx_packets += rx_packets;
116 tot->tx_packets += tx_packets;
117 tot->rx_bytes += rx_bytes;
118 tot->tx_bytes += tx_bytes;
108 } 119 }
109 dev->stats.rx_packets = sum.rx_packets; 120
110 dev->stats.rx_bytes = sum.rx_bytes; 121 tot->rx_errors = dev->stats.rx_errors;
111 dev->stats.tx_packets = sum.tx_packets; 122 tot->tx_fifo_errors = dev->stats.tx_fifo_errors;
112 dev->stats.tx_bytes = sum.tx_bytes; 123 tot->tx_carrier_errors = dev->stats.tx_carrier_errors;
113 return &dev->stats; 124 tot->tx_dropped = dev->stats.tx_dropped;
125 tot->tx_aborted_errors = dev->stats.tx_aborted_errors;
126 tot->tx_errors = dev->stats.tx_errors;
127
128 return tot;
114} 129}
130
115/* 131/*
116 * Must be invoked with rcu_read_lock 132 * Must be invoked with rcu_read_lock
117 */ 133 */
@@ -1126,7 +1142,7 @@ static const struct net_device_ops ipip6_netdev_ops = {
1126 .ndo_start_xmit = ipip6_tunnel_xmit, 1142 .ndo_start_xmit = ipip6_tunnel_xmit,
1127 .ndo_do_ioctl = ipip6_tunnel_ioctl, 1143 .ndo_do_ioctl = ipip6_tunnel_ioctl,
1128 .ndo_change_mtu = ipip6_tunnel_change_mtu, 1144 .ndo_change_mtu = ipip6_tunnel_change_mtu,
1129 .ndo_get_stats = ipip6_get_stats, 1145 .ndo_get_stats64= ipip6_get_stats64,
1130}; 1146};
1131 1147
1132static void ipip6_dev_free(struct net_device *dev) 1148static void ipip6_dev_free(struct net_device *dev)