* [PATCH 2/6] lpfc 8.1.7 : Fix failing firmware download due to mailbox delays needing to be longer
@ 2006-08-01 11:33 James Smart
2006-08-01 12:20 ` Rolf Eike Beer
0 siblings, 1 reply; 3+ messages in thread
From: James Smart @ 2006-08-01 11:33 UTC (permalink / raw)
To: linux-scsi
Fix failing firmware download due to mailbox delays needing to be longer.
Signed-off-by: James Smart <James.Smart@emulex.com>
diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2006-08-01 07:07:38.000000000 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2006-08-01 07:08:50.000000000 -0400
@@ -1000,7 +1000,8 @@ sysfs_mbox_read(struct kobject *kobj, ch
spin_unlock_irq(phba->host->host_lock);
rc = lpfc_sli_issue_mbox_wait (phba,
phba->sysfs_mbox.mbox,
- phba->fc_ratov * 2);
+ lpfc_mbox_tmo_val(phba,
+ phba->sysfs_mbox.mbox->mb.mbxCommand) * HZ);
spin_lock_irq(phba->host->host_lock);
}
diff -upNr a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
--- a/drivers/scsi/lpfc/lpfc_crtn.h 2006-07-31 10:41:15.000000000 -0400
+++ b/drivers/scsi/lpfc/lpfc_crtn.h 2006-08-01 07:08:50.000000000 -0400
@@ -127,6 +127,7 @@ void lpfc_config_port(struct lpfc_hba *,
void lpfc_kill_board(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbox_put(struct lpfc_hba *, LPFC_MBOXQ_t *);
LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *);
+int lpfc_mbox_tmo_val(struct lpfc_hba *, int);
int lpfc_mem_alloc(struct lpfc_hba *);
void lpfc_mem_free(struct lpfc_hba *);
diff -upNr a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
--- a/drivers/scsi/lpfc/lpfc_mbox.c 2006-07-31 10:41:15.000000000 -0400
+++ b/drivers/scsi/lpfc/lpfc_mbox.c 2006-08-01 07:08:50.000000000 -0400
@@ -651,3 +651,19 @@ lpfc_mbox_get(struct lpfc_hba * phba)
return mbq;
}
+
+int
+lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd)
+{
+ switch (cmd) {
+ case MBX_WRITE_NV: /* 0x03 */
+ case MBX_UPDATE_CFG: /* 0x1B */
+ case MBX_DOWN_LOAD: /* 0x1C */
+ case MBX_DEL_LD_ENTRY: /* 0x1D */
+ case MBX_LOAD_AREA: /* 0x81 */
+ case MBX_FLASH_WR_ULA: /* 0x98 */
+ case MBX_LOAD_EXP_ROM: /* 0x9C */
+ return LPFC_MBOX_TMO_FLASH_CMD;
+ }
+ return LPFC_MBOX_TMO;
+}
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c 2006-08-01 07:07:38.000000000 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c 2006-08-01 07:08:50.000000000 -0400
@@ -2197,7 +2197,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba * ph
return (MBX_NOT_FINISHED);
}
/* timeout active mbox command */
- mod_timer(&psli->mbox_tmo, jiffies + HZ * LPFC_MBOX_TMO);
+ mod_timer(&psli->mbox_tmo, (jiffies +
+ (HZ * lpfc_mbox_tmo_val(phba, mb->mbxCommand))));
}
/* Mailbox cmd <cmd> issue */
@@ -2257,7 +2258,6 @@ lpfc_sli_issue_mbox(struct lpfc_hba * ph
break;
case MBX_POLL:
- i = 0;
psli->mbox_active = NULL;
if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
/* First read mbox status word */
@@ -2271,11 +2271,14 @@ lpfc_sli_issue_mbox(struct lpfc_hba * ph
/* Read the HBA Host Attention Register */
ha_copy = readl(phba->HAregaddr);
+ i = lpfc_mbox_tmo_val(phba, mb->mbxCommand);
+ i *= 1000; /* Convert to ms */
+
/* Wait for command to complete */
while (((word0 & OWN_CHIP) == OWN_CHIP) ||
(!(ha_copy & HA_MBATT) &&
(phba->hba_state > LPFC_WARM_START))) {
- if (i++ >= 100) {
+ if (i-- <= 0) {
psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
spin_unlock_irqrestore(phba->host->host_lock,
drvr_flag);
@@ -2293,7 +2296,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba * ph
/* Can be in interrupt context, do not sleep */
/* (or might be called with interrupts disabled) */
- mdelay(i);
+ mdelay(1);
spin_lock_irqsave(phba->host->host_lock, drvr_flag);
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
--- a/drivers/scsi/lpfc/lpfc_sli.h 2006-08-01 07:07:38.000000000 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.h 2006-08-01 07:08:50.000000000 -0400
@@ -225,3 +225,9 @@ struct lpfc_sli {
#define LPFC_MBOX_TMO 30 /* Sec tmo for outstanding mbox
command */
+#define LPFC_MBOX_TMO_FLASH_CMD 300 /* Sec tmo for outstanding FLASH write
+ * or erase cmds. This is especially
+ * long because of the potential of
+ * multiple flash erases that can be
+ * spawned.
+ */
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 2/6] lpfc 8.1.7 : Fix failing firmware download due to mailbox delays needing to be longer
2006-08-01 11:33 [PATCH 2/6] lpfc 8.1.7 : Fix failing firmware download due to mailbox delays needing to be longer James Smart
@ 2006-08-01 12:20 ` Rolf Eike Beer
2006-08-01 13:43 ` James Smart
0 siblings, 1 reply; 3+ messages in thread
From: Rolf Eike Beer @ 2006-08-01 12:20 UTC (permalink / raw)
To: James.Smart; +Cc: linux-scsi
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
James Smart wrote:
> Fix failing firmware download due to mailbox delays needing to be longer.
> /* timeout active mbox command */
> - mod_timer(&psli->mbox_tmo, jiffies + HZ * LPFC_MBOX_TMO);
> + mod_timer(&psli->mbox_tmo, (jiffies +
> + (HZ * lpfc_mbox_tmo_val(phba, mb->mbxCommand))));
> }
In linux/jiffies.h there are some functions for converting jiffies to *secs
and back which you might find useful.
Eike
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/6] lpfc 8.1.7 : Fix failing firmware download due to mailbox delays needing to be longer
2006-08-01 12:20 ` Rolf Eike Beer
@ 2006-08-01 13:43 ` James Smart
0 siblings, 0 replies; 3+ messages in thread
From: James Smart @ 2006-08-01 13:43 UTC (permalink / raw)
To: Rolf Eike Beer; +Cc: linux-scsi
Rolf Eike Beer wrote:
> James Smart wrote:
>> Fix failing firmware download due to mailbox delays needing to be longer.
>
>> /* timeout active mbox command */
>> - mod_timer(&psli->mbox_tmo, jiffies + HZ * LPFC_MBOX_TMO);
>> + mod_timer(&psli->mbox_tmo, (jiffies +
>> + (HZ * lpfc_mbox_tmo_val(phba, mb->mbxCommand))));
>> }
>
> In linux/jiffies.h there are some functions for converting jiffies to *secs
> and back which you might find useful.
Ok - but we're not really converting jiffies to seconds here...
-- james
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-08-01 13:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-01 11:33 [PATCH 2/6] lpfc 8.1.7 : Fix failing firmware download due to mailbox delays needing to be longer James Smart
2006-08-01 12:20 ` Rolf Eike Beer
2006-08-01 13:43 ` James Smart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox