diff options
author | Cong Wang <amwang@redhat.com> | 2013-08-31 01:44:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-31 22:30:00 -0400 |
commit | f39dc1023d6b9933528638a0c2dd618b4fdf664e (patch) | |
tree | 827325cb95d1edf0e4b928c80539d5d962da556d | |
parent | e15a00aafa4b7953ad717d3cb1ad7acf4ff76945 (diff) |
ipv6: move in6_dev_finish_destroy() into core kernel
in6_dev_put() will be needed by vxlan module, so is
in6_dev_finish_destroy().
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/addrconf.c | 30 | ||||
-rw-r--r-- | net/ipv6/addrconf_core.c | 31 |
2 files changed, 31 insertions, 30 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index baaaead69ee1..2a66eaad047f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -304,36 +304,6 @@ err_ip: | |||
304 | return -ENOMEM; | 304 | return -ENOMEM; |
305 | } | 305 | } |
306 | 306 | ||
307 | static void snmp6_free_dev(struct inet6_dev *idev) | ||
308 | { | ||
309 | kfree(idev->stats.icmpv6msgdev); | ||
310 | kfree(idev->stats.icmpv6dev); | ||
311 | snmp_mib_free((void __percpu **)idev->stats.ipv6); | ||
312 | } | ||
313 | |||
314 | /* Nobody refers to this device, we may destroy it. */ | ||
315 | |||
316 | void in6_dev_finish_destroy(struct inet6_dev *idev) | ||
317 | { | ||
318 | struct net_device *dev = idev->dev; | ||
319 | |||
320 | WARN_ON(!list_empty(&idev->addr_list)); | ||
321 | WARN_ON(idev->mc_list != NULL); | ||
322 | WARN_ON(timer_pending(&idev->rs_timer)); | ||
323 | |||
324 | #ifdef NET_REFCNT_DEBUG | ||
325 | pr_debug("%s: %s\n", __func__, dev ? dev->name : "NIL"); | ||
326 | #endif | ||
327 | dev_put(dev); | ||
328 | if (!idev->dead) { | ||
329 | pr_warn("Freeing alive inet6 device %p\n", idev); | ||
330 | return; | ||
331 | } | ||
332 | snmp6_free_dev(idev); | ||
333 | kfree_rcu(idev, rcu); | ||
334 | } | ||
335 | EXPORT_SYMBOL(in6_dev_finish_destroy); | ||
336 | |||
337 | static struct inet6_dev *ipv6_add_dev(struct net_device *dev) | 307 | static struct inet6_dev *ipv6_add_dev(struct net_device *dev) |
338 | { | 308 | { |
339 | struct inet6_dev *ndev; | 309 | struct inet6_dev *ndev; |
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c index a864033d9e78..4c11cbcf8308 100644 --- a/net/ipv6/addrconf_core.c +++ b/net/ipv6/addrconf_core.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/export.h> | 6 | #include <linux/export.h> |
7 | #include <net/ipv6.h> | 7 | #include <net/ipv6.h> |
8 | #include <net/addrconf.h> | 8 | #include <net/addrconf.h> |
9 | #include <net/ip.h> | ||
9 | 10 | ||
10 | #define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) | 11 | #define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) |
11 | 12 | ||
@@ -117,3 +118,33 @@ const struct in6_addr in6addr_interfacelocal_allrouters = IN6ADDR_INTERFACELOCAL | |||
117 | EXPORT_SYMBOL(in6addr_interfacelocal_allrouters); | 118 | EXPORT_SYMBOL(in6addr_interfacelocal_allrouters); |
118 | const struct in6_addr in6addr_sitelocal_allrouters = IN6ADDR_SITELOCAL_ALLROUTERS_INIT; | 119 | const struct in6_addr in6addr_sitelocal_allrouters = IN6ADDR_SITELOCAL_ALLROUTERS_INIT; |
119 | EXPORT_SYMBOL(in6addr_sitelocal_allrouters); | 120 | EXPORT_SYMBOL(in6addr_sitelocal_allrouters); |
121 | |||
122 | static void snmp6_free_dev(struct inet6_dev *idev) | ||
123 | { | ||
124 | kfree(idev->stats.icmpv6msgdev); | ||
125 | kfree(idev->stats.icmpv6dev); | ||
126 | snmp_mib_free((void __percpu **)idev->stats.ipv6); | ||
127 | } | ||
128 | |||
129 | /* Nobody refers to this device, we may destroy it. */ | ||
130 | |||
131 | void in6_dev_finish_destroy(struct inet6_dev *idev) | ||
132 | { | ||
133 | struct net_device *dev = idev->dev; | ||
134 | |||
135 | WARN_ON(!list_empty(&idev->addr_list)); | ||
136 | WARN_ON(idev->mc_list != NULL); | ||
137 | WARN_ON(timer_pending(&idev->rs_timer)); | ||
138 | |||
139 | #ifdef NET_REFCNT_DEBUG | ||
140 | pr_debug("%s: %s\n", __func__, dev ? dev->name : "NIL"); | ||
141 | #endif | ||
142 | dev_put(dev); | ||
143 | if (!idev->dead) { | ||
144 | pr_warn("Freeing alive inet6 device %p\n", idev); | ||
145 | return; | ||
146 | } | ||
147 | snmp6_free_dev(idev); | ||
148 | kfree_rcu(idev, rcu); | ||
149 | } | ||
150 | EXPORT_SYMBOL(in6_dev_finish_destroy); | ||