diff mbox

[4/5,net-next] cnic: Improve NETDEV_UP event handling

Message ID 1307597376-5379-4-git-send-email-mchan@broadcom.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Michael Chan June 9, 2011, 5:29 a.m. UTC
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(-)

Comments

David Miller June 9, 2011, 6:53 a.m. UTC | #1
From: "Michael Chan" <mchan@broadcom.com>
Date: Wed, 8 Jun 2011 22:29:35 -0700

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

Applied.
--
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/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;