diff mbox

[1/2] benet: Wait f/w POST until timeout

Message ID 1362383327-32362-1-git-send-email-shangw@linux.vnet.ibm.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Gavin Shan March 4, 2013, 7:48 a.m. UTC
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(-)

Comments

David Miller March 5, 2013, 9:34 p.m. UTC | #1
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.
--
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
Sathya Perla March 6, 2013, 4:45 a.m. UTC | #2
> -----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!
--
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
David Miller March 6, 2013, 4:58 a.m. UTC | #3
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.
--
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/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);