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>
This commit is contained in:

committed by
David S. Miller

parent
653864d9dd
commit
8f84985fec
@@ -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;
|
||||
|
Reference in New Issue
Block a user