diff options
author | James Smart <james.smart@emulex.com> | 2011-12-13 13:21:35 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-12-15 01:57:44 -0500 |
commit | ff78d8f97c85a568c0799b06137a4171db45b923 (patch) | |
tree | f5bb5d1875075175075c0beb09d770073dd82612 /drivers/scsi | |
parent | 026abb87a5586c838a47aca7198d78e356b6351e (diff) |
[SCSI] lpfc 8.3.28: SLI fixes and added SLI4 support
Adapter (SLI) interface fixes:
- Modify WQ handling to use entry_repost (CR 123981)
- Fix for ABTS. Do not free original IOCB whenever ABTS fails. (CR 115829)
- Check board for FCoE before reading FCoE paramaters (CR124731)
- Add support for SLI4 FC Loop mode (CR 124721)
- Add support for resource count changes during fw reset. (CR 125888, 125675)
- Increase CQE count from 256 to 1024. (CR 126149)
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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 23 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 18 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 1 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 52 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 184 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 2 |
7 files changed, 156 insertions, 126 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 7bf492e156d9..f6697cb0e216 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -2777,6 +2777,14 @@ lpfc_topology_store(struct device *dev, struct device_attribute *attr, | |||
2777 | if (val >= 0 && val <= 6) { | 2777 | if (val >= 0 && val <= 6) { |
2778 | prev_val = phba->cfg_topology; | 2778 | prev_val = phba->cfg_topology; |
2779 | phba->cfg_topology = val; | 2779 | phba->cfg_topology = val; |
2780 | if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && | ||
2781 | val == 4) { | ||
2782 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
2783 | "3113 Loop mode not supported at speed %d\n", | ||
2784 | phba->cfg_link_speed); | ||
2785 | phba->cfg_topology = prev_val; | ||
2786 | return -EINVAL; | ||
2787 | } | ||
2780 | if (nolip) | 2788 | if (nolip) |
2781 | return strlen(buf); | 2789 | return strlen(buf); |
2782 | 2790 | ||
@@ -3222,6 +3230,14 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, | |||
3222 | val); | 3230 | val); |
3223 | return -EINVAL; | 3231 | return -EINVAL; |
3224 | } | 3232 | } |
3233 | if (val == LPFC_USER_LINK_SPEED_16G && | ||
3234 | phba->fc_topology == LPFC_TOPOLOGY_LOOP) { | ||
3235 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
3236 | "3112 lpfc_link_speed attribute cannot be set " | ||
3237 | "to %d. Speed is not supported in loop mode.\n", | ||
3238 | val); | ||
3239 | return -EINVAL; | ||
3240 | } | ||
3225 | if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && | 3241 | if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && |
3226 | (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { | 3242 | (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { |
3227 | prev_val = phba->cfg_link_speed; | 3243 | prev_val = phba->cfg_link_speed; |
@@ -3266,6 +3282,13 @@ lpfc_param_show(link_speed) | |||
3266 | static int | 3282 | static int |
3267 | lpfc_link_speed_init(struct lpfc_hba *phba, int val) | 3283 | lpfc_link_speed_init(struct lpfc_hba *phba, int val) |
3268 | { | 3284 | { |
3285 | if (val == LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { | ||
3286 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
3287 | "3111 lpfc_link_speed of %d cannot " | ||
3288 | "support loop mode, setting topology to default.\n", | ||
3289 | val); | ||
3290 | phba->cfg_topology = 0; | ||
3291 | } | ||
3269 | if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && | 3292 | if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && |
3270 | (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { | 3293 | (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { |
3271 | phba->cfg_link_speed = val; | 3294 | phba->cfg_link_speed = val; |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index f74afa23e0dd..9237ff154234 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -453,3 +453,5 @@ int lpfc_sli_probe_sriov_nr_virtfn(struct lpfc_hba *, int); | |||
453 | uint16_t lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *); | 453 | uint16_t lpfc_sli_sriov_nr_virtfn_get(struct lpfc_hba *); |
454 | int lpfc_sli4_queue_create(struct lpfc_hba *); | 454 | int lpfc_sli4_queue_create(struct lpfc_hba *); |
455 | void lpfc_sli4_queue_destroy(struct lpfc_hba *); | 455 | void lpfc_sli4_queue_destroy(struct lpfc_hba *); |
456 | int lpfc_sli4_read_config(struct lpfc_hba *phba); | ||
457 | int lpfc_scsi_buf_update(struct lpfc_hba *phba); | ||
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 445826a4c981..846ebfd37b5e 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -909,15 +909,15 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
909 | */ | 909 | */ |
910 | if (phba->alpa_map[0] == 0) { | 910 | if (phba->alpa_map[0] == 0) { |
911 | vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; | 911 | vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; |
912 | if ((phba->sli_rev == LPFC_SLI_REV4) && | 912 | } |
913 | (!(vport->fc_flag & FC_VFI_REGISTERED) || | 913 | if ((phba->sli_rev == LPFC_SLI_REV4) && |
914 | (vport->fc_prevDID != vport->fc_myDID))) { | 914 | (!(vport->fc_flag & FC_VFI_REGISTERED) || |
915 | if (vport->fc_flag & FC_VFI_REGISTERED) | 915 | (vport->fc_prevDID != vport->fc_myDID))) { |
916 | lpfc_sli4_unreg_all_rpis(vport); | 916 | if (vport->fc_flag & FC_VFI_REGISTERED) |
917 | lpfc_issue_reg_vfi(vport); | 917 | lpfc_sli4_unreg_all_rpis(vport); |
918 | lpfc_nlp_put(ndlp); | 918 | lpfc_issue_reg_vfi(vport); |
919 | goto out; | 919 | lpfc_nlp_put(ndlp); |
920 | } | 920 | goto out; |
921 | } | 921 | } |
922 | goto flogifail; | 922 | goto flogifail; |
923 | } | 923 | } |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 091f68e5cb70..cf4408f9a2cb 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -2858,7 +2858,6 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
2858 | if (vport->port_state == LPFC_FABRIC_CFG_LINK) { | 2858 | if (vport->port_state == LPFC_FABRIC_CFG_LINK) { |
2859 | /* For private loop just start discovery and we are done. */ | 2859 | /* For private loop just start discovery and we are done. */ |
2860 | if ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && | 2860 | if ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && |
2861 | (phba->alpa_map[0] == 0) && | ||
2862 | !(vport->fc_flag & FC_PUBLIC_LOOP)) { | 2861 | !(vport->fc_flag & FC_PUBLIC_LOOP)) { |
2863 | /* Use loop map to make discovery list */ | 2862 | /* Use loop map to make discovery list */ |
2864 | lpfc_disc_list_loopmap(vport); | 2863 | lpfc_disc_list_loopmap(vport); |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index d247eb015526..6096c9a091d1 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -62,7 +62,6 @@ static int lpfc_post_rcv_buf(struct lpfc_hba *); | |||
62 | static int lpfc_sli4_queue_verify(struct lpfc_hba *); | 62 | static int lpfc_sli4_queue_verify(struct lpfc_hba *); |
63 | static int lpfc_create_bootstrap_mbox(struct lpfc_hba *); | 63 | static int lpfc_create_bootstrap_mbox(struct lpfc_hba *); |
64 | static int lpfc_setup_endian_order(struct lpfc_hba *); | 64 | static int lpfc_setup_endian_order(struct lpfc_hba *); |
65 | static int lpfc_sli4_read_config(struct lpfc_hba *); | ||
66 | static void lpfc_destroy_bootstrap_mbox(struct lpfc_hba *); | 65 | static void lpfc_destroy_bootstrap_mbox(struct lpfc_hba *); |
67 | static void lpfc_free_sgl_list(struct lpfc_hba *); | 66 | static void lpfc_free_sgl_list(struct lpfc_hba *); |
68 | static int lpfc_init_sgl_list(struct lpfc_hba *); | 67 | static int lpfc_init_sgl_list(struct lpfc_hba *); |
@@ -2655,6 +2654,32 @@ lpfc_offline(struct lpfc_hba *phba) | |||
2655 | } | 2654 | } |
2656 | 2655 | ||
2657 | /** | 2656 | /** |
2657 | * lpfc_scsi_buf_update - Update the scsi_buffers that are already allocated. | ||
2658 | * @phba: pointer to lpfc hba data structure. | ||
2659 | * | ||
2660 | * This routine goes through all the scsi buffers in the system and updates the | ||
2661 | * Physical XRIs assigned to the SCSI buffer because these may change after any | ||
2662 | * firmware reset | ||
2663 | * | ||
2664 | * Return codes | ||
2665 | * 0 - successful (for now, it always returns 0) | ||
2666 | **/ | ||
2667 | int | ||
2668 | lpfc_scsi_buf_update(struct lpfc_hba *phba) | ||
2669 | { | ||
2670 | struct lpfc_scsi_buf *sb, *sb_next; | ||
2671 | |||
2672 | spin_lock_irq(&phba->hbalock); | ||
2673 | spin_lock(&phba->scsi_buf_list_lock); | ||
2674 | list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list, list) | ||
2675 | sb->cur_iocbq.sli4_xritag = | ||
2676 | phba->sli4_hba.xri_ids[sb->cur_iocbq.sli4_lxritag]; | ||
2677 | spin_unlock(&phba->scsi_buf_list_lock); | ||
2678 | spin_unlock_irq(&phba->hbalock); | ||
2679 | return 0; | ||
2680 | } | ||
2681 | |||
2682 | /** | ||
2658 | * lpfc_scsi_free - Free all the SCSI buffers and IOCBs from driver lists | 2683 | * lpfc_scsi_free - Free all the SCSI buffers and IOCBs from driver lists |
2659 | * @phba: pointer to lpfc hba data structure. | 2684 | * @phba: pointer to lpfc hba data structure. |
2660 | * | 2685 | * |
@@ -5021,15 +5046,8 @@ lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) | |||
5021 | struct lpfc_rpi_hdr *rpi_hdr; | 5046 | struct lpfc_rpi_hdr *rpi_hdr; |
5022 | 5047 | ||
5023 | INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); | 5048 | INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); |
5024 | /* | 5049 | if (!phba->sli4_hba.rpi_hdrs_in_use) |
5025 | * If the SLI4 port supports extents, posting the rpi header isn't | ||
5026 | * required. Set the expected maximum count and let the actual value | ||
5027 | * get set when extents are fully allocated. | ||
5028 | */ | ||
5029 | if (!phba->sli4_hba.rpi_hdrs_in_use) { | ||
5030 | phba->sli4_hba.next_rpi = phba->sli4_hba.max_cfg_param.max_rpi; | ||
5031 | return rc; | 5050 | return rc; |
5032 | } | ||
5033 | if (phba->sli4_hba.extents_in_use) | 5051 | if (phba->sli4_hba.extents_in_use) |
5034 | return -EIO; | 5052 | return -EIO; |
5035 | 5053 | ||
@@ -5923,7 +5941,7 @@ lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) | |||
5923 | * -ENOMEM - No available memory | 5941 | * -ENOMEM - No available memory |
5924 | * -EIO - The mailbox failed to complete successfully. | 5942 | * -EIO - The mailbox failed to complete successfully. |
5925 | **/ | 5943 | **/ |
5926 | static int | 5944 | int |
5927 | lpfc_sli4_read_config(struct lpfc_hba *phba) | 5945 | lpfc_sli4_read_config(struct lpfc_hba *phba) |
5928 | { | 5946 | { |
5929 | LPFC_MBOXQ_t *pmb; | 5947 | LPFC_MBOXQ_t *pmb; |
@@ -5955,6 +5973,20 @@ lpfc_sli4_read_config(struct lpfc_hba *phba) | |||
5955 | rc = -EIO; | 5973 | rc = -EIO; |
5956 | } else { | 5974 | } else { |
5957 | rd_config = &pmb->u.mqe.un.rd_config; | 5975 | rd_config = &pmb->u.mqe.un.rd_config; |
5976 | if (bf_get(lpfc_mbx_rd_conf_lnk_ldv, rd_config)) { | ||
5977 | phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; | ||
5978 | phba->sli4_hba.lnk_info.lnk_tp = | ||
5979 | bf_get(lpfc_mbx_rd_conf_lnk_type, rd_config); | ||
5980 | phba->sli4_hba.lnk_info.lnk_no = | ||
5981 | bf_get(lpfc_mbx_rd_conf_lnk_numb, rd_config); | ||
5982 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
5983 | "3081 lnk_type:%d, lnk_numb:%d\n", | ||
5984 | phba->sli4_hba.lnk_info.lnk_tp, | ||
5985 | phba->sli4_hba.lnk_info.lnk_no); | ||
5986 | } else | ||
5987 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
5988 | "3082 Mailbox (x%x) returned ldv:x0\n", | ||
5989 | bf_get(lpfc_mqe_command, &pmb->u.mqe)); | ||
5958 | phba->sli4_hba.extents_in_use = | 5990 | phba->sli4_hba.extents_in_use = |
5959 | bf_get(lpfc_mbx_rd_conf_extnts_inuse, rd_config); | 5991 | bf_get(lpfc_mbx_rd_conf_extnts_inuse, rd_config); |
5960 | phba->sli4_hba.max_cfg_param.max_xri = | 5992 | phba->sli4_hba.max_cfg_param.max_xri = |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 1be13e757eda..4c4d77356bb2 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -97,7 +97,7 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe) | |||
97 | if (((q->host_index + 1) % q->entry_count) == q->hba_index) | 97 | if (((q->host_index + 1) % q->entry_count) == q->hba_index) |
98 | return -ENOMEM; | 98 | return -ENOMEM; |
99 | /* set consumption flag every once in a while */ | 99 | /* set consumption flag every once in a while */ |
100 | if (!((q->host_index + 1) % LPFC_RELEASE_NOTIFICATION_INTERVAL)) | 100 | if (!((q->host_index + 1) % q->entry_repost)) |
101 | bf_set(wqe_wqec, &wqe->generic.wqe_com, 1); | 101 | bf_set(wqe_wqec, &wqe->generic.wqe_com, 1); |
102 | if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED) | 102 | if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED) |
103 | bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id); | 103 | bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id); |
@@ -4551,9 +4551,9 @@ lpfc_sli_hba_setup_error: | |||
4551 | * data structure. | 4551 | * data structure. |
4552 | **/ | 4552 | **/ |
4553 | static int | 4553 | static int |
4554 | lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba, | 4554 | lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba) |
4555 | LPFC_MBOXQ_t *mboxq) | ||
4556 | { | 4555 | { |
4556 | LPFC_MBOXQ_t *mboxq; | ||
4557 | struct lpfc_dmabuf *mp; | 4557 | struct lpfc_dmabuf *mp; |
4558 | struct lpfc_mqe *mqe; | 4558 | struct lpfc_mqe *mqe; |
4559 | uint32_t data_length; | 4559 | uint32_t data_length; |
@@ -4565,10 +4565,16 @@ lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba, | |||
4565 | phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; | 4565 | phba->fc_map[1] = LPFC_FCOE_FCF_MAP1; |
4566 | phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; | 4566 | phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; |
4567 | 4567 | ||
4568 | mqe = &mboxq->u.mqe; | 4568 | mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
4569 | if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) | 4569 | if (!mboxq) |
4570 | return -ENOMEM; | 4570 | return -ENOMEM; |
4571 | 4571 | ||
4572 | mqe = &mboxq->u.mqe; | ||
4573 | if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) { | ||
4574 | rc = -ENOMEM; | ||
4575 | goto out_free_mboxq; | ||
4576 | } | ||
4577 | |||
4572 | mp = (struct lpfc_dmabuf *) mboxq->context1; | 4578 | mp = (struct lpfc_dmabuf *) mboxq->context1; |
4573 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | 4579 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); |
4574 | 4580 | ||
@@ -4596,19 +4602,25 @@ lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba, | |||
4596 | if (rc) { | 4602 | if (rc) { |
4597 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 4603 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
4598 | kfree(mp); | 4604 | kfree(mp); |
4599 | return -EIO; | 4605 | rc = -EIO; |
4606 | goto out_free_mboxq; | ||
4600 | } | 4607 | } |
4601 | data_length = mqe->un.mb_words[5]; | 4608 | data_length = mqe->un.mb_words[5]; |
4602 | if (data_length > DMP_RGN23_SIZE) { | 4609 | if (data_length > DMP_RGN23_SIZE) { |
4603 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 4610 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
4604 | kfree(mp); | 4611 | kfree(mp); |
4605 | return -EIO; | 4612 | rc = -EIO; |
4613 | goto out_free_mboxq; | ||
4606 | } | 4614 | } |
4607 | 4615 | ||
4608 | lpfc_parse_fcoe_conf(phba, mp->virt, data_length); | 4616 | lpfc_parse_fcoe_conf(phba, mp->virt, data_length); |
4609 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 4617 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
4610 | kfree(mp); | 4618 | kfree(mp); |
4611 | return 0; | 4619 | rc = 0; |
4620 | |||
4621 | out_free_mboxq: | ||
4622 | mempool_free(mboxq, phba->mbox_mem_pool); | ||
4623 | return rc; | ||
4612 | } | 4624 | } |
4613 | 4625 | ||
4614 | /** | 4626 | /** |
@@ -4706,7 +4718,6 @@ static int | |||
4706 | lpfc_sli4_retrieve_pport_name(struct lpfc_hba *phba) | 4718 | lpfc_sli4_retrieve_pport_name(struct lpfc_hba *phba) |
4707 | { | 4719 | { |
4708 | LPFC_MBOXQ_t *mboxq; | 4720 | LPFC_MBOXQ_t *mboxq; |
4709 | struct lpfc_mbx_read_config *rd_config; | ||
4710 | struct lpfc_mbx_get_cntl_attributes *mbx_cntl_attr; | 4721 | struct lpfc_mbx_get_cntl_attributes *mbx_cntl_attr; |
4711 | struct lpfc_controller_attribute *cntl_attr; | 4722 | struct lpfc_controller_attribute *cntl_attr; |
4712 | struct lpfc_mbx_get_port_name *get_port_name; | 4723 | struct lpfc_mbx_get_port_name *get_port_name; |
@@ -4724,33 +4735,11 @@ lpfc_sli4_retrieve_pport_name(struct lpfc_hba *phba) | |||
4724 | mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 4735 | mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
4725 | if (!mboxq) | 4736 | if (!mboxq) |
4726 | return -ENOMEM; | 4737 | return -ENOMEM; |
4727 | |||
4728 | /* obtain link type and link number via READ_CONFIG */ | 4738 | /* obtain link type and link number via READ_CONFIG */ |
4729 | lpfc_read_config(phba, mboxq); | 4739 | phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL; |
4730 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | 4740 | lpfc_sli4_read_config(phba); |
4731 | if (rc == MBX_SUCCESS) { | 4741 | if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) |
4732 | rd_config = &mboxq->u.mqe.un.rd_config; | 4742 | goto retrieve_ppname; |
4733 | if (bf_get(lpfc_mbx_rd_conf_lnk_ldv, rd_config)) { | ||
4734 | phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; | ||
4735 | phba->sli4_hba.lnk_info.lnk_tp = | ||
4736 | bf_get(lpfc_mbx_rd_conf_lnk_type, rd_config); | ||
4737 | phba->sli4_hba.lnk_info.lnk_no = | ||
4738 | bf_get(lpfc_mbx_rd_conf_lnk_numb, rd_config); | ||
4739 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
4740 | "3081 lnk_type:%d, lnk_numb:%d\n", | ||
4741 | phba->sli4_hba.lnk_info.lnk_tp, | ||
4742 | phba->sli4_hba.lnk_info.lnk_no); | ||
4743 | goto retrieve_ppname; | ||
4744 | } else | ||
4745 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
4746 | "3082 Mailbox (x%x) returned ldv:x0\n", | ||
4747 | bf_get(lpfc_mqe_command, | ||
4748 | &mboxq->u.mqe)); | ||
4749 | } else | ||
4750 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
4751 | "3083 Mailbox (x%x) failed, status:x%x\n", | ||
4752 | bf_get(lpfc_mqe_command, &mboxq->u.mqe), | ||
4753 | bf_get(lpfc_mqe_status, &mboxq->u.mqe)); | ||
4754 | 4743 | ||
4755 | /* obtain link type and link number via COMMON_GET_CNTL_ATTRIBUTES */ | 4744 | /* obtain link type and link number via COMMON_GET_CNTL_ATTRIBUTES */ |
4756 | reqlen = sizeof(struct lpfc_mbx_get_cntl_attributes); | 4745 | reqlen = sizeof(struct lpfc_mbx_get_cntl_attributes); |
@@ -5457,6 +5446,8 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) | |||
5457 | uint16_t count, base; | 5446 | uint16_t count, base; |
5458 | unsigned long longs; | 5447 | unsigned long longs; |
5459 | 5448 | ||
5449 | if (!phba->sli4_hba.rpi_hdrs_in_use) | ||
5450 | phba->sli4_hba.next_rpi = phba->sli4_hba.max_cfg_param.max_rpi; | ||
5460 | if (phba->sli4_hba.extents_in_use) { | 5451 | if (phba->sli4_hba.extents_in_use) { |
5461 | /* | 5452 | /* |
5462 | * The port supports resource extents. The XRI, VPI, VFI, RPI | 5453 | * The port supports resource extents. The XRI, VPI, VFI, RPI |
@@ -5538,9 +5529,10 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) | |||
5538 | * need any action - just exit. | 5529 | * need any action - just exit. |
5539 | */ | 5530 | */ |
5540 | if (bf_get(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags) == | 5531 | if (bf_get(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags) == |
5541 | LPFC_IDX_RSRC_RDY) | 5532 | LPFC_IDX_RSRC_RDY) { |
5542 | return 0; | 5533 | lpfc_sli4_dealloc_resource_identifiers(phba); |
5543 | 5534 | lpfc_sli4_remove_rpis(phba); | |
5535 | } | ||
5544 | /* RPIs. */ | 5536 | /* RPIs. */ |
5545 | count = phba->sli4_hba.max_cfg_param.max_rpi; | 5537 | count = phba->sli4_hba.max_cfg_param.max_rpi; |
5546 | base = phba->sli4_hba.max_cfg_param.rpi_base; | 5538 | base = phba->sli4_hba.max_cfg_param.rpi_base; |
@@ -5880,14 +5872,6 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
5880 | if (!mboxq) | 5872 | if (!mboxq) |
5881 | return -ENOMEM; | 5873 | return -ENOMEM; |
5882 | 5874 | ||
5883 | /* | ||
5884 | * Continue initialization with default values even if driver failed | ||
5885 | * to read FCoE param config regions | ||
5886 | */ | ||
5887 | if (lpfc_sli4_read_fcoe_params(phba, mboxq)) | ||
5888 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_INIT, | ||
5889 | "2570 Failed to read FCoE parameters\n"); | ||
5890 | |||
5891 | /* Issue READ_REV to collect vpd and FW information. */ | 5875 | /* Issue READ_REV to collect vpd and FW information. */ |
5892 | vpd_size = SLI4_PAGE_SIZE; | 5876 | vpd_size = SLI4_PAGE_SIZE; |
5893 | vpd = kzalloc(vpd_size, GFP_KERNEL); | 5877 | vpd = kzalloc(vpd_size, GFP_KERNEL); |
@@ -5925,6 +5909,16 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
5925 | } | 5909 | } |
5926 | 5910 | ||
5927 | /* | 5911 | /* |
5912 | * Continue initialization with default values even if driver failed | ||
5913 | * to read FCoE param config regions, only read parameters if the | ||
5914 | * board is FCoE | ||
5915 | */ | ||
5916 | if (phba->hba_flag & HBA_FCOE_MODE && | ||
5917 | lpfc_sli4_read_fcoe_params(phba)) | ||
5918 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_INIT, | ||
5919 | "2570 Failed to read FCoE parameters\n"); | ||
5920 | |||
5921 | /* | ||
5928 | * Retrieve sli4 device physical port name, failure of doing it | 5922 | * Retrieve sli4 device physical port name, failure of doing it |
5929 | * is considered as non-fatal. | 5923 | * is considered as non-fatal. |
5930 | */ | 5924 | */ |
@@ -6044,6 +6038,8 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
6044 | "rc = x%x\n", rc); | 6038 | "rc = x%x\n", rc); |
6045 | goto out_free_mbox; | 6039 | goto out_free_mbox; |
6046 | } | 6040 | } |
6041 | /* update physical xri mappings in the scsi buffers */ | ||
6042 | lpfc_scsi_buf_update(phba); | ||
6047 | 6043 | ||
6048 | /* Read the port's service parameters. */ | 6044 | /* Read the port's service parameters. */ |
6049 | rc = lpfc_read_sparam(phba, mboxq, vport->vpi); | 6045 | rc = lpfc_read_sparam(phba, mboxq, vport->vpi); |
@@ -7632,6 +7628,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, | |||
7632 | int numBdes, i; | 7628 | int numBdes, i; |
7633 | struct ulp_bde64 bde; | 7629 | struct ulp_bde64 bde; |
7634 | struct lpfc_nodelist *ndlp; | 7630 | struct lpfc_nodelist *ndlp; |
7631 | uint32_t *pcmd; | ||
7635 | 7632 | ||
7636 | fip = phba->hba_flag & HBA_FIP_SUPPORT; | 7633 | fip = phba->hba_flag & HBA_FIP_SUPPORT; |
7637 | /* The fcp commands will set command type */ | 7634 | /* The fcp commands will set command type */ |
@@ -7685,6 +7682,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, | |||
7685 | iocbq->iocb.ulpCommand); | 7682 | iocbq->iocb.ulpCommand); |
7686 | return IOCB_ERROR; | 7683 | return IOCB_ERROR; |
7687 | } | 7684 | } |
7685 | |||
7688 | wqe->els_req.payload_len = xmit_len; | 7686 | wqe->els_req.payload_len = xmit_len; |
7689 | /* Els_reguest64 has a TMO */ | 7687 | /* Els_reguest64 has a TMO */ |
7690 | bf_set(wqe_tmo, &wqe->els_req.wqe_com, | 7688 | bf_set(wqe_tmo, &wqe->els_req.wqe_com, |
@@ -7699,9 +7697,25 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, | |||
7699 | bf_set(wqe_ct, &wqe->els_req.wqe_com, ct); | 7697 | bf_set(wqe_ct, &wqe->els_req.wqe_com, ct); |
7700 | bf_set(wqe_pu, &wqe->els_req.wqe_com, 0); | 7698 | bf_set(wqe_pu, &wqe->els_req.wqe_com, 0); |
7701 | /* CCP CCPE PV PRI in word10 were set in the memcpy */ | 7699 | /* CCP CCPE PV PRI in word10 were set in the memcpy */ |
7702 | if (command_type == ELS_COMMAND_FIP) { | 7700 | if (command_type == ELS_COMMAND_FIP) |
7703 | els_id = ((iocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK) | 7701 | els_id = ((iocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK) |
7704 | >> LPFC_FIP_ELS_ID_SHIFT); | 7702 | >> LPFC_FIP_ELS_ID_SHIFT); |
7703 | pcmd = (uint32_t *) (((struct lpfc_dmabuf *) | ||
7704 | iocbq->context2)->virt); | ||
7705 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { | ||
7706 | if (pcmd && (*pcmd == ELS_CMD_FLOGI || | ||
7707 | *pcmd == ELS_CMD_PLOGI)) { | ||
7708 | bf_set(els_req64_sp, &wqe->els_req, 1); | ||
7709 | bf_set(els_req64_sid, &wqe->els_req, | ||
7710 | iocbq->vport->fc_myDID); | ||
7711 | bf_set(wqe_ct, &wqe->els_req.wqe_com, 1); | ||
7712 | bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com, | ||
7713 | phba->vpi_ids[phba->pport->vpi]); | ||
7714 | } else if (iocbq->context1) { | ||
7715 | bf_set(wqe_ct, &wqe->els_req.wqe_com, 0); | ||
7716 | bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com, | ||
7717 | phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); | ||
7718 | } | ||
7705 | } | 7719 | } |
7706 | bf_set(wqe_temp_rpi, &wqe->els_req.wqe_com, | 7720 | bf_set(wqe_temp_rpi, &wqe->els_req.wqe_com, |
7707 | phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); | 7721 | phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); |
@@ -7862,6 +7876,16 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, | |||
7862 | bf_set(wqe_ebde_cnt, &wqe->xmit_els_rsp.wqe_com, 0); | 7876 | bf_set(wqe_ebde_cnt, &wqe->xmit_els_rsp.wqe_com, 0); |
7863 | bf_set(wqe_rsp_temp_rpi, &wqe->xmit_els_rsp, | 7877 | bf_set(wqe_rsp_temp_rpi, &wqe->xmit_els_rsp, |
7864 | phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); | 7878 | phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); |
7879 | pcmd = (uint32_t *) (((struct lpfc_dmabuf *) | ||
7880 | iocbq->context2)->virt); | ||
7881 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { | ||
7882 | bf_set(els_req64_sp, &wqe->els_req, 1); | ||
7883 | bf_set(els_req64_sid, &wqe->els_req, | ||
7884 | iocbq->vport->fc_myDID); | ||
7885 | bf_set(wqe_ct, &wqe->els_req.wqe_com, 1); | ||
7886 | bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com, | ||
7887 | phba->vpi_ids[phba->pport->vpi]); | ||
7888 | } | ||
7865 | command_type = OTHER_COMMAND; | 7889 | command_type = OTHER_COMMAND; |
7866 | break; | 7890 | break; |
7867 | case CMD_CLOSE_XRI_CN: | 7891 | case CMD_CLOSE_XRI_CN: |
@@ -8839,12 +8863,14 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
8839 | { | 8863 | { |
8840 | IOCB_t *irsp = &rspiocb->iocb; | 8864 | IOCB_t *irsp = &rspiocb->iocb; |
8841 | uint16_t abort_iotag, abort_context; | 8865 | uint16_t abort_iotag, abort_context; |
8842 | struct lpfc_iocbq *abort_iocb; | 8866 | struct lpfc_iocbq *abort_iocb = NULL; |
8843 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; | ||
8844 | |||
8845 | abort_iocb = NULL; | ||
8846 | 8867 | ||
8847 | if (irsp->ulpStatus) { | 8868 | if (irsp->ulpStatus) { |
8869 | |||
8870 | /* | ||
8871 | * Assume that the port already completed and returned, or | ||
8872 | * will return the iocb. Just Log the message. | ||
8873 | */ | ||
8848 | abort_context = cmdiocb->iocb.un.acxri.abortContextTag; | 8874 | abort_context = cmdiocb->iocb.un.acxri.abortContextTag; |
8849 | abort_iotag = cmdiocb->iocb.un.acxri.abortIoTag; | 8875 | abort_iotag = cmdiocb->iocb.un.acxri.abortIoTag; |
8850 | 8876 | ||
@@ -8862,68 +8888,15 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
8862 | */ | 8888 | */ |
8863 | abort_iocb = phba->sli.iocbq_lookup[abort_context]; | 8889 | abort_iocb = phba->sli.iocbq_lookup[abort_context]; |
8864 | 8890 | ||
8865 | /* | ||
8866 | * If the iocb is not found in Firmware queue the iocb | ||
8867 | * might have completed already. Do not free it again. | ||
8868 | */ | ||
8869 | if (irsp->ulpStatus == IOSTAT_LOCAL_REJECT) { | ||
8870 | if (irsp->un.ulpWord[4] != IOERR_NO_XRI) { | ||
8871 | spin_unlock_irq(&phba->hbalock); | ||
8872 | lpfc_sli_release_iocbq(phba, cmdiocb); | ||
8873 | return; | ||
8874 | } | ||
8875 | /* For SLI4 the ulpContext field for abort IOCB | ||
8876 | * holds the iotag of the IOCB being aborted so | ||
8877 | * the local abort_context needs to be reset to | ||
8878 | * match the aborted IOCBs ulpContext. | ||
8879 | */ | ||
8880 | if (abort_iocb && phba->sli_rev == LPFC_SLI_REV4) | ||
8881 | abort_context = abort_iocb->iocb.ulpContext; | ||
8882 | } | ||
8883 | |||
8884 | lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_SLI, | 8891 | lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_SLI, |
8885 | "0327 Cannot abort els iocb %p " | 8892 | "0327 Cannot abort els iocb %p " |
8886 | "with tag %x context %x, abort status %x, " | 8893 | "with tag %x context %x, abort status %x, " |
8887 | "abort code %x\n", | 8894 | "abort code %x\n", |
8888 | abort_iocb, abort_iotag, abort_context, | 8895 | abort_iocb, abort_iotag, abort_context, |
8889 | irsp->ulpStatus, irsp->un.ulpWord[4]); | 8896 | irsp->ulpStatus, irsp->un.ulpWord[4]); |
8890 | /* | ||
8891 | * make sure we have the right iocbq before taking it | ||
8892 | * off the txcmplq and try to call completion routine. | ||
8893 | */ | ||
8894 | if (!abort_iocb || | ||
8895 | abort_iocb->iocb.ulpContext != abort_context || | ||
8896 | (abort_iocb->iocb_flag & LPFC_DRIVER_ABORTED) == 0) | ||
8897 | spin_unlock_irq(&phba->hbalock); | ||
8898 | else if (phba->sli_rev < LPFC_SLI_REV4) { | ||
8899 | /* | ||
8900 | * leave the SLI4 aborted command on the txcmplq | ||
8901 | * list and the command complete WCQE's XB bit | ||
8902 | * will tell whether the SGL (XRI) can be released | ||
8903 | * immediately or to the aborted SGL list for the | ||
8904 | * following abort XRI from the HBA. | ||
8905 | */ | ||
8906 | list_del_init(&abort_iocb->list); | ||
8907 | if (abort_iocb->iocb_flag & LPFC_IO_ON_Q) { | ||
8908 | abort_iocb->iocb_flag &= ~LPFC_IO_ON_Q; | ||
8909 | pring->txcmplq_cnt--; | ||
8910 | } | ||
8911 | |||
8912 | /* Firmware could still be in progress of DMAing | ||
8913 | * payload, so don't free data buffer till after | ||
8914 | * a hbeat. | ||
8915 | */ | ||
8916 | abort_iocb->iocb_flag |= LPFC_DELAY_MEM_FREE; | ||
8917 | abort_iocb->iocb_flag &= ~LPFC_DRIVER_ABORTED; | ||
8918 | spin_unlock_irq(&phba->hbalock); | ||
8919 | 8897 | ||
8920 | abort_iocb->iocb.ulpStatus = IOSTAT_LOCAL_REJECT; | 8898 | spin_unlock_irq(&phba->hbalock); |
8921 | abort_iocb->iocb.un.ulpWord[4] = IOERR_ABORT_REQUESTED; | ||
8922 | (abort_iocb->iocb_cmpl)(phba, abort_iocb, abort_iocb); | ||
8923 | } else | ||
8924 | spin_unlock_irq(&phba->hbalock); | ||
8925 | } | 8899 | } |
8926 | |||
8927 | lpfc_sli_release_iocbq(phba, cmdiocb); | 8900 | lpfc_sli_release_iocbq(phba, cmdiocb); |
8928 | return; | 8901 | return; |
8929 | } | 8902 | } |
@@ -12167,6 +12140,7 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq, | |||
12167 | wq->subtype = subtype; | 12140 | wq->subtype = subtype; |
12168 | wq->host_index = 0; | 12141 | wq->host_index = 0; |
12169 | wq->hba_index = 0; | 12142 | wq->hba_index = 0; |
12143 | wq->entry_repost = LPFC_RELEASE_NOTIFICATION_INTERVAL; | ||
12170 | 12144 | ||
12171 | /* link the wq onto the parent cq child list */ | 12145 | /* link the wq onto the parent cq child list */ |
12172 | list_add_tail(&wq->list, &cq->child_list); | 12146 | list_add_tail(&wq->list, &cq->child_list); |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index d5cffd8af340..7d444c444db4 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -291,7 +291,7 @@ struct lpfc_bmbx { | |||
291 | #define LPFC_RQE_SIZE 8 | 291 | #define LPFC_RQE_SIZE 8 |
292 | 292 | ||
293 | #define LPFC_EQE_DEF_COUNT 1024 | 293 | #define LPFC_EQE_DEF_COUNT 1024 |
294 | #define LPFC_CQE_DEF_COUNT 256 | 294 | #define LPFC_CQE_DEF_COUNT 1024 |
295 | #define LPFC_WQE_DEF_COUNT 256 | 295 | #define LPFC_WQE_DEF_COUNT 256 |
296 | #define LPFC_MQE_DEF_COUNT 16 | 296 | #define LPFC_MQE_DEF_COUNT 16 |
297 | #define LPFC_RQE_DEF_COUNT 512 | 297 | #define LPFC_RQE_DEF_COUNT 512 |