ip6mr: Use on-device stats instead of private ones.

Similar to ipmr.

[ Fix build failures -DaveM ]

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Pavel Emelyanov 2008-05-21 14:17:54 -07:00 committed by David S. Miller
parent cf3677ae19
commit dc58c78c04
1 changed files with 7 additions and 15 deletions

View File

@ -388,8 +388,8 @@ static int pim6_rcv(struct sk_buff *skb)
skb->ip_summed = 0; skb->ip_summed = 0;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
dst_release(skb->dst); dst_release(skb->dst);
((struct net_device_stats *)netdev_priv(reg_dev))->rx_bytes += skb->len; reg_dev->stats.rx_bytes += skb->len;
((struct net_device_stats *)netdev_priv(reg_dev))->rx_packets++; reg_dev->stats.rx_packets++;
skb->dst = NULL; skb->dst = NULL;
nf_reset(skb); nf_reset(skb);
netif_rx(skb); netif_rx(skb);
@ -409,26 +409,20 @@ static struct inet6_protocol pim6_protocol = {
static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
read_lock(&mrt_lock); read_lock(&mrt_lock);
((struct net_device_stats *)netdev_priv(dev))->tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
((struct net_device_stats *)netdev_priv(dev))->tx_packets++; dev->stats.tx_packets++;
ip6mr_cache_report(skb, reg_vif_num, MRT6MSG_WHOLEPKT); ip6mr_cache_report(skb, reg_vif_num, MRT6MSG_WHOLEPKT);
read_unlock(&mrt_lock); read_unlock(&mrt_lock);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
static struct net_device_stats *reg_vif_get_stats(struct net_device *dev)
{
return (struct net_device_stats *)netdev_priv(dev);
}
static void reg_vif_setup(struct net_device *dev) static void reg_vif_setup(struct net_device *dev)
{ {
dev->type = ARPHRD_PIMREG; dev->type = ARPHRD_PIMREG;
dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8; dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8;
dev->flags = IFF_NOARP; dev->flags = IFF_NOARP;
dev->hard_start_xmit = reg_vif_xmit; dev->hard_start_xmit = reg_vif_xmit;
dev->get_stats = reg_vif_get_stats;
dev->destructor = free_netdev; dev->destructor = free_netdev;
} }
@ -436,9 +430,7 @@ static struct net_device *ip6mr_reg_vif(void)
{ {
struct net_device *dev; struct net_device *dev;
dev = alloc_netdev(sizeof(struct net_device_stats), "pim6reg", dev = alloc_netdev(0, "pim6reg", reg_vif_setup);
reg_vif_setup);
if (dev == NULL) if (dev == NULL)
return NULL; return NULL;
@ -1377,8 +1369,8 @@ static int ip6mr_forward2(struct sk_buff *skb, struct mfc6_cache *c, int vifi)
if (vif->flags & MIFF_REGISTER) { if (vif->flags & MIFF_REGISTER) {
vif->pkt_out++; vif->pkt_out++;
vif->bytes_out += skb->len; vif->bytes_out += skb->len;
((struct net_device_stats *)netdev_priv(vif->dev))->tx_bytes += skb->len; vif->dev->stats.tx_bytes += skb->len;
((struct net_device_stats *)netdev_priv(vif->dev))->tx_packets++; vif->dev->stats.tx_packets++;
ip6mr_cache_report(skb, vifi, MRT6MSG_WHOLEPKT); ip6mr_cache_report(skb, vifi, MRT6MSG_WHOLEPKT);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;