aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorLi RongQing <roy.qing.li@gmail.com>2014-01-04 00:57:59 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-04 20:10:24 -0500
commit8f84985fec10de64a6b4cdfea45f2b0ab8f07c78 (patch)
tree03d58e9d72384e8066a6232c793b3ee4242668f6 /net/ipv6
parent653864d9dd6ae26d884abfd53420e61e7383b1da (diff)
net: unify the pcpu_tstats and br_cpu_netstats as one
They are same, so unify them as one, pcpu_sw_netstats. Define pcpu_sw_netstat in netdevice.h, remove pcpu_tstats from if_tunnel and remove br_cpu_netstats from br_private.h Cc: Cong Wang <xiyou.wangcong@gmail.com> Cc: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6_gre.c10
-rw-r--r--net/ipv6/ip6_tunnel.c12
-rw-r--r--net/ipv6/ip6_vti.c10
-rw-r--r--net/ipv6/sit.c10
4 files changed, 21 insertions, 21 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index e27fb78c61f2..e7a440dd5c0d 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -498,7 +498,7 @@ static int ip6gre_rcv(struct sk_buff *skb)
498 &ipv6h->saddr, &ipv6h->daddr, key, 498 &ipv6h->saddr, &ipv6h->daddr, key,
499 gre_proto); 499 gre_proto);
500 if (tunnel) { 500 if (tunnel) {
501 struct pcpu_tstats *tstats; 501 struct pcpu_sw_netstats *tstats;
502 502
503 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) 503 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb))
504 goto drop; 504 goto drop;
@@ -1265,12 +1265,12 @@ static int ip6gre_tunnel_init(struct net_device *dev)
1265 if (ipv6_addr_any(&tunnel->parms.raddr)) 1265 if (ipv6_addr_any(&tunnel->parms.raddr))
1266 dev->header_ops = &ip6gre_header_ops; 1266 dev->header_ops = &ip6gre_header_ops;
1267 1267
1268 dev->tstats = alloc_percpu(struct pcpu_tstats); 1268 dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
1269 if (!dev->tstats) 1269 if (!dev->tstats)
1270 return -ENOMEM; 1270 return -ENOMEM;
1271 1271
1272 for_each_possible_cpu(i) { 1272 for_each_possible_cpu(i) {
1273 struct pcpu_tstats *ip6gre_tunnel_stats; 1273 struct pcpu_sw_netstats *ip6gre_tunnel_stats;
1274 ip6gre_tunnel_stats = per_cpu_ptr(dev->tstats, i); 1274 ip6gre_tunnel_stats = per_cpu_ptr(dev->tstats, i);
1275 u64_stats_init(&ip6gre_tunnel_stats->syncp); 1275 u64_stats_init(&ip6gre_tunnel_stats->syncp);
1276 } 1276 }
@@ -1466,12 +1466,12 @@ static int ip6gre_tap_init(struct net_device *dev)
1466 1466
1467 ip6gre_tnl_link_config(tunnel, 1); 1467 ip6gre_tnl_link_config(tunnel, 1);
1468 1468
1469 dev->tstats = alloc_percpu(struct pcpu_tstats); 1469 dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
1470 if (!dev->tstats) 1470 if (!dev->tstats)
1471 return -ENOMEM; 1471 return -ENOMEM;
1472 1472
1473 for_each_possible_cpu(i) { 1473 for_each_possible_cpu(i) {
1474 struct pcpu_tstats *ip6gre_tap_stats; 1474 struct pcpu_sw_netstats *ip6gre_tap_stats;
1475 ip6gre_tap_stats = per_cpu_ptr(dev->tstats, i); 1475 ip6gre_tap_stats = per_cpu_ptr(dev->tstats, i);
1476 u64_stats_init(&ip6gre_tap_stats->syncp); 1476 u64_stats_init(&ip6gre_tap_stats->syncp);
1477 } 1477 }
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 8d7c9867a445..02894216a46d 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -29,7 +29,6 @@
29#include <linux/if.h> 29#include <linux/if.h>
30#include <linux/in.h> 30#include <linux/in.h>
31#include <linux/ip.h> 31#include <linux/ip.h>
32#include <linux/if_tunnel.h>
33#include <linux/net.h> 32#include <linux/net.h>
34#include <linux/in6.h> 33#include <linux/in6.h>
35#include <linux/netdevice.h> 34#include <linux/netdevice.h>
@@ -102,11 +101,12 @@ struct ip6_tnl_net {
102 101
103static struct net_device_stats *ip6_get_stats(struct net_device *dev) 102static struct net_device_stats *ip6_get_stats(struct net_device *dev)
104{ 103{
105 struct pcpu_tstats sum = { 0 }; 104 struct pcpu_sw_netstats sum = { 0 };
106 int i; 105 int i;
107 106
108 for_each_possible_cpu(i) { 107 for_each_possible_cpu(i) {
109 const struct pcpu_tstats *tstats = per_cpu_ptr(dev->tstats, i); 108 const struct pcpu_sw_netstats *tstats =
109 per_cpu_ptr(dev->tstats, i);
110 110
111 sum.rx_packets += tstats->rx_packets; 111 sum.rx_packets += tstats->rx_packets;
112 sum.rx_bytes += tstats->rx_bytes; 112 sum.rx_bytes += tstats->rx_bytes;
@@ -784,7 +784,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
784 784
785 if ((t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, 785 if ((t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr,
786 &ipv6h->daddr)) != NULL) { 786 &ipv6h->daddr)) != NULL) {
787 struct pcpu_tstats *tstats; 787 struct pcpu_sw_netstats *tstats;
788 788
789 if (t->parms.proto != ipproto && t->parms.proto != 0) { 789 if (t->parms.proto != ipproto && t->parms.proto != 0) {
790 rcu_read_unlock(); 790 rcu_read_unlock();
@@ -1497,12 +1497,12 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
1497 1497
1498 t->dev = dev; 1498 t->dev = dev;
1499 t->net = dev_net(dev); 1499 t->net = dev_net(dev);
1500 dev->tstats = alloc_percpu(struct pcpu_tstats); 1500 dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
1501 if (!dev->tstats) 1501 if (!dev->tstats)
1502 return -ENOMEM; 1502 return -ENOMEM;
1503 1503
1504 for_each_possible_cpu(i) { 1504 for_each_possible_cpu(i) {
1505 struct pcpu_tstats *ip6_tnl_stats; 1505 struct pcpu_sw_netstats *ip6_tnl_stats;
1506 ip6_tnl_stats = per_cpu_ptr(dev->tstats, i); 1506 ip6_tnl_stats = per_cpu_ptr(dev->tstats, i);
1507 u64_stats_init(&ip6_tnl_stats->syncp); 1507 u64_stats_init(&ip6_tnl_stats->syncp);
1508 } 1508 }
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index ed94ba61dda0..da1d9e4d62ca 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -24,7 +24,6 @@
24#include <linux/if.h> 24#include <linux/if.h>
25#include <linux/in.h> 25#include <linux/in.h>
26#include <linux/ip.h> 26#include <linux/ip.h>
27#include <linux/if_tunnel.h>
28#include <linux/net.h> 27#include <linux/net.h>
29#include <linux/in6.h> 28#include <linux/in6.h>
30#include <linux/netdevice.h> 29#include <linux/netdevice.h>
@@ -77,11 +76,12 @@ struct vti6_net {
77 76
78static struct net_device_stats *vti6_get_stats(struct net_device *dev) 77static struct net_device_stats *vti6_get_stats(struct net_device *dev)
79{ 78{
80 struct pcpu_tstats sum = { 0 }; 79 struct pcpu_sw_netstats sum = { 0 };
81 int i; 80 int i;
82 81
83 for_each_possible_cpu(i) { 82 for_each_possible_cpu(i) {
84 const struct pcpu_tstats *tstats = per_cpu_ptr(dev->tstats, i); 83 const struct pcpu_sw_netstats *tstats =
84 per_cpu_ptr(dev->tstats, i);
85 85
86 sum.rx_packets += tstats->rx_packets; 86 sum.rx_packets += tstats->rx_packets;
87 sum.rx_bytes += tstats->rx_bytes; 87 sum.rx_bytes += tstats->rx_bytes;
@@ -312,7 +312,7 @@ static int vti6_rcv(struct sk_buff *skb)
312 312
313 if ((t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr, 313 if ((t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr,
314 &ipv6h->daddr)) != NULL) { 314 &ipv6h->daddr)) != NULL) {
315 struct pcpu_tstats *tstats; 315 struct pcpu_sw_netstats *tstats;
316 316
317 if (t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) { 317 if (t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) {
318 rcu_read_unlock(); 318 rcu_read_unlock();
@@ -753,7 +753,7 @@ static inline int vti6_dev_init_gen(struct net_device *dev)
753 753
754 t->dev = dev; 754 t->dev = dev;
755 t->net = dev_net(dev); 755 t->net = dev_net(dev);
756 dev->tstats = alloc_percpu(struct pcpu_tstats); 756 dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
757 if (!dev->tstats) 757 if (!dev->tstats)
758 return -ENOMEM; 758 return -ENOMEM;
759 return 0; 759 return 0;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 366fbba3359a..9937b2616713 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -671,7 +671,7 @@ static int ipip6_rcv(struct sk_buff *skb)
671 tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev, 671 tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev,
672 iph->saddr, iph->daddr); 672 iph->saddr, iph->daddr);
673 if (tunnel != NULL) { 673 if (tunnel != NULL) {
674 struct pcpu_tstats *tstats; 674 struct pcpu_sw_netstats *tstats;
675 675
676 if (tunnel->parms.iph.protocol != IPPROTO_IPV6 && 676 if (tunnel->parms.iph.protocol != IPPROTO_IPV6 &&
677 tunnel->parms.iph.protocol != 0) 677 tunnel->parms.iph.protocol != 0)
@@ -1361,12 +1361,12 @@ static int ipip6_tunnel_init(struct net_device *dev)
1361 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); 1361 memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
1362 1362
1363 ipip6_tunnel_bind_dev(dev); 1363 ipip6_tunnel_bind_dev(dev);
1364 dev->tstats = alloc_percpu(struct pcpu_tstats); 1364 dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
1365 if (!dev->tstats) 1365 if (!dev->tstats)
1366 return -ENOMEM; 1366 return -ENOMEM;
1367 1367
1368 for_each_possible_cpu(i) { 1368 for_each_possible_cpu(i) {
1369 struct pcpu_tstats *ipip6_tunnel_stats; 1369 struct pcpu_sw_netstats *ipip6_tunnel_stats;
1370 ipip6_tunnel_stats = per_cpu_ptr(dev->tstats, i); 1370 ipip6_tunnel_stats = per_cpu_ptr(dev->tstats, i);
1371 u64_stats_init(&ipip6_tunnel_stats->syncp); 1371 u64_stats_init(&ipip6_tunnel_stats->syncp);
1372 } 1372 }
@@ -1391,12 +1391,12 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1391 iph->ihl = 5; 1391 iph->ihl = 5;
1392 iph->ttl = 64; 1392 iph->ttl = 64;
1393 1393
1394 dev->tstats = alloc_percpu(struct pcpu_tstats); 1394 dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
1395 if (!dev->tstats) 1395 if (!dev->tstats)
1396 return -ENOMEM; 1396 return -ENOMEM;
1397 1397
1398 for_each_possible_cpu(i) { 1398 for_each_possible_cpu(i) {
1399 struct pcpu_tstats *ipip6_fb_stats; 1399 struct pcpu_sw_netstats *ipip6_fb_stats;
1400 ipip6_fb_stats = per_cpu_ptr(dev->tstats, i); 1400 ipip6_fb_stats = per_cpu_ptr(dev->tstats, i);
1401 u64_stats_init(&ipip6_fb_stats->syncp); 1401 u64_stats_init(&ipip6_fb_stats->syncp);
1402 } 1402 }