Commit 50f59cea authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

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

Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent addd68eb
...@@ -496,8 +496,8 @@ static int ipip_rcv(struct sk_buff *skb) ...@@ -496,8 +496,8 @@ static int ipip_rcv(struct sk_buff *skb)
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
tunnel->stat.rx_packets++; tunnel->dev->stats.rx_packets++;
tunnel->stat.rx_bytes += skb->len; tunnel->dev->stats.rx_bytes += skb->len;
skb->dev = tunnel->dev; skb->dev = tunnel->dev;
dst_release(skb->dst); dst_release(skb->dst);
skb->dst = NULL; skb->dst = NULL;
...@@ -520,7 +520,7 @@ static int ipip_rcv(struct sk_buff *skb) ...@@ -520,7 +520,7 @@ static int ipip_rcv(struct sk_buff *skb)
static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct ip_tunnel *tunnel = netdev_priv(dev); struct ip_tunnel *tunnel = netdev_priv(dev);
struct net_device_stats *stats = &tunnel->stat; struct net_device_stats *stats = &tunnel->dev->stats;
struct iphdr *tiph = &tunnel->parms.iph; struct iphdr *tiph = &tunnel->parms.iph;
u8 tos = tunnel->parms.iph.tos; u8 tos = tunnel->parms.iph.tos;
__be16 df = tiph->frag_off; __be16 df = tiph->frag_off;
...@@ -533,7 +533,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -533,7 +533,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
int mtu; int mtu;
if (tunnel->recursion++) { if (tunnel->recursion++) {
tunnel->stat.collisions++; stats->collisions++;
goto tx_error; goto tx_error;
} }
...@@ -546,7 +546,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -546,7 +546,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
if (!dst) { if (!dst) {
/* NBMA tunnel */ /* NBMA tunnel */
if ((rt = skb->rtable) == NULL) { if ((rt = skb->rtable) == NULL) {
tunnel->stat.tx_fifo_errors++; stats->tx_fifo_errors++;
goto tx_error; goto tx_error;
} }
if ((dst = rt->rt_gateway) == 0) if ((dst = rt->rt_gateway) == 0)
...@@ -561,7 +561,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -561,7 +561,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
.tos = RT_TOS(tos) } }, .tos = RT_TOS(tos) } },
.proto = IPPROTO_IPIP }; .proto = IPPROTO_IPIP };
if (ip_route_output_key(dev_net(dev), &rt, &fl)) { if (ip_route_output_key(dev_net(dev), &rt, &fl)) {
tunnel->stat.tx_carrier_errors++; stats->tx_carrier_errors++;
goto tx_error_icmp; goto tx_error_icmp;
} }
} }
...@@ -569,7 +569,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -569,7 +569,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
if (tdev == dev) { if (tdev == dev) {
ip_rt_put(rt); ip_rt_put(rt);
tunnel->stat.collisions++; stats->collisions++;
goto tx_error; goto tx_error;
} }
...@@ -579,7 +579,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -579,7 +579,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu; mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu;
if (mtu < 68) { if (mtu < 68) {
tunnel->stat.collisions++; stats->collisions++;
ip_rt_put(rt); ip_rt_put(rt);
goto tx_error; goto tx_error;
} }
...@@ -813,11 +813,6 @@ done: ...@@ -813,11 +813,6 @@ done:
return err; return err;
} }
static struct net_device_stats *ipip_tunnel_get_stats(struct net_device *dev)
{
return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
}
static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu) static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu)
{ {
if (new_mtu < 68 || new_mtu > 0xFFF8 - sizeof(struct iphdr)) if (new_mtu < 68 || new_mtu > 0xFFF8 - sizeof(struct iphdr))
...@@ -830,7 +825,6 @@ static void ipip_tunnel_setup(struct net_device *dev) ...@@ -830,7 +825,6 @@ static void ipip_tunnel_setup(struct net_device *dev)
{ {
dev->uninit = ipip_tunnel_uninit; dev->uninit = ipip_tunnel_uninit;
dev->hard_start_xmit = ipip_tunnel_xmit; dev->hard_start_xmit = ipip_tunnel_xmit;
dev->get_stats = ipip_tunnel_get_stats;
dev->do_ioctl = ipip_tunnel_ioctl; dev->do_ioctl = ipip_tunnel_ioctl;
dev->change_mtu = ipip_tunnel_change_mtu; dev->change_mtu = ipip_tunnel_change_mtu;
dev->destructor = free_netdev; dev->destructor = free_netdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment