From: Pavel Emelyanov <xemul@parallels.com>
To: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH] ip_gre: fix percpu stats accounting
Date: Thu, 28 Oct 2010 20:07:56 +0400 [thread overview]
Message-ID: <4CC99FDC.9070102@parallels.com> (raw)
commit e985aad7 (ip_gre: percpu stats accounting) forgot the fallback
tunnel case (gre0).
This is the 4th part of the "foo: fix percpu stats accounting" series ;)
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 01087e0..be05d5b 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1321,7 +1321,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
return 0;
}
-static void ipgre_fb_tunnel_init(struct net_device *dev)
+static int ipgre_fb_tunnel_init(struct net_device *dev)
{
struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph;
@@ -1335,8 +1335,13 @@ static void ipgre_fb_tunnel_init(struct net_device *dev)
iph->ihl = 5;
tunnel->hlen = sizeof(struct iphdr) + 4;
+ dev->tstats = alloc_percpu(struct pcpu_tstats);
+ if (!dev->tstats)
+ return -ENOMEM;
+
dev_hold(dev);
rcu_assign_pointer(ign->tunnels_wc[0], tunnel);
+ return 0;
}
@@ -1377,7 +1382,10 @@ static int __net_init ipgre_init_net(struct net *net)
}
dev_net_set(ign->fb_tunnel_dev, net);
- ipgre_fb_tunnel_init(ign->fb_tunnel_dev);
+ err = ipgre_fb_tunnel_init(ign->fb_tunnel_dev);
+ if (err)
+ goto err_reg_dev;
+
ign->fb_tunnel_dev->rtnl_link_ops = &ipgre_link_ops;
if ((err = register_netdev(ign->fb_tunnel_dev)))
@@ -1386,7 +1394,7 @@ static int __net_init ipgre_init_net(struct net *net)
return 0;
err_reg_dev:
- free_netdev(ign->fb_tunnel_dev);
+ ipgre_dev_free(ign->fb_tunnel_dev);
err_alloc_dev:
return err;
}
next reply other threads:[~2010-10-28 16:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 16:07 Pavel Emelyanov [this message]
2010-10-28 16:33 ` [PATCH] ip_gre: fix percpu stats accounting Eric Dumazet
2010-10-28 17:29 ` David Miller
2010-10-28 18:38 ` Eric Dumazet
2010-10-28 18:41 ` David Miller
2010-10-28 18:47 ` Eric Dumazet
2010-10-28 18:49 ` David Miller
2010-10-28 19:11 ` [PATCH] ip_gre: fix fallback tunnel setup Eric Dumazet
2010-10-28 19:29 ` Pavel Emelyanov
2010-10-28 19:34 ` Eric Dumazet
2010-10-30 23:21 ` 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=4CC99FDC.9070102@parallels.com \
--to=xemul@parallels.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.