summaryrefslogtreecommitdiff
path: root/drivers/net/cxgb4/t4_hw.c
diff options
context:
space:
mode:
authorDimitris Michailidis <dm@chelsio.com>2010-06-18 14:05:29 +0400
committerDavid S. Miller <davem@davemloft.net>2010-06-19 09:08:36 +0400
commit204dc3c0b1bea10a7d811970fd41ceabaef31267 (patch)
treee2d3879455ff3c6226ffea439275a21f4edefb39 /drivers/net/cxgb4/t4_hw.c
parent02b5fb8e14923ff9111de1a00004ccd593adaedb (diff)
downloadlinux-204dc3c0b1bea10a7d811970fd41ceabaef31267.tar.xz
cxgb4: implement EEH
Implement the pci_error_handlers methods for EEH. Signed-off-by: Dimitris Michailidis <dm@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb4/t4_hw.c')
-rw-r--r--drivers/net/cxgb4/t4_hw.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c
index 5c81c558ce62..0c8a84a258f3 100644
--- a/drivers/net/cxgb4/t4_hw.c
+++ b/drivers/net/cxgb4/t4_hw.c
@@ -221,6 +221,13 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size,
if ((size & 15) || size > MBOX_LEN)
return -EINVAL;
+ /*
+ * If the device is off-line, as in EEH, commands will time out.
+ * Fail them early so we don't waste time waiting.
+ */
+ if (adap->pdev->error_state != pci_channel_io_normal)
+ return -EIO;
+
v = MBOWNER_GET(t4_read_reg(adap, ctl_reg));
for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++)
v = MBOWNER_GET(t4_read_reg(adap, ctl_reg));
@@ -3045,7 +3052,7 @@ static void __devinit init_link_config(struct link_config *lc,
}
}
-static int __devinit wait_dev_ready(struct adapter *adap)
+int t4_wait_dev_ready(struct adapter *adap)
{
if (t4_read_reg(adap, PL_WHOAMI) != 0xffffffff)
return 0;
@@ -3093,7 +3100,7 @@ int __devinit t4_prep_adapter(struct adapter *adapter)
{
int ret;
- ret = wait_dev_ready(adapter);
+ ret = t4_wait_dev_ready(adapter);
if (ret < 0)
return ret;