mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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 <[email protected]> Cc: Stephen Hemminger <[email protected]> Signed-off-by: Li RongQing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
653864d9dd
commit
8f84985fec
16 changed files with 60 additions and 66 deletions
|
|
@ -498,7 +498,7 @@ static int ip6gre_rcv(struct sk_buff *skb)
|
|||
&ipv6h->saddr, &ipv6h->daddr, key,
|
||||
gre_proto);
|
||||
if (tunnel) {
|
||||
struct pcpu_tstats *tstats;
|
||||
struct pcpu_sw_netstats *tstats;
|
||||
|
||||
if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb))
|
||||
goto drop;
|
||||
|
|
@ -1265,12 +1265,12 @@ static int ip6gre_tunnel_init(struct net_device *dev)
|
|||
if (ipv6_addr_any(&tunnel->parms.raddr))
|
||||
dev->header_ops = &ip6gre_header_ops;
|
||||
|
||||
dev->tstats = alloc_percpu(struct pcpu_tstats);
|
||||
dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
|
||||
if (!dev->tstats)
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_possible_cpu(i) {
|
||||
struct pcpu_tstats *ip6gre_tunnel_stats;
|
||||
struct pcpu_sw_netstats *ip6gre_tunnel_stats;
|
||||
ip6gre_tunnel_stats = per_cpu_ptr(dev->tstats, i);
|
||||
u64_stats_init(&ip6gre_tunnel_stats->syncp);
|
||||
}
|
||||
|
|
@ -1466,12 +1466,12 @@ static int ip6gre_tap_init(struct net_device *dev)
|
|||
|
||||
ip6gre_tnl_link_config(tunnel, 1);
|
||||
|
||||
dev->tstats = alloc_percpu(struct pcpu_tstats);
|
||||
dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
|
||||
if (!dev->tstats)
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_possible_cpu(i) {
|
||||
struct pcpu_tstats *ip6gre_tap_stats;
|
||||
struct pcpu_sw_netstats *ip6gre_tap_stats;
|
||||
ip6gre_tap_stats = per_cpu_ptr(dev->tstats, i);
|
||||
u64_stats_init(&ip6gre_tap_stats->syncp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include <linux/if.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/if_tunnel.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
|
@ -102,11 +101,12 @@ struct ip6_tnl_net {
|
|||
|
||||
static struct net_device_stats *ip6_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct pcpu_tstats sum = { 0 };
|
||||
struct pcpu_sw_netstats sum = { 0 };
|
||||
int i;
|
||||
|
||||
for_each_possible_cpu(i) {
|
||||
const struct pcpu_tstats *tstats = per_cpu_ptr(dev->tstats, i);
|
||||
const struct pcpu_sw_netstats *tstats =
|
||||
per_cpu_ptr(dev->tstats, i);
|
||||
|
||||
sum.rx_packets += tstats->rx_packets;
|
||||
sum.rx_bytes += tstats->rx_bytes;
|
||||
|
|
@ -784,7 +784,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
|
|||
|
||||
if ((t = ip6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr,
|
||||
&ipv6h->daddr)) != NULL) {
|
||||
struct pcpu_tstats *tstats;
|
||||
struct pcpu_sw_netstats *tstats;
|
||||
|
||||
if (t->parms.proto != ipproto && t->parms.proto != 0) {
|
||||
rcu_read_unlock();
|
||||
|
|
@ -1497,12 +1497,12 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
|
|||
|
||||
t->dev = dev;
|
||||
t->net = dev_net(dev);
|
||||
dev->tstats = alloc_percpu(struct pcpu_tstats);
|
||||
dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
|
||||
if (!dev->tstats)
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_possible_cpu(i) {
|
||||
struct pcpu_tstats *ip6_tnl_stats;
|
||||
struct pcpu_sw_netstats *ip6_tnl_stats;
|
||||
ip6_tnl_stats = per_cpu_ptr(dev->tstats, i);
|
||||
u64_stats_init(&ip6_tnl_stats->syncp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <linux/if.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/if_tunnel.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
|
@ -77,11 +76,12 @@ struct vti6_net {
|
|||
|
||||
static struct net_device_stats *vti6_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct pcpu_tstats sum = { 0 };
|
||||
struct pcpu_sw_netstats sum = { 0 };
|
||||
int i;
|
||||
|
||||
for_each_possible_cpu(i) {
|
||||
const struct pcpu_tstats *tstats = per_cpu_ptr(dev->tstats, i);
|
||||
const struct pcpu_sw_netstats *tstats =
|
||||
per_cpu_ptr(dev->tstats, i);
|
||||
|
||||
sum.rx_packets += tstats->rx_packets;
|
||||
sum.rx_bytes += tstats->rx_bytes;
|
||||
|
|
@ -312,7 +312,7 @@ static int vti6_rcv(struct sk_buff *skb)
|
|||
|
||||
if ((t = vti6_tnl_lookup(dev_net(skb->dev), &ipv6h->saddr,
|
||||
&ipv6h->daddr)) != NULL) {
|
||||
struct pcpu_tstats *tstats;
|
||||
struct pcpu_sw_netstats *tstats;
|
||||
|
||||
if (t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) {
|
||||
rcu_read_unlock();
|
||||
|
|
@ -753,7 +753,7 @@ static inline int vti6_dev_init_gen(struct net_device *dev)
|
|||
|
||||
t->dev = dev;
|
||||
t->net = dev_net(dev);
|
||||
dev->tstats = alloc_percpu(struct pcpu_tstats);
|
||||
dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
|
||||
if (!dev->tstats)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -671,7 +671,7 @@ static int ipip6_rcv(struct sk_buff *skb)
|
|||
tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev,
|
||||
iph->saddr, iph->daddr);
|
||||
if (tunnel != NULL) {
|
||||
struct pcpu_tstats *tstats;
|
||||
struct pcpu_sw_netstats *tstats;
|
||||
|
||||
if (tunnel->parms.iph.protocol != IPPROTO_IPV6 &&
|
||||
tunnel->parms.iph.protocol != 0)
|
||||
|
|
@ -1361,12 +1361,12 @@ static int ipip6_tunnel_init(struct net_device *dev)
|
|||
memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
|
||||
|
||||
ipip6_tunnel_bind_dev(dev);
|
||||
dev->tstats = alloc_percpu(struct pcpu_tstats);
|
||||
dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
|
||||
if (!dev->tstats)
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_possible_cpu(i) {
|
||||
struct pcpu_tstats *ipip6_tunnel_stats;
|
||||
struct pcpu_sw_netstats *ipip6_tunnel_stats;
|
||||
ipip6_tunnel_stats = per_cpu_ptr(dev->tstats, i);
|
||||
u64_stats_init(&ipip6_tunnel_stats->syncp);
|
||||
}
|
||||
|
|
@ -1391,12 +1391,12 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
|
|||
iph->ihl = 5;
|
||||
iph->ttl = 64;
|
||||
|
||||
dev->tstats = alloc_percpu(struct pcpu_tstats);
|
||||
dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
|
||||
if (!dev->tstats)
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_possible_cpu(i) {
|
||||
struct pcpu_tstats *ipip6_fb_stats;
|
||||
struct pcpu_sw_netstats *ipip6_fb_stats;
|
||||
ipip6_fb_stats = per_cpu_ptr(dev->tstats, i);
|
||||
u64_stats_init(&ipip6_fb_stats->syncp);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue