From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH net-next 5/10][SIT]: Use on-device stats instead of private ones.
Date: Tue, 20 May 2008 20:36:47 +0400 [thread overview]
Message-ID: <4832FE1F.1030704@openvz.org> (raw)
In-Reply-To: <4832FBD7.7040209@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
net/ipv6/sit.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 5a6fab9..b0ee961 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -578,13 +578,13 @@ static int ipip6_rcv(struct sk_buff *skb)
if ((tunnel->dev->priv_flags & IFF_ISATAP) &&
!isatap_chksrc(skb, iph, tunnel)) {
- tunnel->stat.rx_errors++;
+ tunnel->dev->stats.rx_errors++;
read_unlock(&ipip6_lock);
kfree_skb(skb);
return 0;
}
- tunnel->stat.rx_packets++;
- tunnel->stat.rx_bytes += skb->len;
+ tunnel->dev->stats.rx_packets++;
+ tunnel->dev->stats.rx_bytes += skb->len;
skb->dev = tunnel->dev;
dst_release(skb->dst);
skb->dst = NULL;
@@ -624,7 +624,7 @@ static inline __be32 try_6to4(struct in6_addr *v6dst)
static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *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 ipv6hdr *iph6 = ipv6_hdr(skb);
u8 tos = tunnel->parms.iph.tos;
@@ -638,7 +638,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
int addr_type;
if (tunnel->recursion++) {
- tunnel->stat.collisions++;
+ stats->collisions++;
goto tx_error;
}
@@ -705,20 +705,20 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
.oif = tunnel->parms.link,
.proto = IPPROTO_IPV6 };
if (ip_route_output_key(dev_net(dev), &rt, &fl)) {
- tunnel->stat.tx_carrier_errors++;
+ stats->tx_carrier_errors++;
goto tx_error_icmp;
}
}
if (rt->rt_type != RTN_UNICAST) {
ip_rt_put(rt);
- tunnel->stat.tx_carrier_errors++;
+ stats->tx_carrier_errors++;
goto tx_error_icmp;
}
tdev = rt->u.dst.dev;
if (tdev == dev) {
ip_rt_put(rt);
- tunnel->stat.collisions++;
+ stats->collisions++;
goto tx_error;
}
@@ -728,7 +728,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
mtu = skb->dst ? dst_mtu(skb->dst) : dev->mtu;
if (mtu < 68) {
- tunnel->stat.collisions++;
+ stats->collisions++;
ip_rt_put(rt);
goto tx_error;
}
@@ -1003,11 +1003,6 @@ done:
return err;
}
-static struct net_device_stats *ipip6_tunnel_get_stats(struct net_device *dev)
-{
- return &(((struct ip_tunnel*)netdev_priv(dev))->stat);
-}
-
static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu)
{
if (new_mtu < IPV6_MIN_MTU || new_mtu > 0xFFF8 - sizeof(struct iphdr))
@@ -1021,7 +1016,6 @@ static void ipip6_tunnel_setup(struct net_device *dev)
dev->uninit = ipip6_tunnel_uninit;
dev->destructor = free_netdev;
dev->hard_start_xmit = ipip6_tunnel_xmit;
- dev->get_stats = ipip6_tunnel_get_stats;
dev->do_ioctl = ipip6_tunnel_ioctl;
dev->change_mtu = ipip6_tunnel_change_mtu;
--
1.5.3.4
next prev parent reply other threads:[~2008-05-20 16:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 16:27 [PATCH net-next 0/10] Stir up struct net_device_stats usage and whereabouts Pavel Emelyanov
2008-05-20 16:29 ` [PATCH net-next 1/10][CORE]: The dev->get_stats pointer is not NULL nowadays Pavel Emelyanov
2008-05-20 16:32 ` [PATCH net-next 2/10][BRIDE]: Use on-device stats instead of private ones Pavel Emelyanov
2008-05-20 16:34 ` [PATCH net-next 3/10][IPGRE]: " Pavel Emelyanov
2008-05-20 16:36 ` [PATCH net-next 4/10][IPIP]: " Pavel Emelyanov
2008-05-20 16:36 ` Pavel Emelyanov [this message]
2008-05-20 16:38 ` [PATCH net-next 6/10][IPMR]: Ipip tunnel uses on-device stats Pavel Emelyanov
2008-05-20 16:39 ` [PATCH net-next 7/10][TUNNELS]: Remove stat member from ip_tunnel struct Pavel Emelyanov
2008-05-20 16:41 ` [PATCH net-next 8/10][IP6TNL]: Use on-device stats instead of private ones Pavel Emelyanov
2008-05-20 16:43 ` [PATCH net-next 9/10][IPMR]: " Pavel Emelyanov
2008-05-20 16:44 ` [PATCH net-next 10/10][IP6MR]: " Pavel Emelyanov
2008-05-21 21:18 ` [PATCH net-next 0/10] Stir up struct net_device_stats usage and whereabouts David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4832FE1F.1030704@openvz.org \
--to=xemul@openvz.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).