aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c57
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_disc.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h13
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c42
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c7
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c12
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c12
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c147
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.h7
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h6
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.c5
16 files changed, 233 insertions, 95 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 93f222d66716..df43bfe6d573 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -421,6 +421,7 @@ struct lpfc_vport {
421 uint32_t cfg_enable_da_id; 421 uint32_t cfg_enable_da_id;
422 uint32_t cfg_max_scsicmpl_time; 422 uint32_t cfg_max_scsicmpl_time;
423 uint32_t cfg_tgt_queue_depth; 423 uint32_t cfg_tgt_queue_depth;
424 uint32_t cfg_first_burst_size;
424 425
425 uint32_t dev_loss_tmo_changed; 426 uint32_t dev_loss_tmo_changed;
426 427
@@ -710,8 +711,6 @@ struct lpfc_hba {
710 uint32_t cfg_use_msi; 711 uint32_t cfg_use_msi;
711 uint32_t cfg_fcp_imax; 712 uint32_t cfg_fcp_imax;
712 uint32_t cfg_fcp_cpu_map; 713 uint32_t cfg_fcp_cpu_map;
713 uint32_t cfg_fcp_wq_count;
714 uint32_t cfg_fcp_eq_count;
715 uint32_t cfg_fcp_io_channel; 714 uint32_t cfg_fcp_io_channel;
716 uint32_t cfg_total_seg_cnt; 715 uint32_t cfg_total_seg_cnt;
717 uint32_t cfg_sg_seg_cnt; 716 uint32_t cfg_sg_seg_cnt;
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index f4360c5ea6a9..16498e030c70 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -674,9 +674,6 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type)
674 int i; 674 int i;
675 int rc; 675 int rc;
676 676
677 if (phba->pport->fc_flag & FC_OFFLINE_MODE)
678 return 0;
679
680 init_completion(&online_compl); 677 init_completion(&online_compl);
681 rc = lpfc_workq_post_event(phba, &status, &online_compl, 678 rc = lpfc_workq_post_event(phba, &status, &online_compl,
682 LPFC_EVT_OFFLINE_PREP); 679 LPFC_EVT_OFFLINE_PREP);
@@ -744,14 +741,15 @@ lpfc_selective_reset(struct lpfc_hba *phba)
744 int status = 0; 741 int status = 0;
745 int rc; 742 int rc;
746 743
747 if ((!phba->cfg_enable_hba_reset) || 744 if (!phba->cfg_enable_hba_reset)
748 (phba->pport->fc_flag & FC_OFFLINE_MODE))
749 return -EACCES; 745 return -EACCES;
750 746
751 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); 747 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE)) {
748 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
752 749
753 if (status != 0) 750 if (status != 0)
754 return status; 751 return status;
752 }
755 753
756 init_completion(&online_compl); 754 init_completion(&online_compl);
757 rc = lpfc_workq_post_event(phba, &status, &online_compl, 755 rc = lpfc_workq_post_event(phba, &status, &online_compl,
@@ -2591,9 +2589,12 @@ LPFC_VPORT_ATTR_R(enable_da_id, 1, 0, 1,
2591 2589
2592/* 2590/*
2593# lun_queue_depth: This parameter is used to limit the number of outstanding 2591# lun_queue_depth: This parameter is used to limit the number of outstanding
2594# commands per FCP LUN. Value range is [1,128]. Default value is 30. 2592# commands per FCP LUN. Value range is [1,512]. Default value is 30.
2593# If this parameter value is greater than 1/8th the maximum number of exchanges
2594# supported by the HBA port, then the lun queue depth will be reduced to
2595# 1/8th the maximum number of exchanges.
2595*/ 2596*/
2596LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128, 2597LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 512,
2597 "Max number of FCP commands we can queue to a specific LUN"); 2598 "Max number of FCP commands we can queue to a specific LUN");
2598 2599
2599/* 2600/*
@@ -2601,7 +2602,7 @@ LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128,
2601# commands per target port. Value range is [10,65535]. Default value is 65535. 2602# commands per target port. Value range is [10,65535]. Default value is 65535.
2602*/ 2603*/
2603LPFC_VPORT_ATTR_R(tgt_queue_depth, 65535, 10, 65535, 2604LPFC_VPORT_ATTR_R(tgt_queue_depth, 65535, 10, 65535,
2604 "Max number of FCP commands we can queue to a specific target port"); 2605 "Max number of FCP commands we can queue to a specific target port");
2605 2606
2606/* 2607/*
2607# hba_queue_depth: This parameter is used to limit the number of outstanding 2608# hba_queue_depth: This parameter is used to limit the number of outstanding
@@ -3949,6 +3950,14 @@ LPFC_VPORT_ATTR_RW(use_adisc, 0, 0, 1,
3949 "Use ADISC on rediscovery to authenticate FCP devices"); 3950 "Use ADISC on rediscovery to authenticate FCP devices");
3950 3951
3951/* 3952/*
3953# lpfc_first_burst_size: First burst size to use on the NPorts
3954# that support first burst.
3955# Value range is [0,65536]. Default value is 0.
3956*/
3957LPFC_VPORT_ATTR_RW(first_burst_size, 0, 0, 65536,
3958 "First burst size for Targets that support first burst");
3959
3960/*
3952# lpfc_max_scsicmpl_time: Use scsi command completion time to control I/O queue 3961# lpfc_max_scsicmpl_time: Use scsi command completion time to control I/O queue
3953# depth. Default value is 0. When the value of this parameter is zero the 3962# depth. Default value is 0. When the value of this parameter is zero the
3954# SCSI command completion time is not used for controlling I/O queue depth. When 3963# SCSI command completion time is not used for controlling I/O queue depth. When
@@ -4112,25 +4121,6 @@ LPFC_ATTR_R(use_msi, 2, 0, 2, "Use Message Signaled Interrupts (1) or "
4112 "MSI-X (2), if possible"); 4121 "MSI-X (2), if possible");
4113 4122
4114/* 4123/*
4115# lpfc_fcp_wq_count: Set the number of fast-path FCP work queues
4116# This parameter is ignored and will eventually be depricated
4117#
4118# Value range is [1,7]. Default value is 4.
4119*/
4120LPFC_ATTR_R(fcp_wq_count, LPFC_FCP_IO_CHAN_DEF, LPFC_FCP_IO_CHAN_MIN,
4121 LPFC_FCP_IO_CHAN_MAX,
4122 "Set the number of fast-path FCP work queues, if possible");
4123
4124/*
4125# lpfc_fcp_eq_count: Set the number of FCP EQ/CQ/WQ IO channels
4126#
4127# Value range is [1,7]. Default value is 4.
4128*/
4129LPFC_ATTR_R(fcp_eq_count, LPFC_FCP_IO_CHAN_DEF, LPFC_FCP_IO_CHAN_MIN,
4130 LPFC_FCP_IO_CHAN_MAX,
4131 "Set the number of fast-path FCP event queues, if possible");
4132
4133/*
4134# lpfc_fcp_io_channel: Set the number of FCP EQ/CQ/WQ IO channels 4124# lpfc_fcp_io_channel: Set the number of FCP EQ/CQ/WQ IO channels
4135# 4125#
4136# Value range is [1,7]. Default value is 4. 4126# Value range is [1,7]. Default value is 4.
@@ -4276,6 +4266,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
4276 &dev_attr_lpfc_devloss_tmo, 4266 &dev_attr_lpfc_devloss_tmo,
4277 &dev_attr_lpfc_fcp_class, 4267 &dev_attr_lpfc_fcp_class,
4278 &dev_attr_lpfc_use_adisc, 4268 &dev_attr_lpfc_use_adisc,
4269 &dev_attr_lpfc_first_burst_size,
4279 &dev_attr_lpfc_ack0, 4270 &dev_attr_lpfc_ack0,
4280 &dev_attr_lpfc_topology, 4271 &dev_attr_lpfc_topology,
4281 &dev_attr_lpfc_scan_down, 4272 &dev_attr_lpfc_scan_down,
@@ -4307,8 +4298,6 @@ struct device_attribute *lpfc_hba_attrs[] = {
4307 &dev_attr_lpfc_use_msi, 4298 &dev_attr_lpfc_use_msi,
4308 &dev_attr_lpfc_fcp_imax, 4299 &dev_attr_lpfc_fcp_imax,
4309 &dev_attr_lpfc_fcp_cpu_map, 4300 &dev_attr_lpfc_fcp_cpu_map,
4310 &dev_attr_lpfc_fcp_wq_count,
4311 &dev_attr_lpfc_fcp_eq_count,
4312 &dev_attr_lpfc_fcp_io_channel, 4301 &dev_attr_lpfc_fcp_io_channel,
4313 &dev_attr_lpfc_enable_bg, 4302 &dev_attr_lpfc_enable_bg,
4314 &dev_attr_lpfc_soft_wwnn, 4303 &dev_attr_lpfc_soft_wwnn,
@@ -4352,6 +4341,7 @@ struct device_attribute *lpfc_vport_attrs[] = {
4352 &dev_attr_lpfc_restrict_login, 4341 &dev_attr_lpfc_restrict_login,
4353 &dev_attr_lpfc_fcp_class, 4342 &dev_attr_lpfc_fcp_class,
4354 &dev_attr_lpfc_use_adisc, 4343 &dev_attr_lpfc_use_adisc,
4344 &dev_attr_lpfc_first_burst_size,
4355 &dev_attr_lpfc_fdmi_on, 4345 &dev_attr_lpfc_fdmi_on,
4356 &dev_attr_lpfc_max_luns, 4346 &dev_attr_lpfc_max_luns,
4357 &dev_attr_nport_evt_cnt, 4347 &dev_attr_nport_evt_cnt,
@@ -5290,8 +5280,6 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
5290 lpfc_use_msi_init(phba, lpfc_use_msi); 5280 lpfc_use_msi_init(phba, lpfc_use_msi);
5291 lpfc_fcp_imax_init(phba, lpfc_fcp_imax); 5281 lpfc_fcp_imax_init(phba, lpfc_fcp_imax);
5292 lpfc_fcp_cpu_map_init(phba, lpfc_fcp_cpu_map); 5282 lpfc_fcp_cpu_map_init(phba, lpfc_fcp_cpu_map);
5293 lpfc_fcp_wq_count_init(phba, lpfc_fcp_wq_count);
5294 lpfc_fcp_eq_count_init(phba, lpfc_fcp_eq_count);
5295 lpfc_fcp_io_channel_init(phba, lpfc_fcp_io_channel); 5283 lpfc_fcp_io_channel_init(phba, lpfc_fcp_io_channel);
5296 lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset); 5284 lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset);
5297 lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat); 5285 lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat);
@@ -5331,6 +5319,7 @@ lpfc_get_vport_cfgparam(struct lpfc_vport *vport)
5331 lpfc_restrict_login_init(vport, lpfc_restrict_login); 5319 lpfc_restrict_login_init(vport, lpfc_restrict_login);
5332 lpfc_fcp_class_init(vport, lpfc_fcp_class); 5320 lpfc_fcp_class_init(vport, lpfc_fcp_class);
5333 lpfc_use_adisc_init(vport, lpfc_use_adisc); 5321 lpfc_use_adisc_init(vport, lpfc_use_adisc);
5322 lpfc_first_burst_size_init(vport, lpfc_first_burst_size);
5334 lpfc_max_scsicmpl_time_init(vport, lpfc_max_scsicmpl_time); 5323 lpfc_max_scsicmpl_time_init(vport, lpfc_max_scsicmpl_time);
5335 lpfc_fdmi_on_init(vport, lpfc_fdmi_on); 5324 lpfc_fdmi_on_init(vport, lpfc_fdmi_on);
5336 lpfc_discovery_threads_init(vport, lpfc_discovery_threads); 5325 lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index fcbedd6053c4..79c13c3263f1 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -2498,7 +2498,7 @@ static int lpfcdiag_loop_get_xri(struct lpfc_hba *phba, uint16_t rpi,
2498 struct lpfc_sli_ct_request *ctreq = NULL; 2498 struct lpfc_sli_ct_request *ctreq = NULL;
2499 int ret_val = 0; 2499 int ret_val = 0;
2500 int time_left; 2500 int time_left;
2501 int iocb_stat = 0; 2501 int iocb_stat = IOCB_SUCCESS;
2502 unsigned long flags; 2502 unsigned long flags;
2503 2503
2504 *txxri = 0; 2504 *txxri = 0;
@@ -2574,6 +2574,7 @@ static int lpfcdiag_loop_get_xri(struct lpfc_hba *phba, uint16_t rpi,
2574 2574
2575 cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC; 2575 cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC;
2576 cmdiocbq->vport = phba->pport; 2576 cmdiocbq->vport = phba->pport;
2577 cmdiocbq->iocb_cmpl = NULL;
2577 2578
2578 iocb_stat = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq, 2579 iocb_stat = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq,
2579 rspiocbq, 2580 rspiocbq,
@@ -2963,7 +2964,7 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg_job *job)
2963 uint8_t *ptr = NULL, *rx_databuf = NULL; 2964 uint8_t *ptr = NULL, *rx_databuf = NULL;
2964 int rc = 0; 2965 int rc = 0;
2965 int time_left; 2966 int time_left;
2966 int iocb_stat; 2967 int iocb_stat = IOCB_SUCCESS;
2967 unsigned long flags; 2968 unsigned long flags;
2968 void *dataout = NULL; 2969 void *dataout = NULL;
2969 uint32_t total_mem; 2970 uint32_t total_mem;
@@ -3149,6 +3150,7 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg_job *job)
3149 } 3150 }
3150 cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC; 3151 cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC;
3151 cmdiocbq->vport = phba->pport; 3152 cmdiocbq->vport = phba->pport;
3153 cmdiocbq->iocb_cmpl = NULL;
3152 iocb_stat = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq, 3154 iocb_stat = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq,
3153 rspiocbq, (phba->fc_ratov * 2) + 3155 rspiocbq, (phba->fc_ratov * 2) +
3154 LPFC_DRVR_TIMEOUT); 3156 LPFC_DRVR_TIMEOUT);
@@ -3209,7 +3211,7 @@ err_loopback_test_exit:
3209 lpfc_bsg_event_unref(evt); /* delete */ 3211 lpfc_bsg_event_unref(evt); /* delete */
3210 spin_unlock_irqrestore(&phba->ct_ev_lock, flags); 3212 spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
3211 3213
3212 if (cmdiocbq != NULL) 3214 if ((cmdiocbq != NULL) && (iocb_stat != IOCB_TIMEDOUT))
3213 lpfc_sli_release_iocbq(phba, cmdiocbq); 3215 lpfc_sli_release_iocbq(phba, cmdiocbq);
3214 3216
3215 if (rspiocbq != NULL) 3217 if (rspiocbq != NULL)
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index 68391177432b..02e8cd923d0a 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -895,7 +895,7 @@ lpfc_cmpl_ct(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
895 895
896 if (irsp->ulpStatus) { 896 if (irsp->ulpStatus) {
897 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, 897 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
898 "0268 NS cmd %x Error (%d %d)\n", 898 "0268 NS cmd x%x Error (x%x x%x)\n",
899 cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]); 899 cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]);
900 900
901 if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && 901 if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
index af49fb03dbb8..e409ba5f728c 100644
--- a/drivers/scsi/lpfc/lpfc_disc.h
+++ b/drivers/scsi/lpfc/lpfc_disc.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2008 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2013 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -154,6 +154,7 @@ struct lpfc_node_rrq {
154#define NLP_NODEV_REMOVE 0x08000000 /* Defer removal till discovery ends */ 154#define NLP_NODEV_REMOVE 0x08000000 /* Defer removal till discovery ends */
155#define NLP_TARGET_REMOVE 0x10000000 /* Target remove in process */ 155#define NLP_TARGET_REMOVE 0x10000000 /* Target remove in process */
156#define NLP_SC_REQ 0x20000000 /* Target requires authentication */ 156#define NLP_SC_REQ 0x20000000 /* Target requires authentication */
157#define NLP_FIRSTBURST 0x40000000 /* Target supports FirstBurst */
157#define NLP_RPI_REGISTERED 0x80000000 /* nlp_rpi is valid */ 158#define NLP_RPI_REGISTERED 0x80000000 /* nlp_rpi is valid */
158 159
159/* ndlp usage management macros */ 160/* ndlp usage management macros */
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 6b8ee7449f16..110445f0c58d 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -2122,6 +2122,8 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2122 } 2122 }
2123 npr->estabImagePair = 1; 2123 npr->estabImagePair = 1;
2124 npr->readXferRdyDis = 1; 2124 npr->readXferRdyDis = 1;
2125 if (vport->cfg_first_burst_size)
2126 npr->writeXferRdyDis = 1;
2125 2127
2126 /* For FCP support */ 2128 /* For FCP support */
2127 npr->prliType = PRLI_FCP_TYPE; 2129 npr->prliType = PRLI_FCP_TYPE;
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 4ec3d7c044c2..086c3f28caa6 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -234,6 +234,9 @@ struct ulp_bde64 {
234 uint32_t addrHigh; 234 uint32_t addrHigh;
235}; 235};
236 236
237/* Maximun size of immediate data that can fit into a 128 byte WQE */
238#define LPFC_MAX_BDE_IMM_SIZE 64
239
237struct lpfc_sli4_flags { 240struct lpfc_sli4_flags {
238 uint32_t word0; 241 uint32_t word0;
239#define lpfc_idx_rsrc_rdy_SHIFT 0 242#define lpfc_idx_rsrc_rdy_SHIFT 0
@@ -2585,6 +2588,9 @@ struct lpfc_sli4_parameters {
2585#define cfg_mqv_WORD word6 2588#define cfg_mqv_WORD word6
2586 uint32_t word7; 2589 uint32_t word7;
2587 uint32_t word8; 2590 uint32_t word8;
2591#define cfg_wqsize_SHIFT 8
2592#define cfg_wqsize_MASK 0x0000000f
2593#define cfg_wqsize_WORD word8
2588#define cfg_wqv_SHIFT 14 2594#define cfg_wqv_SHIFT 14
2589#define cfg_wqv_MASK 0x00000003 2595#define cfg_wqv_MASK 0x00000003
2590#define cfg_wqv_WORD word8 2596#define cfg_wqv_WORD word8
@@ -3622,6 +3628,13 @@ union lpfc_wqe {
3622 struct gen_req64_wqe gen_req; 3628 struct gen_req64_wqe gen_req;
3623}; 3629};
3624 3630
3631union lpfc_wqe128 {
3632 uint32_t words[32];
3633 struct lpfc_wqe_generic generic;
3634 struct xmit_seq64_wqe xmit_sequence;
3635 struct gen_req64_wqe gen_req;
3636};
3637
3625#define LPFC_GROUP_OJECT_MAGIC_NUM 0xfeaa0001 3638#define LPFC_GROUP_OJECT_MAGIC_NUM 0xfeaa0001
3626#define LPFC_FILE_TYPE_GROUP 0xf7 3639#define LPFC_FILE_TYPE_GROUP 0xf7
3627#define LPFC_FILE_ID_GROUP 0xa2 3640#define LPFC_FILE_ID_GROUP 0xa2
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index e0b20fad8502..501147c4a147 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -472,10 +472,22 @@ lpfc_config_port_post(struct lpfc_hba *phba)
472 lpfc_sli_read_link_ste(phba); 472 lpfc_sli_read_link_ste(phba);
473 473
474 /* Reset the DFT_HBA_Q_DEPTH to the max xri */ 474 /* Reset the DFT_HBA_Q_DEPTH to the max xri */
475 if (phba->cfg_hba_queue_depth > (mb->un.varRdConfig.max_xri+1)) 475 i = (mb->un.varRdConfig.max_xri + 1);
476 phba->cfg_hba_queue_depth = 476 if (phba->cfg_hba_queue_depth > i) {
477 (mb->un.varRdConfig.max_xri + 1) - 477 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
478 lpfc_sli4_get_els_iocb_cnt(phba); 478 "3359 HBA queue depth changed from %d to %d\n",
479 phba->cfg_hba_queue_depth, i);
480 phba->cfg_hba_queue_depth = i;
481 }
482
483 /* Reset the DFT_LUN_Q_DEPTH to (max xri >> 3) */
484 i = (mb->un.varRdConfig.max_xri >> 3);
485 if (phba->pport->cfg_lun_queue_depth > i) {
486 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
487 "3360 LUN queue depth changed from %d to %d\n",
488 phba->pport->cfg_lun_queue_depth, i);
489 phba->pport->cfg_lun_queue_depth = i;
490 }
479 491
480 phba->lmt = mb->un.varRdConfig.lmt; 492 phba->lmt = mb->un.varRdConfig.lmt;
481 493
@@ -4901,9 +4913,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
4901 lpfc_get_cfgparam(phba); 4913 lpfc_get_cfgparam(phba);
4902 phba->max_vpi = LPFC_MAX_VPI; 4914 phba->max_vpi = LPFC_MAX_VPI;
4903 4915
4904 /* Eventually cfg_fcp_eq_count / cfg_fcp_wq_count will be depricated */
4905 phba->cfg_fcp_io_channel = phba->cfg_fcp_eq_count;
4906
4907 /* This will be set to correct value after the read_config mbox */ 4916 /* This will be set to correct value after the read_config mbox */
4908 phba->max_vports = 0; 4917 phba->max_vports = 0;
4909 4918
@@ -6664,12 +6673,14 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
6664 goto read_cfg_out; 6673 goto read_cfg_out;
6665 6674
6666 /* Reset the DFT_HBA_Q_DEPTH to the max xri */ 6675 /* Reset the DFT_HBA_Q_DEPTH to the max xri */
6667 if (phba->cfg_hba_queue_depth > 6676 length = phba->sli4_hba.max_cfg_param.max_xri -
6668 (phba->sli4_hba.max_cfg_param.max_xri - 6677 lpfc_sli4_get_els_iocb_cnt(phba);
6669 lpfc_sli4_get_els_iocb_cnt(phba))) 6678 if (phba->cfg_hba_queue_depth > length) {
6670 phba->cfg_hba_queue_depth = 6679 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
6671 phba->sli4_hba.max_cfg_param.max_xri - 6680 "3361 HBA queue depth changed from %d to %d\n",
6672 lpfc_sli4_get_els_iocb_cnt(phba); 6681 phba->cfg_hba_queue_depth, length);
6682 phba->cfg_hba_queue_depth = length;
6683 }
6673 6684
6674 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != 6685 if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
6675 LPFC_SLI_INTF_IF_TYPE_2) 6686 LPFC_SLI_INTF_IF_TYPE_2)
@@ -6859,11 +6870,7 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba)
6859 cfg_fcp_io_channel = phba->sli4_hba.max_cfg_param.max_eq; 6870 cfg_fcp_io_channel = phba->sli4_hba.max_cfg_param.max_eq;
6860 } 6871 }
6861 6872
6862 /* Eventually cfg_fcp_eq_count / cfg_fcp_wq_count will be depricated */
6863
6864 /* The actual number of FCP event queues adopted */ 6873 /* The actual number of FCP event queues adopted */
6865 phba->cfg_fcp_eq_count = cfg_fcp_io_channel;
6866 phba->cfg_fcp_wq_count = cfg_fcp_io_channel;
6867 phba->cfg_fcp_io_channel = cfg_fcp_io_channel; 6874 phba->cfg_fcp_io_channel = cfg_fcp_io_channel;
6868 6875
6869 /* Get EQ depth from module parameter, fake the default for now */ 6876 /* Get EQ depth from module parameter, fake the default for now */
@@ -9154,6 +9161,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
9154 sli4_params->mqv = bf_get(cfg_mqv, mbx_sli4_parameters); 9161 sli4_params->mqv = bf_get(cfg_mqv, mbx_sli4_parameters);
9155 sli4_params->wqv = bf_get(cfg_wqv, mbx_sli4_parameters); 9162 sli4_params->wqv = bf_get(cfg_wqv, mbx_sli4_parameters);
9156 sli4_params->rqv = bf_get(cfg_rqv, mbx_sli4_parameters); 9163 sli4_params->rqv = bf_get(cfg_rqv, mbx_sli4_parameters);
9164 sli4_params->wqsize = bf_get(cfg_wqsize, mbx_sli4_parameters);
9157 sli4_params->sgl_pages_max = bf_get(cfg_sgl_page_cnt, 9165 sli4_params->sgl_pages_max = bf_get(cfg_sgl_page_cnt,
9158 mbx_sli4_parameters); 9166 mbx_sli4_parameters);
9159 sli4_params->sgl_pp_align = bf_get(cfg_sgl_pp_align, 9167 sli4_params->sgl_pp_align = bf_get(cfg_sgl_pp_align,
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index b1c510f6b8f0..1f292e29d566 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -178,7 +178,8 @@ lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
178 mb->mbxOwner = OWN_HOST; 178 mb->mbxOwner = OWN_HOST;
179 mb->un.varDmp.cv = 1; 179 mb->un.varDmp.cv = 1;
180 mb->un.varDmp.type = DMP_NV_PARAMS; 180 mb->un.varDmp.type = DMP_NV_PARAMS;
181 mb->un.varDmp.entry_index = 0; 181 if (phba->sli_rev < LPFC_SLI_REV4)
182 mb->un.varDmp.entry_index = 0;
182 mb->un.varDmp.region_id = WAKE_UP_PARMS_REGION_ID; 183 mb->un.varDmp.region_id = WAKE_UP_PARMS_REGION_ID;
183 mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE; 184 mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE;
184 mb->un.varDmp.co = 0; 185 mb->un.varDmp.co = 0;
@@ -361,7 +362,7 @@ lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
361 /* NEW_FEATURE 362 /* NEW_FEATURE
362 * SLI-2, Coalescing Response Feature. 363 * SLI-2, Coalescing Response Feature.
363 */ 364 */
364 if (phba->cfg_cr_delay) { 365 if (phba->cfg_cr_delay && (phba->sli_rev < LPFC_SLI_REV4)) {
365 mb->un.varCfgLnk.cr = 1; 366 mb->un.varCfgLnk.cr = 1;
366 mb->un.varCfgLnk.ci = 1; 367 mb->un.varCfgLnk.ci = 1;
367 mb->un.varCfgLnk.cr_delay = phba->cfg_cr_delay; 368 mb->un.varCfgLnk.cr_delay = phba->cfg_cr_delay;
@@ -377,7 +378,7 @@ lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
377 mb->un.varCfgLnk.crtov = phba->fc_crtov; 378 mb->un.varCfgLnk.crtov = phba->fc_crtov;
378 mb->un.varCfgLnk.citov = phba->fc_citov; 379 mb->un.varCfgLnk.citov = phba->fc_citov;
379 380
380 if (phba->cfg_ack0) 381 if (phba->cfg_ack0 && (phba->sli_rev < LPFC_SLI_REV4))
381 mb->un.varCfgLnk.ack0_enable = 1; 382 mb->un.varCfgLnk.ack0_enable = 1;
382 383
383 mb->mbxCommand = MBX_CONFIG_LINK; 384 mb->mbxCommand = MBX_CONFIG_LINK;
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 6aaf39a1f1c5..abc361259d6d 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -690,11 +690,15 @@ lpfc_rcv_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
690 690
691 ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); 691 ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
692 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 692 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
693 ndlp->nlp_flag &= ~NLP_FIRSTBURST;
693 if (npr->prliType == PRLI_FCP_TYPE) { 694 if (npr->prliType == PRLI_FCP_TYPE) {
694 if (npr->initiatorFunc) 695 if (npr->initiatorFunc)
695 ndlp->nlp_type |= NLP_FCP_INITIATOR; 696 ndlp->nlp_type |= NLP_FCP_INITIATOR;
696 if (npr->targetFunc) 697 if (npr->targetFunc) {
697 ndlp->nlp_type |= NLP_FCP_TARGET; 698 ndlp->nlp_type |= NLP_FCP_TARGET;
699 if (npr->writeXferRdyDis)
700 ndlp->nlp_flag |= NLP_FIRSTBURST;
701 }
698 if (npr->Retry) 702 if (npr->Retry)
699 ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE; 703 ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE;
700 } 704 }
@@ -1676,12 +1680,16 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1676 /* Check out PRLI rsp */ 1680 /* Check out PRLI rsp */
1677 ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); 1681 ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
1678 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; 1682 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
1683 ndlp->nlp_flag &= ~NLP_FIRSTBURST;
1679 if ((npr->acceptRspCode == PRLI_REQ_EXECUTED) && 1684 if ((npr->acceptRspCode == PRLI_REQ_EXECUTED) &&
1680 (npr->prliType == PRLI_FCP_TYPE)) { 1685 (npr->prliType == PRLI_FCP_TYPE)) {
1681 if (npr->initiatorFunc) 1686 if (npr->initiatorFunc)
1682 ndlp->nlp_type |= NLP_FCP_INITIATOR; 1687 ndlp->nlp_type |= NLP_FCP_INITIATOR;
1683 if (npr->targetFunc) 1688 if (npr->targetFunc) {
1684 ndlp->nlp_type |= NLP_FCP_TARGET; 1689 ndlp->nlp_type |= NLP_FCP_TARGET;
1690 if (npr->writeXferRdyDis)
1691 ndlp->nlp_flag |= NLP_FIRSTBURST;
1692 }
1685 if (npr->Retry) 1693 if (npr->Retry)
1686 ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE; 1694 ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE;
1687 } 1695 }
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 243de1d324b7..1242b6c4308b 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -4386,11 +4386,11 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
4386 if (scsi_sg_count(scsi_cmnd)) { 4386 if (scsi_sg_count(scsi_cmnd)) {
4387 if (datadir == DMA_TO_DEVICE) { 4387 if (datadir == DMA_TO_DEVICE) {
4388 iocb_cmd->ulpCommand = CMD_FCP_IWRITE64_CR; 4388 iocb_cmd->ulpCommand = CMD_FCP_IWRITE64_CR;
4389 if (sli4) 4389 iocb_cmd->ulpPU = PARM_READ_CHECK;
4390 iocb_cmd->ulpPU = PARM_READ_CHECK; 4390 if (vport->cfg_first_burst_size &&
4391 else { 4391 (pnode->nlp_flag & NLP_FIRSTBURST)) {
4392 iocb_cmd->un.fcpi.fcpi_parm = 0; 4392 piocbq->iocb.un.fcpi.fcpi_XRdy =
4393 iocb_cmd->ulpPU = 0; 4393 vport->cfg_first_burst_size;
4394 } 4394 }
4395 fcp_cmnd->fcpCntl3 = WRITE_DATA; 4395 fcp_cmnd->fcpCntl3 = WRITE_DATA;
4396 phba->fc4OutputRequests++; 4396 phba->fc4OutputRequests++;
@@ -5022,6 +5022,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata,
5022 lpfc_release_scsi_buf(phba, lpfc_cmd); 5022 lpfc_release_scsi_buf(phba, lpfc_cmd);
5023 return FAILED; 5023 return FAILED;
5024 } 5024 }
5025 iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl;
5025 5026
5026 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, 5027 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
5027 "0702 Issue %s to TGT %d LUN %d " 5028 "0702 Issue %s to TGT %d LUN %d "
@@ -5034,7 +5035,6 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata,
5034 iocbq, iocbqrsp, lpfc_cmd->timeout); 5035 iocbq, iocbqrsp, lpfc_cmd->timeout);
5035 if (status != IOCB_SUCCESS) { 5036 if (status != IOCB_SUCCESS) {
5036 if (status == IOCB_TIMEDOUT) { 5037 if (status == IOCB_TIMEDOUT) {
5037 iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl;
5038 ret = TIMEOUT_ERROR; 5038 ret = TIMEOUT_ERROR;
5039 } else 5039 } else
5040 ret = FAILED; 5040 ret = FAILED;
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 43440ca16f46..0392e114531c 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -6163,6 +6163,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
6163 kfree(vpd); 6163 kfree(vpd);
6164 goto out_free_mbox; 6164 goto out_free_mbox;
6165 } 6165 }
6166
6166 mqe = &mboxq->u.mqe; 6167 mqe = &mboxq->u.mqe;
6167 phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev); 6168 phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev);
6168 if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev)) 6169 if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev))
@@ -6249,6 +6250,16 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
6249 phba->vpd.rev.fcphHigh, phba->vpd.rev.fcphLow, 6250 phba->vpd.rev.fcphHigh, phba->vpd.rev.fcphLow,
6250 phba->vpd.rev.feaLevelHigh, phba->vpd.rev.feaLevelLow); 6251 phba->vpd.rev.feaLevelHigh, phba->vpd.rev.feaLevelLow);
6251 6252
6253 /* Reset the DFT_LUN_Q_DEPTH to (max xri >> 3) */
6254 rc = (phba->sli4_hba.max_cfg_param.max_xri >> 3);
6255 if (phba->pport->cfg_lun_queue_depth > rc) {
6256 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
6257 "3362 LUN queue depth changed from %d to %d\n",
6258 phba->pport->cfg_lun_queue_depth, rc);
6259 phba->pport->cfg_lun_queue_depth = rc;
6260 }
6261
6262
6252 /* 6263 /*
6253 * Discover the port's supported feature set and match it against the 6264 * Discover the port's supported feature set and match it against the
6254 * hosts requests. 6265 * hosts requests.
@@ -9889,6 +9900,24 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba,
9889 struct lpfc_scsi_buf *lpfc_cmd; 9900 struct lpfc_scsi_buf *lpfc_cmd;
9890 9901
9891 spin_lock_irqsave(&phba->hbalock, iflags); 9902 spin_lock_irqsave(&phba->hbalock, iflags);
9903 if (cmdiocbq->iocb_flag & LPFC_IO_WAKE_TMO) {
9904
9905 /*
9906 * A time out has occurred for the iocb. If a time out
9907 * completion handler has been supplied, call it. Otherwise,
9908 * just free the iocbq.
9909 */
9910
9911 spin_unlock_irqrestore(&phba->hbalock, iflags);
9912 cmdiocbq->iocb_cmpl = cmdiocbq->wait_iocb_cmpl;
9913 cmdiocbq->wait_iocb_cmpl = NULL;
9914 if (cmdiocbq->iocb_cmpl)
9915 (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, NULL);
9916 else
9917 lpfc_sli_release_iocbq(phba, cmdiocbq);
9918 return;
9919 }
9920
9892 cmdiocbq->iocb_flag |= LPFC_IO_WAKE; 9921 cmdiocbq->iocb_flag |= LPFC_IO_WAKE;
9893 if (cmdiocbq->context2 && rspiocbq) 9922 if (cmdiocbq->context2 && rspiocbq)
9894 memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb, 9923 memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb,
@@ -9944,10 +9973,16 @@ lpfc_chk_iocb_flg(struct lpfc_hba *phba,
9944 * @timeout: Timeout in number of seconds. 9973 * @timeout: Timeout in number of seconds.
9945 * 9974 *
9946 * This function issues the iocb to firmware and waits for the 9975 * This function issues the iocb to firmware and waits for the
9947 * iocb to complete. If the iocb command is not 9976 * iocb to complete. The iocb_cmpl field of the shall be used
9948 * completed within timeout seconds, it returns IOCB_TIMEDOUT. 9977 * to handle iocbs which time out. If the field is NULL, the
9949 * Caller should not free the iocb resources if this function 9978 * function shall free the iocbq structure. If more clean up is
9950 * returns IOCB_TIMEDOUT. 9979 * needed, the caller is expected to provide a completion function
9980 * that will provide the needed clean up. If the iocb command is
9981 * not completed within timeout seconds, the function will either
9982 * free the iocbq structure (if iocb_cmpl == NULL) or execute the
9983 * completion function set in the iocb_cmpl field and then return
9984 * a status of IOCB_TIMEDOUT. The caller should not free the iocb
9985 * resources if this function returns IOCB_TIMEDOUT.
9951 * The function waits for the iocb completion using an 9986 * The function waits for the iocb completion using an
9952 * non-interruptible wait. 9987 * non-interruptible wait.
9953 * This function will sleep while waiting for iocb completion. 9988 * This function will sleep while waiting for iocb completion.
@@ -9980,6 +10015,9 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba,
9980 int txq_cnt = 0; 10015 int txq_cnt = 0;
9981 int txcmplq_cnt = 0; 10016 int txcmplq_cnt = 0;
9982 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; 10017 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
10018 unsigned long iflags;
10019 bool iocb_completed = true;
10020
9983 /* 10021 /*
9984 * If the caller has provided a response iocbq buffer, then context2 10022 * If the caller has provided a response iocbq buffer, then context2
9985 * is NULL or its an error. 10023 * is NULL or its an error.
@@ -9990,9 +10028,10 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba,
9990 piocb->context2 = prspiocbq; 10028 piocb->context2 = prspiocbq;
9991 } 10029 }
9992 10030
10031 piocb->wait_iocb_cmpl = piocb->iocb_cmpl;
9993 piocb->iocb_cmpl = lpfc_sli_wake_iocb_wait; 10032 piocb->iocb_cmpl = lpfc_sli_wake_iocb_wait;
9994 piocb->context_un.wait_queue = &done_q; 10033 piocb->context_un.wait_queue = &done_q;
9995 piocb->iocb_flag &= ~LPFC_IO_WAKE; 10034 piocb->iocb_flag &= ~(LPFC_IO_WAKE | LPFC_IO_WAKE_TMO);
9996 10035
9997 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { 10036 if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
9998 if (lpfc_readl(phba->HCregaddr, &creg_val)) 10037 if (lpfc_readl(phba->HCregaddr, &creg_val))
@@ -10009,8 +10048,19 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba,
10009 timeleft = wait_event_timeout(done_q, 10048 timeleft = wait_event_timeout(done_q,
10010 lpfc_chk_iocb_flg(phba, piocb, LPFC_IO_WAKE), 10049 lpfc_chk_iocb_flg(phba, piocb, LPFC_IO_WAKE),
10011 timeout_req); 10050 timeout_req);
10051 spin_lock_irqsave(&phba->hbalock, iflags);
10052 if (!(piocb->iocb_flag & LPFC_IO_WAKE)) {
10012 10053
10013 if (piocb->iocb_flag & LPFC_IO_WAKE) { 10054 /*
10055 * IOCB timed out. Inform the wake iocb wait
10056 * completion function and set local status
10057 */
10058
10059 iocb_completed = false;
10060 piocb->iocb_flag |= LPFC_IO_WAKE_TMO;
10061 }
10062 spin_unlock_irqrestore(&phba->hbalock, iflags);
10063 if (iocb_completed) {
10014 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 10064 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
10015 "0331 IOCB wake signaled\n"); 10065 "0331 IOCB wake signaled\n");
10016 } else if (timeleft == 0) { 10066 } else if (timeleft == 0) {
@@ -10122,7 +10172,6 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq,
10122 */ 10172 */
10123 if (pmboxq->mbox_flag & LPFC_MBX_WAKE) { 10173 if (pmboxq->mbox_flag & LPFC_MBX_WAKE) {
10124 retval = MBX_SUCCESS; 10174 retval = MBX_SUCCESS;
10125 lpfc_sli4_swap_str(phba, pmboxq);
10126 } else { 10175 } else {
10127 retval = MBX_TIMEOUT; 10176 retval = MBX_TIMEOUT;
10128 pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 10177 pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
@@ -12820,10 +12869,44 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
12820 wq->page_count); 12869 wq->page_count);
12821 bf_set(lpfc_mbx_wq_create_cq_id, &wq_create->u.request, 12870 bf_set(lpfc_mbx_wq_create_cq_id, &wq_create->u.request,
12822 cq->queue_id); 12871 cq->queue_id);
12872
12873 /* wqv is the earliest version supported, NOT the latest */
12823 bf_set(lpfc_mbox_hdr_version, &shdr->request, 12874 bf_set(lpfc_mbox_hdr_version, &shdr->request,
12824 phba->sli4_hba.pc_sli4_params.wqv); 12875 phba->sli4_hba.pc_sli4_params.wqv);
12825 12876
12826 if (phba->sli4_hba.pc_sli4_params.wqv == LPFC_Q_CREATE_VERSION_1) { 12877 switch (phba->sli4_hba.pc_sli4_params.wqv) {
12878 case LPFC_Q_CREATE_VERSION_0:
12879 switch (wq->entry_size) {
12880 default:
12881 case 64:
12882 /* Nothing to do, version 0 ONLY supports 64 byte */
12883 page = wq_create->u.request.page;
12884 break;
12885 case 128:
12886 if (!(phba->sli4_hba.pc_sli4_params.wqsize &
12887 LPFC_WQ_SZ128_SUPPORT)) {
12888 status = -ERANGE;
12889 goto out;
12890 }
12891 /* If we get here the HBA MUST also support V1 and
12892 * we MUST use it
12893 */
12894 bf_set(lpfc_mbox_hdr_version, &shdr->request,
12895 LPFC_Q_CREATE_VERSION_1);
12896
12897 bf_set(lpfc_mbx_wq_create_wqe_count,
12898 &wq_create->u.request_1, wq->entry_count);
12899 bf_set(lpfc_mbx_wq_create_wqe_size,
12900 &wq_create->u.request_1,
12901 LPFC_WQ_WQE_SIZE_128);
12902 bf_set(lpfc_mbx_wq_create_page_size,
12903 &wq_create->u.request_1,
12904 (PAGE_SIZE/SLI4_PAGE_SIZE));
12905 page = wq_create->u.request_1.page;
12906 break;
12907 }
12908 break;
12909 case LPFC_Q_CREATE_VERSION_1:
12827 bf_set(lpfc_mbx_wq_create_wqe_count, &wq_create->u.request_1, 12910 bf_set(lpfc_mbx_wq_create_wqe_count, &wq_create->u.request_1,
12828 wq->entry_count); 12911 wq->entry_count);
12829 switch (wq->entry_size) { 12912 switch (wq->entry_size) {
@@ -12834,6 +12917,11 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
12834 LPFC_WQ_WQE_SIZE_64); 12917 LPFC_WQ_WQE_SIZE_64);
12835 break; 12918 break;
12836 case 128: 12919 case 128:
12920 if (!(phba->sli4_hba.pc_sli4_params.wqsize &
12921 LPFC_WQ_SZ128_SUPPORT)) {
12922 status = -ERANGE;
12923 goto out;
12924 }
12837 bf_set(lpfc_mbx_wq_create_wqe_size, 12925 bf_set(lpfc_mbx_wq_create_wqe_size,
12838 &wq_create->u.request_1, 12926 &wq_create->u.request_1,
12839 LPFC_WQ_WQE_SIZE_128); 12927 LPFC_WQ_WQE_SIZE_128);
@@ -12842,9 +12930,12 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,
12842 bf_set(lpfc_mbx_wq_create_page_size, &wq_create->u.request_1, 12930 bf_set(lpfc_mbx_wq_create_page_size, &wq_create->u.request_1,
12843 (PAGE_SIZE/SLI4_PAGE_SIZE)); 12931 (PAGE_SIZE/SLI4_PAGE_SIZE));
12844 page = wq_create->u.request_1.page; 12932 page = wq_create->u.request_1.page;
12845 } else { 12933 break;
12846 page = wq_create->u.request.page; 12934 default:
12935 status = -ERANGE;
12936 goto out;
12847 } 12937 }
12938
12848 list_for_each_entry(dmabuf, &wq->page_list, list) { 12939 list_for_each_entry(dmabuf, &wq->page_list, list) {
12849 memset(dmabuf->virt, 0, hw_page_size); 12940 memset(dmabuf->virt, 0, hw_page_size);
12850 page[dmabuf->buffer_tag].addr_lo = putPaddrLow(dmabuf->phys); 12941 page[dmabuf->buffer_tag].addr_lo = putPaddrLow(dmabuf->phys);
@@ -14665,14 +14756,20 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
14665 first_iocbq->iocb.unsli3.rcvsli3.vpi = 14756 first_iocbq->iocb.unsli3.rcvsli3.vpi =
14666 vport->phba->vpi_ids[vport->vpi]; 14757 vport->phba->vpi_ids[vport->vpi];
14667 /* put the first buffer into the first IOCBq */ 14758 /* put the first buffer into the first IOCBq */
14759 tot_len = bf_get(lpfc_rcqe_length,
14760 &seq_dmabuf->cq_event.cqe.rcqe_cmpl);
14761
14668 first_iocbq->context2 = &seq_dmabuf->dbuf; 14762 first_iocbq->context2 = &seq_dmabuf->dbuf;
14669 first_iocbq->context3 = NULL; 14763 first_iocbq->context3 = NULL;
14670 first_iocbq->iocb.ulpBdeCount = 1; 14764 first_iocbq->iocb.ulpBdeCount = 1;
14671 first_iocbq->iocb.un.cont64[0].tus.f.bdeSize = 14765 if (tot_len > LPFC_DATA_BUF_SIZE)
14766 first_iocbq->iocb.un.cont64[0].tus.f.bdeSize =
14672 LPFC_DATA_BUF_SIZE; 14767 LPFC_DATA_BUF_SIZE;
14768 else
14769 first_iocbq->iocb.un.cont64[0].tus.f.bdeSize = tot_len;
14770
14673 first_iocbq->iocb.un.rcvels.remoteID = sid; 14771 first_iocbq->iocb.un.rcvels.remoteID = sid;
14674 tot_len = bf_get(lpfc_rcqe_length, 14772
14675 &seq_dmabuf->cq_event.cqe.rcqe_cmpl);
14676 first_iocbq->iocb.unsli3.rcvsli3.acc_len = tot_len; 14773 first_iocbq->iocb.unsli3.rcvsli3.acc_len = tot_len;
14677 } 14774 }
14678 iocbq = first_iocbq; 14775 iocbq = first_iocbq;
@@ -14688,14 +14785,17 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
14688 if (!iocbq->context3) { 14785 if (!iocbq->context3) {
14689 iocbq->context3 = d_buf; 14786 iocbq->context3 = d_buf;
14690 iocbq->iocb.ulpBdeCount++; 14787 iocbq->iocb.ulpBdeCount++;
14691 pbde = (struct ulp_bde64 *)
14692 &iocbq->iocb.unsli3.sli3Words[4];
14693 pbde->tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
14694
14695 /* We need to get the size out of the right CQE */ 14788 /* We need to get the size out of the right CQE */
14696 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); 14789 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
14697 len = bf_get(lpfc_rcqe_length, 14790 len = bf_get(lpfc_rcqe_length,
14698 &hbq_buf->cq_event.cqe.rcqe_cmpl); 14791 &hbq_buf->cq_event.cqe.rcqe_cmpl);
14792 pbde = (struct ulp_bde64 *)
14793 &iocbq->iocb.unsli3.sli3Words[4];
14794 if (len > LPFC_DATA_BUF_SIZE)
14795 pbde->tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
14796 else
14797 pbde->tus.f.bdeSize = len;
14798
14699 iocbq->iocb.unsli3.rcvsli3.acc_len += len; 14799 iocbq->iocb.unsli3.rcvsli3.acc_len += len;
14700 tot_len += len; 14800 tot_len += len;
14701 } else { 14801 } else {
@@ -14710,16 +14810,19 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
14710 lpfc_in_buf_free(vport->phba, d_buf); 14810 lpfc_in_buf_free(vport->phba, d_buf);
14711 continue; 14811 continue;
14712 } 14812 }
14813 /* We need to get the size out of the right CQE */
14814 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
14815 len = bf_get(lpfc_rcqe_length,
14816 &hbq_buf->cq_event.cqe.rcqe_cmpl);
14713 iocbq->context2 = d_buf; 14817 iocbq->context2 = d_buf;
14714 iocbq->context3 = NULL; 14818 iocbq->context3 = NULL;
14715 iocbq->iocb.ulpBdeCount = 1; 14819 iocbq->iocb.ulpBdeCount = 1;
14716 iocbq->iocb.un.cont64[0].tus.f.bdeSize = 14820 if (len > LPFC_DATA_BUF_SIZE)
14821 iocbq->iocb.un.cont64[0].tus.f.bdeSize =
14717 LPFC_DATA_BUF_SIZE; 14822 LPFC_DATA_BUF_SIZE;
14823 else
14824 iocbq->iocb.un.cont64[0].tus.f.bdeSize = len;
14718 14825
14719 /* We need to get the size out of the right CQE */
14720 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
14721 len = bf_get(lpfc_rcqe_length,
14722 &hbq_buf->cq_event.cqe.rcqe_cmpl);
14723 tot_len += len; 14826 tot_len += len;
14724 iocbq->iocb.unsli3.rcvsli3.acc_len = tot_len; 14827 iocbq->iocb.unsli3.rcvsli3.acc_len = tot_len;
14725 14828
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
index 9d2e0c6fe334..97617996206d 100644
--- a/drivers/scsi/lpfc/lpfc_sli.h
+++ b/drivers/scsi/lpfc/lpfc_sli.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2013 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -60,7 +60,8 @@ struct lpfc_iocbq {
60 uint8_t retry; /* retry counter for IOCB cmd - if needed */ 60 uint8_t retry; /* retry counter for IOCB cmd - if needed */
61 uint16_t iocb_flag; 61 uint16_t iocb_flag;
62#define LPFC_IO_LIBDFC 1 /* libdfc iocb */ 62#define LPFC_IO_LIBDFC 1 /* libdfc iocb */
63#define LPFC_IO_WAKE 2 /* High Priority Queue signal flag */ 63#define LPFC_IO_WAKE 2 /* Synchronous I/O completed */
64#define LPFC_IO_WAKE_TMO LPFC_IO_WAKE /* Synchronous I/O timed out */
64#define LPFC_IO_FCP 4 /* FCP command -- iocbq in scsi_buf */ 65#define LPFC_IO_FCP 4 /* FCP command -- iocbq in scsi_buf */
65#define LPFC_DRIVER_ABORTED 8 /* driver aborted this request */ 66#define LPFC_DRIVER_ABORTED 8 /* driver aborted this request */
66#define LPFC_IO_FABRIC 0x10 /* Iocb send using fabric scheduler */ 67#define LPFC_IO_FABRIC 0x10 /* Iocb send using fabric scheduler */
@@ -93,6 +94,8 @@ struct lpfc_iocbq {
93 94
94 void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, 95 void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
95 struct lpfc_iocbq *); 96 struct lpfc_iocbq *);
97 void (*wait_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
98 struct lpfc_iocbq *);
96 void (*iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, 99 void (*iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
97 struct lpfc_iocbq *); 100 struct lpfc_iocbq *);
98}; 101};
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index d710b87a4417..5bcc38223ac9 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -117,6 +117,7 @@ union sli4_qe {
117 struct lpfc_rcqe_complete *rcqe_complete; 117 struct lpfc_rcqe_complete *rcqe_complete;
118 struct lpfc_mqe *mqe; 118 struct lpfc_mqe *mqe;
119 union lpfc_wqe *wqe; 119 union lpfc_wqe *wqe;
120 union lpfc_wqe128 *wqe128;
120 struct lpfc_rqe *rqe; 121 struct lpfc_rqe *rqe;
121}; 122};
122 123
@@ -325,12 +326,14 @@ struct lpfc_bmbx {
325#define LPFC_EQE_SIZE_16B 16 326#define LPFC_EQE_SIZE_16B 16
326#define LPFC_CQE_SIZE 16 327#define LPFC_CQE_SIZE 16
327#define LPFC_WQE_SIZE 64 328#define LPFC_WQE_SIZE 64
329#define LPFC_WQE128_SIZE 128
328#define LPFC_MQE_SIZE 256 330#define LPFC_MQE_SIZE 256
329#define LPFC_RQE_SIZE 8 331#define LPFC_RQE_SIZE 8
330 332
331#define LPFC_EQE_DEF_COUNT 1024 333#define LPFC_EQE_DEF_COUNT 1024
332#define LPFC_CQE_DEF_COUNT 1024 334#define LPFC_CQE_DEF_COUNT 1024
333#define LPFC_WQE_DEF_COUNT 256 335#define LPFC_WQE_DEF_COUNT 256
336#define LPFC_WQE128_DEF_COUNT 128
334#define LPFC_MQE_DEF_COUNT 16 337#define LPFC_MQE_DEF_COUNT 16
335#define LPFC_RQE_DEF_COUNT 512 338#define LPFC_RQE_DEF_COUNT 512
336 339
@@ -416,6 +419,9 @@ struct lpfc_pc_sli4_params {
416 uint8_t mqv; 419 uint8_t mqv;
417 uint8_t wqv; 420 uint8_t wqv;
418 uint8_t rqv; 421 uint8_t rqv;
422 uint8_t wqsize;
423#define LPFC_WQ_SZ64_SUPPORT 1
424#define LPFC_WQ_SZ128_SUPPORT 2
419}; 425};
420 426
421struct lpfc_iov { 427struct lpfc_iov {
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index c6c32eebf3dd..21859d2006ce 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,7 +18,7 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define LPFC_DRIVER_VERSION "8.3.40" 21#define LPFC_DRIVER_VERSION "8.3.41"
22#define LPFC_DRIVER_NAME "lpfc" 22#define LPFC_DRIVER_NAME "lpfc"
23 23
24/* Used for SLI 2/3 */ 24/* Used for SLI 2/3 */
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index e28e431564b0..a87ee33f4f2a 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2008 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2013 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -387,6 +387,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
387 /* Create binary sysfs attribute for vport */ 387 /* Create binary sysfs attribute for vport */
388 lpfc_alloc_sysfs_attr(vport); 388 lpfc_alloc_sysfs_attr(vport);
389 389
390 /* Set the DFT_LUN_Q_DEPTH accordingly */
391 vport->cfg_lun_queue_depth = phba->pport->cfg_lun_queue_depth;
392
390 *(struct lpfc_vport **)fc_vport->dd_data = vport; 393 *(struct lpfc_vport **)fc_vport->dd_data = vport;
391 vport->fc_vport = fc_vport; 394 vport->fc_vport = fc_vport;
392 395