From: Amit Kumar Salecha <amit.salecha@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ameen.rahman@qlogic.com
Subject: [PATCH NEXT 7/8] qlcnic: fix interface attach sequence
Date: Wed, 31 Mar 2010 05:03:45 -0700 [thread overview]
Message-ID: <1270037026-9062-8-git-send-email-amit.salecha@qlogic.com> (raw)
In-Reply-To: <1270037026-9062-1-git-send-email-amit.salecha@qlogic.com>
Interface should be visible even if resource allocation fails.
netif_device_attach should be called for every netif_device_detach.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic_main.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 87511f1..6faabf4 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -952,11 +952,11 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings)
adapter->max_sds_rings = max_sds_rings;
if (qlcnic_attach(adapter))
- return;
+ goto out;
if (netif_running(netdev))
__qlcnic_up(adapter, netdev);
-
+out:
netif_device_attach(netdev);
}
@@ -978,8 +978,10 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test)
adapter->diag_test = test;
ret = qlcnic_attach(adapter);
- if (ret)
+ if (ret) {
+ netif_device_attach(netdev);
return ret;
+ }
if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) {
for (ring = 0; ring < adapter->max_sds_rings; ring++) {
@@ -1012,16 +1014,12 @@ qlcnic_reset_context(struct qlcnic_adapter *adapter)
if (netif_running(netdev)) {
err = qlcnic_attach(adapter);
if (!err)
- err = __qlcnic_up(adapter, netdev);
-
- if (err)
- goto done;
+ __qlcnic_up(adapter, netdev);
}
netif_device_attach(netdev);
}
-done:
clear_bit(__QLCNIC_RESETTING, &adapter->state);
return err;
}
@@ -1337,6 +1335,7 @@ err_out_detach:
qlcnic_detach(adapter);
err_out:
qlcnic_clr_all_drv_state(adapter);
+ netif_device_attach(netdev);
return err;
}
#endif
@@ -2152,6 +2151,7 @@ qlcnic_fwinit_work(struct work_struct *work)
}
err_ret:
+ netif_device_attach(adapter->netdev);
qlcnic_clr_all_drv_state(adapter);
}
@@ -2190,6 +2190,7 @@ qlcnic_detach_work(struct work_struct *work)
err_ret:
dev_err(&adapter->pdev->dev, "detach failed; status=%d temp=%d\n",
status, adapter->temp);
+ netif_device_attach(netdev);
qlcnic_clr_all_drv_state(adapter);
}
@@ -2252,9 +2253,8 @@ qlcnic_attach_work(struct work_struct *work)
qlcnic_config_indev_addr(netdev, NETDEV_UP);
}
- netif_device_attach(netdev);
-
done:
+ netif_device_attach(netdev);
adapter->fw_fail_cnt = 0;
clear_bit(__QLCNIC_RESETTING, &adapter->state);
--
1.6.0.2
next prev parent reply other threads:[~2010-03-31 12:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-31 12:03 [PATCH NEXT 0/8]qlcnic: fix diagnostic tools access Amit Kumar Salecha
2010-03-31 12:03 ` [PATCH NEXT 1/8] qlcnic: fix fw load from file Amit Kumar Salecha
2010-03-31 12:03 ` [PATCH NEXT 2/8] qlcnic: handle queue manager access Amit Kumar Salecha
2010-03-31 12:03 ` [PATCH NEXT 3/8] qlcnic: update oncard memory size check Amit Kumar Salecha
2010-03-31 12:03 ` [PATCH NEXT 4/8] qlcnic: fix onchip memory access Amit Kumar Salecha
2010-03-31 12:03 ` [PATCH NEXT 5/8] qlcnic: use IDC defined timeout value Amit Kumar Salecha
2010-03-31 12:03 ` [PATCH NEXT 6/8] qlcnic: add driver debug support Amit Kumar Salecha
2010-04-01 23:02 ` David Miller
2010-03-31 12:03 ` Amit Kumar Salecha [this message]
2010-03-31 12:03 ` [PATCH NEXT 8/8] qlcnic: update version to 5.0.1 Amit Kumar Salecha
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=1270037026-9062-8-git-send-email-amit.salecha@qlogic.com \
--to=amit.salecha@qlogic.com \
--cc=ameen.rahman@qlogic.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).