Skip to contentSkip to conversation

veth: veth pair device code cleanup

PATCH Applied Daniel Lezcano 2 participants 5 messages Oct 28, 2008 – Oct 29, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover veth: veth pair device code cleanup

The next two patches remove some unused code in the veth pair network device.

#1 lore raw

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
Index: net-2.6/drivers/net/veth.c
===================================================================
@@ -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;
maintainer Applied
#2 lore raw

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 in veth_priv->dev.

Applied.

#3 lore raw

PATCH 2/2 veth: remove unused list

In reply to Daniel Lezcano

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.

---
 drivers/net/veth.c |   13 -------------
 1 file changed, 13 deletions(-)
drivers/net/veth.c +0 -13
Index: net-2.6/drivers/net/veth.c
===================================================================
@@ -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);
 }
maintainer
#4 lore raw

Re: [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.

Also applied, thanks for these cleanups.