aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2011-02-16 12:39:24 -0500
committerJames Bottomley <James.Bottomley@suse.de>2011-02-18 13:39:18 -0500
commitfedd3b7b93302c7789bd3eeb190653cfb0fe7645 (patch)
treed4fef56133462b9879c63d15be391b9ea3490d19 /drivers/scsi/lpfc
parent382be668c5a284844f9dcbb5b1cb8ffba2386d80 (diff)
[SCSI] lpfc 8.3.21: Critical Errors and Bug Fixes
Critical Errors: - Correctly handle non-zero return lpfc_workq_post_event and return ENOMEM - Save the irq level when locking the host_lock in lpfc_findnode_did Bug Fixes: - Adjust payload_length and request_length for sli4_config mailbox commands. - Add the freed sgl/XRI to the tail of the list rather than to the head. - Set the FC_VPORT_NEEDS_INIT_VPI on vport deletes and check it before issuing a fdisc on an els retry. - Only call lpfc_hba_init_link() if phba->cfg_suppress_link_up is LPFC_INITIALIZE_LINK. - Add support for SLI-4 Performance Hints 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')
-rw-r--r--drivers/scsi/lpfc/lpfc.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c29
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c3
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c5
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h104
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c113
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c16
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c15
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c21
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.c4
12 files changed, 264 insertions, 56 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 746dd3d7a092..b388e436c687 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -548,6 +548,8 @@ struct lpfc_hba {
548#define LPFC_SLI3_CRP_ENABLED 0x08 548#define LPFC_SLI3_CRP_ENABLED 0x08
549#define LPFC_SLI3_BG_ENABLED 0x20 549#define LPFC_SLI3_BG_ENABLED 0x20
550#define LPFC_SLI3_DSS_ENABLED 0x40 550#define LPFC_SLI3_DSS_ENABLED 0x40
551#define LPFC_SLI4_PERFH_ENABLED 0x80
552#define LPFC_SLI4_PHWQ_ENABLED 0x100
551 uint32_t iocb_cmd_size; 553 uint32_t iocb_cmd_size;
552 uint32_t iocb_rsp_size; 554 uint32_t iocb_rsp_size;
553 555
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 3512abb8a587..745774c5a4be 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -623,10 +623,14 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type)
623 int status = 0; 623 int status = 0;
624 int cnt = 0; 624 int cnt = 0;
625 int i; 625 int i;
626 int rc;
626 627
627 init_completion(&online_compl); 628 init_completion(&online_compl);
628 lpfc_workq_post_event(phba, &status, &online_compl, 629 rc = lpfc_workq_post_event(phba, &status, &online_compl,
629 LPFC_EVT_OFFLINE_PREP); 630 LPFC_EVT_OFFLINE_PREP);
631 if (rc == 0)
632 return -ENOMEM;
633
630 wait_for_completion(&online_compl); 634 wait_for_completion(&online_compl);
631 635
632 if (status != 0) 636 if (status != 0)
@@ -652,7 +656,10 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type)
652 } 656 }
653 657
654 init_completion(&online_compl); 658 init_completion(&online_compl);
655 lpfc_workq_post_event(phba, &status, &online_compl, type); 659 rc = lpfc_workq_post_event(phba, &status, &online_compl, type);
660 if (rc == 0)
661 return -ENOMEM;
662
656 wait_for_completion(&online_compl); 663 wait_for_completion(&online_compl);
657 664
658 if (status != 0) 665 if (status != 0)
@@ -682,6 +689,7 @@ lpfc_selective_reset(struct lpfc_hba *phba)
682{ 689{
683 struct completion online_compl; 690 struct completion online_compl;
684 int status = 0; 691 int status = 0;
692 int rc;
685 693
686 if (!phba->cfg_enable_hba_reset) 694 if (!phba->cfg_enable_hba_reset)
687 return -EIO; 695 return -EIO;
@@ -692,8 +700,11 @@ lpfc_selective_reset(struct lpfc_hba *phba)
692 return status; 700 return status;
693 701
694 init_completion(&online_compl); 702 init_completion(&online_compl);
695 lpfc_workq_post_event(phba, &status, &online_compl, 703 rc = lpfc_workq_post_event(phba, &status, &online_compl,
696 LPFC_EVT_ONLINE); 704 LPFC_EVT_ONLINE);
705 if (rc == 0)
706 return -ENOMEM;
707
697 wait_for_completion(&online_compl); 708 wait_for_completion(&online_compl);
698 709
699 if (status != 0) 710 if (status != 0)
@@ -812,14 +823,17 @@ lpfc_board_mode_store(struct device *dev, struct device_attribute *attr,
812 struct lpfc_hba *phba = vport->phba; 823 struct lpfc_hba *phba = vport->phba;
813 struct completion online_compl; 824 struct completion online_compl;
814 int status=0; 825 int status=0;
826 int rc;
815 827
816 if (!phba->cfg_enable_hba_reset) 828 if (!phba->cfg_enable_hba_reset)
817 return -EACCES; 829 return -EACCES;
818 init_completion(&online_compl); 830 init_completion(&online_compl);
819 831
820 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { 832 if(strncmp(buf, "online", sizeof("online") - 1) == 0) {
821 lpfc_workq_post_event(phba, &status, &online_compl, 833 rc = lpfc_workq_post_event(phba, &status, &online_compl,
822 LPFC_EVT_ONLINE); 834 LPFC_EVT_ONLINE);
835 if (rc == 0)
836 return -ENOMEM;
823 wait_for_completion(&online_compl); 837 wait_for_completion(&online_compl);
824 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) 838 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0)
825 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); 839 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
@@ -1813,6 +1827,7 @@ lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr,
1813 int stat1=0, stat2=0; 1827 int stat1=0, stat2=0;
1814 unsigned int i, j, cnt=count; 1828 unsigned int i, j, cnt=count;
1815 u8 wwpn[8]; 1829 u8 wwpn[8];
1830 int rc;
1816 1831
1817 if (!phba->cfg_enable_hba_reset) 1832 if (!phba->cfg_enable_hba_reset)
1818 return -EACCES; 1833 return -EACCES;
@@ -1863,7 +1878,11 @@ lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr,
1863 "0463 lpfc_soft_wwpn attribute set failed to " 1878 "0463 lpfc_soft_wwpn attribute set failed to "
1864 "reinit adapter - %d\n", stat1); 1879 "reinit adapter - %d\n", stat1);
1865 init_completion(&online_compl); 1880 init_completion(&online_compl);
1866 lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE); 1881 rc = lpfc_workq_post_event(phba, &stat2, &online_compl,
1882 LPFC_EVT_ONLINE);
1883 if (rc == 0)
1884 return -ENOMEM;
1885
1867 wait_for_completion(&online_compl); 1886 wait_for_completion(&online_compl);
1868 if (stat2) 1887 if (stat2)
1869 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1888 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index 17fde522c84a..5b4513792a89 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -53,9 +53,9 @@ void lpfc_unreg_vpi(struct lpfc_hba *, uint16_t, LPFC_MBOXQ_t *);
53void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t); 53void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);
54void lpfc_request_features(struct lpfc_hba *, struct lpfcMboxq *); 54void lpfc_request_features(struct lpfc_hba *, struct lpfcMboxq *);
55void lpfc_supported_pages(struct lpfcMboxq *); 55void lpfc_supported_pages(struct lpfcMboxq *);
56void lpfc_sli4_params(struct lpfcMboxq *); 56void lpfc_pc_sli4_params(struct lpfcMboxq *);
57int lpfc_pc_sli4_params_get(struct lpfc_hba *, LPFC_MBOXQ_t *); 57int lpfc_pc_sli4_params_get(struct lpfc_hba *, LPFC_MBOXQ_t *);
58 58int lpfc_get_sli4_parameters(struct lpfc_hba *, LPFC_MBOXQ_t *);
59struct lpfc_vport *lpfc_find_vport_by_did(struct lpfc_hba *, uint32_t); 59struct lpfc_vport *lpfc_find_vport_by_did(struct lpfc_hba *, uint32_t);
60void lpfc_cleanup_rcv_buffers(struct lpfc_vport *); 60void lpfc_cleanup_rcv_buffers(struct lpfc_vport *);
61void lpfc_rcv_seq_check_edtov(struct lpfc_vport *); 61void lpfc_rcv_seq_check_edtov(struct lpfc_vport *);
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index c62d567cc845..58e1a55d97f9 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -2745,7 +2745,8 @@ lpfc_els_retry_delay_handler(struct lpfc_nodelist *ndlp)
2745 } 2745 }
2746 break; 2746 break;
2747 case ELS_CMD_FDISC: 2747 case ELS_CMD_FDISC:
2748 lpfc_issue_els_fdisc(vport, ndlp, retry); 2748 if (!(vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI))
2749 lpfc_issue_els_fdisc(vport, ndlp, retry);
2749 break; 2750 break;
2750 } 2751 }
2751 return; 2752 return;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index bb015960dbc9..1f9c7f19c31f 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -4426,10 +4426,11 @@ lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
4426{ 4426{
4427 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 4427 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
4428 struct lpfc_nodelist *ndlp; 4428 struct lpfc_nodelist *ndlp;
4429 unsigned long iflags;
4429 4430
4430 spin_lock_irq(shost->host_lock); 4431 spin_lock_irqsave(shost->host_lock, iflags);
4431 ndlp = __lpfc_findnode_did(vport, did); 4432 ndlp = __lpfc_findnode_did(vport, did);
4432 spin_unlock_irq(shost->host_lock); 4433 spin_unlock_irqrestore(shost->host_lock, iflags);
4433 return ndlp; 4434 return ndlp;
4434} 4435}
4435 4436
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 94c1aa1136de..c7178d60c7bf 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -778,6 +778,7 @@ struct mbox_header {
778#define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A 778#define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A
779#define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D 779#define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D
780#define LPFC_MBOX_OPCODE_MQ_CREATE_EXT 0x5A 780#define LPFC_MBOX_OPCODE_MQ_CREATE_EXT 0x5A
781#define LPFC_MBOX_OPCODE_GET_SLI4_PARAMETERS 0xB5
781 782
782/* FCoE Opcodes */ 783/* FCoE Opcodes */
783#define LPFC_MBOX_OPCODE_FCOE_WQ_CREATE 0x01 784#define LPFC_MBOX_OPCODE_FCOE_WQ_CREATE 0x01
@@ -1852,6 +1853,9 @@ struct lpfc_mbx_request_features {
1852#define lpfc_mbx_rq_ftr_rq_ifip_SHIFT 7 1853#define lpfc_mbx_rq_ftr_rq_ifip_SHIFT 7
1853#define lpfc_mbx_rq_ftr_rq_ifip_MASK 0x00000001 1854#define lpfc_mbx_rq_ftr_rq_ifip_MASK 0x00000001
1854#define lpfc_mbx_rq_ftr_rq_ifip_WORD word2 1855#define lpfc_mbx_rq_ftr_rq_ifip_WORD word2
1856#define lpfc_mbx_rq_ftr_rq_perfh_SHIFT 11
1857#define lpfc_mbx_rq_ftr_rq_perfh_MASK 0x00000001
1858#define lpfc_mbx_rq_ftr_rq_perfh_WORD word2
1855 uint32_t word3; 1859 uint32_t word3;
1856#define lpfc_mbx_rq_ftr_rsp_iaab_SHIFT 0 1860#define lpfc_mbx_rq_ftr_rsp_iaab_SHIFT 0
1857#define lpfc_mbx_rq_ftr_rsp_iaab_MASK 0x00000001 1861#define lpfc_mbx_rq_ftr_rsp_iaab_MASK 0x00000001
@@ -1877,6 +1881,9 @@ struct lpfc_mbx_request_features {
1877#define lpfc_mbx_rq_ftr_rsp_ifip_SHIFT 7 1881#define lpfc_mbx_rq_ftr_rsp_ifip_SHIFT 7
1878#define lpfc_mbx_rq_ftr_rsp_ifip_MASK 0x00000001 1882#define lpfc_mbx_rq_ftr_rsp_ifip_MASK 0x00000001
1879#define lpfc_mbx_rq_ftr_rsp_ifip_WORD word3 1883#define lpfc_mbx_rq_ftr_rsp_ifip_WORD word3
1884#define lpfc_mbx_rq_ftr_rsp_perfh_SHIFT 11
1885#define lpfc_mbx_rq_ftr_rsp_perfh_MASK 0x00000001
1886#define lpfc_mbx_rq_ftr_rsp_perfh_WORD word3
1880}; 1887};
1881 1888
1882struct lpfc_mbx_supp_pages { 1889struct lpfc_mbx_supp_pages {
@@ -1935,7 +1942,7 @@ struct lpfc_mbx_supp_pages {
1935#define LPFC_SLI4_PARAMETERS 2 1942#define LPFC_SLI4_PARAMETERS 2
1936}; 1943};
1937 1944
1938struct lpfc_mbx_sli4_params { 1945struct lpfc_mbx_pc_sli4_params {
1939 uint32_t word1; 1946 uint32_t word1;
1940#define qs_SHIFT 0 1947#define qs_SHIFT 0
1941#define qs_MASK 0x00000001 1948#define qs_MASK 0x00000001
@@ -2051,6 +2058,88 @@ struct lpfc_mbx_sli4_params {
2051 uint32_t rsvd_13_63[51]; 2058 uint32_t rsvd_13_63[51];
2052}; 2059};
2053 2060
2061struct lpfc_sli4_parameters {
2062 uint32_t word0;
2063#define cfg_prot_type_SHIFT 0
2064#define cfg_prot_type_MASK 0x000000FF
2065#define cfg_prot_type_WORD word0
2066 uint32_t word1;
2067#define cfg_ft_SHIFT 0
2068#define cfg_ft_MASK 0x00000001
2069#define cfg_ft_WORD word1
2070#define cfg_sli_rev_SHIFT 4
2071#define cfg_sli_rev_MASK 0x0000000f
2072#define cfg_sli_rev_WORD word1
2073#define cfg_sli_family_SHIFT 8
2074#define cfg_sli_family_MASK 0x0000000f
2075#define cfg_sli_family_WORD word1
2076#define cfg_if_type_SHIFT 12
2077#define cfg_if_type_MASK 0x0000000f
2078#define cfg_if_type_WORD word1
2079#define cfg_sli_hint_1_SHIFT 16
2080#define cfg_sli_hint_1_MASK 0x000000ff
2081#define cfg_sli_hint_1_WORD word1
2082#define cfg_sli_hint_2_SHIFT 24
2083#define cfg_sli_hint_2_MASK 0x0000001f
2084#define cfg_sli_hint_2_WORD word1
2085 uint32_t word2;
2086 uint32_t word3;
2087 uint32_t word4;
2088#define cfg_cqv_SHIFT 14
2089#define cfg_cqv_MASK 0x00000003
2090#define cfg_cqv_WORD word4
2091 uint32_t word5;
2092 uint32_t word6;
2093#define cfg_mqv_SHIFT 14
2094#define cfg_mqv_MASK 0x00000003
2095#define cfg_mqv_WORD word6
2096 uint32_t word7;
2097 uint32_t word8;
2098#define cfg_wqv_SHIFT 14
2099#define cfg_wqv_MASK 0x00000003
2100#define cfg_wqv_WORD word8
2101 uint32_t word9;
2102 uint32_t word10;
2103#define cfg_rqv_SHIFT 14
2104#define cfg_rqv_MASK 0x00000003
2105#define cfg_rqv_WORD word10
2106 uint32_t word11;
2107#define cfg_rq_db_window_SHIFT 28
2108#define cfg_rq_db_window_MASK 0x0000000f
2109#define cfg_rq_db_window_WORD word11
2110 uint32_t word12;
2111#define cfg_fcoe_SHIFT 0
2112#define cfg_fcoe_MASK 0x00000001
2113#define cfg_fcoe_WORD word12
2114#define cfg_phwq_SHIFT 15
2115#define cfg_phwq_MASK 0x00000001
2116#define cfg_phwq_WORD word12
2117#define cfg_loopbk_scope_SHIFT 28
2118#define cfg_loopbk_scope_MASK 0x0000000f
2119#define cfg_loopbk_scope_WORD word12
2120 uint32_t sge_supp_len;
2121 uint32_t word14;
2122#define cfg_sgl_page_cnt_SHIFT 0
2123#define cfg_sgl_page_cnt_MASK 0x0000000f
2124#define cfg_sgl_page_cnt_WORD word14
2125#define cfg_sgl_page_size_SHIFT 8
2126#define cfg_sgl_page_size_MASK 0x000000ff
2127#define cfg_sgl_page_size_WORD word14
2128#define cfg_sgl_pp_align_SHIFT 16
2129#define cfg_sgl_pp_align_MASK 0x000000ff
2130#define cfg_sgl_pp_align_WORD word14
2131 uint32_t word15;
2132 uint32_t word16;
2133 uint32_t word17;
2134 uint32_t word18;
2135 uint32_t word19;
2136};
2137
2138struct lpfc_mbx_get_sli4_parameters {
2139 struct mbox_header header;
2140 struct lpfc_sli4_parameters sli4_parameters;
2141};
2142
2054/* Mailbox Completion Queue Error Messages */ 2143/* Mailbox Completion Queue Error Messages */
2055#define MB_CQE_STATUS_SUCCESS 0x0 2144#define MB_CQE_STATUS_SUCCESS 0x0
2056#define MB_CQE_STATUS_INSUFFICIENT_PRIVILEGES 0x1 2145#define MB_CQE_STATUS_INSUFFICIENT_PRIVILEGES 0x1
@@ -2103,7 +2192,8 @@ struct lpfc_mqe {
2103 struct lpfc_mbx_post_hdr_tmpl hdr_tmpl; 2192 struct lpfc_mbx_post_hdr_tmpl hdr_tmpl;
2104 struct lpfc_mbx_query_fw_cfg query_fw_cfg; 2193 struct lpfc_mbx_query_fw_cfg query_fw_cfg;
2105 struct lpfc_mbx_supp_pages supp_pages; 2194 struct lpfc_mbx_supp_pages supp_pages;
2106 struct lpfc_mbx_sli4_params sli4_params; 2195 struct lpfc_mbx_pc_sli4_params sli4_params;
2196 struct lpfc_mbx_get_sli4_parameters get_sli4_parameters;
2107 struct lpfc_mbx_nop nop; 2197 struct lpfc_mbx_nop nop;
2108 } un; 2198 } un;
2109}; 2199};
@@ -2381,6 +2471,10 @@ struct wqe_common {
2381#define wqe_wqes_SHIFT 15 2471#define wqe_wqes_SHIFT 15
2382#define wqe_wqes_MASK 0x00000001 2472#define wqe_wqes_MASK 0x00000001
2383#define wqe_wqes_WORD word10 2473#define wqe_wqes_WORD word10
2474/* Note that this field overlaps above fields */
2475#define wqe_wqid_SHIFT 1
2476#define wqe_wqid_MASK 0x0000007f
2477#define wqe_wqid_WORD word10
2384#define wqe_pri_SHIFT 16 2478#define wqe_pri_SHIFT 16
2385#define wqe_pri_MASK 0x00000007 2479#define wqe_pri_MASK 0x00000007
2386#define wqe_pri_WORD word10 2480#define wqe_pri_WORD word10
@@ -2599,7 +2693,8 @@ struct fcp_iwrite64_wqe {
2599 uint32_t total_xfer_len; 2693 uint32_t total_xfer_len;
2600 uint32_t initial_xfer_len; 2694 uint32_t initial_xfer_len;
2601 struct wqe_common wqe_com; /* words 6-11 */ 2695 struct wqe_common wqe_com; /* words 6-11 */
2602 uint32_t rsvd_12_15[4]; /* word 12-15 */ 2696 uint32_t rsrvd12;
2697 struct ulp_bde64 ph_bde; /* words 13-15 */
2603}; 2698};
2604 2699
2605struct fcp_iread64_wqe { 2700struct fcp_iread64_wqe {
@@ -2608,7 +2703,8 @@ struct fcp_iread64_wqe {
2608 uint32_t total_xfer_len; /* word 4 */ 2703 uint32_t total_xfer_len; /* word 4 */
2609 uint32_t rsrvd5; /* word 5 */ 2704 uint32_t rsrvd5; /* word 5 */
2610 struct wqe_common wqe_com; /* words 6-11 */ 2705 struct wqe_common wqe_com; /* words 6-11 */
2611 uint32_t rsvd_12_15[4]; /* word 12-15 */ 2706 uint32_t rsrvd12;
2707 struct ulp_bde64 ph_bde; /* words 13-15 */
2612}; 2708};
2613 2709
2614struct fcp_icmnd64_wqe { 2710struct fcp_icmnd64_wqe {
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 6d0b36aa3389..0b5f76caa6e4 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4283,36 +4283,37 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
4283 goto out_free_bsmbx; 4283 goto out_free_bsmbx;
4284 } 4284 }
4285 4285
4286 /* Get the Supported Pages. It is always available. */ 4286 /* Get the Supported Pages if PORT_CAPABILITIES is supported by port. */
4287 lpfc_supported_pages(mboxq); 4287 lpfc_supported_pages(mboxq);
4288 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 4288 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
4289 if (unlikely(rc)) { 4289 if (!rc) {
4290 rc = -EIO; 4290 mqe = &mboxq->u.mqe;
4291 mempool_free(mboxq, phba->mbox_mem_pool); 4291 memcpy(&pn_page[0], ((uint8_t *)&mqe->un.supp_pages.word3),
4292 goto out_free_bsmbx; 4292 LPFC_MAX_SUPPORTED_PAGES);
4293 } 4293 for (i = 0; i < LPFC_MAX_SUPPORTED_PAGES; i++) {
4294 4294 switch (pn_page[i]) {
4295 mqe = &mboxq->u.mqe; 4295 case LPFC_SLI4_PARAMETERS:
4296 memcpy(&pn_page[0], ((uint8_t *)&mqe->un.supp_pages.word3), 4296 phba->sli4_hba.pc_sli4_params.supported = 1;
4297 LPFC_MAX_SUPPORTED_PAGES); 4297 break;
4298 for (i = 0; i < LPFC_MAX_SUPPORTED_PAGES; i++) { 4298 default:
4299 switch (pn_page[i]) { 4299 break;
4300 case LPFC_SLI4_PARAMETERS: 4300 }
4301 phba->sli4_hba.pc_sli4_params.supported = 1; 4301 }
4302 break; 4302 /* Read the port's SLI4 Parameters capabilities if supported. */
4303 default: 4303 if (phba->sli4_hba.pc_sli4_params.supported)
4304 break; 4304 rc = lpfc_pc_sli4_params_get(phba, mboxq);
4305 if (rc) {
4306 mempool_free(mboxq, phba->mbox_mem_pool);
4307 rc = -EIO;
4308 goto out_free_bsmbx;
4305 } 4309 }
4306 } 4310 }
4307 4311 /*
4308 /* Read the port's SLI4 Parameters capabilities if supported. */ 4312 * Get sli4 parameters that override parameters from Port capabilities.
4309 if (phba->sli4_hba.pc_sli4_params.supported) 4313 * If this call fails it is not a critical error so continue loading.
4310 rc = lpfc_pc_sli4_params_get(phba, mboxq); 4314 */
4315 lpfc_get_sli4_parameters(phba, mboxq);
4311 mempool_free(mboxq, phba->mbox_mem_pool); 4316 mempool_free(mboxq, phba->mbox_mem_pool);
4312 if (rc) {
4313 rc = -EIO;
4314 goto out_free_bsmbx;
4315 }
4316 /* Create all the SLI4 queues */ 4317 /* Create all the SLI4 queues */
4317 rc = lpfc_sli4_queue_create(phba); 4318 rc = lpfc_sli4_queue_create(phba);
4318 if (rc) 4319 if (rc)
@@ -7810,7 +7811,7 @@ lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
7810 mqe = &mboxq->u.mqe; 7811 mqe = &mboxq->u.mqe;
7811 7812
7812 /* Read the port's SLI4 Parameters port capabilities */ 7813 /* Read the port's SLI4 Parameters port capabilities */
7813 lpfc_sli4_params(mboxq); 7814 lpfc_pc_sli4_params(mboxq);
7814 if (!phba->sli4_hba.intr_enable) 7815 if (!phba->sli4_hba.intr_enable)
7815 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 7816 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
7816 else { 7817 else {
@@ -7854,6 +7855,66 @@ lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
7854} 7855}
7855 7856
7856/** 7857/**
7858 * lpfc_get_sli4_parameters - Get the SLI4 Config PARAMETERS.
7859 * @phba: Pointer to HBA context object.
7860 * @mboxq: Pointer to the mailboxq memory for the mailbox command response.
7861 *
7862 * This function is called in the SLI4 code path to read the port's
7863 * sli4 capabilities.
7864 *
7865 * This function may be be called from any context that can block-wait
7866 * for the completion. The expectation is that this routine is called
7867 * typically from probe_one or from the online routine.
7868 **/
7869int
7870lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
7871{
7872 int rc;
7873 struct lpfc_mqe *mqe = &mboxq->u.mqe;
7874 struct lpfc_pc_sli4_params *sli4_params;
7875 int length;
7876 struct lpfc_sli4_parameters *mbx_sli4_parameters;
7877
7878 /* Read the port's SLI4 Config Parameters */
7879 length = (sizeof(struct lpfc_mbx_get_sli4_parameters) -
7880 sizeof(struct lpfc_sli4_cfg_mhdr));
7881 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON,
7882 LPFC_MBOX_OPCODE_GET_SLI4_PARAMETERS,
7883 length, LPFC_SLI4_MBX_EMBED);
7884 if (!phba->sli4_hba.intr_enable)
7885 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
7886 else
7887 rc = lpfc_sli_issue_mbox_wait(phba, mboxq,
7888 lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG));
7889 if (unlikely(rc))
7890 return rc;
7891 sli4_params = &phba->sli4_hba.pc_sli4_params;
7892 mbx_sli4_parameters = &mqe->un.get_sli4_parameters.sli4_parameters;
7893 sli4_params->if_type = bf_get(cfg_if_type, mbx_sli4_parameters);
7894 sli4_params->sli_rev = bf_get(cfg_sli_rev, mbx_sli4_parameters);
7895 sli4_params->sli_family = bf_get(cfg_sli_family, mbx_sli4_parameters);
7896 sli4_params->featurelevel_1 = bf_get(cfg_sli_hint_1,
7897 mbx_sli4_parameters);
7898 sli4_params->featurelevel_2 = bf_get(cfg_sli_hint_2,
7899 mbx_sli4_parameters);
7900 if (bf_get(cfg_phwq, mbx_sli4_parameters))
7901 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED;
7902 else
7903 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED;
7904 sli4_params->sge_supp_len = mbx_sli4_parameters->sge_supp_len;
7905 sli4_params->loopbk_scope = bf_get(loopbk_scope, mbx_sli4_parameters);
7906 sli4_params->cqv = bf_get(cfg_cqv, mbx_sli4_parameters);
7907 sli4_params->mqv = bf_get(cfg_mqv, mbx_sli4_parameters);
7908 sli4_params->wqv = bf_get(cfg_wqv, mbx_sli4_parameters);
7909 sli4_params->rqv = bf_get(cfg_rqv, mbx_sli4_parameters);
7910 sli4_params->sgl_pages_max = bf_get(cfg_sgl_page_cnt,
7911 mbx_sli4_parameters);
7912 sli4_params->sgl_pp_align = bf_get(cfg_sgl_pp_align,
7913 mbx_sli4_parameters);
7914 return 0;
7915}
7916
7917/**
7857 * lpfc_pci_probe_one_s3 - PCI probe func to reg SLI-3 device to PCI subsystem. 7918 * lpfc_pci_probe_one_s3 - PCI probe func to reg SLI-3 device to PCI subsystem.
7858 * @pdev: pointer to PCI device 7919 * @pdev: pointer to PCI device
7859 * @pid: pointer to PCI device identifier 7920 * @pid: pointer to PCI device identifier
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 23403c650207..9fb4345ec021 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -1692,7 +1692,7 @@ lpfc_sli4_mbox_cmd_free(struct lpfc_hba *phba, struct lpfcMboxq *mbox)
1692 * @mbox: pointer to lpfc mbox command. 1692 * @mbox: pointer to lpfc mbox command.
1693 * @subsystem: The sli4 config sub mailbox subsystem. 1693 * @subsystem: The sli4 config sub mailbox subsystem.
1694 * @opcode: The sli4 config sub mailbox command opcode. 1694 * @opcode: The sli4 config sub mailbox command opcode.
1695 * @length: Length of the sli4 config mailbox command. 1695 * @length: Length of the sli4 config mailbox command (including sub-header).
1696 * 1696 *
1697 * This routine sets up the header fields of SLI4 specific mailbox command 1697 * This routine sets up the header fields of SLI4 specific mailbox command
1698 * for sending IOCTL command. 1698 * for sending IOCTL command.
@@ -1723,14 +1723,14 @@ lpfc_sli4_config(struct lpfc_hba *phba, struct lpfcMboxq *mbox,
1723 if (emb) { 1723 if (emb) {
1724 /* Set up main header fields */ 1724 /* Set up main header fields */
1725 bf_set(lpfc_mbox_hdr_emb, &sli4_config->header.cfg_mhdr, 1); 1725 bf_set(lpfc_mbox_hdr_emb, &sli4_config->header.cfg_mhdr, 1);
1726 sli4_config->header.cfg_mhdr.payload_length = 1726 sli4_config->header.cfg_mhdr.payload_length = length;
1727 LPFC_MBX_CMD_HDR_LENGTH + length;
1728 /* Set up sub-header fields following main header */ 1727 /* Set up sub-header fields following main header */
1729 bf_set(lpfc_mbox_hdr_opcode, 1728 bf_set(lpfc_mbox_hdr_opcode,
1730 &sli4_config->header.cfg_shdr.request, opcode); 1729 &sli4_config->header.cfg_shdr.request, opcode);
1731 bf_set(lpfc_mbox_hdr_subsystem, 1730 bf_set(lpfc_mbox_hdr_subsystem,
1732 &sli4_config->header.cfg_shdr.request, subsystem); 1731 &sli4_config->header.cfg_shdr.request, subsystem);
1733 sli4_config->header.cfg_shdr.request.request_length = length; 1732 sli4_config->header.cfg_shdr.request.request_length =
1733 length - LPFC_MBX_CMD_HDR_LENGTH;
1734 return length; 1734 return length;
1735 } 1735 }
1736 1736
@@ -1902,6 +1902,7 @@ lpfc_request_features(struct lpfc_hba *phba, struct lpfcMboxq *mboxq)
1902 1902
1903 /* Set up host requested features. */ 1903 /* Set up host requested features. */
1904 bf_set(lpfc_mbx_rq_ftr_rq_fcpi, &mboxq->u.mqe.un.req_ftrs, 1); 1904 bf_set(lpfc_mbx_rq_ftr_rq_fcpi, &mboxq->u.mqe.un.req_ftrs, 1);
1905 bf_set(lpfc_mbx_rq_ftr_rq_perfh, &mboxq->u.mqe.un.req_ftrs, 1);
1905 1906
1906 /* Enable DIF (block guard) only if configured to do so. */ 1907 /* Enable DIF (block guard) only if configured to do so. */
1907 if (phba->cfg_enable_bg) 1908 if (phba->cfg_enable_bg)
@@ -2159,17 +2160,16 @@ lpfc_supported_pages(struct lpfcMboxq *mbox)
2159} 2160}
2160 2161
2161/** 2162/**
2162 * lpfc_sli4_params - Initialize the PORT_CAPABILITIES SLI4 Params 2163 * lpfc_pc_sli4_params - Initialize the PORT_CAPABILITIES SLI4 Params mbox cmd.
2163 * mailbox command.
2164 * @mbox: pointer to lpfc mbox command to initialize. 2164 * @mbox: pointer to lpfc mbox command to initialize.
2165 * 2165 *
2166 * The PORT_CAPABILITIES SLI4 parameters mailbox command is issued to 2166 * The PORT_CAPABILITIES SLI4 parameters mailbox command is issued to
2167 * retrieve the particular SLI4 features supported by the port. 2167 * retrieve the particular SLI4 features supported by the port.
2168 **/ 2168 **/
2169void 2169void
2170lpfc_sli4_params(struct lpfcMboxq *mbox) 2170lpfc_pc_sli4_params(struct lpfcMboxq *mbox)
2171{ 2171{
2172 struct lpfc_mbx_sli4_params *sli4_params; 2172 struct lpfc_mbx_pc_sli4_params *sli4_params;
2173 2173
2174 memset(mbox, 0, sizeof(*mbox)); 2174 memset(mbox, 0, sizeof(*mbox));
2175 sli4_params = &mbox->u.mqe.un.sli4_params; 2175 sli4_params = &mbox->u.mqe.un.sli4_params;
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index c97751c95d77..af5498d735e2 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1981,12 +1981,14 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
1981 struct scatterlist *sgel = NULL; 1981 struct scatterlist *sgel = NULL;
1982 struct fcp_cmnd *fcp_cmnd = lpfc_cmd->fcp_cmnd; 1982 struct fcp_cmnd *fcp_cmnd = lpfc_cmd->fcp_cmnd;
1983 struct sli4_sge *sgl = (struct sli4_sge *)lpfc_cmd->fcp_bpl; 1983 struct sli4_sge *sgl = (struct sli4_sge *)lpfc_cmd->fcp_bpl;
1984 struct sli4_sge *first_data_sgl;
1984 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb; 1985 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb;
1985 dma_addr_t physaddr; 1986 dma_addr_t physaddr;
1986 uint32_t num_bde = 0; 1987 uint32_t num_bde = 0;
1987 uint32_t dma_len; 1988 uint32_t dma_len;
1988 uint32_t dma_offset = 0; 1989 uint32_t dma_offset = 0;
1989 int nseg; 1990 int nseg;
1991 struct ulp_bde64 *bde;
1990 1992
1991 /* 1993 /*
1992 * There are three possibilities here - use scatter-gather segment, use 1994 * There are three possibilities here - use scatter-gather segment, use
@@ -2011,7 +2013,7 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
2011 bf_set(lpfc_sli4_sge_last, sgl, 0); 2013 bf_set(lpfc_sli4_sge_last, sgl, 0);
2012 sgl->word2 = cpu_to_le32(sgl->word2); 2014 sgl->word2 = cpu_to_le32(sgl->word2);
2013 sgl += 1; 2015 sgl += 1;
2014 2016 first_data_sgl = sgl;
2015 lpfc_cmd->seg_cnt = nseg; 2017 lpfc_cmd->seg_cnt = nseg;
2016 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { 2018 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) {
2017 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9074 BLKGRD:" 2019 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9074 BLKGRD:"
@@ -2047,6 +2049,17 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
2047 dma_offset += dma_len; 2049 dma_offset += dma_len;
2048 sgl++; 2050 sgl++;
2049 } 2051 }
2052 /* setup the performance hint (first data BDE) if enabled */
2053 if (phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) {
2054 bde = (struct ulp_bde64 *)
2055 &(iocb_cmd->unsli3.sli3Words[5]);
2056 bde->addrLow = first_data_sgl->addr_lo;
2057 bde->addrHigh = first_data_sgl->addr_hi;
2058 bde->tus.f.bdeSize =
2059 le32_to_cpu(first_data_sgl->sge_len);
2060 bde->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
2061 bde->tus.w = cpu_to_le32(bde->tus.w);
2062 }
2050 } else { 2063 } else {
2051 sgl += 1; 2064 sgl += 1;
2052 /* clear the last flag in the fcp_rsp map entry */ 2065 /* clear the last flag in the fcp_rsp map entry */
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index a359d2b873ce..ed8f048dfb53 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -96,7 +96,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
96 /* set consumption flag every once in a while */ 96 /* set consumption flag every once in a while */
97 if (!((q->host_index + 1) % LPFC_RELEASE_NOTIFICATION_INTERVAL)) 97 if (!((q->host_index + 1) % LPFC_RELEASE_NOTIFICATION_INTERVAL))
98 bf_set(wqe_wqec, &wqe->generic.wqe_com, 1); 98 bf_set(wqe_wqec, &wqe->generic.wqe_com, 1);
99 99 if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED)
100 bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id);
100 lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size); 101 lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
101 102
102 /* Update the host index before invoking device */ 103 /* Update the host index before invoking device */
@@ -969,7 +970,8 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
969 } else { 970 } else {
970 sglq->state = SGL_FREED; 971 sglq->state = SGL_FREED;
971 sglq->ndlp = NULL; 972 sglq->ndlp = NULL;
972 list_add(&sglq->list, &phba->sli4_hba.lpfc_sgl_list); 973 list_add_tail(&sglq->list,
974 &phba->sli4_hba.lpfc_sgl_list);
973 975
974 /* Check if TXQ queue needs to be serviced */ 976 /* Check if TXQ queue needs to be serviced */
975 if (pring->txq_cnt) 977 if (pring->txq_cnt)
@@ -4817,7 +4819,10 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4817 "0378 No support for fcpi mode.\n"); 4819 "0378 No support for fcpi mode.\n");
4818 ftr_rsp++; 4820 ftr_rsp++;
4819 } 4821 }
4820 4822 if (bf_get(lpfc_mbx_rq_ftr_rsp_perfh, &mqe->un.req_ftrs))
4823 phba->sli3_options |= LPFC_SLI4_PERFH_ENABLED;
4824 else
4825 phba->sli3_options &= ~LPFC_SLI4_PERFH_ENABLED;
4821 /* 4826 /*
4822 * If the port cannot support the host's requested features 4827 * If the port cannot support the host's requested features
4823 * then turn off the global config parameters to disable the 4828 * then turn off the global config parameters to disable the
@@ -5004,7 +5009,8 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
5004 spin_lock_irq(&phba->hbalock); 5009 spin_lock_irq(&phba->hbalock);
5005 phba->link_state = LPFC_LINK_DOWN; 5010 phba->link_state = LPFC_LINK_DOWN;
5006 spin_unlock_irq(&phba->hbalock); 5011 spin_unlock_irq(&phba->hbalock);
5007 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); 5012 if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK)
5013 rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT);
5008out_unset_queue: 5014out_unset_queue:
5009 /* Unset all the queues set up in this routine when error out */ 5015 /* Unset all the queues set up in this routine when error out */
5010 if (rc) 5016 if (rc)
@@ -11189,7 +11195,7 @@ lpfc_rq_destroy(struct lpfc_hba *phba, struct lpfc_queue *hrq,
11189 if (!mbox) 11195 if (!mbox)
11190 return -ENOMEM; 11196 return -ENOMEM;
11191 length = (sizeof(struct lpfc_mbx_rq_destroy) - 11197 length = (sizeof(struct lpfc_mbx_rq_destroy) -
11192 sizeof(struct mbox_header)); 11198 sizeof(struct lpfc_sli4_cfg_mhdr));
11193 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, 11199 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE,
11194 LPFC_MBOX_OPCODE_FCOE_RQ_DESTROY, 11200 LPFC_MBOX_OPCODE_FCOE_RQ_DESTROY,
11195 length, LPFC_SLI4_MBX_EMBED); 11201 length, LPFC_SLI4_MBX_EMBED);
@@ -11279,7 +11285,7 @@ lpfc_sli4_post_sgl(struct lpfc_hba *phba,
11279 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, 11285 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE,
11280 LPFC_MBOX_OPCODE_FCOE_POST_SGL_PAGES, 11286 LPFC_MBOX_OPCODE_FCOE_POST_SGL_PAGES,
11281 sizeof(struct lpfc_mbx_post_sgl_pages) - 11287 sizeof(struct lpfc_mbx_post_sgl_pages) -
11282 sizeof(struct mbox_header), LPFC_SLI4_MBX_EMBED); 11288 sizeof(struct lpfc_sli4_cfg_mhdr), LPFC_SLI4_MBX_EMBED);
11283 11289
11284 post_sgl_pages = (struct lpfc_mbx_post_sgl_pages *) 11290 post_sgl_pages = (struct lpfc_mbx_post_sgl_pages *)
11285 &mbox->u.mqe.un.post_sgl_pages; 11291 &mbox->u.mqe.un.post_sgl_pages;
@@ -12402,7 +12408,8 @@ lpfc_sli4_post_rpi_hdr(struct lpfc_hba *phba, struct lpfc_rpi_hdr *rpi_page)
12402 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE, 12408 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE,
12403 LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE, 12409 LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE,
12404 sizeof(struct lpfc_mbx_post_hdr_tmpl) - 12410 sizeof(struct lpfc_mbx_post_hdr_tmpl) -
12405 sizeof(struct mbox_header), LPFC_SLI4_MBX_EMBED); 12411 sizeof(struct lpfc_sli4_cfg_mhdr),
12412 LPFC_SLI4_MBX_EMBED);
12406 bf_set(lpfc_mbx_post_hdr_tmpl_page_cnt, 12413 bf_set(lpfc_mbx_post_hdr_tmpl_page_cnt,
12407 hdr_tmpl, rpi_page->page_count); 12414 hdr_tmpl, rpi_page->page_count);
12408 bf_set(lpfc_mbx_post_hdr_tmpl_rpi_offset, hdr_tmpl, 12415 bf_set(lpfc_mbx_post_hdr_tmpl_rpi_offset, hdr_tmpl,
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index c7217d579e0f..aea4aa012270 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -359,6 +359,10 @@ struct lpfc_pc_sli4_params {
359 uint32_t hdr_pp_align; 359 uint32_t hdr_pp_align;
360 uint32_t sgl_pages_max; 360 uint32_t sgl_pages_max;
361 uint32_t sgl_pp_align; 361 uint32_t sgl_pp_align;
362 uint8_t cqv;
363 uint8_t mqv;
364 uint8_t wqv;
365 uint8_t rqv;
362}; 366};
363 367
364/* SLI4 HBA data structure entries */ 368/* SLI4 HBA data structure entries */
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 6b8d2952e32f..30ba5440c67a 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -464,6 +464,7 @@ disable_vport(struct fc_vport *fc_vport)
464 struct lpfc_hba *phba = vport->phba; 464 struct lpfc_hba *phba = vport->phba;
465 struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL; 465 struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL;
466 long timeout; 466 long timeout;
467 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
467 468
468 ndlp = lpfc_findnode_did(vport, Fabric_DID); 469 ndlp = lpfc_findnode_did(vport, Fabric_DID);
469 if (ndlp && NLP_CHK_NODE_ACT(ndlp) 470 if (ndlp && NLP_CHK_NODE_ACT(ndlp)
@@ -498,6 +499,9 @@ disable_vport(struct fc_vport *fc_vport)
498 * scsi_host_put() to release the vport. 499 * scsi_host_put() to release the vport.
499 */ 500 */
500 lpfc_mbx_unreg_vpi(vport); 501 lpfc_mbx_unreg_vpi(vport);
502 spin_lock_irq(shost->host_lock);
503 vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
504 spin_unlock_irq(shost->host_lock);
501 505
502 lpfc_vport_set_state(vport, FC_VPORT_DISABLED); 506 lpfc_vport_set_state(vport, FC_VPORT_DISABLED);
503 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, 507 lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,