From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
To: netdev@vger.kernel.org
Cc: dm@chelsio.com,
Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Subject: [PATCH] cxgb4: fix probe when already with invalid parameters
Date: Wed, 19 Mar 2014 15:49:54 -0300 [thread overview]
Message-ID: <1395254994-12011-1-git-send-email-cascardo@linux.vnet.ibm.com> (raw)
Since commit 636f9d371f70f22961fd598fe18380057518ca31 ("cxgb4: Add
support for T4 configuration file"), we have problems when probing the
device, and finding out it's already initialized, but does not have
valid buffer sizes setup.
This may happen with kexec without shutdown, or bad firmware or
bootloader.
The usual symptom is that probe fails:
[ 2.605494] cxgb4 0000:50:00.4: Coming up as MASTER: Adapter already initialized
[ 2.605511] cxgb4 0000:50:00.4: bad SGE FL page buffer sizes [0, 0]
[ 2.625629] cxgb4: probe of 0000:50:00.4 failed with error -22
The solution is to treat the adapter as not initialized in case the
parameters are invalid.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 34 +++++++++++++---------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 34e2488..d0638f9 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -5237,13 +5237,27 @@ static int adap_init0(struct adapter *adap)
* master initialization), note that we're living with existing
* adapter parameters. Otherwise, it's time to try initializing the
* adapter ...
+ *
+ * If we're living with non-hard-coded parameters (either from a
+ * Firmware Configuration File or values programmed by a different PF
+ * Driver), give the SGE code a chance to pull in anything that it
+ * needs ... Note that this must be called after we retrieve our VPD
+ * parameters in order to know how to convert core ticks to seconds.
*/
if (state == DEV_STATE_INIT) {
dev_info(adap->pdev_dev, "Coming up as %s: "\
"Adapter already initialized\n",
adap->flags & MASTER_PF ? "MASTER" : "SLAVE");
adap->flags |= USING_SOFT_PARAMS;
- } else {
+ ret = t4_sge_init(adap);
+ if (ret == -EINVAL) {
+ adap->flags &= ~USING_SOFT_PARAMS;
+ state = DEV_STATE_UNINIT;
+ } else if (ret < 0) {
+ goto bye;
+ }
+ }
+ if (state != DEV_STATE_INIT) {
dev_info(adap->pdev_dev, "Coming up as MASTER: "\
"Initializing adapter\n");
@@ -5300,19 +5314,11 @@ static int adap_init0(struct adapter *adap)
-ret);
goto bye;
}
- }
-
- /*
- * If we're living with non-hard-coded parameters (either from a
- * Firmware Configuration File or values programmed by a different PF
- * Driver), give the SGE code a chance to pull in anything that it
- * needs ... Note that this must be called after we retrieve our VPD
- * parameters in order to know how to convert core ticks to seconds.
- */
- if (adap->flags & USING_SOFT_PARAMS) {
- ret = t4_sge_init(adap);
- if (ret < 0)
- goto bye;
+ if (adap->flags & USING_SOFT_PARAMS) {
+ ret = t4_sge_init(adap);
+ if (ret < 0)
+ goto bye;
+ }
}
if (is_bypass_device(adap->pdev->device))
--
1.7.1
next reply other threads:[~2014-03-19 18:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 18:49 Thadeu Lima de Souza Cascardo [this message]
2014-03-19 21:38 ` [PATCH] cxgb4: fix probe when already with invalid parameters Dimitrios Michailidis
2014-03-19 21:55 ` Casey Leedom
2014-03-19 21:57 ` Thadeu Lima de Souza Cascardo
2014-03-19 22:13 ` Casey Leedom
2014-03-19 22:25 ` Casey Leedom
2014-03-19 22:30 ` Thadeu Lima de Souza Cascardo
2014-03-19 22:41 ` Casey Leedom
2014-03-19 22:54 ` Dimitrios Michailidis
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=1395254994-12011-1-git-send-email-cascardo@linux.vnet.ibm.com \
--to=cascardo@linux.vnet.ibm.com \
--cc=dm@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).