netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] net: dummy: add auto_up module parameter
@ 2010-11-30 15:57 Octavian Purdila
  2010-12-06 20:36 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Octavian Purdila @ 2010-11-30 15:57 UTC (permalink / raw)
  To: netdev; +Cc: Vlad Dogaru, Lucian Grijincu, Octavian Purdila

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(-)

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;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next-2.6] net: dummy: add auto_up module parameter
  2010-11-30 15:57 [PATCH net-next-2.6] net: dummy: add auto_up module parameter Octavian Purdila
@ 2010-12-06 20:36 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-12-06 20:36 UTC (permalink / raw)
  To: opurdila; +Cc: netdev, ddvlad, lucian.grijincu

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-06 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-30 15:57 [PATCH net-next-2.6] net: dummy: add auto_up module parameter Octavian Purdila
2010-12-06 20:36 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).