aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2010-11-20 23:11:48 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:23:59 -0500
commit76a95d75ede64e4f1684ddb8c626fdfdb641bda2 (patch)
tree53420aed0a91873a382b886bf3b3ca828df48edc /drivers/scsi/lpfc/lpfc_sli.c
parent085c647c3377c3e39c8c572278507b1e1c7e7bf7 (diff)
[SCSI] lpfc 8.3.19: Add SLI4 FC Discovery support
Add SLI4 FC Discovery support - Replace READ_LA and READ_LA64 with READ_TOPOLOGY mailbox command. - Converted the old READ_LA structure to use bf_set/get instead of bit fields. - Rename HBA_FCOE_SUPPORT flag to HBA_FCOE_MODE. Flag now indicates function is running as SLI-4 FC or FCoE port. Make sure flag reset each time READ_REV completed as it can dynamically change. - Removed BDE union in the READ_TOPOLOGY mailbox command and added a define to define the ALPA MAP SIZE. Added FC Code for async events. - Added code to support new 16G link speed. - Define new set of values to keep track of valid user settable link speeds. - Used new link speed definitions to define link speed max and bitmap. - Redefined FDMI Port sppeds to be hax values and added the 16G value. - Added new CQE trailer code for FC Events. - Add lpfc_issue_init_vfi and lpfc_init_vfi_cmpl routines. - Replace many calls to the initial_flogi routine with lpfc_issue_init_vfi. - Add vp and vpi fields to the INIT_VFI mailbox command. - Addapt lpfc_hba_init_link routine for SLI4 use. - Use lpfc_hba_init_link call from lpfc_sli4_hba_setup. - Add a check for FC mode to register the FCFI before init link. - Convert lpfc_sli4_init_vpi to be called without a vpi (get it from vport). Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c81
1 files changed, 40 insertions, 41 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 06b1655b4d59..bedaa4e7cbf8 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1634,7 +1634,6 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand)
1634 case MBX_READ_LNK_STAT: 1634 case MBX_READ_LNK_STAT:
1635 case MBX_REG_LOGIN: 1635 case MBX_REG_LOGIN:
1636 case MBX_UNREG_LOGIN: 1636 case MBX_UNREG_LOGIN:
1637 case MBX_READ_LA:
1638 case MBX_CLEAR_LA: 1637 case MBX_CLEAR_LA:
1639 case MBX_DUMP_MEMORY: 1638 case MBX_DUMP_MEMORY:
1640 case MBX_DUMP_CONTEXT: 1639 case MBX_DUMP_CONTEXT:
@@ -1656,7 +1655,7 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand)
1656 case MBX_READ_SPARM64: 1655 case MBX_READ_SPARM64:
1657 case MBX_READ_RPI64: 1656 case MBX_READ_RPI64:
1658 case MBX_REG_LOGIN64: 1657 case MBX_REG_LOGIN64:
1659 case MBX_READ_LA64: 1658 case MBX_READ_TOPOLOGY:
1660 case MBX_WRITE_WWN: 1659 case MBX_WRITE_WWN:
1661 case MBX_SET_DEBUG: 1660 case MBX_SET_DEBUG:
1662 case MBX_LOAD_EXP_ROM: 1661 case MBX_LOAD_EXP_ROM:
@@ -4357,13 +4356,16 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4357 } 4356 }
4358 4357
4359 rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size); 4358 rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size);
4360 if (unlikely(rc)) 4359 if (unlikely(rc)) {
4361 goto out_free_vpd; 4360 kfree(vpd);
4362 4361 goto out_free_mbox;
4362 }
4363 mqe = &mboxq->u.mqe; 4363 mqe = &mboxq->u.mqe;
4364 phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev); 4364 phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev);
4365 if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev)) 4365 if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev))
4366 phba->hba_flag |= HBA_FCOE_SUPPORT; 4366 phba->hba_flag |= HBA_FCOE_MODE;
4367 else
4368 phba->hba_flag &= ~HBA_FCOE_MODE;
4367 4369
4368 if (bf_get(lpfc_mbx_rd_rev_cee_ver, &mqe->un.read_rev) == 4370 if (bf_get(lpfc_mbx_rd_rev_cee_ver, &mqe->un.read_rev) ==
4369 LPFC_DCBX_CEE_MODE) 4371 LPFC_DCBX_CEE_MODE)
@@ -4372,13 +4374,14 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4372 phba->hba_flag &= ~HBA_FIP_SUPPORT; 4374 phba->hba_flag &= ~HBA_FIP_SUPPORT;
4373 4375
4374 if (phba->sli_rev != LPFC_SLI_REV4 || 4376 if (phba->sli_rev != LPFC_SLI_REV4 ||
4375 !(phba->hba_flag & HBA_FCOE_SUPPORT)) { 4377 !(phba->hba_flag & HBA_FCOE_MODE)) {
4376 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 4378 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
4377 "0376 READ_REV Error. SLI Level %d " 4379 "0376 READ_REV Error. SLI Level %d "
4378 "FCoE enabled %d\n", 4380 "FCoE enabled %d\n",
4379 phba->sli_rev, phba->hba_flag & HBA_FCOE_SUPPORT); 4381 phba->sli_rev, phba->hba_flag & HBA_FCOE_MODE);
4380 rc = -EIO; 4382 rc = -EIO;
4381 goto out_free_vpd; 4383 kfree(vpd);
4384 goto out_free_mbox;
4382 } 4385 }
4383 /* 4386 /*
4384 * Evaluate the read rev and vpd data. Populate the driver 4387 * Evaluate the read rev and vpd data. Populate the driver
@@ -4392,6 +4395,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4392 "Using defaults.\n", rc); 4395 "Using defaults.\n", rc);
4393 rc = 0; 4396 rc = 0;
4394 } 4397 }
4398 kfree(vpd);
4395 4399
4396 /* Save information as VPD data */ 4400 /* Save information as VPD data */
4397 phba->vpd.rev.biuRev = mqe->un.read_rev.first_hw_rev; 4401 phba->vpd.rev.biuRev = mqe->un.read_rev.first_hw_rev;
@@ -4428,7 +4432,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4428 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 4432 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
4429 if (unlikely(rc)) { 4433 if (unlikely(rc)) {
4430 rc = -EIO; 4434 rc = -EIO;
4431 goto out_free_vpd; 4435 goto out_free_mbox;
4432 } 4436 }
4433 4437
4434 /* 4438 /*
@@ -4476,7 +4480,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4476 if (rc) { 4480 if (rc) {
4477 phba->link_state = LPFC_HBA_ERROR; 4481 phba->link_state = LPFC_HBA_ERROR;
4478 rc = -ENOMEM; 4482 rc = -ENOMEM;
4479 goto out_free_vpd; 4483 goto out_free_mbox;
4480 } 4484 }
4481 4485
4482 mboxq->vport = vport; 4486 mboxq->vport = vport;
@@ -4501,7 +4505,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4501 rc, bf_get(lpfc_mqe_status, mqe)); 4505 rc, bf_get(lpfc_mqe_status, mqe));
4502 phba->link_state = LPFC_HBA_ERROR; 4506 phba->link_state = LPFC_HBA_ERROR;
4503 rc = -EIO; 4507 rc = -EIO;
4504 goto out_free_vpd; 4508 goto out_free_mbox;
4505 } 4509 }
4506 4510
4507 if (phba->cfg_soft_wwnn) 4511 if (phba->cfg_soft_wwnn)
@@ -4526,7 +4530,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4526 "0582 Error %d during sgl post operation\n", 4530 "0582 Error %d during sgl post operation\n",
4527 rc); 4531 rc);
4528 rc = -ENODEV; 4532 rc = -ENODEV;
4529 goto out_free_vpd; 4533 goto out_free_mbox;
4530 } 4534 }
4531 4535
4532 /* Register SCSI SGL pool to the device */ 4536 /* Register SCSI SGL pool to the device */
@@ -4538,7 +4542,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4538 /* Some Scsi buffers were moved to the abort scsi list */ 4542 /* Some Scsi buffers were moved to the abort scsi list */
4539 /* A pci function reset will repost them */ 4543 /* A pci function reset will repost them */
4540 rc = -ENODEV; 4544 rc = -ENODEV;
4541 goto out_free_vpd; 4545 goto out_free_mbox;
4542 } 4546 }
4543 4547
4544 /* Post the rpi header region to the device. */ 4548 /* Post the rpi header region to the device. */
@@ -4548,7 +4552,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4548 "0393 Error %d during rpi post operation\n", 4552 "0393 Error %d during rpi post operation\n",
4549 rc); 4553 rc);
4550 rc = -ENODEV; 4554 rc = -ENODEV;
4551 goto out_free_vpd; 4555 goto out_free_mbox;
4552 } 4556 }
4553 4557
4554 /* Set up all the queues to the device */ 4558 /* Set up all the queues to the device */
@@ -4608,33 +4612,33 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4608 } 4612 }
4609 } 4613 }
4610 4614
4615 if (!(phba->hba_flag & HBA_FCOE_MODE)) {
4616 /*
4617 * The FC Port needs to register FCFI (index 0)
4618 */
4619 lpfc_reg_fcfi(phba, mboxq);
4620 mboxq->vport = phba->pport;
4621 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
4622 if (rc == MBX_SUCCESS)
4623 rc = 0;
4624 else
4625 goto out_unset_queue;
4626 }
4611 /* 4627 /*
4612 * The port is ready, set the host's link state to LINK_DOWN 4628 * The port is ready, set the host's link state to LINK_DOWN
4613 * in preparation for link interrupts. 4629 * in preparation for link interrupts.
4614 */ 4630 */
4615 lpfc_init_link(phba, mboxq, phba->cfg_topology, phba->cfg_link_speed);
4616 mboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
4617 lpfc_set_loopback_flag(phba);
4618 /* Change driver state to LPFC_LINK_DOWN right before init link */
4619 spin_lock_irq(&phba->hbalock); 4631 spin_lock_irq(&phba->hbalock);
4620 phba->link_state = LPFC_LINK_DOWN; 4632 phba->link_state = LPFC_LINK_DOWN;
4621 spin_unlock_irq(&phba->hbalock); 4633 spin_unlock_irq(&phba->hbalock);
4622 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); 4634 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT);
4623 if (unlikely(rc != MBX_NOT_FINISHED)) { 4635out_unset_queue:
4624 kfree(vpd);
4625 return 0;
4626 } else
4627 rc = -EIO;
4628
4629 /* Unset all the queues set up in this routine when error out */ 4636 /* Unset all the queues set up in this routine when error out */
4630 if (rc) 4637 if (rc)
4631 lpfc_sli4_queue_unset(phba); 4638 lpfc_sli4_queue_unset(phba);
4632
4633out_stop_timers: 4639out_stop_timers:
4634 if (rc) 4640 if (rc)
4635 lpfc_stop_hba_timers(phba); 4641 lpfc_stop_hba_timers(phba);
4636out_free_vpd:
4637 kfree(vpd);
4638out_free_mbox: 4642out_free_mbox:
4639 mempool_free(mboxq, phba->mbox_mem_pool); 4643 mempool_free(mboxq, phba->mbox_mem_pool);
4640 return rc; 4644 return rc;
@@ -12157,42 +12161,37 @@ lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp)
12157 12161
12158/** 12162/**
12159 * lpfc_sli4_init_vpi - Initialize a vpi with the port 12163 * lpfc_sli4_init_vpi - Initialize a vpi with the port
12160 * @phba: pointer to lpfc hba data structure. 12164 * @vport: Pointer to the vport for which the vpi is being initialized
12161 * @vpi: vpi value to activate with the port.
12162 * 12165 *
12163 * This routine is invoked to activate a vpi with the 12166 * This routine is invoked to activate a vpi with the port.
12164 * port when the host intends to use vports with a
12165 * nonzero vpi.
12166 * 12167 *
12167 * Returns: 12168 * Returns:
12168 * 0 success 12169 * 0 success
12169 * -Evalue otherwise 12170 * -Evalue otherwise
12170 **/ 12171 **/
12171int 12172int
12172lpfc_sli4_init_vpi(struct lpfc_hba *phba, uint16_t vpi) 12173lpfc_sli4_init_vpi(struct lpfc_vport *vport)
12173{ 12174{
12174 LPFC_MBOXQ_t *mboxq; 12175 LPFC_MBOXQ_t *mboxq;
12175 int rc = 0; 12176 int rc = 0;
12176 int retval = MBX_SUCCESS; 12177 int retval = MBX_SUCCESS;
12177 uint32_t mbox_tmo; 12178 uint32_t mbox_tmo;
12178 12179 struct lpfc_hba *phba = vport->phba;
12179 if (vpi == 0)
12180 return -EINVAL;
12181 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 12180 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
12182 if (!mboxq) 12181 if (!mboxq)
12183 return -ENOMEM; 12182 return -ENOMEM;
12184 lpfc_init_vpi(phba, mboxq, vpi); 12183 lpfc_init_vpi(phba, mboxq, vport->vpi);
12185 mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI); 12184 mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI);
12186 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); 12185 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
12187 if (rc != MBX_SUCCESS) { 12186 if (rc != MBX_SUCCESS) {
12188 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 12187 lpfc_printf_vlog(vport, KERN_ERR, LOG_SLI,
12189 "2022 INIT VPI Mailbox failed " 12188 "2022 INIT VPI Mailbox failed "
12190 "status %d, mbxStatus x%x\n", rc, 12189 "status %d, mbxStatus x%x\n", rc,
12191 bf_get(lpfc_mqe_status, &mboxq->u.mqe)); 12190 bf_get(lpfc_mqe_status, &mboxq->u.mqe));
12192 retval = -EIO; 12191 retval = -EIO;
12193 } 12192 }
12194 if (rc != MBX_TIMEOUT) 12193 if (rc != MBX_TIMEOUT)
12195 mempool_free(mboxq, phba->mbox_mem_pool); 12194 mempool_free(mboxq, vport->phba->mbox_mem_pool);
12196 12195
12197 return retval; 12196 return retval;
12198} 12197}