diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-10-28 04:39:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-29 04:17:15 -0400 |
commit | da03945140a035a2962f7f93e359085596f20499 (patch) | |
tree | dcbc6530e8177ecee9e316eaf3494ea40a0958b4 /drivers/net/qlge/qlge_mpi.c | |
parent | 6d190c6edf42a572485cf1b6c7479bfc42753084 (diff) |
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>
Diffstat (limited to 'drivers/net/qlge/qlge_mpi.c')
-rw-r--r-- | drivers/net/qlge/qlge_mpi.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 99e58e3f8e22..bcf13c96f73f 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -470,7 +470,8 @@ end: | |||
470 | */ | 470 | */ |
471 | static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | 471 | static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) |
472 | { | 472 | { |
473 | int status, count; | 473 | int status; |
474 | unsigned long count; | ||
474 | 475 | ||
475 | 476 | ||
476 | /* Begin polled mode for MPI */ | 477 | /* Begin polled mode for MPI */ |
@@ -491,9 +492,9 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
491 | /* Wait for the command to complete. We loop | 492 | /* Wait for the command to complete. We loop |
492 | * here because some AEN might arrive while | 493 | * here because some AEN might arrive while |
493 | * we're waiting for the mailbox command to | 494 | * we're waiting for the mailbox command to |
494 | * complete. If more than 5 arrive then we can | 495 | * complete. If more than 5 seconds expire we can |
495 | * assume something is wrong. */ | 496 | * assume something is wrong. */ |
496 | count = 5; | 497 | count = jiffies + HZ * MAILBOX_TIMEOUT; |
497 | do { | 498 | do { |
498 | /* Wait for the interrupt to come in. */ | 499 | /* Wait for the interrupt to come in. */ |
499 | status = ql_wait_mbx_cmd_cmplt(qdev); | 500 | status = ql_wait_mbx_cmd_cmplt(qdev); |
@@ -517,15 +518,15 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
517 | MB_CMD_STS_GOOD) || | 518 | MB_CMD_STS_GOOD) || |
518 | ((mbcp->mbox_out[0] & 0x0000f000) == | 519 | ((mbcp->mbox_out[0] & 0x0000f000) == |
519 | MB_CMD_STS_INTRMDT)) | 520 | MB_CMD_STS_INTRMDT)) |
520 | break; | 521 | goto done; |
521 | } while (--count); | 522 | } while (time_before(jiffies, count)); |
522 | 523 | ||
523 | if (!count) { | 524 | QPRINTK(qdev, DRV, ERR, |
524 | QPRINTK(qdev, DRV, ERR, | 525 | "Timed out waiting for mailbox complete.\n"); |
525 | "Timed out waiting for mailbox complete.\n"); | 526 | status = -ETIMEDOUT; |
526 | status = -ETIMEDOUT; | 527 | goto end; |
527 | goto end; | 528 | |
528 | } | 529 | done: |
529 | 530 | ||
530 | /* Now we can clear the interrupt condition | 531 | /* Now we can clear the interrupt condition |
531 | * and look at our status. | 532 | * and look at our status. |