[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20130610132448.3f3c5d93@nehalam.linuxnetplumber.net>
Date: Mon, 10 Jun 2013 13:24:48 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH net-next 06/12] vxlan: move freecpu to uninit
Use ndo_uninit to avoid having to override destructor.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
--- a/drivers/net/vxlan.c 2013-06-10 12:19:59.522092022 -0700
+++ b/drivers/net/vxlan.c 2013-06-10 12:20:00.590079878 -0700
@@ -1272,6 +1272,17 @@ static int vxlan_init(struct net_device
return 0;
}
+static void vxlan_uninit(struct net_device *dev)
+{
+ struct vxlan_dev *vxlan = netdev_priv(dev);
+ struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
+ struct vxlan_sock *vs = vxlan->vn_sock;
+
+ if (vs)
+ vxlan_sock_release(vn, vs);
+ free_percpu(dev->tstats);
+}
+
/* Start ageing timer and join group when device is brought up */
static int vxlan_open(struct net_device *dev)
{
@@ -1337,6 +1348,7 @@ static void vxlan_set_multicast_list(str
static const struct net_device_ops vxlan_netdev_ops = {
.ndo_init = vxlan_init,
+ .ndo_uninit = vxlan_uninit,
.ndo_open = vxlan_open,
.ndo_stop = vxlan_stop,
.ndo_start_xmit = vxlan_xmit,
@@ -1355,12 +1367,6 @@ static struct device_type vxlan_type = {
.name = "vxlan",
};
-static void vxlan_free(struct net_device *dev)
-{
- free_percpu(dev->tstats);
- free_netdev(dev);
-}
-
/* Initialize the device structure. */
static void vxlan_setup(struct net_device *dev)
{
@@ -1373,7 +1379,7 @@ static void vxlan_setup(struct net_devic
dev->hard_header_len = ETH_HLEN + VXLAN_HEADROOM;
dev->netdev_ops = &vxlan_netdev_ops;
- dev->destructor = vxlan_free;
+ dev->destructor = free_netdev;
SET_NETDEV_DEVTYPE(dev, &vxlan_type);
dev->tx_queue_len = 0;
@@ -1676,14 +1682,10 @@ static int vxlan_newlink(struct net *net
static void vxlan_dellink(struct net_device *dev, struct list_head *head)
{
struct vxlan_dev *vxlan = netdev_priv(dev);
- struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
- struct vxlan_sock *vs = vxlan->vn_sock;
hlist_del_rcu(&vxlan->hlist);
list_del(&vxlan->next);
unregister_netdevice_queue(dev, head);
- if (vs)
- vxlan_sock_release(vn, vs);
}
static size_t vxlan_get_size(const struct net_device *dev)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists