aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2011-06-08 15:29:35 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-09 02:52:37 -0400
commitdb1d350fcb156b58f66a67680617077bcacfe6fc (patch)
tree084d9254b62b05a4b7ce41606c6a7197a068a090
parent11f23aa8ccd56786f0a6f04211cf59b3fab2ce08 (diff)
cnic: Improve NETDEV_UP event handling
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/cnic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index a529bde03c56..6c544b3411fa 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,
5342 5342
5343 dev = cnic_from_netdev(netdev); 5343 dev = cnic_from_netdev(netdev);
5344 5344
5345 if (!dev && (event == NETDEV_REGISTER || event == NETDEV_UP)) { 5345 if (!dev && (event == NETDEV_REGISTER || netif_running(netdev))) {
5346 /* Check for the hot-plug device */ 5346 /* Check for the hot-plug device */
5347 dev = is_cnic_dev(netdev); 5347 dev = is_cnic_dev(netdev);
5348 if (dev) { 5348 if (dev) {
@@ -5358,7 +5358,7 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
5358 else if (event == NETDEV_UNREGISTER) 5358 else if (event == NETDEV_UNREGISTER)
5359 cnic_ulp_exit(dev); 5359 cnic_ulp_exit(dev);
5360 5360
5361 if (event == NETDEV_UP) { 5361 if (event == NETDEV_UP || (new_dev && netif_running(netdev))) {
5362 if (cnic_register_netdev(dev) != 0) { 5362 if (cnic_register_netdev(dev) != 0) {
5363 cnic_put(dev); 5363 cnic_put(dev);
5364 goto done; 5364 goto done;