netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Chen <wangchen@cn.fujitsu.com>
To: "David S. Miller" <davem@davemloft.net>, Jeff Garzik <jgarzik@pobox.com>
Cc: maintainers@chelsio.com, netdev@vger.kernel.org,
	Wang Chen <wangchen@cn.fujitsu.com>
Subject: [PATCH 1/4] cxgb2: rtnl_lock out of loop will be faster
Date: Wed, 12 Dec 2007 16:46:13 +0800	[thread overview]
Message-ID: <475F9FD5.3000208@cn.fujitsu.com> (raw)

[PATCH 1/4] [NETDEV] cxgb2: rtnl_lock out of loop will be faster

Before this patch, it gets and releases the lock at each
iteration of the loop. Changing unregister_netdev to
unregister_netdevice and locking outside of the loop will
be faster for this approach.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
 cxgb2.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

--- linux-2.6.24.rc5.org/drivers/net/chelsio/cxgb2.c	2007-12-12 10:19:39.000000000 +0800
+++ linux-2.6.24.rc5/drivers/net/chelsio/cxgb2.c	2007-12-12 16:24:14.000000000 +0800
@@ -46,6 +46,7 @@
 #include <linux/mii.h>
 #include <linux/sockios.h>
 #include <linux/dma-mapping.h>
+#include <linux/rtnetlink.h>
 #include <asm/uaccess.h>
 
 #include "cpl5_cmd.h"
@@ -1387,10 +1388,12 @@ static void __devexit remove_one(struct 
 	struct adapter *adapter = dev->priv;
 	int i;
 
+	rtnl_lock();
 	for_each_port(adapter, i) {
 		if (test_bit(i, &adapter->registered_device_map))
-			unregister_netdev(adapter->port[i].dev);
+			unregister_netdevice(adapter->port[i].dev);
 	}
+	rtnl_unlock();
 
 	t1_free_sw_modules(adapter);
 	iounmap(adapter->regs);


                 reply	other threads:[~2007-12-12  8:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=475F9FD5.3000208@cn.fujitsu.com \
    --to=wangchen@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=jgarzik@pobox.com \
    --cc=maintainers@chelsio.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).