mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
qlge: Fix firmware mailbox command timeout.
The mailbox command process would only process a maximum of 5 unrelated firmware events while waiting for it's command completion status. It should process an unlimited number of events while waiting for a maximum of 5 seconds. Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6d190c6edf
commit
da03945140
2 changed files with 13 additions and 11 deletions
|
@ -95,6 +95,7 @@ enum {
|
||||||
|
|
||||||
/* Misc. stuff */
|
/* Misc. stuff */
|
||||||
MAILBOX_COUNT = 16,
|
MAILBOX_COUNT = 16,
|
||||||
|
MAILBOX_TIMEOUT = 5,
|
||||||
|
|
||||||
PROC_ADDR_RDY = (1 << 31),
|
PROC_ADDR_RDY = (1 << 31),
|
||||||
PROC_ADDR_R = (1 << 30),
|
PROC_ADDR_R = (1 << 30),
|
||||||
|
|
|
@ -470,7 +470,8 @@ static int ql_mpi_handler(struct ql_adapter *qdev, struct mbox_params *mbcp)
|
||||||
*/
|
*/
|
||||||
static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
|
static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
|
||||||
{
|
{
|
||||||
int status, count;
|
int status;
|
||||||
|
unsigned long count;
|
||||||
|
|
||||||
|
|
||||||
/* Begin polled mode for MPI */
|
/* Begin polled mode for MPI */
|
||||||
|
@ -491,9 +492,9 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
|
||||||
/* Wait for the command to complete. We loop
|
/* Wait for the command to complete. We loop
|
||||||
* here because some AEN might arrive while
|
* here because some AEN might arrive while
|
||||||
* we're waiting for the mailbox command to
|
* we're waiting for the mailbox command to
|
||||||
* complete. If more than 5 arrive then we can
|
* complete. If more than 5 seconds expire we can
|
||||||
* assume something is wrong. */
|
* assume something is wrong. */
|
||||||
count = 5;
|
count = jiffies + HZ * MAILBOX_TIMEOUT;
|
||||||
do {
|
do {
|
||||||
/* Wait for the interrupt to come in. */
|
/* Wait for the interrupt to come in. */
|
||||||
status = ql_wait_mbx_cmd_cmplt(qdev);
|
status = ql_wait_mbx_cmd_cmplt(qdev);
|
||||||
|
@ -517,15 +518,15 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
|
||||||
MB_CMD_STS_GOOD) ||
|
MB_CMD_STS_GOOD) ||
|
||||||
((mbcp->mbox_out[0] & 0x0000f000) ==
|
((mbcp->mbox_out[0] & 0x0000f000) ==
|
||||||
MB_CMD_STS_INTRMDT))
|
MB_CMD_STS_INTRMDT))
|
||||||
break;
|
goto done;
|
||||||
} while (--count);
|
} while (time_before(jiffies, count));
|
||||||
|
|
||||||
if (!count) {
|
|
||||||
QPRINTK(qdev, DRV, ERR,
|
QPRINTK(qdev, DRV, ERR,
|
||||||
"Timed out waiting for mailbox complete.\n");
|
"Timed out waiting for mailbox complete.\n");
|
||||||
status = -ETIMEDOUT;
|
status = -ETIMEDOUT;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
|
||||||
|
done:
|
||||||
|
|
||||||
/* Now we can clear the interrupt condition
|
/* Now we can clear the interrupt condition
|
||||||
* and look at our status.
|
* and look at our status.
|
||||||
|
|
Loading…
Reference in a new issue