netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH 4/5 net-next] cnic: Improve NETDEV_UP event handling
Date: Wed, 8 Jun 2011 22:29:35 -0700	[thread overview]
Message-ID: <1307597376-5379-4-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1307597376-5379-3-git-send-email-mchan@broadcom.com>

During NETDEV_UP, we use symbol_get() to get the net driver's cnic
probe function.  This sometimes doesn't work if NETDEV_UP happens
right after NETDEV_REGISTER and the net driver is still running module
init code.  As a result, the cnic device may not be discovered.  We
fix this by probing on all NETDEV events if the device's netif_running
state is up.

Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/cnic.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index a529bde..6c544b3 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -5342,7 +5342,7 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
 
 	dev = cnic_from_netdev(netdev);
 
-	if (!dev && (event == NETDEV_REGISTER || event == NETDEV_UP)) {
+	if (!dev && (event == NETDEV_REGISTER || netif_running(netdev))) {
 		/* Check for the hot-plug device */
 		dev = is_cnic_dev(netdev);
 		if (dev) {
@@ -5358,7 +5358,7 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
 		else if (event == NETDEV_UNREGISTER)
 			cnic_ulp_exit(dev);
 
-		if (event == NETDEV_UP) {
+		if (event == NETDEV_UP || (new_dev && netif_running(netdev))) {
 			if (cnic_register_netdev(dev) != 0) {
 				cnic_put(dev);
 				goto done;
-- 
1.6.4.GIT



  reply	other threads:[~2011-06-09  6:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  5:29 [PATCH 1/5 net-next] cnic: Fix interrupt logic Michael Chan
2011-06-09  5:29 ` [PATCH 2/5 net-next] cnic: Fix race conditions with firmware Michael Chan
2011-06-09  5:29   ` [PATCH 3/5 net-next] cnic: Randomize initial TCP port for iSCSI connections Michael Chan
2011-06-09  5:29     ` Michael Chan [this message]
2011-06-09  5:29       ` [PATCH 5/5 net-next] cnic, bnx2: Check iSCSI support early in bnx2_init_one() Michael Chan
2011-06-09  6:53         ` David Miller
2011-06-09 10:42         ` Neil Horman
2011-06-10  0:37           ` Michael Chan
2011-06-09  6:53       ` [PATCH 4/5 net-next] cnic: Improve NETDEV_UP event handling David Miller
2011-06-09  6:53     ` [PATCH 3/5 net-next] cnic: Randomize initial TCP port for iSCSI connections David Miller
2011-06-09 15:27     ` Stephen Hemminger
2011-06-10  1:08       ` Michael Chan
2011-06-10  4:01         ` Stephen Hemminger
2011-06-10  4:39           ` Eric Dumazet
2011-06-10  6:25           ` Michael Chan
2011-06-09  6:53   ` [PATCH 2/5 net-next] cnic: Fix race conditions with firmware David Miller
2011-06-09  6:52 ` [PATCH 1/5 net-next] cnic: Fix interrupt logic David Miller

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=1307597376-5379-4-git-send-email-mchan@broadcom.com \
    --to=mchan@broadcom.com \
    --cc=davem@davemloft.net \
    --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).