aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2013-01-03 15:43:29 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-01-29 19:11:08 -0500
commit7b15db32d3a585e5f7e304b4728b29daa534e039 (patch)
tree88e069a904bd000d5dff3f9a0fce0837cee8767a
parent5b5b36a92b34cf78bb3f2fec2127846b12b4fe2f (diff)
[SCSI] lpfc 8.3.37: Removed use of NOP mailboxes for interrupt verification
Removed use of NOP mailboxes for interrupt verification in pci_probe_one_s4 Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c179
1 files changed, 26 insertions, 153 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 89ad55807012..5262049651ee 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -7664,78 +7664,6 @@ out:
7664} 7664}
7665 7665
7666/** 7666/**
7667 * lpfc_sli4_send_nop_mbox_cmds - Send sli-4 nop mailbox commands
7668 * @phba: pointer to lpfc hba data structure.
7669 * @cnt: number of nop mailbox commands to send.
7670 *
7671 * This routine is invoked to send a number @cnt of NOP mailbox command and
7672 * wait for each command to complete.
7673 *
7674 * Return: the number of NOP mailbox command completed.
7675 **/
7676static int
7677lpfc_sli4_send_nop_mbox_cmds(struct lpfc_hba *phba, uint32_t cnt)
7678{
7679 LPFC_MBOXQ_t *mboxq;
7680 int length, cmdsent;
7681 uint32_t mbox_tmo;
7682 uint32_t rc = 0;
7683 uint32_t shdr_status, shdr_add_status;
7684 union lpfc_sli4_cfg_shdr *shdr;
7685
7686 if (cnt == 0) {
7687 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
7688 "2518 Requested to send 0 NOP mailbox cmd\n");
7689 return cnt;
7690 }
7691
7692 mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
7693 if (!mboxq) {
7694 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
7695 "2519 Unable to allocate memory for issuing "
7696 "NOP mailbox command\n");
7697 return 0;
7698 }
7699
7700 /* Set up NOP SLI4_CONFIG mailbox-ioctl command */
7701 length = (sizeof(struct lpfc_mbx_nop) -
7702 sizeof(struct lpfc_sli4_cfg_mhdr));
7703
7704 for (cmdsent = 0; cmdsent < cnt; cmdsent++) {
7705 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON,
7706 LPFC_MBOX_OPCODE_NOP, length,
7707 LPFC_SLI4_MBX_EMBED);
7708 if (!phba->sli4_hba.intr_enable)
7709 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
7710 else {
7711 mbox_tmo = lpfc_mbox_tmo_val(phba, mboxq);
7712 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
7713 }
7714 if (rc == MBX_TIMEOUT)
7715 break;
7716 /* Check return status */
7717 shdr = (union lpfc_sli4_cfg_shdr *)
7718 &mboxq->u.mqe.un.sli4_config.header.cfg_shdr;
7719 shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
7720 shdr_add_status = bf_get(lpfc_mbox_hdr_add_status,
7721 &shdr->response);
7722 if (shdr_status || shdr_add_status || rc) {
7723 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
7724 "2520 NOP mailbox command failed "
7725 "status x%x add_status x%x mbx "
7726 "status x%x\n", shdr_status,
7727 shdr_add_status, rc);
7728 break;
7729 }
7730 }
7731
7732 if (rc != MBX_TIMEOUT)
7733 mempool_free(mboxq, phba->mbox_mem_pool);
7734
7735 return cmdsent;
7736}
7737
7738/**
7739 * lpfc_sli4_pci_mem_setup - Setup SLI4 HBA PCI memory space. 7667 * lpfc_sli4_pci_mem_setup - Setup SLI4 HBA PCI memory space.
7740 * @phba: pointer to lpfc hba data structure. 7668 * @phba: pointer to lpfc hba data structure.
7741 * 7669 *
@@ -8503,37 +8431,6 @@ lpfc_unset_hba(struct lpfc_hba *phba)
8503} 8431}
8504 8432
8505/** 8433/**
8506 * lpfc_sli4_unset_hba - Unset SLI4 hba device initialization.
8507 * @phba: pointer to lpfc hba data structure.
8508 *
8509 * This routine is invoked to unset the HBA device initialization steps to
8510 * a device with SLI-4 interface spec.
8511 **/
8512static void
8513lpfc_sli4_unset_hba(struct lpfc_hba *phba)
8514{
8515 struct lpfc_vport *vport = phba->pport;
8516 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
8517
8518 spin_lock_irq(shost->host_lock);
8519 vport->load_flag |= FC_UNLOADING;
8520 spin_unlock_irq(shost->host_lock);
8521
8522 phba->pport->work_port_events = 0;
8523
8524 /* Stop the SLI4 device port */
8525 lpfc_stop_port(phba);
8526
8527 lpfc_sli4_disable_intr(phba);
8528
8529 /* Reset SLI4 HBA FCoE function */
8530 lpfc_pci_function_reset(phba);
8531 lpfc_sli4_queue_destroy(phba);
8532
8533 return;
8534}
8535
8536/**
8537 * lpfc_sli4_xri_exchange_busy_wait - Wait for device XRI exchange busy 8434 * lpfc_sli4_xri_exchange_busy_wait - Wait for device XRI exchange busy
8538 * @phba: Pointer to HBA context object. 8435 * @phba: Pointer to HBA context object.
8539 * 8436 *
@@ -9595,7 +9492,6 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
9595 struct Scsi_Host *shost = NULL; 9492 struct Scsi_Host *shost = NULL;
9596 int error, ret; 9493 int error, ret;
9597 uint32_t cfg_mode, intr_mode; 9494 uint32_t cfg_mode, intr_mode;
9598 int mcnt;
9599 int adjusted_fcp_io_channel; 9495 int adjusted_fcp_io_channel;
9600 9496
9601 /* Allocate memory for HBA structure */ 9497 /* Allocate memory for HBA structure */
@@ -9684,58 +9580,35 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
9684 shost = lpfc_shost_from_vport(vport); /* save shost for error cleanup */ 9580 shost = lpfc_shost_from_vport(vport); /* save shost for error cleanup */
9685 /* Now, trying to enable interrupt and bring up the device */ 9581 /* Now, trying to enable interrupt and bring up the device */
9686 cfg_mode = phba->cfg_use_msi; 9582 cfg_mode = phba->cfg_use_msi;
9687 while (true) {
9688 /* Put device to a known state before enabling interrupt */
9689 lpfc_stop_port(phba);
9690 /* Configure and enable interrupt */
9691 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode);
9692 if (intr_mode == LPFC_INTR_ERROR) {
9693 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
9694 "0426 Failed to enable interrupt.\n");
9695 error = -ENODEV;
9696 goto out_free_sysfs_attr;
9697 }
9698 /* Default to single EQ for non-MSI-X */
9699 if (phba->intr_type != MSIX)
9700 adjusted_fcp_io_channel = 1;
9701 else
9702 adjusted_fcp_io_channel = phba->cfg_fcp_io_channel;
9703 phba->cfg_fcp_io_channel = adjusted_fcp_io_channel;
9704 /* Set up SLI-4 HBA */
9705 if (lpfc_sli4_hba_setup(phba)) {
9706 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
9707 "1421 Failed to set up hba\n");
9708 error = -ENODEV;
9709 goto out_disable_intr;
9710 }
9711
9712 /* Send NOP mbx cmds for non-INTx mode active interrupt test */
9713 if (intr_mode != 0)
9714 mcnt = lpfc_sli4_send_nop_mbox_cmds(phba,
9715 LPFC_ACT_INTR_CNT);
9716 9583
9717 /* Check active interrupts received only for MSI/MSI-X */ 9584 /* Put device to a known state before enabling interrupt */
9718 if (intr_mode == 0 || 9585 lpfc_stop_port(phba);
9719 phba->sli.slistat.sli_intr >= LPFC_ACT_INTR_CNT) { 9586 /* Configure and enable interrupt */
9720 /* Log the current active interrupt mode */ 9587 intr_mode = lpfc_sli4_enable_intr(phba, cfg_mode);
9721 phba->intr_mode = intr_mode; 9588 if (intr_mode == LPFC_INTR_ERROR) {
9722 lpfc_log_intr_mode(phba, intr_mode); 9589 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
9723 break; 9590 "0426 Failed to enable interrupt.\n");
9724 } 9591 error = -ENODEV;
9725 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 9592 goto out_free_sysfs_attr;
9726 "0451 Configure interrupt mode (%d) " 9593 }
9727 "failed active interrupt test.\n", 9594 /* Default to single EQ for non-MSI-X */
9728 intr_mode); 9595 if (phba->intr_type != MSIX)
9729 /* Unset the previous SLI-4 HBA setup. */ 9596 adjusted_fcp_io_channel = 1;
9730 /* 9597 else
9731 * TODO: Is this operation compatible with IF TYPE 2 9598 adjusted_fcp_io_channel = phba->cfg_fcp_io_channel;
9732 * devices? All port state is deleted and cleared. 9599 phba->cfg_fcp_io_channel = adjusted_fcp_io_channel;
9733 */ 9600 /* Set up SLI-4 HBA */
9734 lpfc_sli4_unset_hba(phba); 9601 if (lpfc_sli4_hba_setup(phba)) {
9735 /* Try next level of interrupt mode */ 9602 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
9736 cfg_mode = --intr_mode; 9603 "1421 Failed to set up hba\n");
9604 error = -ENODEV;
9605 goto out_disable_intr;
9737 } 9606 }
9738 9607
9608 /* Log the current active interrupt mode */
9609 phba->intr_mode = intr_mode;
9610 lpfc_log_intr_mode(phba, intr_mode);
9611
9739 /* Perform post initialization setup */ 9612 /* Perform post initialization setup */
9740 lpfc_post_init_setup(phba); 9613 lpfc_post_init_setup(phba);
9741 9614