* [PATCH net-next 1/2] cxgb4: Don't sleep when mbox cmd is issued from interrupt context
2016-05-03 13:28 [PATCH net-next 0/2] cxgb4: mbox enhancements for cxgb4 Hariprasad Shenai
@ 2016-05-03 13:28 ` Hariprasad Shenai
2016-05-03 13:28 ` [PATCH net-next 2/2] cxgb4: Check for firmware errors in the mailbox command loop Hariprasad Shenai
2016-05-04 17:59 ` [PATCH net-next 0/2] cxgb4: mbox enhancements for cxgb4 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Hariprasad Shenai @ 2016-05-03 13:28 UTC (permalink / raw)
To: davem; +Cc: netdev, leedom, swise, nirranjan, santosh, Hariprasad Shenai
When link goes down, from the interrupt handler DCB priority for the
Tx queues needs to be unset. We issue mbox command to unset the Tx queue
priority with negative timeout. In t4_wr_mbox_meat_timeout() do not sleep
when negative timeout is passed, since it is called from interrupt context.
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
---
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 49bcbf16c9ca..59f5e0b40286 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -304,6 +304,12 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
if (adap->pdev->error_state != pci_channel_io_normal)
return -EIO;
+ /* If we have a negative timeout, that implies that we can't sleep. */
+ if (timeout < 0) {
+ sleep_ok = false;
+ timeout = -timeout;
+ }
+
v = MBOWNER_G(t4_read_reg(adap, ctl_reg));
for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++)
v = MBOWNER_G(t4_read_reg(adap, ctl_reg));
--
2.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net-next 2/2] cxgb4: Check for firmware errors in the mailbox command loop
2016-05-03 13:28 [PATCH net-next 0/2] cxgb4: mbox enhancements for cxgb4 Hariprasad Shenai
2016-05-03 13:28 ` [PATCH net-next 1/2] cxgb4: Don't sleep when mbox cmd is issued from interrupt context Hariprasad Shenai
@ 2016-05-03 13:28 ` Hariprasad Shenai
2016-05-04 17:59 ` [PATCH net-next 0/2] cxgb4: mbox enhancements for cxgb4 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Hariprasad Shenai @ 2016-05-03 13:28 UTC (permalink / raw)
To: davem; +Cc: netdev, leedom, swise, nirranjan, santosh, Hariprasad Shenai
Check for firmware errors in the mailbox command loop and report
them differently rather than simply timing out when the firmware goes
belly up.
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
---
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 59f5e0b40286..a63addb4e72c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -293,6 +293,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
u32 data_reg = PF_REG(mbox, CIM_PF_MAILBOX_DATA_A);
u32 ctl_reg = PF_REG(mbox, CIM_PF_MAILBOX_CTRL_A);
__be64 cmd_rpl[MBOX_LEN / 8];
+ u32 pcie_fw;
if ((size & 15) || size > MBOX_LEN)
return -EINVAL;
@@ -331,7 +332,10 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
delay_idx = 0;
ms = delay[0];
- for (i = 0; i < timeout; i += ms) {
+ for (i = 0;
+ !((pcie_fw = t4_read_reg(adap, PCIE_FW_A)) & PCIE_FW_ERR_F) &&
+ i < timeout;
+ i += ms) {
if (sleep_ok) {
ms = delay[delay_idx]; /* last element may repeat */
if (delay_idx < ARRAY_SIZE(delay) - 1)
@@ -366,7 +370,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
}
}
- ret = -ETIMEDOUT;
+ ret = (pcie_fw & PCIE_FW_ERR_F) ? -ENXIO : -ETIMEDOUT;
t4_record_mbox(adap, cmd, MBOX_LEN, access, ret);
dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n",
*(const u8 *)cmd, mbox);
--
2.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread