* [PATCH 1/2] benet: Wait f/w POST until timeout
@ 2013-03-04 7:48 Gavin Shan
2013-03-04 7:48 ` [PATCH 2/2] benet: Wait I/O while resuming device Gavin Shan
2013-03-05 21:34 ` [PATCH 1/2] benet: Wait f/w POST until timeout David Miller
0 siblings, 2 replies; 8+ messages in thread
From: Gavin Shan @ 2013-03-04 7:48 UTC (permalink / raw)
To: netdev; +Cc: sathya.perla, subbu.seetharaman, ajit.khaparde, Gavin Shan
While PCI card faces EEH errors, reset (usually hot reset) is
expected to recover from the EEH errors. After EEH core finishes
the reset, the driver callback (be_eeh_reset) is called and wait
the firmware to complete POST successfully. The original code would
return with error once detecting failure during POST stage. That
seems not enough.
The patch forces the driver (be_eeh_reset) to wait the firmware
completes POST until timeout, instead of returning error upon
detection POST failure immediately. Also, it would improve the
reliability of the EEH funtionality of the driver.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
drivers/net/ethernet/emulex/benet/be_cmds.c | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 071aea7..813407f 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -473,7 +473,7 @@ static int be_mbox_notify_wait(struct be_adapter *adapter)
return 0;
}
-static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
+static void be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
{
u32 sem;
u32 reg = skyhawk_chip(adapter) ? SLIPORT_SEMAPHORE_OFFSET_SH :
@@ -481,11 +481,6 @@ static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
pci_read_config_dword(adapter->pdev, reg, &sem);
*stage = sem & POST_STAGE_MASK;
-
- if ((sem >> POST_ERR_SHIFT) & POST_ERR_MASK)
- return -1;
- else
- return 0;
}
int lancer_wait_ready(struct be_adapter *adapter)
@@ -579,19 +574,17 @@ int be_fw_wait_ready(struct be_adapter *adapter)
}
do {
- status = be_POST_stage_get(adapter, &stage);
- if (status) {
- dev_err(dev, "POST error; stage=0x%x\n", stage);
- return -1;
- } else if (stage != POST_STAGE_ARMFW_RDY) {
- if (msleep_interruptible(2000)) {
- dev_err(dev, "Waiting for POST aborted\n");
- return -EINTR;
- }
- timeout += 2;
- } else {
+ be_POST_stage_get(adapter, &stage);
+ if (stage == POST_STAGE_ARMFW_RDY)
return 0;
+
+ dev_info(dev, "Waiting for POST, %ds elapsed\n",
+ timeout);
+ if (msleep_interruptible(2000)) {
+ dev_err(dev, "Waiting for POST aborted\n");
+ return -EINTR;
}
+ timeout += 2;
} while (timeout < 60);
dev_err(dev, "POST timeout; stage=0x%x\n", stage);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] benet: Wait I/O while resuming device
2013-03-04 7:48 [PATCH 1/2] benet: Wait f/w POST until timeout Gavin Shan
@ 2013-03-04 7:48 ` Gavin Shan
2013-03-04 9:17 ` Perla, Sathya
2013-03-05 21:34 ` [PATCH 1/2] benet: Wait f/w POST until timeout David Miller
1 sibling, 1 reply; 8+ messages in thread
From: Gavin Shan @ 2013-03-04 7:48 UTC (permalink / raw)
To: netdev; +Cc: sathya.perla, subbu.seetharaman, ajit.khaparde, Gavin Shan
After resetting the adapter, the config space register (0x7c) might
give fake information to indicate the f/w is ready. In turn, 0xFF's
is always returned while accessing on I/O space registers. The patch
adds more check to make sure the I/O space is ready for access before
accessing that region.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
drivers/net/ethernet/emulex/benet/be_cmds.c | 29 +++++++++++++++++++++++++++
drivers/net/ethernet/emulex/benet/be_cmds.h | 1 +
drivers/net/ethernet/emulex/benet/be_main.c | 5 ++++
3 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 813407f..3e8824e 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -696,6 +696,35 @@ static struct be_mcc_wrb *wrb_from_mccq(struct be_adapter *adapter)
return wrb;
}
+int be_cmd_fw_wait_io(struct be_adapter *adapter)
+{
+ void __iomem *db = adapter->db + MPU_MAILBOX_DB_OFFSET;
+ int timeout = 0;
+ u32 val;
+
+ if (lancer_chip(adapter))
+ return 0;
+
+ do {
+ val = ioread32(db);
+ if (val != 0xffffffff)
+ return 0;
+
+ dev_info(&adapter->pdev->dev,
+ "Wating for I/O (0x%08x), %ds elapsed\n",
+ val, timeout);
+ if (msleep_interruptible(2000)) {
+ dev_err(&adapter->pdev->dev,
+ "Waiting for I/O aborted\n");
+ return -EIO;
+ }
+ timeout += 2;
+ } while (timeout < 60);
+
+ dev_err(&adapter->pdev->dev, "Timeout waiting for I/O (%d)\n", timeout);
+ return -1;
+}
+
/* Tell fw we're about to start firing cmds by writing a
* special pattern across the wrb hdr; uses mbox
*/
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 9697086..9d03cb1 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1888,6 +1888,7 @@ int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
int offset);
extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
struct be_dma_mem *nonemb_cmd);
+extern int be_cmd_fw_wait_io(struct be_adapter *adapter);
extern int be_cmd_fw_init(struct be_adapter *adapter);
extern int be_cmd_fw_clean(struct be_adapter *adapter);
extern void be_async_mcc_enable(struct be_adapter *adapter);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 3860888..7609424 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -4347,6 +4347,11 @@ static void be_eeh_resume(struct pci_dev *pdev)
pci_save_state(pdev);
+ /* Wating for I/O ready */
+ status = be_cmd_fw_wait_io(adapter);
+ if (status)
+ goto err;
+
/* tell fw we're ready to fire cmds */
status = be_cmd_fw_init(adapter);
if (status)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [PATCH 2/2] benet: Wait I/O while resuming device
2013-03-04 7:48 ` [PATCH 2/2] benet: Wait I/O while resuming device Gavin Shan
@ 2013-03-04 9:17 ` Perla, Sathya
[not found] ` <20130304101841.GA20882@shangw.(null)>
0 siblings, 1 reply; 8+ messages in thread
From: Perla, Sathya @ 2013-03-04 9:17 UTC (permalink / raw)
To: Gavin Shan, netdev@vger.kernel.org
Cc: Seetharaman, Subramanian, Khaparde, Ajit
> -----Original Message-----
> From: Gavin Shan [mailto:shangw@linux.vnet.ibm.com]
>
> After resetting the adapter, the config space register (0x7c) might give fake
> information to indicate the f/w is ready. In turn, 0xFF's is always returned while
> accessing on I/O space registers. The patch adds more check to make sure the
> I/O space is ready for access before accessing that region.
>
...
>
> +int be_cmd_fw_wait_io(struct be_adapter *adapter) {
> + void __iomem *db = adapter->db + MPU_MAILBOX_DB_OFFSET;
> + int timeout = 0;
> + u32 val;
> +
> + if (lancer_chip(adapter))
> + return 0;
> +
> + do {
> + val = ioread32(db);
> + if (val != 0xffffffff)
> + return 0;
Wouldn't reading 0xffffffff from a register cause a new EEH flow to be triggered?
Anyway, the SLIPORT_SEMAPHORE register that returns a valid POST
state *always* is available in the CSR BAR space. This will be for BE2 and BE3
chips. For Skyhawk-R chips config-space/0x7c will work fine.
I can give a patch with these changes in a few days if that works for you....
> +
> + dev_info(&adapter->pdev->dev,
> + "Wating for I/O (0x%08x), %ds elapsed\n",
> + val, timeout);
> + if (msleep_interruptible(2000)) {
> + dev_err(&adapter->pdev->dev,
> + "Waiting for I/O aborted\n");
> + return -EIO;
> + }
> + timeout += 2;
> + } while (timeout < 60);
> +
> + dev_err(&adapter->pdev->dev, "Timeout waiting for I/O (%d)\n",
> timeout);
> + return -1;
> +}
> +
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] benet: Wait f/w POST until timeout
2013-03-04 7:48 [PATCH 1/2] benet: Wait f/w POST until timeout Gavin Shan
2013-03-04 7:48 ` [PATCH 2/2] benet: Wait I/O while resuming device Gavin Shan
@ 2013-03-05 21:34 ` David Miller
2013-03-06 4:45 ` Perla, Sathya
1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2013-03-05 21:34 UTC (permalink / raw)
To: shangw; +Cc: netdev, sathya.perla, subbu.seetharaman, ajit.khaparde
From: Gavin Shan <shangw@linux.vnet.ibm.com>
Date: Mon, 4 Mar 2013 15:48:46 +0800
> While PCI card faces EEH errors, reset (usually hot reset) is
> expected to recover from the EEH errors. After EEH core finishes
> the reset, the driver callback (be_eeh_reset) is called and wait
> the firmware to complete POST successfully. The original code would
> return with error once detecting failure during POST stage. That
> seems not enough.
>
> The patch forces the driver (be_eeh_reset) to wait the firmware
> completes POST until timeout, instead of returning error upon
> detection POST failure immediately. Also, it would improve the
> reliability of the EEH funtionality of the driver.
>
> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
I know that patch #2 of this series needs to be implemented differently,
but this patch seems fine.
So can I get an ACK from one of the benet driver folks?
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 1/2] benet: Wait f/w POST until timeout
2013-03-05 21:34 ` [PATCH 1/2] benet: Wait f/w POST until timeout David Miller
@ 2013-03-06 4:45 ` Perla, Sathya
2013-03-06 4:58 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: Perla, Sathya @ 2013-03-06 4:45 UTC (permalink / raw)
To: David Miller, shangw@linux.vnet.ibm.com
Cc: netdev@vger.kernel.org, Seetharaman, Subramanian, Khaparde, Ajit
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
>
> From: Gavin Shan <shangw@linux.vnet.ibm.com>
> Date: Mon, 4 Mar 2013 15:48:46 +0800
>
> > While PCI card faces EEH errors, reset (usually hot reset) is expected
> > to recover from the EEH errors. After EEH core finishes the reset, the
> > driver callback (be_eeh_reset) is called and wait the firmware to
> > complete POST successfully. The original code would return with error
> > once detecting failure during POST stage. That seems not enough.
> >
> > The patch forces the driver (be_eeh_reset) to wait the firmware
> > completes POST until timeout, instead of returning error upon
> > detection POST failure immediately. Also, it would improve the
> > reliability of the EEH funtionality of the driver.
> >
> > Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
>
> I know that patch #2 of this series needs to be implemented differently, but this
> patch seems fine.
>
> So can I get an ACK from one of the benet driver folks?
Acked-by: Sathya Perla <sathya.perla@emulex.com>
thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] benet: Wait f/w POST until timeout
2013-03-06 4:45 ` Perla, Sathya
@ 2013-03-06 4:58 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2013-03-06 4:58 UTC (permalink / raw)
To: Sathya.Perla; +Cc: shangw, netdev, subbu.seetharaman, Ajit.Khaparde
From: "Perla, Sathya" <Sathya.Perla@Emulex.Com>
Date: Wed, 6 Mar 2013 04:45:03 +0000
>> -----Original Message-----
>> From: David Miller [mailto:davem@davemloft.net]
>>
>> From: Gavin Shan <shangw@linux.vnet.ibm.com>
>> Date: Mon, 4 Mar 2013 15:48:46 +0800
>>
>> > While PCI card faces EEH errors, reset (usually hot reset) is expected
>> > to recover from the EEH errors. After EEH core finishes the reset, the
>> > driver callback (be_eeh_reset) is called and wait the firmware to
>> > complete POST successfully. The original code would return with error
>> > once detecting failure during POST stage. That seems not enough.
>> >
>> > The patch forces the driver (be_eeh_reset) to wait the firmware
>> > completes POST until timeout, instead of returning error upon
>> > detection POST failure immediately. Also, it would improve the
>> > reliability of the EEH funtionality of the driver.
>> >
>> > Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
>>
>> I know that patch #2 of this series needs to be implemented differently, but this
>> patch seems fine.
>>
>> So can I get an ACK from one of the benet driver folks?
>
> Acked-by: Sathya Perla <sathya.perla@emulex.com>
Applied, thanks for reviewing.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-03-06 4:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04 7:48 [PATCH 1/2] benet: Wait f/w POST until timeout Gavin Shan
2013-03-04 7:48 ` [PATCH 2/2] benet: Wait I/O while resuming device Gavin Shan
2013-03-04 9:17 ` Perla, Sathya
[not found] ` <20130304101841.GA20882@shangw.(null)>
2013-03-04 11:11 ` Perla, Sathya
[not found] ` <20130305072126.GA19947@shangw.(null)>
2013-03-05 7:59 ` Perla, Sathya
2013-03-05 21:34 ` [PATCH 1/2] benet: Wait f/w POST until timeout David Miller
2013-03-06 4:45 ` Perla, Sathya
2013-03-06 4:58 ` David Miller
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).