aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2009-10-02 15:16:51 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:01:41 -0500
commit6a9c52cf22e4ca13816bb2bd9899129cd4445de7 (patch)
tree02c44960d58fbaada692062ed96287425d0cd853
parent6669f9bb902b8c3f5e33cb8c32c8c0eec6ed68ed (diff)
[SCSI] lpfc 8.3.5: fix sysfs parameters, vport creation and other bugs and update logging
This patch include the following fixes and changes: - Fix crash when "error" is echoed to board_mode sysfs parameter - Fix FCoE Parameter parsing in regions 23 - Fix driver crash when creating vport with large number of targets on SLI4 - Fix bug with npiv message being logged when it is not supported by the adapter - Fix a potential dereferencing mailbox structure after free bug - Fix firmware crash after vport create with high target count - Error out requests to set board_mode to warm restart via sysfs on SLI4 HBAs - Fix Block guard logging - Fix a memory corruption issue during GID_FT IO prep - Fix crash while processing unsolicited FC frames - Fix failed to allocate XRI message is not a critical failure - Update and fix formatting in some log messages - Fix missing new line characters in log messages - Removed the use of the locally defined FC transport layer related macros - Check the rsplen in lpfc_handle_fcp_err function before using rsplen Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c15
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c5
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c19
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c10
-rw-r--r--drivers/scsi/lpfc/lpfc_disc.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c13
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h15
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c54
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c11
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c180
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c85
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h2
12 files changed, 214 insertions, 197 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 07f0172674c9..e058f1018ff2 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -29,6 +29,7 @@
29#include <scsi/scsi_host.h> 29#include <scsi/scsi_host.h>
30#include <scsi/scsi_tcq.h> 30#include <scsi/scsi_tcq.h>
31#include <scsi/scsi_transport_fc.h> 31#include <scsi/scsi_transport_fc.h>
32#include <scsi/fc/fc_fs.h>
32 33
33#include "lpfc_hw4.h" 34#include "lpfc_hw4.h"
34#include "lpfc_hw.h" 35#include "lpfc_hw.h"
@@ -762,9 +763,15 @@ lpfc_board_mode_store(struct device *dev, struct device_attribute *attr,
762 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) 763 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0)
763 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); 764 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
764 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) 765 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0)
765 status = lpfc_do_offline(phba, LPFC_EVT_WARM_START); 766 if (phba->sli_rev == LPFC_SLI_REV4)
767 return -EINVAL;
768 else
769 status = lpfc_do_offline(phba, LPFC_EVT_WARM_START);
766 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) 770 else if (strncmp(buf, "error", sizeof("error") - 1) == 0)
767 status = lpfc_do_offline(phba, LPFC_EVT_KILL); 771 if (phba->sli_rev == LPFC_SLI_REV4)
772 return -EINVAL;
773 else
774 status = lpfc_do_offline(phba, LPFC_EVT_KILL);
768 else 775 else
769 return -EINVAL; 776 return -EINVAL;
770 777
@@ -2846,7 +2853,7 @@ LPFC_ATTR_R(multi_ring_support, 1, 1, 2, "Determines number of primary "
2846# identifies what rctl value to configure the additional ring for. 2853# identifies what rctl value to configure the additional ring for.
2847# Value range is [1,0xff]. Default value is 4 (Unsolicated Data). 2854# Value range is [1,0xff]. Default value is 4 (Unsolicated Data).
2848*/ 2855*/
2849LPFC_ATTR_R(multi_ring_rctl, FC_UNSOL_DATA, 1, 2856LPFC_ATTR_R(multi_ring_rctl, FC_RCTL_DD_UNSOL_DATA, 1,
2850 255, "Identifies RCTL for additional ring configuration"); 2857 255, "Identifies RCTL for additional ring configuration");
2851 2858
2852/* 2859/*
@@ -2854,7 +2861,7 @@ LPFC_ATTR_R(multi_ring_rctl, FC_UNSOL_DATA, 1,
2854# identifies what type value to configure the additional ring for. 2861# identifies what type value to configure the additional ring for.
2855# Value range is [1,0xff]. Default value is 5 (LLC/SNAP). 2862# Value range is [1,0xff]. Default value is 5 (LLC/SNAP).
2856*/ 2863*/
2857LPFC_ATTR_R(multi_ring_type, FC_LLC_SNAP, 1, 2864LPFC_ATTR_R(multi_ring_type, FC_TYPE_IP, 1,
2858 255, "Identifies TYPE for additional ring configuration"); 2865 255, "Identifies TYPE for additional ring configuration");
2859 2866
2860/* 2867/*
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index da6bf5aac9dd..a5d9048235d9 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -26,6 +26,7 @@
26#include <scsi/scsi_host.h> 26#include <scsi/scsi_host.h>
27#include <scsi/scsi_transport_fc.h> 27#include <scsi/scsi_transport_fc.h>
28#include <scsi/scsi_bsg_fc.h> 28#include <scsi/scsi_bsg_fc.h>
29#include <scsi/fc/fc_fs.h>
29 30
30#include "lpfc_hw4.h" 31#include "lpfc_hw4.h"
31#include "lpfc_hw.h" 32#include "lpfc_hw.h"
@@ -148,8 +149,8 @@ lpfc_bsg_rport_ct(struct fc_bsg_job *job)
148 cmd->ulpCommand = CMD_GEN_REQUEST64_CR; 149 cmd->ulpCommand = CMD_GEN_REQUEST64_CR;
149 cmd->un.genreq64.w5.hcsw.Fctl = (SI | LA); 150 cmd->un.genreq64.w5.hcsw.Fctl = (SI | LA);
150 cmd->un.genreq64.w5.hcsw.Dfctl = 0; 151 cmd->un.genreq64.w5.hcsw.Dfctl = 0;
151 cmd->un.genreq64.w5.hcsw.Rctl = FC_UNSOL_CTL; 152 cmd->un.genreq64.w5.hcsw.Rctl = FC_RCTL_DD_UNSOL_CTL;
152 cmd->un.genreq64.w5.hcsw.Type = FC_COMMON_TRANSPORT_ULP; 153 cmd->un.genreq64.w5.hcsw.Type = FC_TYPE_CT;
153 cmd->ulpBdeCount = 1; 154 cmd->ulpBdeCount = 1;
154 cmd->ulpLe = 1; 155 cmd->ulpLe = 1;
155 cmd->ulpClass = CLASS3; 156 cmd->ulpClass = CLASS3;
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index e724048bf390..0ebcd9baca79 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -31,6 +31,7 @@
31#include <scsi/scsi_device.h> 31#include <scsi/scsi_device.h>
32#include <scsi/scsi_host.h> 32#include <scsi/scsi_host.h>
33#include <scsi/scsi_transport_fc.h> 33#include <scsi/scsi_transport_fc.h>
34#include <scsi/fc/fc_fs.h>
34 35
35#include "lpfc_hw4.h" 36#include "lpfc_hw4.h"
36#include "lpfc_hw.h" 37#include "lpfc_hw.h"
@@ -336,8 +337,8 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,
336 /* Fill in rest of iocb */ 337 /* Fill in rest of iocb */
337 icmd->un.genreq64.w5.hcsw.Fctl = (SI | LA); 338 icmd->un.genreq64.w5.hcsw.Fctl = (SI | LA);
338 icmd->un.genreq64.w5.hcsw.Dfctl = 0; 339 icmd->un.genreq64.w5.hcsw.Dfctl = 0;
339 icmd->un.genreq64.w5.hcsw.Rctl = FC_UNSOL_CTL; 340 icmd->un.genreq64.w5.hcsw.Rctl = FC_RCTL_DD_UNSOL_CTL;
340 icmd->un.genreq64.w5.hcsw.Type = FC_COMMON_TRANSPORT_ULP; 341 icmd->un.genreq64.w5.hcsw.Type = FC_TYPE_CT;
341 342
342 if (!tmo) { 343 if (!tmo) {
343 /* FC spec states we need 3 * ratov for CT requests */ 344 /* FC spec states we need 3 * ratov for CT requests */
@@ -395,9 +396,14 @@ lpfc_ct_cmd(struct lpfc_vport *vport, struct lpfc_dmabuf *inmp,
395 outmp = lpfc_alloc_ct_rsp(phba, cmdcode, bpl, rsp_size, &cnt); 396 outmp = lpfc_alloc_ct_rsp(phba, cmdcode, bpl, rsp_size, &cnt);
396 if (!outmp) 397 if (!outmp)
397 return -ENOMEM; 398 return -ENOMEM;
398 399 /*
400 * Form the CT IOCB. The total number of BDEs in this IOCB
401 * is the single command plus response count from
402 * lpfc_alloc_ct_rsp.
403 */
404 cnt += 1;
399 status = lpfc_gen_req(vport, bmp, inmp, outmp, cmpl, ndlp, 0, 405 status = lpfc_gen_req(vport, bmp, inmp, outmp, cmpl, ndlp, 0,
400 cnt+1, 0, retry); 406 cnt, 0, retry);
401 if (status) { 407 if (status) {
402 lpfc_free_ct_rsp(phba, outmp); 408 lpfc_free_ct_rsp(phba, outmp);
403 return -ENOMEM; 409 return -ENOMEM;
@@ -533,6 +539,9 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
533 SLI_CTNS_GFF_ID, 539 SLI_CTNS_GFF_ID,
534 0, Did) == 0) 540 0, Did) == 0)
535 vport->num_disc_nodes++; 541 vport->num_disc_nodes++;
542 else
543 lpfc_setup_disc_node
544 (vport, Did);
536 } 545 }
537 else { 546 else {
538 lpfc_debugfs_disc_trc(vport, 547 lpfc_debugfs_disc_trc(vport,
@@ -1241,7 +1250,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1241 be16_to_cpu(SLI_CTNS_RFF_ID); 1250 be16_to_cpu(SLI_CTNS_RFF_ID);
1242 CtReq->un.rff.PortId = cpu_to_be32(vport->fc_myDID); 1251 CtReq->un.rff.PortId = cpu_to_be32(vport->fc_myDID);
1243 CtReq->un.rff.fbits = FC4_FEATURE_INIT; 1252 CtReq->un.rff.fbits = FC4_FEATURE_INIT;
1244 CtReq->un.rff.type_code = FC_FCP_DATA; 1253 CtReq->un.rff.type_code = FC_TYPE_FCP;
1245 cmpl = lpfc_cmpl_ct_cmd_rff_id; 1254 cmpl = lpfc_cmpl_ct_cmd_rff_id;
1246 break; 1255 break;
1247 } 1256 }
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 8d0f0de76b63..391584183d81 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -926,7 +926,7 @@ lpfc_debugfs_dumpData_open(struct inode *inode, struct file *file)
926 goto out; 926 goto out;
927 927
928 /* Round to page boundry */ 928 /* Round to page boundry */
929 printk(KERN_ERR "BLKGRD %s: _dump_buf_data=0x%p\n", 929 printk(KERN_ERR "9059 BLKGRD: %s: _dump_buf_data=0x%p\n",
930 __func__, _dump_buf_data); 930 __func__, _dump_buf_data);
931 debug->buffer = _dump_buf_data; 931 debug->buffer = _dump_buf_data;
932 if (!debug->buffer) { 932 if (!debug->buffer) {
@@ -956,8 +956,8 @@ lpfc_debugfs_dumpDif_open(struct inode *inode, struct file *file)
956 goto out; 956 goto out;
957 957
958 /* Round to page boundry */ 958 /* Round to page boundry */
959 printk(KERN_ERR "BLKGRD %s: _dump_buf_dif=0x%p file=%s\n", __func__, 959 printk(KERN_ERR "9060 BLKGRD: %s: _dump_buf_dif=0x%p file=%s\n",
960 _dump_buf_dif, file->f_dentry->d_name.name); 960 __func__, _dump_buf_dif, file->f_dentry->d_name.name);
961 debug->buffer = _dump_buf_dif; 961 debug->buffer = _dump_buf_dif;
962 if (!debug->buffer) { 962 if (!debug->buffer) {
963 kfree(debug); 963 kfree(debug);
@@ -1377,7 +1377,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
1377 debugfs_create_dir(name, phba->hba_debugfs_root); 1377 debugfs_create_dir(name, phba->hba_debugfs_root);
1378 if (!vport->vport_debugfs_root) { 1378 if (!vport->vport_debugfs_root) {
1379 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, 1379 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1380 "0417 Cant create debugfs"); 1380 "0417 Cant create debugfs\n");
1381 goto debug_failed; 1381 goto debug_failed;
1382 } 1382 }
1383 atomic_inc(&phba->debugfs_vport_count); 1383 atomic_inc(&phba->debugfs_vport_count);
@@ -1430,7 +1430,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
1430 vport, &lpfc_debugfs_op_nodelist); 1430 vport, &lpfc_debugfs_op_nodelist);
1431 if (!vport->debug_nodelist) { 1431 if (!vport->debug_nodelist) {
1432 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, 1432 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
1433 "0409 Cant create debugfs nodelist"); 1433 "0409 Cant create debugfs nodelist\n");
1434 goto debug_failed; 1434 goto debug_failed;
1435 } 1435 }
1436debug_failed: 1436debug_failed:
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
index 1142070e9484..f26f6e160a2a 100644
--- a/drivers/scsi/lpfc/lpfc_disc.h
+++ b/drivers/scsi/lpfc/lpfc_disc.h
@@ -19,7 +19,7 @@
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define FC_MAX_HOLD_RSCN 32 /* max number of deferred RSCNs */ 21#define FC_MAX_HOLD_RSCN 32 /* max number of deferred RSCNs */
22#define FC_MAX_NS_RSP 65536 /* max size NameServer rsp */ 22#define FC_MAX_NS_RSP 64512 /* max size NameServer rsp */
23#define FC_MAXLOOP 126 /* max devices supported on a fc loop */ 23#define FC_MAXLOOP 126 /* max devices supported on a fc loop */
24#define LPFC_DISC_FLOGI_TMO 10 /* Discovery FLOGI ratov */ 24#define LPFC_DISC_FLOGI_TMO 10 /* Discovery FLOGI ratov */
25 25
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 1b2771ac15f2..e8689cabe5f7 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1699,9 +1699,8 @@ lpfc_init_vpi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1699 lpfc_initial_fdisc(vport); 1699 lpfc_initial_fdisc(vport);
1700 else { 1700 else {
1701 lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); 1701 lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP);
1702 lpfc_printf_vlog(vport, KERN_ERR, 1702 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
1703 LOG_ELS, 1703 "2606 No NPIV Fabric support\n");
1704 "2606 No NPIV Fabric support\n");
1705 } 1704 }
1706 return; 1705 return;
1707} 1706}
@@ -1901,7 +1900,10 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
1901 if (phba->fc_topology == TOPOLOGY_LOOP) { 1900 if (phba->fc_topology == TOPOLOGY_LOOP) {
1902 phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED; 1901 phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED;
1903 1902
1904 if (phba->cfg_enable_npiv) 1903 /* if npiv is enabled and this adapter supports npiv log
1904 * a message that npiv is not supported in this topology
1905 */
1906 if (phba->cfg_enable_npiv && phba->max_vpi)
1905 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, 1907 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
1906 "1309 Link Up Event npiv not supported in loop " 1908 "1309 Link Up Event npiv not supported in loop "
1907 "topology\n"); 1909 "topology\n");
@@ -3118,7 +3120,7 @@ lpfc_no_rpi(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
3118 struct lpfc_sli *psli; 3120 struct lpfc_sli *psli;
3119 struct lpfc_sli_ring *pring; 3121 struct lpfc_sli_ring *pring;
3120 struct lpfc_iocbq *iocb, *next_iocb; 3122 struct lpfc_iocbq *iocb, *next_iocb;
3121 uint32_t rpi, i; 3123 uint32_t i;
3122 3124
3123 lpfc_fabric_abort_nport(ndlp); 3125 lpfc_fabric_abort_nport(ndlp);
3124 3126
@@ -3127,7 +3129,6 @@ lpfc_no_rpi(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
3127 * by firmware with a no rpi error. 3129 * by firmware with a no rpi error.
3128 */ 3130 */
3129 psli = &phba->sli; 3131 psli = &phba->sli;
3130 rpi = ndlp->nlp_rpi;
3131 if (ndlp->nlp_flag & NLP_RPI_VALID) { 3132 if (ndlp->nlp_flag & NLP_RPI_VALID) {
3132 /* Now process each ring */ 3133 /* Now process each ring */
3133 for (i = 0; i < psli->num_rings; i++) { 3134 for (i = 0; i < psli->num_rings; i++) {
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 74f9f028b45f..8274f998ef2f 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -1124,21 +1124,6 @@ typedef struct {
1124/* Number of 4-byte words in an IOCB. */ 1124/* Number of 4-byte words in an IOCB. */
1125#define IOCB_WORD_SZ 8 1125#define IOCB_WORD_SZ 8
1126 1126
1127/* defines for type field in fc header */
1128#define FC_ELS_DATA 0x1
1129#define FC_LLC_SNAP 0x5
1130#define FC_FCP_DATA 0x8
1131#define FC_COMMON_TRANSPORT_ULP 0x20
1132
1133/* defines for rctl field in fc header */
1134#define FC_DEV_DATA 0x0
1135#define FC_UNSOL_CTL 0x2
1136#define FC_SOL_CTL 0x3
1137#define FC_UNSOL_DATA 0x4
1138#define FC_FCP_CMND 0x6
1139#define FC_ELS_REQ 0x22
1140#define FC_ELS_RSP 0x23
1141
1142/* network headers for Dfctl field */ 1127/* network headers for Dfctl field */
1143#define FC_NET_HDR 0x20 1128#define FC_NET_HDR 0x20
1144 1129
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a7b5566ea0b5..12ab1eae47f9 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -3004,12 +3004,11 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3004 spin_unlock_irq(&phba->hbalock); 3004 spin_unlock_irq(&phba->hbalock);
3005 3005
3006 /* Read the FCF table and re-discover SAN. */ 3006 /* Read the FCF table and re-discover SAN. */
3007 rc = lpfc_sli4_read_fcf_record(phba, 3007 rc = lpfc_sli4_read_fcf_record(phba, LPFC_FCOE_FCF_GET_FIRST);
3008 LPFC_FCOE_FCF_GET_FIRST);
3009 if (rc) 3008 if (rc)
3010 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 3009 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
3011 "2547 Read FCF record failed 0x%x\n", 3010 "2547 Read FCF record failed 0x%x\n",
3012 rc); 3011 rc);
3013 break; 3012 break;
3014 3013
3015 case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL: 3014 case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL:
@@ -3021,7 +3020,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3021 3020
3022 case LPFC_FCOE_EVENT_TYPE_FCF_DEAD: 3021 case LPFC_FCOE_EVENT_TYPE_FCF_DEAD:
3023 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 3022 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
3024 "2549 FCF disconnected fron network index 0x%x" 3023 "2549 FCF disconnected from network index 0x%x"
3025 " tag 0x%x\n", acqe_fcoe->index, 3024 " tag 0x%x\n", acqe_fcoe->index,
3026 acqe_fcoe->event_tag); 3025 acqe_fcoe->event_tag);
3027 /* If the event is not for currently used fcf do nothing */ 3026 /* If the event is not for currently used fcf do nothing */
@@ -3917,7 +3916,7 @@ lpfc_free_sgl_list(struct lpfc_hba *phba)
3917 rc = lpfc_sli4_remove_all_sgl_pages(phba); 3916 rc = lpfc_sli4_remove_all_sgl_pages(phba);
3918 if (rc) { 3917 if (rc) {
3919 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 3918 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3920 "2005 Unable to deregister pages from HBA: %x", rc); 3919 "2005 Unable to deregister pages from HBA: %x\n", rc);
3921 } 3920 }
3922 kfree(phba->sli4_hba.lpfc_els_sgl_array); 3921 kfree(phba->sli4_hba.lpfc_els_sgl_array);
3923} 3922}
@@ -4366,7 +4365,8 @@ lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost)
4366 _dump_buf_data = 4365 _dump_buf_data =
4367 (char *) __get_free_pages(GFP_KERNEL, pagecnt); 4366 (char *) __get_free_pages(GFP_KERNEL, pagecnt);
4368 if (_dump_buf_data) { 4367 if (_dump_buf_data) {
4369 printk(KERN_ERR "BLKGRD allocated %d pages for " 4368 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
4369 "9043 BLKGRD: allocated %d pages for "
4370 "_dump_buf_data at 0x%p\n", 4370 "_dump_buf_data at 0x%p\n",
4371 (1 << pagecnt), _dump_buf_data); 4371 (1 << pagecnt), _dump_buf_data);
4372 _dump_buf_data_order = pagecnt; 4372 _dump_buf_data_order = pagecnt;
@@ -4377,17 +4377,20 @@ lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost)
4377 --pagecnt; 4377 --pagecnt;
4378 } 4378 }
4379 if (!_dump_buf_data_order) 4379 if (!_dump_buf_data_order)
4380 printk(KERN_ERR "BLKGRD ERROR unable to allocate " 4380 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
4381 "9044 BLKGRD: ERROR unable to allocate "
4381 "memory for hexdump\n"); 4382 "memory for hexdump\n");
4382 } else 4383 } else
4383 printk(KERN_ERR "BLKGRD already allocated _dump_buf_data=0x%p" 4384 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
4385 "9045 BLKGRD: already allocated _dump_buf_data=0x%p"
4384 "\n", _dump_buf_data); 4386 "\n", _dump_buf_data);
4385 if (!_dump_buf_dif) { 4387 if (!_dump_buf_dif) {
4386 while (pagecnt) { 4388 while (pagecnt) {
4387 _dump_buf_dif = 4389 _dump_buf_dif =
4388 (char *) __get_free_pages(GFP_KERNEL, pagecnt); 4390 (char *) __get_free_pages(GFP_KERNEL, pagecnt);
4389 if (_dump_buf_dif) { 4391 if (_dump_buf_dif) {
4390 printk(KERN_ERR "BLKGRD allocated %d pages for " 4392 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
4393 "9046 BLKGRD: allocated %d pages for "
4391 "_dump_buf_dif at 0x%p\n", 4394 "_dump_buf_dif at 0x%p\n",
4392 (1 << pagecnt), _dump_buf_dif); 4395 (1 << pagecnt), _dump_buf_dif);
4393 _dump_buf_dif_order = pagecnt; 4396 _dump_buf_dif_order = pagecnt;
@@ -4398,10 +4401,12 @@ lpfc_setup_bg(struct lpfc_hba *phba, struct Scsi_Host *shost)
4398 --pagecnt; 4401 --pagecnt;
4399 } 4402 }
4400 if (!_dump_buf_dif_order) 4403 if (!_dump_buf_dif_order)
4401 printk(KERN_ERR "BLKGRD ERROR unable to allocate " 4404 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
4405 "9047 BLKGRD: ERROR unable to allocate "
4402 "memory for hexdump\n"); 4406 "memory for hexdump\n");
4403 } else 4407 } else
4404 printk(KERN_ERR "BLKGRD already allocated _dump_buf_dif=0x%p\n", 4408 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
4409 "9048 BLKGRD: already allocated _dump_buf_dif=0x%p\n",
4405 _dump_buf_dif); 4410 _dump_buf_dif);
4406} 4411}
4407 4412
@@ -5072,10 +5077,9 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba)
5072 /* It does not make sense to have more EQs than WQs */ 5077 /* It does not make sense to have more EQs than WQs */
5073 if (cfg_fcp_eq_count > phba->cfg_fcp_wq_count) { 5078 if (cfg_fcp_eq_count > phba->cfg_fcp_wq_count) {
5074 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, 5079 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
5075 "2593 The number of FCP EQs (%d) is more " 5080 "2593 The FCP EQ count(%d) cannot be greater "
5076 "than the number of FCP WQs (%d), take " 5081 "than the FCP WQ count(%d), limiting the "
5077 "the number of FCP EQs same as than of " 5082 "FCP EQ count to %d\n", cfg_fcp_eq_count,
5078 "WQs (%d)\n", cfg_fcp_eq_count,
5079 phba->cfg_fcp_wq_count, 5083 phba->cfg_fcp_wq_count,
5080 phba->cfg_fcp_wq_count); 5084 phba->cfg_fcp_wq_count);
5081 cfg_fcp_eq_count = phba->cfg_fcp_wq_count; 5085 cfg_fcp_eq_count = phba->cfg_fcp_wq_count;
@@ -7271,15 +7275,15 @@ lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba)
7271 7275
7272 if (phba->sli_rev == LPFC_SLI_REV4) { 7276 if (phba->sli_rev == LPFC_SLI_REV4) {
7273 if (max_xri <= 100) 7277 if (max_xri <= 100)
7274 return 4; 7278 return 10;
7275 else if (max_xri <= 256) 7279 else if (max_xri <= 256)
7276 return 8; 7280 return 25;
7277 else if (max_xri <= 512) 7281 else if (max_xri <= 512)
7278 return 16; 7282 return 50;
7279 else if (max_xri <= 1024) 7283 else if (max_xri <= 1024)
7280 return 32; 7284 return 100;
7281 else 7285 else
7282 return 48; 7286 return 150;
7283 } else 7287 } else
7284 return 0; 7288 return 0;
7285} 7289}
@@ -8117,15 +8121,15 @@ lpfc_exit(void)
8117 if (lpfc_enable_npiv) 8121 if (lpfc_enable_npiv)
8118 fc_release_transport(lpfc_vport_transport_template); 8122 fc_release_transport(lpfc_vport_transport_template);
8119 if (_dump_buf_data) { 8123 if (_dump_buf_data) {
8120 printk(KERN_ERR "BLKGRD freeing %lu pages for _dump_buf_data " 8124 printk(KERN_ERR "9062 BLKGRD: freeing %lu pages for "
8121 "at 0x%p\n", 8125 "_dump_buf_data at 0x%p\n",
8122 (1L << _dump_buf_data_order), _dump_buf_data); 8126 (1L << _dump_buf_data_order), _dump_buf_data);
8123 free_pages((unsigned long)_dump_buf_data, _dump_buf_data_order); 8127 free_pages((unsigned long)_dump_buf_data, _dump_buf_data_order);
8124 } 8128 }
8125 8129
8126 if (_dump_buf_dif) { 8130 if (_dump_buf_dif) {
8127 printk(KERN_ERR "BLKGRD freeing %lu pages for _dump_buf_dif " 8131 printk(KERN_ERR "9049 BLKGRD: freeing %lu pages for "
8128 "at 0x%p\n", 8132 "_dump_buf_dif at 0x%p\n",
8129 (1L << _dump_buf_dif_order), _dump_buf_dif); 8133 (1L << _dump_buf_dif_order), _dump_buf_dif);
8130 free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order); 8134 free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order);
8131 } 8135 }
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 2a38d94654bc..500a6b6e778e 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -25,8 +25,8 @@
25 25
26#include <scsi/scsi_device.h> 26#include <scsi/scsi_device.h>
27#include <scsi/scsi_transport_fc.h> 27#include <scsi/scsi_transport_fc.h>
28
29#include <scsi/scsi.h> 28#include <scsi/scsi.h>
29#include <scsi/fc/fc_fs.h>
30 30
31#include "lpfc_hw4.h" 31#include "lpfc_hw4.h"
32#include "lpfc_hw.h" 32#include "lpfc_hw.h"
@@ -1135,7 +1135,7 @@ lpfc_config_ring(struct lpfc_hba * phba, int ring, LPFC_MBOXQ_t * pmb)
1135 /* Otherwise we setup specific rctl / type masks for this ring */ 1135 /* Otherwise we setup specific rctl / type masks for this ring */
1136 for (i = 0; i < pring->num_mask; i++) { 1136 for (i = 0; i < pring->num_mask; i++) {
1137 mb->un.varCfgRing.rrRegs[i].rval = pring->prt[i].rctl; 1137 mb->un.varCfgRing.rrRegs[i].rval = pring->prt[i].rctl;
1138 if (mb->un.varCfgRing.rrRegs[i].rval != FC_ELS_REQ) 1138 if (mb->un.varCfgRing.rrRegs[i].rval != FC_RCTL_ELS_REQ)
1139 mb->un.varCfgRing.rrRegs[i].rmask = 0xff; 1139 mb->un.varCfgRing.rrRegs[i].rmask = 0xff;
1140 else 1140 else
1141 mb->un.varCfgRing.rrRegs[i].rmask = 0xfe; 1141 mb->un.varCfgRing.rrRegs[i].rmask = 0xfe;
@@ -1657,9 +1657,12 @@ lpfc_sli4_config(struct lpfc_hba *phba, struct lpfcMboxq *mbox,
1657 /* Allocate record for keeping SGE virtual addresses */ 1657 /* Allocate record for keeping SGE virtual addresses */
1658 mbox->sge_array = kmalloc(sizeof(struct lpfc_mbx_nembed_sge_virt), 1658 mbox->sge_array = kmalloc(sizeof(struct lpfc_mbx_nembed_sge_virt),
1659 GFP_KERNEL); 1659 GFP_KERNEL);
1660 if (!mbox->sge_array) 1660 if (!mbox->sge_array) {
1661 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
1662 "2527 Failed to allocate non-embedded SGE "
1663 "array.\n");
1661 return 0; 1664 return 0;
1662 1665 }
1663 for (pagen = 0, alloc_len = 0; pagen < pcount; pagen++) { 1666 for (pagen = 0, alloc_len = 0; pagen < pcount; pagen++) {
1664 /* The DMA memory is always allocated in the length of a 1667 /* The DMA memory is always allocated in the length of a
1665 * page even though the last SGE might not fill up to a 1668 * page even though the last SGE might not fill up to a
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index e25179193a82..bcddb6c1a148 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -61,20 +61,22 @@ static void
61lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); 61lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb);
62 62
63static void 63static void
64lpfc_debug_save_data(struct scsi_cmnd *cmnd) 64lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd)
65{ 65{
66 void *src, *dst; 66 void *src, *dst;
67 struct scatterlist *sgde = scsi_sglist(cmnd); 67 struct scatterlist *sgde = scsi_sglist(cmnd);
68 68
69 if (!_dump_buf_data) { 69 if (!_dump_buf_data) {
70 printk(KERN_ERR "BLKGRD ERROR %s _dump_buf_data is NULL\n", 70 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
71 "9050 BLKGRD: ERROR %s _dump_buf_data is NULL\n",
71 __func__); 72 __func__);
72 return; 73 return;
73 } 74 }
74 75
75 76
76 if (!sgde) { 77 if (!sgde) {
77 printk(KERN_ERR "BLKGRD ERROR: data scatterlist is null\n"); 78 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
79 "9051 BLKGRD: ERROR: data scatterlist is null\n");
78 return; 80 return;
79 } 81 }
80 82
@@ -88,19 +90,21 @@ lpfc_debug_save_data(struct scsi_cmnd *cmnd)
88} 90}
89 91
90static void 92static void
91lpfc_debug_save_dif(struct scsi_cmnd *cmnd) 93lpfc_debug_save_dif(struct lpfc_hba *phba, struct scsi_cmnd *cmnd)
92{ 94{
93 void *src, *dst; 95 void *src, *dst;
94 struct scatterlist *sgde = scsi_prot_sglist(cmnd); 96 struct scatterlist *sgde = scsi_prot_sglist(cmnd);
95 97
96 if (!_dump_buf_dif) { 98 if (!_dump_buf_dif) {
97 printk(KERN_ERR "BLKGRD ERROR %s _dump_buf_data is NULL\n", 99 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
100 "9052 BLKGRD: ERROR %s _dump_buf_data is NULL\n",
98 __func__); 101 __func__);
99 return; 102 return;
100 } 103 }
101 104
102 if (!sgde) { 105 if (!sgde) {
103 printk(KERN_ERR "BLKGRD ERROR: prot scatterlist is null\n"); 106 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
107 "9053 BLKGRD: ERROR: prot scatterlist is null\n");
104 return; 108 return;
105 } 109 }
106 110
@@ -1024,7 +1028,8 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
1024 1028
1025 lpfc_cmd->seg_cnt = nseg; 1029 lpfc_cmd->seg_cnt = nseg;
1026 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { 1030 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) {
1027 printk(KERN_ERR "%s: Too many sg segments from " 1031 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1032 "9064 BLKGRD: %s: Too many sg segments from "
1028 "dma_map_sg. Config %d, seg_cnt %d\n", 1033 "dma_map_sg. Config %d, seg_cnt %d\n",
1029 __func__, phba->cfg_sg_seg_cnt, 1034 __func__, phba->cfg_sg_seg_cnt,
1030 lpfc_cmd->seg_cnt); 1035 lpfc_cmd->seg_cnt);
@@ -1112,7 +1117,7 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
1112 * with the cmd 1117 * with the cmd
1113 */ 1118 */
1114static int 1119static int
1115lpfc_sc_to_sli_prof(struct scsi_cmnd *sc) 1120lpfc_sc_to_sli_prof(struct lpfc_hba *phba, struct scsi_cmnd *sc)
1116{ 1121{
1117 uint8_t guard_type = scsi_host_get_guard(sc->device->host); 1122 uint8_t guard_type = scsi_host_get_guard(sc->device->host);
1118 uint8_t ret_prof = LPFC_PROF_INVALID; 1123 uint8_t ret_prof = LPFC_PROF_INVALID;
@@ -1136,7 +1141,8 @@ lpfc_sc_to_sli_prof(struct scsi_cmnd *sc)
1136 1141
1137 case SCSI_PROT_NORMAL: 1142 case SCSI_PROT_NORMAL:
1138 default: 1143 default:
1139 printk(KERN_ERR "Bad op/guard:%d/%d combination\n", 1144 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1145 "9063 BLKGRD:Bad op/guard:%d/%d combination\n",
1140 scsi_get_prot_op(sc), guard_type); 1146 scsi_get_prot_op(sc), guard_type);
1141 break; 1147 break;
1142 1148
@@ -1157,7 +1163,8 @@ lpfc_sc_to_sli_prof(struct scsi_cmnd *sc)
1157 case SCSI_PROT_WRITE_STRIP: 1163 case SCSI_PROT_WRITE_STRIP:
1158 case SCSI_PROT_NORMAL: 1164 case SCSI_PROT_NORMAL:
1159 default: 1165 default:
1160 printk(KERN_ERR "Bad op/guard:%d/%d combination\n", 1166 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1167 "9075 BLKGRD: Bad op/guard:%d/%d combination\n",
1161 scsi_get_prot_op(sc), guard_type); 1168 scsi_get_prot_op(sc), guard_type);
1162 break; 1169 break;
1163 } 1170 }
@@ -1259,7 +1266,7 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1259 uint16_t apptagmask, apptagval; 1266 uint16_t apptagmask, apptagval;
1260 1267
1261 pde1 = (struct lpfc_pde *) bpl; 1268 pde1 = (struct lpfc_pde *) bpl;
1262 prof = lpfc_sc_to_sli_prof(sc); 1269 prof = lpfc_sc_to_sli_prof(phba, sc);
1263 1270
1264 if (prof == LPFC_PROF_INVALID) 1271 if (prof == LPFC_PROF_INVALID)
1265 goto out; 1272 goto out;
@@ -1359,7 +1366,7 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1359 return 0; 1366 return 0;
1360 } 1367 }
1361 1368
1362 prof = lpfc_sc_to_sli_prof(sc); 1369 prof = lpfc_sc_to_sli_prof(phba, sc);
1363 if (prof == LPFC_PROF_INVALID) 1370 if (prof == LPFC_PROF_INVALID)
1364 goto out; 1371 goto out;
1365 1372
@@ -1408,7 +1415,8 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1408 subtotal = 0; /* total bytes processed for current prot grp */ 1415 subtotal = 0; /* total bytes processed for current prot grp */
1409 while (!pgdone) { 1416 while (!pgdone) {
1410 if (!sgde) { 1417 if (!sgde) {
1411 printk(KERN_ERR "%s Invalid data segment\n", 1418 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1419 "9065 BLKGRD:%s Invalid data segment\n",
1412 __func__); 1420 __func__);
1413 return 0; 1421 return 0;
1414 } 1422 }
@@ -1462,7 +1470,8 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1462 reftag += protgrp_blks; 1470 reftag += protgrp_blks;
1463 } else { 1471 } else {
1464 /* if we're here, we have a bug */ 1472 /* if we're here, we have a bug */
1465 printk(KERN_ERR "BLKGRD: bug in %s\n", __func__); 1473 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1474 "9054 BLKGRD: bug in %s\n", __func__);
1466 } 1475 }
1467 1476
1468 } while (!alldone); 1477 } while (!alldone);
@@ -1544,8 +1553,10 @@ lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba,
1544 1553
1545 lpfc_cmd->seg_cnt = datasegcnt; 1554 lpfc_cmd->seg_cnt = datasegcnt;
1546 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { 1555 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) {
1547 printk(KERN_ERR "%s: Too many sg segments from " 1556 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1548 "dma_map_sg. Config %d, seg_cnt %d\n", 1557 "9067 BLKGRD: %s: Too many sg segments"
1558 " from dma_map_sg. Config %d, seg_cnt"
1559 " %d\n",
1549 __func__, phba->cfg_sg_seg_cnt, 1560 __func__, phba->cfg_sg_seg_cnt,
1550 lpfc_cmd->seg_cnt); 1561 lpfc_cmd->seg_cnt);
1551 scsi_dma_unmap(scsi_cmnd); 1562 scsi_dma_unmap(scsi_cmnd);
@@ -1579,8 +1590,9 @@ lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba,
1579 lpfc_cmd->prot_seg_cnt = protsegcnt; 1590 lpfc_cmd->prot_seg_cnt = protsegcnt;
1580 if (lpfc_cmd->prot_seg_cnt 1591 if (lpfc_cmd->prot_seg_cnt
1581 > phba->cfg_prot_sg_seg_cnt) { 1592 > phba->cfg_prot_sg_seg_cnt) {
1582 printk(KERN_ERR "%s: Too many prot sg segments " 1593 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1583 "from dma_map_sg. Config %d," 1594 "9068 BLKGRD: %s: Too many prot sg "
1595 "segments from dma_map_sg. Config %d,"
1584 "prot_seg_cnt %d\n", __func__, 1596 "prot_seg_cnt %d\n", __func__,
1585 phba->cfg_prot_sg_seg_cnt, 1597 phba->cfg_prot_sg_seg_cnt,
1586 lpfc_cmd->prot_seg_cnt); 1598 lpfc_cmd->prot_seg_cnt);
@@ -1671,23 +1683,26 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
1671 uint32_t bgstat = bgf->bgstat; 1683 uint32_t bgstat = bgf->bgstat;
1672 uint64_t failing_sector = 0; 1684 uint64_t failing_sector = 0;
1673 1685
1674 printk(KERN_ERR "BG ERROR in cmd 0x%x lba 0x%llx blk cnt 0x%x " 1686 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9069 BLKGRD: BG ERROR in cmd"
1687 " 0x%x lba 0x%llx blk cnt 0x%x "
1675 "bgstat=0x%x bghm=0x%x\n", 1688 "bgstat=0x%x bghm=0x%x\n",
1676 cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd), 1689 cmd->cmnd[0], (unsigned long long)scsi_get_lba(cmd),
1677 blk_rq_sectors(cmd->request), bgstat, bghm); 1690 blk_rq_sectors(cmd->request), bgstat, bghm);
1678 1691
1679 spin_lock(&_dump_buf_lock); 1692 spin_lock(&_dump_buf_lock);
1680 if (!_dump_buf_done) { 1693 if (!_dump_buf_done) {
1681 printk(KERN_ERR "Saving Data for %u blocks to debugfs\n", 1694 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9070 BLKGRD: Saving"
1695 " Data for %u blocks to debugfs\n",
1682 (cmd->cmnd[7] << 8 | cmd->cmnd[8])); 1696 (cmd->cmnd[7] << 8 | cmd->cmnd[8]));
1683 lpfc_debug_save_data(cmd); 1697 lpfc_debug_save_data(phba, cmd);
1684 1698
1685 /* If we have a prot sgl, save the DIF buffer */ 1699 /* If we have a prot sgl, save the DIF buffer */
1686 if (lpfc_prot_group_type(phba, cmd) == 1700 if (lpfc_prot_group_type(phba, cmd) ==
1687 LPFC_PG_TYPE_DIF_BUF) { 1701 LPFC_PG_TYPE_DIF_BUF) {
1688 printk(KERN_ERR "Saving DIF for %u blocks to debugfs\n", 1702 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9071 BLKGRD: "
1689 (cmd->cmnd[7] << 8 | cmd->cmnd[8])); 1703 "Saving DIF for %u blocks to debugfs\n",
1690 lpfc_debug_save_dif(cmd); 1704 (cmd->cmnd[7] << 8 | cmd->cmnd[8]));
1705 lpfc_debug_save_dif(phba, cmd);
1691 } 1706 }
1692 1707
1693 _dump_buf_done = 1; 1708 _dump_buf_done = 1;
@@ -1696,15 +1711,17 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
1696 1711
1697 if (lpfc_bgs_get_invalid_prof(bgstat)) { 1712 if (lpfc_bgs_get_invalid_prof(bgstat)) {
1698 cmd->result = ScsiResult(DID_ERROR, 0); 1713 cmd->result = ScsiResult(DID_ERROR, 0);
1699 printk(KERN_ERR "Invalid BlockGuard profile. bgstat:0x%x\n", 1714 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9072 BLKGRD: Invalid"
1700 bgstat); 1715 " BlockGuard profile. bgstat:0x%x\n",
1716 bgstat);
1701 ret = (-1); 1717 ret = (-1);
1702 goto out; 1718 goto out;
1703 } 1719 }
1704 1720
1705 if (lpfc_bgs_get_uninit_dif_block(bgstat)) { 1721 if (lpfc_bgs_get_uninit_dif_block(bgstat)) {
1706 cmd->result = ScsiResult(DID_ERROR, 0); 1722 cmd->result = ScsiResult(DID_ERROR, 0);
1707 printk(KERN_ERR "Invalid BlockGuard DIF Block. bgstat:0x%x\n", 1723 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9073 BLKGRD: "
1724 "Invalid BlockGuard DIF Block. bgstat:0x%x\n",
1708 bgstat); 1725 bgstat);
1709 ret = (-1); 1726 ret = (-1);
1710 goto out; 1727 goto out;
@@ -1718,7 +1735,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
1718 cmd->result = DRIVER_SENSE << 24 1735 cmd->result = DRIVER_SENSE << 24
1719 | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); 1736 | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
1720 phba->bg_guard_err_cnt++; 1737 phba->bg_guard_err_cnt++;
1721 printk(KERN_ERR "BLKGRD: guard_tag error\n"); 1738 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1739 "9055 BLKGRD: guard_tag error\n");
1722 } 1740 }
1723 1741
1724 if (lpfc_bgs_get_reftag_err(bgstat)) { 1742 if (lpfc_bgs_get_reftag_err(bgstat)) {
@@ -1730,7 +1748,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
1730 | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); 1748 | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
1731 1749
1732 phba->bg_reftag_err_cnt++; 1750 phba->bg_reftag_err_cnt++;
1733 printk(KERN_ERR "BLKGRD: ref_tag error\n"); 1751 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1752 "9056 BLKGRD: ref_tag error\n");
1734 } 1753 }
1735 1754
1736 if (lpfc_bgs_get_apptag_err(bgstat)) { 1755 if (lpfc_bgs_get_apptag_err(bgstat)) {
@@ -1742,7 +1761,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
1742 | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION); 1761 | ScsiResult(DID_ABORT, SAM_STAT_CHECK_CONDITION);
1743 1762
1744 phba->bg_apptag_err_cnt++; 1763 phba->bg_apptag_err_cnt++;
1745 printk(KERN_ERR "BLKGRD: app_tag error\n"); 1764 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1765 "9061 BLKGRD: app_tag error\n");
1746 } 1766 }
1747 1767
1748 if (lpfc_bgs_get_hi_water_mark_present(bgstat)) { 1768 if (lpfc_bgs_get_hi_water_mark_present(bgstat)) {
@@ -1763,7 +1783,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
1763 if (!ret) { 1783 if (!ret) {
1764 /* No error was reported - problem in FW? */ 1784 /* No error was reported - problem in FW? */
1765 cmd->result = ScsiResult(DID_ERROR, 0); 1785 cmd->result = ScsiResult(DID_ERROR, 0);
1766 printk(KERN_ERR "BLKGRD: no errors reported!\n"); 1786 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
1787 "9057 BLKGRD: no errors reported!\n");
1767 } 1788 }
1768 1789
1769out: 1790out:
@@ -1822,9 +1843,10 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
1822 1843
1823 lpfc_cmd->seg_cnt = nseg; 1844 lpfc_cmd->seg_cnt = nseg;
1824 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { 1845 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) {
1825 printk(KERN_ERR "%s: Too many sg segments from " 1846 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9074 BLKGRD:"
1826 "dma_map_sg. Config %d, seg_cnt %d\n", 1847 " %s: Too many sg segments from "
1827 __func__, phba->cfg_sg_seg_cnt, 1848 "dma_map_sg. Config %d, seg_cnt %d\n",
1849 __func__, phba->cfg_sg_seg_cnt,
1828 lpfc_cmd->seg_cnt); 1850 lpfc_cmd->seg_cnt);
1829 scsi_dma_unmap(scsi_cmnd); 1851 scsi_dma_unmap(scsi_cmnd);
1830 return 1; 1852 return 1;
@@ -2050,6 +2072,21 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
2050 goto out; 2072 goto out;
2051 } 2073 }
2052 2074
2075 if (resp_info & RSP_LEN_VALID) {
2076 rsplen = be32_to_cpu(fcprsp->rspRspLen);
2077 if ((rsplen != 0 && rsplen != 4 && rsplen != 8) ||
2078 (fcprsp->rspInfo3 != RSP_NO_FAILURE)) {
2079 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
2080 "2719 Invalid response length: "
2081 "tgt x%x lun x%x cmnd x%x rsplen x%x\n",
2082 cmnd->device->id,
2083 cmnd->device->lun, cmnd->cmnd[0],
2084 rsplen);
2085 host_status = DID_ERROR;
2086 goto out;
2087 }
2088 }
2089
2053 if ((resp_info & SNS_LEN_VALID) && fcprsp->rspSnsLen) { 2090 if ((resp_info & SNS_LEN_VALID) && fcprsp->rspSnsLen) {
2054 uint32_t snslen = be32_to_cpu(fcprsp->rspSnsLen); 2091 uint32_t snslen = be32_to_cpu(fcprsp->rspSnsLen);
2055 if (snslen > SCSI_SENSE_BUFFERSIZE) 2092 if (snslen > SCSI_SENSE_BUFFERSIZE)
@@ -2074,15 +2111,6 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
2074 be32_to_cpu(fcprsp->rspRspLen), 2111 be32_to_cpu(fcprsp->rspRspLen),
2075 fcprsp->rspInfo3); 2112 fcprsp->rspInfo3);
2076 2113
2077 if (resp_info & RSP_LEN_VALID) {
2078 rsplen = be32_to_cpu(fcprsp->rspRspLen);
2079 if ((rsplen != 0 && rsplen != 4 && rsplen != 8) ||
2080 (fcprsp->rspInfo3 != RSP_NO_FAILURE)) {
2081 host_status = DID_ERROR;
2082 goto out;
2083 }
2084 }
2085
2086 scsi_set_resid(cmnd, 0); 2114 scsi_set_resid(cmnd, 0);
2087 if (resp_info & RESID_UNDER) { 2115 if (resp_info & RESID_UNDER) {
2088 scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId)); 2116 scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId));
@@ -2264,7 +2292,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
2264 lpfc_printf_vlog(vport, KERN_WARNING, 2292 lpfc_printf_vlog(vport, KERN_WARNING,
2265 LOG_BG, 2293 LOG_BG,
2266 "9031 non-zero BGSTAT " 2294 "9031 non-zero BGSTAT "
2267 "on unprotected cmd"); 2295 "on unprotected cmd\n");
2268 } 2296 }
2269 } 2297 }
2270 2298
@@ -2785,9 +2813,10 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
2785 if (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && 2813 if (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED) &&
2786 scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { 2814 scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) {
2787 2815
2788 printk(KERN_ERR "BLKGRD ERROR: rcvd protected cmd:%02x op:%02x " 2816 lpfc_printf_log(phba, KERN_ERR, LOG_BG,
2789 "str=%s without registering for BlockGuard - " 2817 "9058 BLKGRD: ERROR: rcvd protected cmd:%02x"
2790 "Rejecting command\n", 2818 " op:%02x str=%s without registering for"
2819 " BlockGuard - Rejecting command\n",
2791 cmnd->cmnd[0], scsi_get_prot_op(cmnd), 2820 cmnd->cmnd[0], scsi_get_prot_op(cmnd),
2792 dif_op_str[scsi_get_prot_op(cmnd)]); 2821 dif_op_str[scsi_get_prot_op(cmnd)]);
2793 goto out_fail_command; 2822 goto out_fail_command;
@@ -2827,61 +2856,66 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
2827 cmnd->scsi_done = done; 2856 cmnd->scsi_done = done;
2828 2857
2829 if (scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { 2858 if (scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) {
2830 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 2859 if (vport->phba->cfg_enable_bg) {
2860 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2831 "9033 BLKGRD: rcvd protected cmd:%02x op:%02x " 2861 "9033 BLKGRD: rcvd protected cmd:%02x op:%02x "
2832 "str=%s\n", 2862 "str=%s\n",
2833 cmnd->cmnd[0], scsi_get_prot_op(cmnd), 2863 cmnd->cmnd[0], scsi_get_prot_op(cmnd),
2834 dif_op_str[scsi_get_prot_op(cmnd)]); 2864 dif_op_str[scsi_get_prot_op(cmnd)]);
2835 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 2865 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2836 "9034 BLKGRD: CDB: %02x %02x %02x %02x %02x " 2866 "9034 BLKGRD: CDB: %02x %02x %02x %02x %02x "
2837 "%02x %02x %02x %02x %02x\n", 2867 "%02x %02x %02x %02x %02x\n",
2838 cmnd->cmnd[0], cmnd->cmnd[1], cmnd->cmnd[2], 2868 cmnd->cmnd[0], cmnd->cmnd[1], cmnd->cmnd[2],
2839 cmnd->cmnd[3], cmnd->cmnd[4], cmnd->cmnd[5], 2869 cmnd->cmnd[3], cmnd->cmnd[4], cmnd->cmnd[5],
2840 cmnd->cmnd[6], cmnd->cmnd[7], cmnd->cmnd[8], 2870 cmnd->cmnd[6], cmnd->cmnd[7], cmnd->cmnd[8],
2841 cmnd->cmnd[9]); 2871 cmnd->cmnd[9]);
2842 if (cmnd->cmnd[0] == READ_10) 2872 if (cmnd->cmnd[0] == READ_10)
2843 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 2873 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2844 "9035 BLKGRD: READ @ sector %llu, " 2874 "9035 BLKGRD: READ @ sector %llu, "
2845 "count %u\n", 2875 "count %u\n",
2846 (unsigned long long)scsi_get_lba(cmnd), 2876 (unsigned long long)scsi_get_lba(cmnd),
2847 blk_rq_sectors(cmnd->request)); 2877 blk_rq_sectors(cmnd->request));
2848 else if (cmnd->cmnd[0] == WRITE_10) 2878 else if (cmnd->cmnd[0] == WRITE_10)
2849 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 2879 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2850 "9036 BLKGRD: WRITE @ sector %llu, " 2880 "9036 BLKGRD: WRITE @ sector %llu, "
2851 "count %u cmd=%p\n", 2881 "count %u cmd=%p\n",
2852 (unsigned long long)scsi_get_lba(cmnd), 2882 (unsigned long long)scsi_get_lba(cmnd),
2853 blk_rq_sectors(cmnd->request), 2883 blk_rq_sectors(cmnd->request),
2854 cmnd); 2884 cmnd);
2885 }
2855 2886
2856 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); 2887 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd);
2857 } else { 2888 } else {
2858 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 2889 if (vport->phba->cfg_enable_bg) {
2859 "9038 BLKGRD: rcvd unprotected cmd:%02x op:%02x"
2860 " str=%s\n",
2861 cmnd->cmnd[0], scsi_get_prot_op(cmnd),
2862 dif_op_str[scsi_get_prot_op(cmnd)]);
2863 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2864 "9039 BLKGRD: CDB: %02x %02x %02x %02x %02x "
2865 "%02x %02x %02x %02x %02x\n",
2866 cmnd->cmnd[0], cmnd->cmnd[1], cmnd->cmnd[2],
2867 cmnd->cmnd[3], cmnd->cmnd[4], cmnd->cmnd[5],
2868 cmnd->cmnd[6], cmnd->cmnd[7], cmnd->cmnd[8],
2869 cmnd->cmnd[9]);
2870 if (cmnd->cmnd[0] == READ_10)
2871 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 2890 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2872 "9040 dbg: READ @ sector %llu, " 2891 "9038 BLKGRD: rcvd unprotected cmd:"
2873 "count %u\n", 2892 "%02x op:%02x str=%s\n",
2874 (unsigned long long)scsi_get_lba(cmnd), 2893 cmnd->cmnd[0], scsi_get_prot_op(cmnd),
2894 dif_op_str[scsi_get_prot_op(cmnd)]);
2895 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2896 "9039 BLKGRD: CDB: %02x %02x %02x "
2897 "%02x %02x %02x %02x %02x %02x %02x\n",
2898 cmnd->cmnd[0], cmnd->cmnd[1],
2899 cmnd->cmnd[2], cmnd->cmnd[3],
2900 cmnd->cmnd[4], cmnd->cmnd[5],
2901 cmnd->cmnd[6], cmnd->cmnd[7],
2902 cmnd->cmnd[8], cmnd->cmnd[9]);
2903 if (cmnd->cmnd[0] == READ_10)
2904 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2905 "9040 dbg: READ @ sector %llu, "
2906 "count %u\n",
2907 (unsigned long long)scsi_get_lba(cmnd),
2875 blk_rq_sectors(cmnd->request)); 2908 blk_rq_sectors(cmnd->request));
2876 else if (cmnd->cmnd[0] == WRITE_10) 2909 else if (cmnd->cmnd[0] == WRITE_10)
2877 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 2910 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2878 "9041 dbg: WRITE @ sector %llu, " 2911 "9041 dbg: WRITE @ sector %llu, "
2879 "count %u cmd=%p\n", 2912 "count %u cmd=%p\n",
2880 (unsigned long long)scsi_get_lba(cmnd), 2913 (unsigned long long)scsi_get_lba(cmnd),
2881 blk_rq_sectors(cmnd->request), cmnd); 2914 blk_rq_sectors(cmnd->request), cmnd);
2882 else 2915 else
2883 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, 2916 lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG,
2884 "9042 dbg: parser not implemented\n"); 2917 "9042 dbg: parser not implemented\n");
2918 }
2885 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); 2919 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd);
2886 } 2920 }
2887 2921
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e8d3e4732a84..9693c777425a 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -516,6 +516,8 @@ __lpfc_sli_get_sglq(struct lpfc_hba *phba)
516 struct lpfc_sglq *sglq = NULL; 516 struct lpfc_sglq *sglq = NULL;
517 uint16_t adj_xri; 517 uint16_t adj_xri;
518 list_remove_head(lpfc_sgl_list, sglq, struct lpfc_sglq, list); 518 list_remove_head(lpfc_sgl_list, sglq, struct lpfc_sglq, list);
519 if (!sglq)
520 return NULL;
519 adj_xri = sglq->sli4_xritag - phba->sli4_hba.max_cfg_param.xri_base; 521 adj_xri = sglq->sli4_xritag - phba->sli4_hba.max_cfg_param.xri_base;
520 phba->sli4_hba.lpfc_sglq_active_list[adj_xri] = sglq; 522 phba->sli4_hba.lpfc_sglq_active_list[adj_xri] = sglq;
521 return sglq; 523 return sglq;
@@ -2070,8 +2072,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2070 if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX) || 2072 if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX) ||
2071 (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX) || 2073 (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX) ||
2072 (irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX)) { 2074 (irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX)) {
2073 Rctl = FC_ELS_REQ; 2075 Rctl = FC_RCTL_ELS_REQ;
2074 Type = FC_ELS_DATA; 2076 Type = FC_TYPE_ELS;
2075 } else { 2077 } else {
2076 w5p = (WORD5 *)&(saveq->iocb.un.ulpWord[5]); 2078 w5p = (WORD5 *)&(saveq->iocb.un.ulpWord[5]);
2077 Rctl = w5p->hcsw.Rctl; 2079 Rctl = w5p->hcsw.Rctl;
@@ -2081,8 +2083,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2081 if ((Rctl == 0) && (pring->ringno == LPFC_ELS_RING) && 2083 if ((Rctl == 0) && (pring->ringno == LPFC_ELS_RING) &&
2082 (irsp->ulpCommand == CMD_RCV_SEQUENCE64_CX || 2084 (irsp->ulpCommand == CMD_RCV_SEQUENCE64_CX ||
2083 irsp->ulpCommand == CMD_IOCB_RCV_SEQ64_CX)) { 2085 irsp->ulpCommand == CMD_IOCB_RCV_SEQ64_CX)) {
2084 Rctl = FC_ELS_REQ; 2086 Rctl = FC_RCTL_ELS_REQ;
2085 Type = FC_ELS_DATA; 2087 Type = FC_TYPE_ELS;
2086 w5p->hcsw.Rctl = Rctl; 2088 w5p->hcsw.Rctl = Rctl;
2087 w5p->hcsw.Type = Type; 2089 w5p->hcsw.Type = Type;
2088 } 2090 }
@@ -4485,7 +4487,8 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4485 rc = lpfc_sli4_post_sgl_list(phba); 4487 rc = lpfc_sli4_post_sgl_list(phba);
4486 if (unlikely(rc)) { 4488 if (unlikely(rc)) {
4487 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 4489 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
4488 "0582 Error %d during sgl post operation", rc); 4490 "0582 Error %d during sgl post operation\n",
4491 rc);
4489 rc = -ENODEV; 4492 rc = -ENODEV;
4490 goto out_free_vpd; 4493 goto out_free_vpd;
4491 } 4494 }
@@ -4494,8 +4497,8 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
4494 rc = lpfc_sli4_repost_scsi_sgl_list(phba); 4497 rc = lpfc_sli4_repost_scsi_sgl_list(phba);
4495 if (unlikely(rc)) { 4498 if (unlikely(rc)) {
4496 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI, 4499 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX | LOG_SLI,
4497 "0383 Error %d during scsi sgl post opeation", 4500 "0383 Error %d during scsi sgl post "
4498 rc); 4501 "operation\n", rc);
4499 /* Some Scsi buffers were moved to the abort scsi list */ 4502 /* Some Scsi buffers were moved to the abort scsi list */
4500 /* A pci function reset will repost them */ 4503 /* A pci function reset will repost them */
4501 rc = -ENODEV; 4504 rc = -ENODEV;
@@ -5686,7 +5689,7 @@ __lpfc_sli_issue_iocb_s3(struct lpfc_hba *phba, uint32_t ring_number,
5686 case CMD_GEN_REQUEST64_CX: 5689 case CMD_GEN_REQUEST64_CX:
5687 if (!(phba->sli.sli_flag & LPFC_MENLO_MAINT) || 5690 if (!(phba->sli.sli_flag & LPFC_MENLO_MAINT) ||
5688 (piocb->iocb.un.genreq64.w5.hcsw.Rctl != 5691 (piocb->iocb.un.genreq64.w5.hcsw.Rctl !=
5689 FC_FCP_CMND) || 5692 FC_RCTL_DD_UNSOL_CMD) ||
5690 (piocb->iocb.un.genreq64.w5.hcsw.Type != 5693 (piocb->iocb.un.genreq64.w5.hcsw.Type !=
5691 MENLO_TRANSPORT_TYPE)) 5694 MENLO_TRANSPORT_TYPE))
5692 5695
@@ -6485,27 +6488,27 @@ lpfc_sli_setup(struct lpfc_hba *phba)
6485 lpfc_sli_async_event_handler; 6488 lpfc_sli_async_event_handler;
6486 pring->num_mask = LPFC_MAX_RING_MASK; 6489 pring->num_mask = LPFC_MAX_RING_MASK;
6487 pring->prt[0].profile = 0; /* Mask 0 */ 6490 pring->prt[0].profile = 0; /* Mask 0 */
6488 pring->prt[0].rctl = FC_ELS_REQ; 6491 pring->prt[0].rctl = FC_RCTL_ELS_REQ;
6489 pring->prt[0].type = FC_ELS_DATA; 6492 pring->prt[0].type = FC_TYPE_ELS;
6490 pring->prt[0].lpfc_sli_rcv_unsol_event = 6493 pring->prt[0].lpfc_sli_rcv_unsol_event =
6491 lpfc_els_unsol_event; 6494 lpfc_els_unsol_event;
6492 pring->prt[1].profile = 0; /* Mask 1 */ 6495 pring->prt[1].profile = 0; /* Mask 1 */
6493 pring->prt[1].rctl = FC_ELS_RSP; 6496 pring->prt[1].rctl = FC_RCTL_ELS_REP;
6494 pring->prt[1].type = FC_ELS_DATA; 6497 pring->prt[1].type = FC_TYPE_ELS;
6495 pring->prt[1].lpfc_sli_rcv_unsol_event = 6498 pring->prt[1].lpfc_sli_rcv_unsol_event =
6496 lpfc_els_unsol_event; 6499 lpfc_els_unsol_event;
6497 pring->prt[2].profile = 0; /* Mask 2 */ 6500 pring->prt[2].profile = 0; /* Mask 2 */
6498 /* NameServer Inquiry */ 6501 /* NameServer Inquiry */
6499 pring->prt[2].rctl = FC_UNSOL_CTL; 6502 pring->prt[2].rctl = FC_RCTL_DD_UNSOL_CTL;
6500 /* NameServer */ 6503 /* NameServer */
6501 pring->prt[2].type = FC_COMMON_TRANSPORT_ULP; 6504 pring->prt[2].type = FC_TYPE_CT;
6502 pring->prt[2].lpfc_sli_rcv_unsol_event = 6505 pring->prt[2].lpfc_sli_rcv_unsol_event =
6503 lpfc_ct_unsol_event; 6506 lpfc_ct_unsol_event;
6504 pring->prt[3].profile = 0; /* Mask 3 */ 6507 pring->prt[3].profile = 0; /* Mask 3 */
6505 /* NameServer response */ 6508 /* NameServer response */
6506 pring->prt[3].rctl = FC_SOL_CTL; 6509 pring->prt[3].rctl = FC_RCTL_DD_SOL_CTL;
6507 /* NameServer */ 6510 /* NameServer */
6508 pring->prt[3].type = FC_COMMON_TRANSPORT_ULP; 6511 pring->prt[3].type = FC_TYPE_CT;
6509 pring->prt[3].lpfc_sli_rcv_unsol_event = 6512 pring->prt[3].lpfc_sli_rcv_unsol_event =
6510 lpfc_ct_unsol_event; 6513 lpfc_ct_unsol_event;
6511 /* abort unsolicited sequence */ 6514 /* abort unsolicited sequence */
@@ -8089,7 +8092,7 @@ lpfc_sli_sp_intr_handler(int irq, void *dev_id)
8089 KERN_ERR, 8092 KERN_ERR,
8090 LOG_MBOX | LOG_SLI, 8093 LOG_MBOX | LOG_SLI,
8091 "0350 rc should have" 8094 "0350 rc should have"
8092 "been MBX_BUSY"); 8095 "been MBX_BUSY\n");
8093 if (rc != MBX_NOT_FINISHED) 8096 if (rc != MBX_NOT_FINISHED)
8094 goto send_current_mbox; 8097 goto send_current_mbox;
8095 } 8098 }
@@ -8118,7 +8121,7 @@ send_current_mbox:
8118 if (rc != MBX_SUCCESS) 8121 if (rc != MBX_SUCCESS)
8119 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | 8122 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX |
8120 LOG_SLI, "0349 rc should be " 8123 LOG_SLI, "0349 rc should be "
8121 "MBX_SUCCESS"); 8124 "MBX_SUCCESS\n");
8122 } 8125 }
8123 8126
8124 spin_lock_irqsave(&phba->hbalock, iflag); 8127 spin_lock_irqsave(&phba->hbalock, iflag);
@@ -10454,8 +10457,7 @@ lpfc_sli4_next_xritag(struct lpfc_hba *phba)
10454 return xritag; 10457 return xritag;
10455 } 10458 }
10456 spin_unlock_irq(&phba->hbalock); 10459 spin_unlock_irq(&phba->hbalock);
10457 10460 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
10458 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
10459 "2004 Failed to allocate XRI.last XRITAG is %d" 10461 "2004 Failed to allocate XRI.last XRITAG is %d"
10460 " Max XRI is %d, Used XRI is %d\n", 10462 " Max XRI is %d, Used XRI is %d\n",
10461 phba->sli4_hba.next_xri, 10463 phba->sli4_hba.next_xri,
@@ -10519,15 +10521,7 @@ lpfc_sli4_post_sgl_list(struct lpfc_hba *phba)
10519 lpfc_sli4_mbox_cmd_free(phba, mbox); 10521 lpfc_sli4_mbox_cmd_free(phba, mbox);
10520 return -ENOMEM; 10522 return -ENOMEM;
10521 } 10523 }
10522
10523 /* Get the first SGE entry from the non-embedded DMA memory */ 10524 /* Get the first SGE entry from the non-embedded DMA memory */
10524 if (unlikely(!mbox->sge_array)) {
10525 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
10526 "2525 Failed to get the non-embedded SGE "
10527 "virtual address\n");
10528 lpfc_sli4_mbox_cmd_free(phba, mbox);
10529 return -ENOMEM;
10530 }
10531 viraddr = mbox->sge_array->addr[0]; 10525 viraddr = mbox->sge_array->addr[0];
10532 10526
10533 /* Set up the SGL pages in the non-embedded DMA pages */ 10527 /* Set up the SGL pages in the non-embedded DMA pages */
@@ -10551,8 +10545,7 @@ lpfc_sli4_post_sgl_list(struct lpfc_hba *phba)
10551 sgl_pg_pairs++; 10545 sgl_pg_pairs++;
10552 } 10546 }
10553 bf_set(lpfc_post_sgl_pages_xri, sgl, xritag_start); 10547 bf_set(lpfc_post_sgl_pages_xri, sgl, xritag_start);
10554 pg_pairs = (pg_pairs > 0) ? (pg_pairs - 1) : pg_pairs; 10548 bf_set(lpfc_post_sgl_pages_xricnt, sgl, els_xri_cnt);
10555 bf_set(lpfc_post_sgl_pages_xricnt, sgl, pg_pairs);
10556 /* Perform endian conversion if necessary */ 10549 /* Perform endian conversion if necessary */
10557 sgl->word0 = cpu_to_le32(sgl->word0); 10550 sgl->word0 = cpu_to_le32(sgl->word0);
10558 10551
@@ -10634,15 +10627,7 @@ lpfc_sli4_post_scsi_sgl_block(struct lpfc_hba *phba, struct list_head *sblist,
10634 lpfc_sli4_mbox_cmd_free(phba, mbox); 10627 lpfc_sli4_mbox_cmd_free(phba, mbox);
10635 return -ENOMEM; 10628 return -ENOMEM;
10636 } 10629 }
10637
10638 /* Get the first SGE entry from the non-embedded DMA memory */ 10630 /* Get the first SGE entry from the non-embedded DMA memory */
10639 if (unlikely(!mbox->sge_array)) {
10640 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
10641 "2565 Failed to get the non-embedded SGE "
10642 "virtual address\n");
10643 lpfc_sli4_mbox_cmd_free(phba, mbox);
10644 return -ENOMEM;
10645 }
10646 viraddr = mbox->sge_array->addr[0]; 10631 viraddr = mbox->sge_array->addr[0];
10647 10632
10648 /* Set up the SGL pages in the non-embedded DMA pages */ 10633 /* Set up the SGL pages in the non-embedded DMA pages */
@@ -11565,6 +11550,7 @@ lpfc_sli4_init_vpi(struct lpfc_hba *phba, uint16_t vpi)
11565{ 11550{
11566 LPFC_MBOXQ_t *mboxq; 11551 LPFC_MBOXQ_t *mboxq;
11567 int rc = 0; 11552 int rc = 0;
11553 int retval = MBX_SUCCESS;
11568 uint32_t mbox_tmo; 11554 uint32_t mbox_tmo;
11569 11555
11570 if (vpi == 0) 11556 if (vpi == 0)
@@ -11575,16 +11561,17 @@ lpfc_sli4_init_vpi(struct lpfc_hba *phba, uint16_t vpi)
11575 lpfc_init_vpi(phba, mboxq, vpi); 11561 lpfc_init_vpi(phba, mboxq, vpi);
11576 mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI); 11562 mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI);
11577 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); 11563 rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
11578 if (rc != MBX_TIMEOUT)
11579 mempool_free(mboxq, phba->mbox_mem_pool);
11580 if (rc != MBX_SUCCESS) { 11564 if (rc != MBX_SUCCESS) {
11581 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 11565 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
11582 "2022 INIT VPI Mailbox failed " 11566 "2022 INIT VPI Mailbox failed "
11583 "status %d, mbxStatus x%x\n", rc, 11567 "status %d, mbxStatus x%x\n", rc,
11584 bf_get(lpfc_mqe_status, &mboxq->u.mqe)); 11568 bf_get(lpfc_mqe_status, &mboxq->u.mqe));
11585 rc = -EIO; 11569 retval = -EIO;
11586 } 11570 }
11587 return rc; 11571 if (rc != MBX_TIMEOUT)
11572 mempool_free(mboxq, phba->mbox_mem_pool);
11573
11574 return retval;
11588} 11575}
11589 11576
11590/** 11577/**
@@ -11669,13 +11656,6 @@ lpfc_sli4_add_fcf_record(struct lpfc_hba *phba, struct fcf_record *fcf_record)
11669 */ 11656 */
11670 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge); 11657 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge);
11671 phys_addr = getPaddr(sge.pa_hi, sge.pa_lo); 11658 phys_addr = getPaddr(sge.pa_hi, sge.pa_lo);
11672 if (unlikely(!mboxq->sge_array)) {
11673 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
11674 "2526 Failed to get the non-embedded SGE "
11675 "virtual address\n");
11676 lpfc_sli4_mbox_cmd_free(phba, mboxq);
11677 return -ENOMEM;
11678 }
11679 virt_addr = mboxq->sge_array->addr[0]; 11659 virt_addr = mboxq->sge_array->addr[0];
11680 /* 11660 /*
11681 * Configure the FCF record for FCFI 0. This is the driver's 11661 * Configure the FCF record for FCFI 0. This is the driver's
@@ -11799,13 +11779,6 @@ lpfc_sli4_read_fcf_record(struct lpfc_hba *phba, uint16_t fcf_index)
11799 */ 11779 */
11800 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge); 11780 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge);
11801 phys_addr = getPaddr(sge.pa_hi, sge.pa_lo); 11781 phys_addr = getPaddr(sge.pa_hi, sge.pa_lo);
11802 if (unlikely(!mboxq->sge_array)) {
11803 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
11804 "2527 Failed to get the non-embedded SGE "
11805 "virtual address\n");
11806 error = -ENOMEM;
11807 goto fail_fcfscan;
11808 }
11809 virt_addr = mboxq->sge_array->addr[0]; 11782 virt_addr = mboxq->sge_array->addr[0];
11810 read_fcf = (struct lpfc_mbx_read_fcf_tbl *)virt_addr; 11783 read_fcf = (struct lpfc_mbx_read_fcf_tbl *)virt_addr;
11811 11784
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index fc3de6fdd709..1f6cb01e6c6b 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -159,7 +159,7 @@ struct lpfc_fip_param_hdr {
159#define lpfc_fip_param_hdr_fipp_mode_SHIFT 6 159#define lpfc_fip_param_hdr_fipp_mode_SHIFT 6
160#define lpfc_fip_param_hdr_fipp_mode_MASK 0x3 160#define lpfc_fip_param_hdr_fipp_mode_MASK 0x3
161#define lpfc_fip_param_hdr_fipp_mode_WORD parm_flags 161#define lpfc_fip_param_hdr_fipp_mode_WORD parm_flags
162#define FIPP_MODE_ON 0x2 162#define FIPP_MODE_ON 0x1
163#define FIPP_MODE_OFF 0x0 163#define FIPP_MODE_OFF 0x0
164#define FIPP_VLAN_VALID 0x1 164#define FIPP_VLAN_VALID 0x1
165}; 165};