Commit 50f59cea075875d84018a5fc62cf2f5e6173a919
Committed by
David S. Miller
1 parent
addd68eb6f
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 8 additions and 14 deletions Side-by-side Diff
net/ipv4/ipip.c
... | ... | @@ -496,8 +496,8 @@ |
496 | 496 | skb->protocol = htons(ETH_P_IP); |
497 | 497 | skb->pkt_type = PACKET_HOST; |
498 | 498 | |
499 | - tunnel->stat.rx_packets++; | |
500 | - tunnel->stat.rx_bytes += skb->len; | |
499 | + tunnel->dev->stats.rx_packets++; | |
500 | + tunnel->dev->stats.rx_bytes += skb->len; | |
501 | 501 | skb->dev = tunnel->dev; |
502 | 502 | dst_release(skb->dst); |
503 | 503 | skb->dst = NULL; |
... | ... | @@ -520,7 +520,7 @@ |
520 | 520 | static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) |
521 | 521 | { |
522 | 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 | 524 | struct iphdr *tiph = &tunnel->parms.iph; |
525 | 525 | u8 tos = tunnel->parms.iph.tos; |
526 | 526 | __be16 df = tiph->frag_off; |
... | ... | @@ -533,7 +533,7 @@ |
533 | 533 | int mtu; |
534 | 534 | |
535 | 535 | if (tunnel->recursion++) { |
536 | - tunnel->stat.collisions++; | |
536 | + stats->collisions++; | |
537 | 537 | goto tx_error; |
538 | 538 | } |
539 | 539 | |
... | ... | @@ -546,7 +546,7 @@ |
546 | 546 | if (!dst) { |
547 | 547 | /* NBMA tunnel */ |
548 | 548 | if ((rt = skb->rtable) == NULL) { |
549 | - tunnel->stat.tx_fifo_errors++; | |
549 | + stats->tx_fifo_errors++; | |
550 | 550 | goto tx_error; |
551 | 551 | } |
552 | 552 | if ((dst = rt->rt_gateway) == 0) |
... | ... | @@ -561,7 +561,7 @@ |
561 | 561 | .tos = RT_TOS(tos) } }, |
562 | 562 | .proto = IPPROTO_IPIP }; |
563 | 563 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { |
564 | - tunnel->stat.tx_carrier_errors++; | |
564 | + stats->tx_carrier_errors++; | |
565 | 565 | goto tx_error_icmp; |
566 | 566 | } |
567 | 567 | } |
... | ... | @@ -569,7 +569,7 @@ |
569 | 569 | |
570 | 570 | if (tdev == dev) { |
571 | 571 | ip_rt_put(rt); |
572 | - tunnel->stat.collisions++; | |
572 | + stats->collisions++; | |
573 | 573 | goto tx_error; |
574 | 574 | } |
575 | 575 | |
... | ... | @@ -579,7 +579,7 @@ |
579 | 579 | mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu; |
580 | 580 | |
581 | 581 | if (mtu < 68) { |
582 | - tunnel->stat.collisions++; | |
582 | + stats->collisions++; | |
583 | 583 | ip_rt_put(rt); |
584 | 584 | goto tx_error; |
585 | 585 | } |
... | ... | @@ -813,11 +813,6 @@ |
813 | 813 | return err; |
814 | 814 | } |
815 | 815 | |
816 | -static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev) | |
817 | -{ | |
818 | - return &(((struct ip_tunnel*)netdev_priv(dev))->stat); | |
819 | -} | |
820 | - | |
821 | 816 | static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) |
822 | 817 | { |
823 | 818 | if (new_mtu < 68 || new_mtu > 0xFFF8 - sizeof(struct iphdr)) |
... | ... | @@ -830,7 +825,6 @@ |
830 | 825 | { |
831 | 826 | dev->uninit = ipip_tunnel_uninit; |
832 | 827 | dev->hard_start_xmit = ipip_tunnel_xmit; |
833 | - dev->get_stats = ipip_tunnel_get_stats; | |
834 | 828 | dev->do_ioctl = ipip_tunnel_ioctl; |
835 | 829 | dev->change_mtu = ipip_tunnel_change_mtu; |
836 | 830 | dev->destructor = free_netdev; |