Skip to content

Commit 2754024

Browse files
committed
Merge branch 'cxgb4-mbox'
Hariprasad Shenai says: ==================== cxgb4: mbox enhancements for cxgb4 This patch series checks for firmware errors when we are waiting for mbox response in a loop and breaks out. When negative timeout is passed to mailbox code, don't sleep. Negative timeout is passed only from interrupt context. This patch series has been created against net-next tree and includes patches on cxgb4 driver. We have included all the maintainers of respective drivers. Kindly review the change and let us know in case of any review comments. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents ecc9120 + f358738 commit 2754024

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

  • drivers/net/ethernet/chelsio/cxgb4

‎drivers/net/ethernet/chelsio/cxgb4/t4_hw.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
293293
u32 data_reg = PF_REG(mbox, CIM_PF_MAILBOX_DATA_A);
294294
u32 ctl_reg = PF_REG(mbox, CIM_PF_MAILBOX_CTRL_A);
295295
__be64 cmd_rpl[MBOX_LEN / 8];
296+
u32 pcie_fw;
296297

297298
if ((size & 15) || size > MBOX_LEN)
298299
return -EINVAL;
@@ -304,6 +305,12 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
304305
if (adap->pdev->error_state != pci_channel_io_normal)
305306
return -EIO;
306307

308+
/* If we have a negative timeout, that implies that we can't sleep. */
309+
if (timeout < 0) {
310+
sleep_ok = false;
311+
timeout = -timeout;
312+
}
313+
307314
v = MBOWNER_G(t4_read_reg(adap, ctl_reg));
308315
for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++)
309316
v = MBOWNER_G(t4_read_reg(adap, ctl_reg));
@@ -325,7 +332,10 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
325332
delay_idx = 0;
326333
ms = delay[0];
327334

328-
for (i = 0; i < timeout; i += ms) {
335+
for (i = 0;
336+
!((pcie_fw = t4_read_reg(adap, PCIE_FW_A)) & PCIE_FW_ERR_F) &&
337+
i < timeout;
338+
i += ms) {
329339
if (sleep_ok) {
330340
ms = delay[delay_idx]; /* last element may repeat */
331341
if (delay_idx < ARRAY_SIZE(delay) - 1)
@@ -360,7 +370,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
360370
}
361371
}
362372

363-
ret = -ETIMEDOUT;
373+
ret = (pcie_fw & PCIE_FW_ERR_F) ? -ENXIO : -ETIMEDOUT;
364374
t4_record_mbox(adap, cmd, MBOX_LEN, access, ret);
365375
dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n",
366376
*(const u8 *)cmd, mbox);

0 commit comments

Comments
 (0)