veth: veth pair device code cleanup
Subsystems (2)
cover veth: veth pair device code cleanup
The next two patches remove some unused code in the veth pair network device.
PATCH 1/2 veth: Remove useless veth field
The veth private structure contains a netdev pointer refering to its peer. This field is never used and it is pointless because if we can access, the veth_priv, that means we already have the netdev which is stored in veth_priv->dev.
--- drivers/net/veth.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/veth.c +0 -3
@@ -30,7 +30,6 @@ struct veth_net_stats {struct veth_priv {struct net_device *peer; -struct net_device *dev;struct list_head list;struct veth_net_stats *stats;unsigned ip_summed;
@@ -420,12 +419,10 @@ static int veth_newlink(struct net_devic*/ priv =netdev_priv (dev); - priv->dev = dev; priv->peer = peer;list_add (&priv->list, &veth_list); priv =netdev_priv (peer); - priv->dev = peer; priv->peer = dev;INIT_LIST_HEAD (&priv->list);return 0 ;
Re: [patch 1/2] veth: Remove useless veth field
From: Daniel Lezcano <[email protected]>
Date: Tue, 28 Oct 2008 22:11:43 +0100
Quoted 6 lines
The veth private structure contains a netdev pointer refering to its peer. This field is never used and it is pointless because if we can access, the
veth_priv, that means we already have the netdev which is stored inveth_priv->dev.Signed-off-by Daniel Lezcano <[email protected]>
Applied.
PATCH 2/2 veth: remove unused list
In reply to Daniel LezcanoThe veth network device is stored in a list in the netdev private. AFAICS, this list is never used so I removed this list from the code.
--- drivers/net/veth.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/net/veth.c +0 -13
@@ -8,7 +8,6 @@* */ -#include <linux/list.h> #include <linux/netdevice.h> #include <linux/ethtool.h> #include <linux/etherdevice.h>
@@ -30,13 +29,10 @@ struct veth_net_stats {struct veth_priv {struct net_device *peer; -struct list_head list;struct veth_net_stats *stats;unsigned ip_summed; }; -static LIST_HEAD (veth_list); -/* * ethtool interface */
@@ -420,11 +416,9 @@ static int veth_newlink(struct net_devic priv =netdev_priv (dev); priv->peer = peer; -list_add (&priv->list, &veth_list); priv =netdev_priv (peer); priv->peer = dev; -INIT_LIST_HEAD (&priv->list);return 0 ; err_register_dev:
@@ -446,13 +440,6 @@ static void veth_dellink(struct net_devi priv =netdev_priv (dev); peer = priv->peer; -if (!list_empty (&priv->list)) -list_del (&priv->list); - - priv =netdev_priv (peer); -if (!list_empty (&priv->list)) -list_del (&priv->list); -unregister_netdevice (dev);unregister_netdevice (peer); }
David Miller
maintainerRe: [patch 2/2] veth: remove unused list
From: Daniel Lezcano <[email protected]>
Date: Tue, 28 Oct 2008 22:11:44 +0100
Quoted 4 lines
The veth network device is stored in a list in the netdev private. AFAICS, this list is never used so I removed this list from the code.
Signed-off-by Daniel Lezcano <[email protected]>
Also applied, thanks for these cleanups.