[SCSI] lpfc 8.3.27: Changed worst case mailbox timeout

Changed the timeout value for flash-based SLI_CONFIG (0x9B)
mailbox command to 300 seconds for worst case flash delays.

Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
James Smart 2011-10-10 21:32:43 -04:00 committed by James Bottomley
parent 73d91e503a
commit a183a15f88
8 changed files with 230 additions and 137 deletions

View File

@ -4113,8 +4113,10 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj,
struct Scsi_Host *shost = class_to_shost(dev); struct Scsi_Host *shost = class_to_shost(dev);
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
int rc; LPFC_MBOXQ_t *mboxq;
MAILBOX_t *pmb; MAILBOX_t *pmb;
uint32_t mbox_tmo;
int rc;
if (off > MAILBOX_CMD_SIZE) if (off > MAILBOX_CMD_SIZE)
return -ERANGE; return -ERANGE;
@ -4139,7 +4141,8 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj,
if (off == 0 && if (off == 0 &&
phba->sysfs_mbox.state == SMBOX_WRITING && phba->sysfs_mbox.state == SMBOX_WRITING &&
phba->sysfs_mbox.offset >= 2 * sizeof(uint32_t)) { phba->sysfs_mbox.offset >= 2 * sizeof(uint32_t)) {
pmb = &phba->sysfs_mbox.mbox->u.mb; mboxq = (LPFC_MBOXQ_t *)&phba->sysfs_mbox.mbox;
pmb = &mboxq->u.mb;
switch (pmb->mbxCommand) { switch (pmb->mbxCommand) {
/* Offline only */ /* Offline only */
case MBX_INIT_LINK: case MBX_INIT_LINK:
@ -4249,9 +4252,8 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj,
} else { } else {
spin_unlock_irq(&phba->hbalock); spin_unlock_irq(&phba->hbalock);
rc = lpfc_sli_issue_mbox_wait (phba, mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq);
phba->sysfs_mbox.mbox, rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
lpfc_mbox_tmo_val(phba, pmb->mbxCommand) * HZ);
spin_lock_irq(&phba->hbalock); spin_lock_irq(&phba->hbalock);
} }

View File

@ -209,7 +209,7 @@ void __lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *);
int lpfc_mbox_cmd_check(struct lpfc_hba *, LPFC_MBOXQ_t *); int lpfc_mbox_cmd_check(struct lpfc_hba *, LPFC_MBOXQ_t *);
int lpfc_mbox_dev_check(struct lpfc_hba *); int lpfc_mbox_dev_check(struct lpfc_hba *);
int lpfc_mbox_tmo_val(struct lpfc_hba *, int); int lpfc_mbox_tmo_val(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_init_vfi(struct lpfcMboxq *, struct lpfc_vport *); void lpfc_init_vfi(struct lpfcMboxq *, struct lpfc_vport *);
void lpfc_reg_vfi(struct lpfcMboxq *, struct lpfc_vport *, dma_addr_t); void lpfc_reg_vfi(struct lpfcMboxq *, struct lpfc_vport *, dma_addr_t);
void lpfc_init_vpi(struct lpfc_hba *, struct lpfcMboxq *, uint16_t); void lpfc_init_vpi(struct lpfc_hba *, struct lpfcMboxq *, uint16_t);

View File

@ -826,6 +826,7 @@ struct mbox_header {
#define LPFC_EXTENT_VERSION_DEFAULT 0 #define LPFC_EXTENT_VERSION_DEFAULT 0
/* Subsystem Definitions */ /* Subsystem Definitions */
#define LPFC_MBOX_SUBSYSTEM_NA 0x0
#define LPFC_MBOX_SUBSYSTEM_COMMON 0x1 #define LPFC_MBOX_SUBSYSTEM_COMMON 0x1
#define LPFC_MBOX_SUBSYSTEM_FCOE 0xC #define LPFC_MBOX_SUBSYSTEM_FCOE 0xC
@ -836,25 +837,33 @@ struct mbox_header {
#define HOST_ENDIAN_HIGH_WORD1 0xFF7856FF #define HOST_ENDIAN_HIGH_WORD1 0xFF7856FF
/* Common Opcodes */ /* Common Opcodes */
#define LPFC_MBOX_OPCODE_CQ_CREATE 0x0C #define LPFC_MBOX_OPCODE_NA 0x00
#define LPFC_MBOX_OPCODE_EQ_CREATE 0x0D #define LPFC_MBOX_OPCODE_CQ_CREATE 0x0C
#define LPFC_MBOX_OPCODE_MQ_CREATE 0x15 #define LPFC_MBOX_OPCODE_EQ_CREATE 0x0D
#define LPFC_MBOX_OPCODE_GET_CNTL_ATTRIBUTES 0x20 #define LPFC_MBOX_OPCODE_MQ_CREATE 0x15
#define LPFC_MBOX_OPCODE_NOP 0x21 #define LPFC_MBOX_OPCODE_GET_CNTL_ATTRIBUTES 0x20
#define LPFC_MBOX_OPCODE_MQ_DESTROY 0x35 #define LPFC_MBOX_OPCODE_NOP 0x21
#define LPFC_MBOX_OPCODE_CQ_DESTROY 0x36 #define LPFC_MBOX_OPCODE_MQ_DESTROY 0x35
#define LPFC_MBOX_OPCODE_EQ_DESTROY 0x37 #define LPFC_MBOX_OPCODE_CQ_DESTROY 0x36
#define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A #define LPFC_MBOX_OPCODE_EQ_DESTROY 0x37
#define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D #define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A
#define LPFC_MBOX_OPCODE_MQ_CREATE_EXT 0x5A #define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D
#define LPFC_MBOX_OPCODE_GET_RSRC_EXTENT_INFO 0x9A #define LPFC_MBOX_OPCODE_MQ_CREATE_EXT 0x5A
#define LPFC_MBOX_OPCODE_GET_ALLOC_RSRC_EXTENT 0x9B #define LPFC_MBOX_OPCODE_GET_RSRC_EXTENT_INFO 0x9A
#define LPFC_MBOX_OPCODE_ALLOC_RSRC_EXTENT 0x9C #define LPFC_MBOX_OPCODE_GET_ALLOC_RSRC_EXTENT 0x9B
#define LPFC_MBOX_OPCODE_DEALLOC_RSRC_EXTENT 0x9D #define LPFC_MBOX_OPCODE_ALLOC_RSRC_EXTENT 0x9C
#define LPFC_MBOX_OPCODE_GET_FUNCTION_CONFIG 0xA0 #define LPFC_MBOX_OPCODE_DEALLOC_RSRC_EXTENT 0x9D
#define LPFC_MBOX_OPCODE_GET_PROFILE_CONFIG 0xA4 #define LPFC_MBOX_OPCODE_GET_FUNCTION_CONFIG 0xA0
#define LPFC_MBOX_OPCODE_WRITE_OBJECT 0xAC #define LPFC_MBOX_OPCODE_GET_PROFILE_CONFIG 0xA4
#define LPFC_MBOX_OPCODE_GET_SLI4_PARAMETERS 0xB5 #define LPFC_MBOX_OPCODE_SET_PROFILE_CONFIG 0xA5
#define LPFC_MBOX_OPCODE_GET_PROFILE_LIST 0xA6
#define LPFC_MBOX_OPCODE_SET_ACT_PROFILE 0xA8
#define LPFC_MBOX_OPCODE_GET_FACTORY_PROFILE_CONFIG 0xA9
#define LPFC_MBOX_OPCODE_READ_OBJECT 0xAB
#define LPFC_MBOX_OPCODE_WRITE_OBJECT 0xAC
#define LPFC_MBOX_OPCODE_READ_OBJECT_LIST 0xAD
#define LPFC_MBOX_OPCODE_DELETE_OBJECT 0xAE
#define LPFC_MBOX_OPCODE_GET_SLI4_PARAMETERS 0xB5
/* FCoE Opcodes */ /* FCoE Opcodes */
#define LPFC_MBOX_OPCODE_FCOE_WQ_CREATE 0x01 #define LPFC_MBOX_OPCODE_FCOE_WQ_CREATE 0x01
@ -868,6 +877,7 @@ struct mbox_header {
#define LPFC_MBOX_OPCODE_FCOE_DELETE_FCF 0x0A #define LPFC_MBOX_OPCODE_FCOE_DELETE_FCF 0x0A
#define LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE 0x0B #define LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE 0x0B
#define LPFC_MBOX_OPCODE_FCOE_REDISCOVER_FCF 0x10 #define LPFC_MBOX_OPCODE_FCOE_REDISCOVER_FCF 0x10
#define LPFC_MBOX_OPCODE_FCOE_SET_FCLINK_SETTINGS 0x21
#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE 0x22 #define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE 0x22
#define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK 0x23 #define LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_LOOPBACK 0x23

View File

@ -2441,17 +2441,19 @@ lpfc_block_mgmt_io(struct lpfc_hba * phba)
uint8_t actcmd = MBX_HEARTBEAT; uint8_t actcmd = MBX_HEARTBEAT;
unsigned long timeout; unsigned long timeout;
timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies;
spin_lock_irqsave(&phba->hbalock, iflag); spin_lock_irqsave(&phba->hbalock, iflag);
phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO; phba->sli.sli_flag |= LPFC_BLOCK_MGMT_IO;
if (phba->sli.mbox_active) if (phba->sli.mbox_active) {
actcmd = phba->sli.mbox_active->u.mb.mbxCommand; actcmd = phba->sli.mbox_active->u.mb.mbxCommand;
/* Determine how long we might wait for the active mailbox
* command to be gracefully completed by firmware.
*/
timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba,
phba->sli.mbox_active) * 1000) + jiffies;
}
spin_unlock_irqrestore(&phba->hbalock, iflag); spin_unlock_irqrestore(&phba->hbalock, iflag);
/* Determine how long we might wait for the active mailbox
* command to be gracefully completed by firmware.
*/
timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, actcmd) * 1000) +
jiffies;
/* Wait for the outstnading mailbox command to complete */ /* Wait for the outstnading mailbox command to complete */
while (phba->sli.mbox_active) { while (phba->sli.mbox_active) {
/* Check active mailbox complete status every 2ms */ /* Check active mailbox complete status every 2ms */
@ -7158,12 +7160,13 @@ lpfc_sli4_send_nop_mbox_cmds(struct lpfc_hba *phba, uint32_t cnt)
lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_NOP, length, LPFC_SLI4_MBX_EMBED); LPFC_MBOX_OPCODE_NOP, length, LPFC_SLI4_MBX_EMBED);
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG);
for (cmdsent = 0; cmdsent < cnt; cmdsent++) { for (cmdsent = 0; cmdsent < cnt; cmdsent++) {
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
else else {
mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq);
rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
}
if (rc == MBX_TIMEOUT) if (rc == MBX_TIMEOUT)
break; break;
/* Check return status */ /* Check return status */
@ -8129,7 +8132,7 @@ lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_PORT_CAPABILITIES); mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq);
rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
} }
@ -8191,6 +8194,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
int rc; int rc;
struct lpfc_mqe *mqe = &mboxq->u.mqe; struct lpfc_mqe *mqe = &mboxq->u.mqe;
struct lpfc_pc_sli4_params *sli4_params; struct lpfc_pc_sli4_params *sli4_params;
uint32_t mbox_tmo;
int length; int length;
struct lpfc_sli4_parameters *mbx_sli4_parameters; struct lpfc_sli4_parameters *mbx_sli4_parameters;
@ -8209,9 +8213,10 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
length, LPFC_SLI4_MBX_EMBED); length, LPFC_SLI4_MBX_EMBED);
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
else else {
rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq);
lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG)); rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
}
if (unlikely(rc)) if (unlikely(rc))
return rc; return rc;
sli4_params = &phba->sli4_hba.pc_sli4_params; sli4_params = &phba->sli4_hba.pc_sli4_params;

View File

@ -1598,9 +1598,12 @@ lpfc_mbox_dev_check(struct lpfc_hba *phba)
* Timeout value to be used for the given mailbox command * Timeout value to be used for the given mailbox command
**/ **/
int int
lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd) lpfc_mbox_tmo_val(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
{ {
switch (cmd) { MAILBOX_t *mbox = &mboxq->u.mb;
uint8_t subsys, opcode;
switch (mbox->mbxCommand) {
case MBX_WRITE_NV: /* 0x03 */ case MBX_WRITE_NV: /* 0x03 */
case MBX_UPDATE_CFG: /* 0x1B */ case MBX_UPDATE_CFG: /* 0x1B */
case MBX_DOWN_LOAD: /* 0x1C */ case MBX_DOWN_LOAD: /* 0x1C */
@ -1610,6 +1613,28 @@ lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd)
case MBX_LOAD_EXP_ROM: /* 0x9C */ case MBX_LOAD_EXP_ROM: /* 0x9C */
return LPFC_MBOX_TMO_FLASH_CMD; return LPFC_MBOX_TMO_FLASH_CMD;
case MBX_SLI4_CONFIG: /* 0x9b */ case MBX_SLI4_CONFIG: /* 0x9b */
subsys = lpfc_sli_config_mbox_subsys_get(phba, mboxq);
opcode = lpfc_sli_config_mbox_opcode_get(phba, mboxq);
if (subsys == LPFC_MBOX_SUBSYSTEM_COMMON) {
switch (opcode) {
case LPFC_MBOX_OPCODE_READ_OBJECT:
case LPFC_MBOX_OPCODE_WRITE_OBJECT:
case LPFC_MBOX_OPCODE_READ_OBJECT_LIST:
case LPFC_MBOX_OPCODE_DELETE_OBJECT:
case LPFC_MBOX_OPCODE_GET_FUNCTION_CONFIG:
case LPFC_MBOX_OPCODE_GET_PROFILE_LIST:
case LPFC_MBOX_OPCODE_SET_ACT_PROFILE:
case LPFC_MBOX_OPCODE_SET_PROFILE_CONFIG:
case LPFC_MBOX_OPCODE_GET_FACTORY_PROFILE_CONFIG:
return LPFC_MBOX_SLI4_CONFIG_EXTENDED_TMO;
}
}
if (subsys == LPFC_MBOX_SUBSYSTEM_FCOE) {
switch (opcode) {
case LPFC_MBOX_OPCODE_FCOE_SET_FCLINK_SETTINGS:
return LPFC_MBOX_SLI4_CONFIG_EXTENDED_TMO;
}
}
return LPFC_MBOX_SLI4_CONFIG_TMO; return LPFC_MBOX_SLI4_CONFIG_TMO;
} }
return LPFC_MBOX_TMO; return LPFC_MBOX_TMO;
@ -1859,7 +1884,7 @@ lpfc_sli4_mbox_rsrc_extent(struct lpfc_hba *phba, struct lpfcMboxq *mbox,
} }
/* Complete the initialization for the particular Opcode. */ /* Complete the initialization for the particular Opcode. */
opcode = lpfc_sli4_mbox_opcode_get(phba, mbox); opcode = lpfc_sli_config_mbox_opcode_get(phba, mbox);
switch (opcode) { switch (opcode) {
case LPFC_MBOX_OPCODE_ALLOC_RSRC_EXTENT: case LPFC_MBOX_OPCODE_ALLOC_RSRC_EXTENT:
if (emb == LPFC_SLI4_MBX_EMBED) if (emb == LPFC_SLI4_MBX_EMBED)
@ -1886,23 +1911,56 @@ lpfc_sli4_mbox_rsrc_extent(struct lpfc_hba *phba, struct lpfcMboxq *mbox,
} }
/** /**
* lpfc_sli4_mbox_opcode_get - Get the opcode from a sli4 mailbox command * lpfc_sli_config_mbox_subsys_get - Get subsystem from a sli_config mbox cmd
* @phba: pointer to lpfc hba data structure. * @phba: pointer to lpfc hba data structure.
* @mbox: pointer to lpfc mbox command. * @mbox: pointer to lpfc mbox command queue entry.
* *
* This routine gets the opcode from a SLI4 specific mailbox command for * This routine gets the subsystem from a SLI4 specific SLI_CONFIG mailbox
* sending IOCTL command. If the mailbox command is not MBX_SLI4_CONFIG * command. If the mailbox command is not MBX_SLI4_CONFIG (0x9B) or if the
* (0x9B) or if the IOCTL sub-header is not present, opcode 0x0 shall be * sub-header is not present, subsystem LPFC_MBOX_SUBSYSTEM_NA (0x0) shall
* returned. * be returned.
**/ **/
uint8_t uint8_t
lpfc_sli4_mbox_opcode_get(struct lpfc_hba *phba, struct lpfcMboxq *mbox) lpfc_sli_config_mbox_subsys_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
{ {
struct lpfc_mbx_sli4_config *sli4_cfg; struct lpfc_mbx_sli4_config *sli4_cfg;
union lpfc_sli4_cfg_shdr *cfg_shdr; union lpfc_sli4_cfg_shdr *cfg_shdr;
if (mbox->u.mb.mbxCommand != MBX_SLI4_CONFIG) if (mbox->u.mb.mbxCommand != MBX_SLI4_CONFIG)
return 0; return LPFC_MBOX_SUBSYSTEM_NA;
sli4_cfg = &mbox->u.mqe.un.sli4_config;
/* For embedded mbox command, get opcode from embedded sub-header*/
if (bf_get(lpfc_mbox_hdr_emb, &sli4_cfg->header.cfg_mhdr)) {
cfg_shdr = &mbox->u.mqe.un.sli4_config.header.cfg_shdr;
return bf_get(lpfc_mbox_hdr_subsystem, &cfg_shdr->request);
}
/* For non-embedded mbox command, get opcode from first dma page */
if (unlikely(!mbox->sge_array))
return LPFC_MBOX_SUBSYSTEM_NA;
cfg_shdr = (union lpfc_sli4_cfg_shdr *)mbox->sge_array->addr[0];
return bf_get(lpfc_mbox_hdr_subsystem, &cfg_shdr->request);
}
/**
* lpfc_sli_config_mbox_opcode_get - Get opcode from a sli_config mbox cmd
* @phba: pointer to lpfc hba data structure.
* @mbox: pointer to lpfc mbox command queue entry.
*
* This routine gets the opcode from a SLI4 specific SLI_CONFIG mailbox
* command. If the mailbox command is not MBX_SLI4_CONFIG (0x9B) or if
* the sub-header is not present, opcode LPFC_MBOX_OPCODE_NA (0x0) be
* returned.
**/
uint8_t
lpfc_sli_config_mbox_opcode_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
{
struct lpfc_mbx_sli4_config *sli4_cfg;
union lpfc_sli4_cfg_shdr *cfg_shdr;
if (mbox->u.mb.mbxCommand != MBX_SLI4_CONFIG)
return LPFC_MBOX_OPCODE_NA;
sli4_cfg = &mbox->u.mqe.un.sli4_config; sli4_cfg = &mbox->u.mqe.un.sli4_config;
/* For embedded mbox command, get opcode from embedded sub-header*/ /* For embedded mbox command, get opcode from embedded sub-header*/
@ -1913,7 +1971,7 @@ lpfc_sli4_mbox_opcode_get(struct lpfc_hba *phba, struct lpfcMboxq *mbox)
/* For non-embedded mbox command, get opcode from first dma page */ /* For non-embedded mbox command, get opcode from first dma page */
if (unlikely(!mbox->sge_array)) if (unlikely(!mbox->sge_array))
return 0; return LPFC_MBOX_OPCODE_NA;
cfg_shdr = (union lpfc_sli4_cfg_shdr *)mbox->sge_array->addr[0]; cfg_shdr = (union lpfc_sli4_cfg_shdr *)mbox->sge_array->addr[0];
return bf_get(lpfc_mbox_hdr_opcode, &cfg_shdr->request); return bf_get(lpfc_mbox_hdr_opcode, &cfg_shdr->request);
} }

View File

@ -2200,10 +2200,13 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
/* Unknown mailbox command compl */ /* Unknown mailbox command compl */
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
"(%d):0323 Unknown Mailbox command " "(%d):0323 Unknown Mailbox command "
"x%x (x%x) Cmpl\n", "x%x (x%x/x%x) Cmpl\n",
pmb->vport ? pmb->vport->vpi : 0, pmb->vport ? pmb->vport->vpi : 0,
pmbox->mbxCommand, pmbox->mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, pmb)); lpfc_sli_config_mbox_subsys_get(phba,
pmb),
lpfc_sli_config_mbox_opcode_get(phba,
pmb));
phba->link_state = LPFC_HBA_ERROR; phba->link_state = LPFC_HBA_ERROR;
phba->work_hs = HS_FFER3; phba->work_hs = HS_FFER3;
lpfc_handle_eratt(phba); lpfc_handle_eratt(phba);
@ -2215,17 +2218,19 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
if (pmbox->mbxStatus == MBXERR_NO_RESOURCES) { if (pmbox->mbxStatus == MBXERR_NO_RESOURCES) {
/* Mbox cmd cmpl error - RETRYing */ /* Mbox cmd cmpl error - RETRYing */
lpfc_printf_log(phba, KERN_INFO, lpfc_printf_log(phba, KERN_INFO,
LOG_MBOX | LOG_SLI, LOG_MBOX | LOG_SLI,
"(%d):0305 Mbox cmd cmpl " "(%d):0305 Mbox cmd cmpl "
"error - RETRYing Data: x%x " "error - RETRYing Data: x%x "
"(x%x) x%x x%x x%x\n", "(x%x/x%x) x%x x%x x%x\n",
pmb->vport ? pmb->vport->vpi :0, pmb->vport ? pmb->vport->vpi : 0,
pmbox->mbxCommand, pmbox->mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, lpfc_sli_config_mbox_subsys_get(phba,
pmb), pmb),
pmbox->mbxStatus, lpfc_sli_config_mbox_opcode_get(phba,
pmbox->un.varWords[0], pmb),
pmb->vport->port_state); pmbox->mbxStatus,
pmbox->un.varWords[0],
pmb->vport->port_state);
pmbox->mbxStatus = 0; pmbox->mbxStatus = 0;
pmbox->mbxOwner = OWN_HOST; pmbox->mbxOwner = OWN_HOST;
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
@ -2236,11 +2241,12 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
/* Mailbox cmd <cmd> Cmpl <cmpl> */ /* Mailbox cmd <cmd> Cmpl <cmpl> */
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
"(%d):0307 Mailbox cmd x%x (x%x) Cmpl x%p " "(%d):0307 Mailbox cmd x%x (x%x/x%x) Cmpl x%p "
"Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n", "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n",
pmb->vport ? pmb->vport->vpi : 0, pmb->vport ? pmb->vport->vpi : 0,
pmbox->mbxCommand, pmbox->mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, pmb), lpfc_sli_config_mbox_subsys_get(phba, pmb),
lpfc_sli_config_mbox_opcode_get(phba, pmb),
pmb->mbox_cmpl, pmb->mbox_cmpl,
*((uint32_t *) pmbox), *((uint32_t *) pmbox),
pmbox->un.varWords[0], pmbox->un.varWords[0],
@ -4754,7 +4760,7 @@ lpfc_sli4_get_avail_extnt_rsrc(struct lpfc_hba *phba, uint16_t type,
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
if (unlikely(rc)) { if (unlikely(rc)) {
@ -4911,7 +4917,7 @@ lpfc_sli4_cfg_post_extnts(struct lpfc_hba *phba, uint16_t *extnt_cnt,
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
@ -5194,7 +5200,7 @@ lpfc_sli4_dealloc_extent(struct lpfc_hba *phba, uint16_t type)
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, mbox_tmo); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
if (unlikely(rc)) { if (unlikely(rc)) {
@ -5619,7 +5625,7 @@ lpfc_sli4_get_allocated_extnts(struct lpfc_hba *phba, uint16_t type,
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
@ -6322,7 +6328,7 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox,
} }
/* timeout active mbox command */ /* timeout active mbox command */
mod_timer(&psli->mbox_tmo, (jiffies + mod_timer(&psli->mbox_tmo, (jiffies +
(HZ * lpfc_mbox_tmo_val(phba, mb->mbxCommand)))); (HZ * lpfc_mbox_tmo_val(phba, pmbox))));
} }
/* Mailbox cmd <cmd> issue */ /* Mailbox cmd <cmd> issue */
@ -6446,9 +6452,8 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox,
drvr_flag); drvr_flag);
goto out_not_finished; goto out_not_finished;
} }
timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) *
mb->mbxCommand) * 1000) + jiffies;
1000) + jiffies;
i = 0; i = 0;
/* Wait for command to complete */ /* Wait for command to complete */
while (((word0 & OWN_CHIP) == OWN_CHIP) || while (((word0 & OWN_CHIP) == OWN_CHIP) ||
@ -6559,21 +6564,21 @@ static int
lpfc_sli4_async_mbox_block(struct lpfc_hba *phba) lpfc_sli4_async_mbox_block(struct lpfc_hba *phba)
{ {
struct lpfc_sli *psli = &phba->sli; struct lpfc_sli *psli = &phba->sli;
uint8_t actcmd = MBX_HEARTBEAT;
int rc = 0; int rc = 0;
unsigned long timeout; unsigned long timeout = 0;
/* Mark the asynchronous mailbox command posting as blocked */ /* Mark the asynchronous mailbox command posting as blocked */
spin_lock_irq(&phba->hbalock); spin_lock_irq(&phba->hbalock);
psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK;
if (phba->sli.mbox_active)
actcmd = phba->sli.mbox_active->u.mb.mbxCommand;
spin_unlock_irq(&phba->hbalock);
/* Determine how long we might wait for the active mailbox /* Determine how long we might wait for the active mailbox
* command to be gracefully completed by firmware. * command to be gracefully completed by firmware.
*/ */
timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, actcmd) * 1000) + if (phba->sli.mbox_active)
jiffies; timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba,
phba->sli.mbox_active) *
1000) + jiffies;
spin_unlock_irq(&phba->hbalock);
/* Wait for the outstnading mailbox command to complete */ /* Wait for the outstnading mailbox command to complete */
while (phba->sli.mbox_active) { while (phba->sli.mbox_active) {
/* Check active mailbox complete status every 2ms */ /* Check active mailbox complete status every 2ms */
@ -6668,11 +6673,12 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
if (psli->sli_flag & LPFC_SLI_MBOX_ACTIVE) { if (psli->sli_flag & LPFC_SLI_MBOX_ACTIVE) {
spin_unlock_irqrestore(&phba->hbalock, iflag); spin_unlock_irqrestore(&phba->hbalock, iflag);
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
"(%d):2532 Mailbox command x%x (x%x) " "(%d):2532 Mailbox command x%x (x%x/x%x) "
"cannot issue Data: x%x x%x\n", "cannot issue Data: x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0, mboxq->vport ? mboxq->vport->vpi : 0,
mboxq->u.mb.mbxCommand, mboxq->u.mb.mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
psli->sli_flag, MBX_POLL); psli->sli_flag, MBX_POLL);
return MBXERR_ERROR; return MBXERR_ERROR;
} }
@ -6695,7 +6701,7 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
dma_address = &phba->sli4_hba.bmbx.dma_address; dma_address = &phba->sli4_hba.bmbx.dma_address;
writel(dma_address->addr_hi, phba->sli4_hba.BMBXregaddr); writel(dma_address->addr_hi, phba->sli4_hba.BMBXregaddr);
timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mbx_cmnd) timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)
* 1000) + jiffies; * 1000) + jiffies;
do { do {
bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr);
@ -6711,7 +6717,7 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
/* Post the low mailbox dma address to the port. */ /* Post the low mailbox dma address to the port. */
writel(dma_address->addr_lo, phba->sli4_hba.BMBXregaddr); writel(dma_address->addr_lo, phba->sli4_hba.BMBXregaddr);
timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mbx_cmnd) timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)
* 1000) + jiffies; * 1000) + jiffies;
do { do {
bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr);
@ -6750,11 +6756,12 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
lpfc_sli4_swap_str(phba, mboxq); lpfc_sli4_swap_str(phba, mboxq);
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
"(%d):0356 Mailbox cmd x%x (x%x) Status x%x " "(%d):0356 Mailbox cmd x%x (x%x/x%x) Status x%x "
"Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x x%x x%x" "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x x%x x%x"
" x%x x%x CQ: x%x x%x x%x x%x\n", " x%x x%x CQ: x%x x%x x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0, mboxq->vport ? mboxq->vport->vpi : 0, mbx_cmnd,
mbx_cmnd, lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
bf_get(lpfc_mqe_status, mb), bf_get(lpfc_mqe_status, mb),
mb->un.mb_words[0], mb->un.mb_words[1], mb->un.mb_words[0], mb->un.mb_words[1],
mb->un.mb_words[2], mb->un.mb_words[3], mb->un.mb_words[2], mb->un.mb_words[3],
@ -6800,11 +6807,12 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
rc = lpfc_mbox_dev_check(phba); rc = lpfc_mbox_dev_check(phba);
if (unlikely(rc)) { if (unlikely(rc)) {
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
"(%d):2544 Mailbox command x%x (x%x) " "(%d):2544 Mailbox command x%x (x%x/x%x) "
"cannot issue Data: x%x x%x\n", "cannot issue Data: x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0, mboxq->vport ? mboxq->vport->vpi : 0,
mboxq->u.mb.mbxCommand, mboxq->u.mb.mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
psli->sli_flag, flag); psli->sli_flag, flag);
goto out_not_finished; goto out_not_finished;
} }
@ -6818,20 +6826,25 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
if (rc != MBX_SUCCESS) if (rc != MBX_SUCCESS)
lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI,
"(%d):2541 Mailbox command x%x " "(%d):2541 Mailbox command x%x "
"(x%x) cannot issue Data: x%x x%x\n", "(x%x/x%x) cannot issue Data: "
"x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0, mboxq->vport ? mboxq->vport->vpi : 0,
mboxq->u.mb.mbxCommand, mboxq->u.mb.mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba,
mboxq),
lpfc_sli_config_mbox_opcode_get(phba,
mboxq),
psli->sli_flag, flag); psli->sli_flag, flag);
return rc; return rc;
} else if (flag == MBX_POLL) { } else if (flag == MBX_POLL) {
lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI,
"(%d):2542 Try to issue mailbox command " "(%d):2542 Try to issue mailbox command "
"x%x (x%x) synchronously ahead of async" "x%x (x%x/x%x) synchronously ahead of async"
"mailbox command queue: x%x x%x\n", "mailbox command queue: x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0, mboxq->vport ? mboxq->vport->vpi : 0,
mboxq->u.mb.mbxCommand, mboxq->u.mb.mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
psli->sli_flag, flag); psli->sli_flag, flag);
/* Try to block the asynchronous mailbox posting */ /* Try to block the asynchronous mailbox posting */
rc = lpfc_sli4_async_mbox_block(phba); rc = lpfc_sli4_async_mbox_block(phba);
@ -6840,16 +6853,18 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
rc = lpfc_sli4_post_sync_mbox(phba, mboxq); rc = lpfc_sli4_post_sync_mbox(phba, mboxq);
if (rc != MBX_SUCCESS) if (rc != MBX_SUCCESS)
lpfc_printf_log(phba, KERN_ERR, lpfc_printf_log(phba, KERN_ERR,
LOG_MBOX | LOG_SLI, LOG_MBOX | LOG_SLI,
"(%d):2597 Mailbox command " "(%d):2597 Mailbox command "
"x%x (x%x) cannot issue " "x%x (x%x/x%x) cannot issue "
"Data: x%x x%x\n", "Data: x%x x%x\n",
mboxq->vport ? mboxq->vport ?
mboxq->vport->vpi : 0, mboxq->vport->vpi : 0,
mboxq->u.mb.mbxCommand, mboxq->u.mb.mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, lpfc_sli_config_mbox_subsys_get(phba,
mboxq), mboxq),
psli->sli_flag, flag); lpfc_sli_config_mbox_opcode_get(phba,
mboxq),
psli->sli_flag, flag);
/* Unblock the async mailbox posting afterward */ /* Unblock the async mailbox posting afterward */
lpfc_sli4_async_mbox_unblock(phba); lpfc_sli4_async_mbox_unblock(phba);
} }
@ -6860,11 +6875,12 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
rc = lpfc_mbox_cmd_check(phba, mboxq); rc = lpfc_mbox_cmd_check(phba, mboxq);
if (rc) { if (rc) {
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
"(%d):2543 Mailbox command x%x (x%x) " "(%d):2543 Mailbox command x%x (x%x/x%x) "
"cannot issue Data: x%x x%x\n", "cannot issue Data: x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0, mboxq->vport ? mboxq->vport->vpi : 0,
mboxq->u.mb.mbxCommand, mboxq->u.mb.mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
psli->sli_flag, flag); psli->sli_flag, flag);
goto out_not_finished; goto out_not_finished;
} }
@ -6876,10 +6892,11 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
spin_unlock_irqrestore(&phba->hbalock, iflags); spin_unlock_irqrestore(&phba->hbalock, iflags);
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
"(%d):0354 Mbox cmd issue - Enqueue Data: " "(%d):0354 Mbox cmd issue - Enqueue Data: "
"x%x (x%x) x%x x%x x%x\n", "x%x (x%x/x%x) x%x x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0xffffff, mboxq->vport ? mboxq->vport->vpi : 0xffffff,
bf_get(lpfc_mqe_command, &mboxq->u.mqe), bf_get(lpfc_mqe_command, &mboxq->u.mqe),
lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
phba->pport->port_state, phba->pport->port_state,
psli->sli_flag, MBX_NOWAIT); psli->sli_flag, MBX_NOWAIT);
/* Wake up worker thread to transport mailbox command from head */ /* Wake up worker thread to transport mailbox command from head */
@ -6956,13 +6973,14 @@ lpfc_sli4_post_async_mbox(struct lpfc_hba *phba)
/* Start timer for the mbox_tmo and log some mailbox post messages */ /* Start timer for the mbox_tmo and log some mailbox post messages */
mod_timer(&psli->mbox_tmo, (jiffies + mod_timer(&psli->mbox_tmo, (jiffies +
(HZ * lpfc_mbox_tmo_val(phba, mbx_cmnd)))); (HZ * lpfc_mbox_tmo_val(phba, mboxq))));
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
"(%d):0355 Mailbox cmd x%x (x%x) issue Data: " "(%d):0355 Mailbox cmd x%x (x%x/x%x) issue Data: "
"x%x x%x\n", "x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0, mbx_cmnd, mboxq->vport ? mboxq->vport->vpi : 0, mbx_cmnd,
lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
phba->pport->port_state, psli->sli_flag); phba->pport->port_state, psli->sli_flag);
if (mbx_cmnd != MBX_HEARTBEAT) { if (mbx_cmnd != MBX_HEARTBEAT) {
@ -6986,11 +7004,12 @@ lpfc_sli4_post_async_mbox(struct lpfc_hba *phba)
rc = lpfc_sli4_mq_put(phba->sli4_hba.mbx_wq, mqe); rc = lpfc_sli4_mq_put(phba->sli4_hba.mbx_wq, mqe);
if (rc != MBX_SUCCESS) { if (rc != MBX_SUCCESS) {
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
"(%d):2533 Mailbox command x%x (x%x) " "(%d):2533 Mailbox command x%x (x%x/x%x) "
"cannot issue Data: x%x x%x\n", "cannot issue Data: x%x x%x\n",
mboxq->vport ? mboxq->vport->vpi : 0, mboxq->vport ? mboxq->vport->vpi : 0,
mboxq->u.mb.mbxCommand, mboxq->u.mb.mbxCommand,
lpfc_sli4_mbox_opcode_get(phba, mboxq), lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
psli->sli_flag, MBX_NOWAIT); psli->sli_flag, MBX_NOWAIT);
goto out_not_finished; goto out_not_finished;
} }
@ -9407,23 +9426,24 @@ void
lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba) lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba)
{ {
struct lpfc_sli *psli = &phba->sli; struct lpfc_sli *psli = &phba->sli;
uint8_t actcmd = MBX_HEARTBEAT;
unsigned long timeout; unsigned long timeout;
timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies;
spin_lock_irq(&phba->hbalock); spin_lock_irq(&phba->hbalock);
psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK; psli->sli_flag |= LPFC_SLI_ASYNC_MBX_BLK;
spin_unlock_irq(&phba->hbalock); spin_unlock_irq(&phba->hbalock);
if (psli->sli_flag & LPFC_SLI_ACTIVE) { if (psli->sli_flag & LPFC_SLI_ACTIVE) {
spin_lock_irq(&phba->hbalock); spin_lock_irq(&phba->hbalock);
if (phba->sli.mbox_active)
actcmd = phba->sli.mbox_active->u.mb.mbxCommand;
spin_unlock_irq(&phba->hbalock);
/* Determine how long we might wait for the active mailbox /* Determine how long we might wait for the active mailbox
* command to be gracefully completed by firmware. * command to be gracefully completed by firmware.
*/ */
timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, actcmd) * if (phba->sli.mbox_active)
1000) + jiffies; timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba,
phba->sli.mbox_active) *
1000) + jiffies;
spin_unlock_irq(&phba->hbalock);
while (phba->sli.mbox_active) { while (phba->sli.mbox_active) {
/* Check active mailbox complete status every 2ms */ /* Check active mailbox complete status every 2ms */
msleep(2); msleep(2);
@ -12532,7 +12552,7 @@ lpfc_sli4_post_sgl(struct lpfc_hba *phba,
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
/* The IOCTL status is embedded in the mailbox subheader. */ /* The IOCTL status is embedded in the mailbox subheader. */
@ -12747,7 +12767,7 @@ lpfc_sli4_post_els_sgl_list(struct lpfc_hba *phba)
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr; shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr;
@ -12910,7 +12930,7 @@ lpfc_sli4_post_els_sgl_list_ext(struct lpfc_hba *phba)
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr; shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr;
@ -13034,7 +13054,7 @@ lpfc_sli4_post_scsi_sgl_block(struct lpfc_hba *phba, struct list_head *sblist,
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr; shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr;
@ -13190,7 +13210,7 @@ lpfc_sli4_post_scsi_sgl_blk_ext(struct lpfc_hba *phba, struct list_head *sblist,
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr; shdr = (union lpfc_sli4_cfg_shdr *) &sgl->cfg_shdr;
@ -14356,7 +14376,7 @@ lpfc_sli4_init_vpi(struct lpfc_vport *vport)
if (!mboxq) if (!mboxq)
return -ENOMEM; return -ENOMEM;
lpfc_init_vpi(phba, mboxq, vport->vpi); lpfc_init_vpi(phba, mboxq, vport->vpi);
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI); mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq);
rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
if (rc != MBX_SUCCESS) { if (rc != MBX_SUCCESS) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_SLI, lpfc_printf_vlog(vport, KERN_ERR, LOG_SLI,
@ -15232,7 +15252,7 @@ lpfc_wr_object(struct lpfc_hba *phba, struct list_head *dmabuf_list,
if (!phba->sli4_hba.intr_enable) if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else { else {
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
} }
/* The IOCTL status is embedded in the mailbox subheader. */ /* The IOCTL status is embedded in the mailbox subheader. */

View File

@ -293,13 +293,11 @@ struct lpfc_sli {
struct lpfc_lnk_stat lnk_stat_offsets; struct lpfc_lnk_stat lnk_stat_offsets;
}; };
#define LPFC_MBOX_TMO 30 /* Sec tmo for outstanding mbox /* Timeout for normal outstanding mbox command (Seconds) */
command */ #define LPFC_MBOX_TMO 30
#define LPFC_MBOX_SLI4_CONFIG_TMO 60 /* Sec tmo for outstanding mbox /* Timeout for non-flash-based outstanding sli_config mbox command (Seconds) */
command */ #define LPFC_MBOX_SLI4_CONFIG_TMO 60
#define LPFC_MBOX_TMO_FLASH_CMD 300 /* Sec tmo for outstanding FLASH write /* Timeout for flash-based outstanding sli_config mbox command (Seconds) */
* or erase cmds. This is especially #define LPFC_MBOX_SLI4_CONFIG_EXTENDED_TMO 300
* long because of the potential of /* Timeout for other flash-based outstanding mbox command (Seconds) */
* multiple flash erases that can be #define LPFC_MBOX_TMO_FLASH_CMD 300
* spawned.
*/

View File

@ -635,5 +635,5 @@ void lpfc_mbx_cmpl_fcf_rr_read_fcf_rec(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_read_fcf_rec(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_mbx_cmpl_read_fcf_rec(struct lpfc_hba *, LPFC_MBOXQ_t *);
int lpfc_sli4_unregister_fcf(struct lpfc_hba *); int lpfc_sli4_unregister_fcf(struct lpfc_hba *);
int lpfc_sli4_post_status_check(struct lpfc_hba *); int lpfc_sli4_post_status_check(struct lpfc_hba *);
uint8_t lpfc_sli4_mbox_opcode_get(struct lpfc_hba *, struct lpfcMboxq *); uint8_t lpfc_sli_config_mbox_subsys_get(struct lpfc_hba *, LPFC_MBOXQ_t *);
uint8_t lpfc_sli_config_mbox_opcode_get(struct lpfc_hba *, LPFC_MBOXQ_t *);