diff mbox

[net-next-2.6] net: dummy: add auto_up module parameter

Message ID 1291132647-15018-1-git-send-email-opurdila@ixiacom.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Octavian Purdila Nov. 30, 2010, 3:57 p.m. UTC
Add auto_up module parameter to automatically bring up the created
devices. This is useful when using the dummy driver for testing net
device register / unregister performance.

Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
---
 drivers/net/dummy.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

David Miller Dec. 6, 2010, 8:36 p.m. UTC | #1
From: Octavian Purdila <opurdila@ixiacom.com>
Date: Tue, 30 Nov 2010 17:57:27 +0200

> Add auto_up module parameter to automatically bring up the created
> devices. This is useful when using the dummy driver for testing net
> device register / unregister performance.
> 
> Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>

Registering a new netdevice with IFF_UP set is an error.  You can't
set IFF_UP without also doing all of the other work, callbacks, and
state changes which are made by dev_open()'s code paths.

If, as you say, your interests are in testing register/unregister
performance, you can do that by making the appropriate calls in a loop
from userspace.

I honestly don't see what you hope to gain with this change, and
anyways since the registration state is basically illegal you'll need
to find another way to do this.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index ff2d29b..ce653b0 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -39,6 +39,7 @@ 
 #include <linux/u64_stats_sync.h>
 
 static int numdummies = 1;
+static int auto_up;
 
 static int dummy_set_address(struct net_device *dev, void *p)
 {
@@ -132,6 +133,8 @@  static void dummy_setup(struct net_device *dev)
 	/* Fill in device structure with ethernet-generic values. */
 	dev->tx_queue_len = 0;
 	dev->flags |= IFF_NOARP;
+	if (auto_up)
+		dev->flags |= IFF_UP;
 	dev->flags &= ~IFF_MULTICAST;
 	dev->features	|= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO;
 	dev->features	|= NETIF_F_NO_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
@@ -159,6 +162,9 @@  static struct rtnl_link_ops dummy_link_ops __read_mostly = {
 module_param(numdummies, int, 0);
 MODULE_PARM_DESC(numdummies, "Number of dummy pseudo devices");
 
+module_param(auto_up, int, 0);
+MODULE_PARM_DESC(auto_up, "Automatically bring up the device when created");
+
 static int __init dummy_init_one(void)
 {
 	struct net_device *dev_dummy;