aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2009-10-02 15:16:51 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:01:41 -0500
commit6a9c52cf22e4ca13816bb2bd9899129cd4445de7 (patch)
tree02c44960d58fbaada692062ed96287425d0cd853 /drivers/scsi/lpfc/lpfc_sli.c
parent6669f9bb902b8c3f5e33cb8c32c8c0eec6ed68ed (diff)
[SCSI] lpfc 8.3.5: fix sysfs parameters, vport creation and other bugs and update logging
This patch include the following fixes and changes: - Fix crash when "error" is echoed to board_mode sysfs parameter - Fix FCoE Parameter parsing in regions 23 - Fix driver crash when creating vport with large number of targets on SLI4 - Fix bug with npiv message being logged when it is not supported by the adapter - Fix a potential dereferencing mailbox structure after free bug - Fix firmware crash after vport create with high target count - Error out requests to set board_mode to warm restart via sysfs on SLI4 HBAs - Fix Block guard logging - Fix a memory corruption issue during GID_FT IO prep - Fix crash while processing unsolicited FC frames - Fix failed to allocate XRI message is not a critical failure - Update and fix formatting in some log messages - Fix missing new line characters in log messages - Removed the use of the locally defined FC transport layer related macros - Check the rsplen in lpfc_handle_fcp_err function before using rsplen 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.c85
1 files changed, 29 insertions, 56 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e8d3e4732a8..9693c777425 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -516,6 +516,8 @@ __lpfc_sli_get_sglq(struct lpfc_hba *phba)
516 struct lpfc_sglq *sglq = NULL; 516 struct lpfc_sglq *sglq = NULL;
517 uint16_t adj_xri; 517 uint16_t adj_xri;
518 list_remove_head(lpfc_sgl_list, sglq, struct lpfc_sglq, list); 518 list_remove_head(lpfc_sgl_list, sglq, struct lpfc_sglq, list);
519 if (!sglq)
520 return NULL;
519 adj_xri = sglq->sli4_xritag - phba->sli4_hba.max_cfg_param.xri_base; 521 adj_xri = sglq->sli4_xritag - phba->sli4_hba.max_cfg_param.xri_base;
520 phba->sli4_hba.lpfc_sglq_active_list[adj_xri] = sglq; 522 phba->sli4_hba.lpfc_sglq_active_list[adj_xri] = sglq;
521 return sglq; 523 return sglq;
@@ -2070,8 +2072,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2070 if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX) || 2072 if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX) ||
2071 (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX) || 2073 (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX) ||
2072 (irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX)) { 2074 (irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX)) {
2073 Rctl = FC_ELS_REQ; 2075 Rctl = FC_RCTL_ELS_REQ;
2074 Type = FC_ELS_DATA; 2076 Type = FC_TYPE_ELS;
2075 } else { 2077 } else {
2076 w5p = (WORD5 *)&(saveq->iocb.un.ulpWord[5]); 2078 w5p = (WORD5 *)&(saveq->iocb.un.ulpWord[5]);
2077 Rctl = w5p->hcsw.Rctl; 2079 Rctl = w5p->hcsw.Rctl;
@@ -2081,8 +2083,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2081 if ((Rctl == 0) && (pring->ringno == LPFC_ELS_RING) && 2083 if ((Rctl == 0) && (pring->ringno == LPFC_ELS_RING) &&
2082 (irsp->ulpCommand == CMD_RCV_SEQUENCE64_CX || 2084 (irsp->ulpCommand == CMD_RCV_SEQUENCE64_CX ||
2083 irsp->ulpCommand == CMD_IOCB_RCV_SEQ64_CX)) { 2085 irsp->ulpCommand == CMD_IOCB_RCV_SEQ64_CX)) {
2084 Rctl = FC_ELS_REQ; 2086 Rctl = FC_RCTL_ELS_REQ;
2085 Type = FC_ELS_DATA; 2087 Type = FC_TYPE_ELS;
2086 w5p->hcsw.Rctl = Rctl; 2088 w5p->hcsw.Rctl = Rctl;
2087 w5p->hcsw.Type = Type; 2089 w5p->hcsw.Type = Type;
2088 } 2090 }
@@ -4485,7 +4487,8 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4485 rc = lpfc_sli4_post_sgl_list(phba); 4487 rc = lpfc_sli4_post_sgl_list(phba);
4486 if (unlikely(rc)) { 4488 if (unlikely(rc)) {
4487 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 4489 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
4488 "0582 Error %d during sgl post operation", rc); 4490 "0582 Error %d during sgl post operation\n",
4491 rc);
4489 rc = -ENODEV; 4492 rc = -ENODEV;
4490 goto out_free_vpd; 4493 goto out_free_vpd;
4491 } 4494 }
@@ -4494,8 +4497,8 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4494 rc = lpfc_sli4_repost_scsi_sgl_list(phba); 4497 rc = lpfc_sli4_repost_scsi_sgl_list(phba);
4495 if (unlikely(rc)) { 4498 if (unlikely(rc)) {
4496 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, 4499 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI,
4497 "0383 Error %d during scsi sgl post opeation", 4500 "0383 Error %d during scsi sgl post "
4498 rc); 4501 "operation\n", rc);
4499 /* Some Scsi buffers were moved to the abort scsi list */ 4502 /* Some Scsi buffers were moved to the abort scsi list */
4500 /* A pci function reset will repost them */ 4503 /* A pci function reset will repost them */
4501 rc = -ENODEV; 4504 rc = -ENODEV;
@@ -5686,7 +5689,7 @@ __lpfc_sli_issue_iocb_s3(struct lpfc_hba *phba, uint32_t ring_number,
5686 case CMD_GEN_REQUEST64_CX: 5689 case CMD_GEN_REQUEST64_CX:
5687 if (!(phba->sli.sli_flag & LPFC_MENLO_MAINT) || 5690 if (!(phba->sli.sli_flag & LPFC_MENLO_MAINT) ||
5688 (piocb->iocb.un.genreq64.w5.hcsw.Rctl != 5691 (piocb->iocb.un.genreq64.w5.hcsw.Rctl !=
5689 FC_FCP_CMND) || 5692 FC_RCTL_DD_UNSOL_CMD) ||
5690 (piocb->iocb.un.genreq64.w5.hcsw.Type != 5693 (piocb->iocb.un.genreq64.w5.hcsw.Type !=
5691 MENLO_TRANSPORT_TYPE)) 5694 MENLO_TRANSPORT_TYPE))
5692 5695
@@ -6485,27 +6488,27 @@ lpfc_sli_setup(struct lpfc_hba *phba)
6485 lpfc_sli_async_event_handler; 6488 lpfc_sli_async_event_handler;
6486 pring->num_mask = LPFC_MAX_RING_MASK; 6489 pring->num_mask = LPFC_MAX_RING_MASK;
6487 pring->prt[0].profile = 0; /* Mask 0 */ 6490 pring->prt[0].profile = 0; /* Mask 0 */
6488 pring->prt[0].rctl = FC_ELS_REQ; 6491 pring->prt[0].rctl = FC_RCTL_ELS_REQ;
6489 pring->prt[0].type = FC_ELS_DATA; 6492 pring->prt[0].type = FC_TYPE_ELS;
6490 pring->prt[0].lpfc_sli_rcv_unsol_event = 6493 pring->prt[0].lpfc_sli_rcv_unsol_event =
6491 lpfc_els_unsol_event; 6494 lpfc_els_unsol_event;
6492 pring->prt[1].profile = 0; /* Mask 1 */ 6495 pring->prt[1].profile = 0; /* Mask 1 */
6493 pring->prt[1].rctl = FC_ELS_RSP; 6496 pring->prt[1].rctl = FC_RCTL_ELS_REP;
6494 pring->prt[1].type = FC_ELS_DATA; 6497 pring->prt[1].type = FC_TYPE_ELS;
6495 pring->prt[1].lpfc_sli_rcv_unsol_event = 6498 pring->prt[1].lpfc_sli_rcv_unsol_event =
6496 lpfc_els_unsol_event; 6499 lpfc_els_unsol_event;
6497 pring->prt[2].profile = 0; /* Mask 2 */ 6500 pring->prt[2].profile = 0; /* Mask 2 */
6498 /* NameServer Inquiry */ 6501 /* NameServer Inquiry */
6499 pring->prt[2].rctl = FC_UNSOL_CTL; 6502 pring->prt[2].rctl = FC_RCTL_DD_UNSOL_CTL;
6500 /* NameServer */ 6503 /* NameServer */
6501 pring->prt[2].type = FC_COMMON_TRANSPORT_ULP; 6504 pring->prt[2].type = FC_TYPE_CT;
6502 pring->prt[2].lpfc_sli_rcv_unsol_event = 6505 pring->prt[2].lpfc_sli_rcv_unsol_event =
6503 lpfc_ct_unsol_event; 6506 lpfc_ct_unsol_event;
6504 pring->prt[3].profile = 0; /* Mask 3 */ 6507 pring->prt[3].profile = 0; /* Mask 3 */
6505 /* NameServer response */ 6508 /* NameServer response */
6506 pring->prt[3].rctl = FC_SOL_CTL; 6509 pring->prt[3].rctl = FC_RCTL_DD_SOL_CTL;
6507 /* NameServer */ 6510 /* NameServer */
6508 pring->prt[3].type = FC_COMMON_TRANSPORT_ULP; 6511 pring->prt[3].type = FC_TYPE_CT;
6509 pring->prt[3].lpfc_sli_rcv_unsol_event = 6512 pring->prt[3].lpfc_sli_rcv_unsol_event =
6510 lpfc_ct_unsol_event; 6513 lpfc_ct_unsol_event;
6511 /* abort unsolicited sequence */ 6514 /* abort unsolicited sequence */
@@ -8089,7 +8092,7 @@ lpfc_sli_sp_intr_handler(int irq, void *dev_id)
8089 KERN_ERR, 8092 KERN_ERR,
8090 LOG_MBOX | LOG_SLI, 8093 LOG_MBOX | LOG_SLI,
8091 "0350 rc should have" 8094 "0350 rc should have"
8092 "been MBX_BUSY"); 8095 "been MBX_BUSY\n");
8093 if (rc != MBX_NOT_FINISHED) 8096 if (rc != MBX_NOT_FINISHED)
8094 goto send_current_mbox; 8097 goto send_current_mbox;
8095 } 8098 }
@@ -8118,7 +8121,7 @@ send_current_mbox:
8118 if (rc != MBX_SUCCESS) 8121 if (rc != MBX_SUCCESS)
8119 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | 8122 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX |
8120 LOG_SLI, "0349 rc should be " 8123 LOG_SLI, "0349 rc should be "
8121 "MBX_SUCCESS"); 8124 "MBX_SUCCESS\n");
8122 } 8125 }
8123 8126
8124 spin_lock_irqsave(&phba->hbalock, iflag); 8127 spin_lock_irqsave(&phba->hbalock, iflag);
@@ -10454,8 +10457,7 @@ lpfc_sli4_next_xritag(struct lpfc_hba *phba)
10454 return xritag; 10457 return xritag;
10455 } 10458 }
10456 spin_unlock_irq(&phba->hbalock); 10459 spin_unlock_irq(&phba->hbalock);
10457 10460 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
10458 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
10459 "2004 Failed to allocate XRI.last XRITAG is %d" 10461 "2004 Failed to allocate XRI.last XRITAG is %d"
10460 " Max XRI is %d, Used XRI is %d\n", 10462 " Max XRI is %d, Used XRI is %d\n",
10461 phba->sli4_hba.next_xri, 10463 phba->sli4_hba.next_xri,
@@ -10519,15 +10521,7 @@ lpfc_sli4_post_sgl_list(struct lpfc_hba *phba)
10519 lpfc_sli4_mbox_cmd_free(phba, mbox); 10521 lpfc_sli4_mbox_cmd_free(phba, mbox);
10520 return -ENOMEM; 10522 return -ENOMEM;
10521 } 10523 }
10522
10523 /* Get the first SGE entry from the non-embedded DMA memory */ 10524 /* Get the first SGE entry from the non-embedded DMA memory */
10524 if (unlikely(!mbox->sge_array)) {
10525 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
10526 "2525 Failed to get the non-embedded SGE "
10527 "virtual address\n");
10528 lpfc_sli4_mbox_cmd_free(phba, mbox);
10529 return -ENOMEM;
10530 }
10531 viraddr = mbox->sge_array->addr[0]; 10525 viraddr = mbox->sge_array->addr[0];
10532 10526
10533 /* Set up the SGL pages in the non-embedded DMA pages */ 10527 /* Set up the SGL pages in the non-embedded DMA pages */
@@ -10551,8 +10545,7 @@ lpfc_sli4_post_sgl_list(struct lpfc_hba *phba)
10551 sgl_pg_pairs++; 10545 sgl_pg_pairs++;
10552 } 10546 }
10553 bf_set(lpfc_post_sgl_pages_xri, sgl, xritag_start); 10547 bf_set(lpfc_post_sgl_pages_xri, sgl, xritag_start);
10554 pg_pairs = (pg_pairs > 0) ? (pg_pairs - 1) : pg_pairs; 10548 bf_set(lpfc_post_sgl_pages_xricnt, sgl, els_xri_cnt);
10555 bf_set(lpfc_post_sgl_pages_xricnt, sgl, pg_pairs);
10556 /* Perform endian conversion if necessary */ 10549 /* Perform endian conversion if necessary */
10557 sgl->word0 = cpu_to_le32(sgl->word0); 10550 sgl->word0 = cpu_to_le32(sgl->word0);
10558 10551
@@ -10634,15 +10627,7 @@ lpfc_sli4_post_scsi_sgl_block(struct lpfc_hba *phba, struct list_head *sblist,
10634 lpfc_sli4_mbox_cmd_free(phba, mbox); 10627 lpfc_sli4_mbox_cmd_free(phba, mbox);
10635 return -ENOMEM; 10628 return -ENOMEM;
10636 } 10629 }
10637
10638 /* Get the first SGE entry from the non-embedded DMA memory */ 10630 /* Get the first SGE entry from the non-embedded DMA memory */
10639 if (unlikely(!mbox->sge_array)) {
10640 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
10641 "2565 Failed to get the non-embedded SGE "
10642 "virtual address\n");
10643 lpfc_sli4_mbox_cmd_free(phba, mbox);
10644 return -ENOMEM;
10645 }
10646 viraddr = mbox->sge_array->addr[0]; 10631 viraddr = mbox->sge_array->addr[0];
10647 10632
10648 /* Set up the SGL pages in the non-embedded DMA pages */ 10633 /* Set up the SGL pages in the non-embedded DMA pages */
@@ -11565,6 +11550,7 @@ lpfc_sli4_init_vpi(struct lpfc_hba *phba, uint16_t vpi)
11565{ 11550{
11566 LPFC_MBOXQ_t *mboxq; 11551 LPFC_MBOXQ_t *mboxq;
11567 int rc = 0; 11552 int rc = 0;
11553 int retval = MBX_SUCCESS;
11568 uint32_t mbox_tmo; 11554 uint32_t mbox_tmo;
11569 11555
11570 if (vpi == 0) 11556 if (vpi == 0)
@@ -11575,16 +11561,17 @@ lpfc_sli4_init_vpi(struct lpfc_hba *phba, uint16_t vpi)
11575 lpfc_init_vpi(phba, mboxq, vpi); 11561 lpfc_init_vpi(phba, mboxq, vpi);
11576 mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI); 11562 mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI);
11577 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); 11563 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
11578 if (rc != MBX_TIMEOUT)
11579 mempool_free(mboxq, phba->mbox_mem_pool);
11580 if (rc != MBX_SUCCESS) { 11564 if (rc != MBX_SUCCESS) {
11581 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 11565 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
11582 "2022 INIT VPI Mailbox failed " 11566 "2022 INIT VPI Mailbox failed "
11583 "status %d, mbxStatus x%x\n", rc, 11567 "status %d, mbxStatus x%x\n", rc,
11584 bf_get(lpfc_mqe_status, &mboxq->u.mqe)); 11568 bf_get(lpfc_mqe_status, &mboxq->u.mqe));
11585 rc = -EIO; 11569 retval = -EIO;
11586 } 11570 }
11587 return rc; 11571 if (rc != MBX_TIMEOUT)
11572 mempool_free(mboxq, phba->mbox_mem_pool);
11573
11574 return retval;
11588} 11575}
11589 11576
11590/** 11577/**
@@ -11669,13 +11656,6 @@ lpfc_sli4_add_fcf_record(struct lpfc_hba *phba, struct fcf_record *fcf_record)
11669 */ 11656 */
11670 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge); 11657 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge);
11671 phys_addr = getPaddr(sge.pa_hi, sge.pa_lo); 11658 phys_addr = getPaddr(sge.pa_hi, sge.pa_lo);
11672 if (unlikely(!mboxq->sge_array)) {
11673 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
11674 "2526 Failed to get the non-embedded SGE "
11675 "virtual address\n");
11676 lpfc_sli4_mbox_cmd_free(phba, mboxq);
11677 return -ENOMEM;
11678 }
11679 virt_addr = mboxq->sge_array->addr[0]; 11659 virt_addr = mboxq->sge_array->addr[0];
11680 /* 11660 /*
11681 * Configure the FCF record for FCFI 0. This is the driver's 11661 * Configure the FCF record for FCFI 0. This is the driver's
@@ -11799,13 +11779,6 @@ lpfc_sli4_read_fcf_record(struct lpfc_hba *phba, uint16_t fcf_index)
11799 */ 11779 */
11800 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge); 11780 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge);
11801 phys_addr = getPaddr(sge.pa_hi, sge.pa_lo); 11781 phys_addr = getPaddr(sge.pa_hi, sge.pa_lo);
11802 if (unlikely(!mboxq->sge_array)) {
11803 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
11804 "2527 Failed to get the non-embedded SGE "
11805 "virtual address\n");
11806 error = -ENOMEM;
11807 goto fail_fcfscan;
11808 }
11809 virt_addr = mboxq->sge_array->addr[0]; 11782 virt_addr = mboxq->sge_array->addr[0];
11810 read_fcf = (struct lpfc_mbx_read_fcf_tbl *)virt_addr; 11783 read_fcf = (struct lpfc_mbx_read_fcf_tbl *)virt_addr;
11811 11784