aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipip.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-05-21 17:15:16 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-21 17:15:16 -0400
commit50f59cea075875d84018a5fc62cf2f5e6173a919 (patch)
treeae018655310dd3ad09b549764c6437a6748c06e8 /net/ipv4/ipip.c
parentaddd68eb6fe6f10017974947c90cc85ab2848cf2 (diff)
ipip: Use on-device stats instead of private ones.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipip.c')
-rw-r--r--net/ipv4/ipip.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 149111f08e8d..26c85c23ca4f 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -496,8 +496,8 @@ static int ipip_rcv(struct sk_buff *skb)
496 skb->protocol = htons(ETH_P_IP); 496 skb->protocol = htons(ETH_P_IP);
497 skb->pkt_type = PACKET_HOST; 497 skb->pkt_type = PACKET_HOST;
498 498
499 tunnel->stat.rx_packets++; 499 tunnel->dev->stats.rx_packets++;
500 tunnel->stat.rx_bytes += skb->len; 500 tunnel->dev->stats.rx_bytes += skb->len;
501 skb->dev = tunnel->dev; 501 skb->dev = tunnel->dev;
502 dst_release(skb->dst); 502 dst_release(skb->dst);
503 skb->dst = NULL; 503 skb->dst = NULL;
@@ -520,7 +520,7 @@ static int ipip_rcv(struct sk_buff *skb)
520static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 520static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
521{ 521{
522 struct ip_tunnel *tunnel = netdev_priv(dev); 522 struct ip_tunnel *tunnel = netdev_priv(dev);
523 struct net_device_stats *stats = &tunnel->stat; 523 struct net_device_stats *stats = &tunnel->dev->stats;
524 struct iphdr *tiph = &tunnel->parms.iph; 524 struct iphdr *tiph = &tunnel->parms.iph;
525 u8 tos = tunnel->parms.iph.tos; 525 u8 tos = tunnel->parms.iph.tos;
526 __be16 df = tiph->frag_off; 526 __be16 df = tiph->frag_off;
@@ -533,7 +533,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
533 int mtu; 533 int mtu;
534 534
535 if (tunnel->recursion++) { 535 if (tunnel->recursion++) {
536 tunnel->stat.collisions++; 536 stats->collisions++;
537 goto tx_error; 537 goto tx_error;
538 } 538 }
539 539
@@ -546,7 +546,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
546 if (!dst) { 546 if (!dst) {
547 /* NBMA tunnel */ 547 /* NBMA tunnel */
548 if ((rt = skb->rtable) == NULL) { 548 if ((rt = skb->rtable) == NULL) {
549 tunnel->stat.tx_fifo_errors++; 549 stats->tx_fifo_errors++;
550 goto tx_error; 550 goto tx_error;
551 } 551 }
552 if ((dst = rt->rt_gateway) == 0) 552 if ((dst = rt->rt_gateway) == 0)
@@ -561,7 +561,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
561 .tos = RT_TOS(tos) } }, 561 .tos = RT_TOS(tos) } },
562 .proto = IPPROTO_IPIP }; 562 .proto = IPPROTO_IPIP };
563 if (ip_route_output_key(dev_net(dev), &rt, &fl)) { 563 if (ip_route_output_key(dev_net(dev), &rt, &fl)) {
564 tunnel->stat.tx_carrier_errors++; 564 stats->tx_carrier_errors++;
565 goto tx_error_icmp; 565 goto tx_error_icmp;
566 } 566 }
567 } 567 }
@@ -569,7 +569,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
569 569
570 if (tdev == dev) { 570 if (tdev == dev) {
571 ip_rt_put(rt); 571 ip_rt_put(rt);
572 tunnel->stat.collisions++; 572 stats->collisions++;
573 goto tx_error; 573 goto tx_error;
574 } 574 }
575 575
@@ -579,7 +579,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
579 mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu; 579 mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu;
580 580
581 if (mtu < 68) { 581 if (mtu < 68) {
582 tunnel->stat.collisions++; 582 stats->collisions++;
583 ip_rt_put(rt); 583 ip_rt_put(rt);
584 goto tx_error; 584 goto tx_error;
585 } 585 }
@@ -813,11 +813,6 @@ done:
813 return err; 813 return err;
814} 814}
815 815
816static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev)
817{
818 return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
819}
820
821static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) 816static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu)
822{ 817{
823 if (new_mtu < 68 || new_mtu > 0xFFF8 - sizeof(struct iphdr)) 818 if (new_mtu < 68 || new_mtu > 0xFFF8 - sizeof(struct iphdr))
@@ -830,7 +825,6 @@ static void ipip_tunnel_setup(struct net_device *dev)
830{ 825{
831 dev->uninit = ipip_tunnel_uninit; 826 dev->uninit = ipip_tunnel_uninit;
832 dev->hard_start_xmit = ipip_tunnel_xmit; 827 dev->hard_start_xmit = ipip_tunnel_xmit;
833 dev->get_stats = ipip_tunnel_get_stats;
834 dev->do_ioctl = ipip_tunnel_ioctl; 828 dev->do_ioctl = ipip_tunnel_ioctl;
835 dev->change_mtu = ipip_tunnel_change_mtu; 829 dev->change_mtu = ipip_tunnel_change_mtu;
836 dev->destructor = free_netdev; 830 dev->destructor = free_netdev;