aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-04 15:30:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-04 15:30:30 -0400
commit84cbd7222b2b00dcddef3103203986b3d59c836a (patch)
treecdbe55ec410f853d4d532ed3252334cb110d5985 /drivers/scsi/lpfc
parent80cc38b16389849a6e06441ace4530f6b2497c3c (diff)
parenta3fda7dd5179989dd0ead820dcebd13f956ddec1 (diff)
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull first round of SCSI updates from James Bottomley: "The patch set is mostly driver updates (usf, zfcp, lpfc, mpt2sas, megaraid_sas, bfa, ipr) and a few bug fixes. Also of note is that the Buslogic driver has been rewritten to a better coding style and 64 bit support added. We also removed the libsas limitation on 16 bytes for the command size (currently no drivers make use of this)" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (101 commits) [SCSI] megaraid: minor cut and paste error fixed. [SCSI] ufshcd-pltfrm: remove unnecessary dma_set_coherent_mask() call [SCSI] ufs: fix register address in UIC error interrupt handling [SCSI] ufshcd-pltfrm: add missing empty slot in ufs_of_match[] [SCSI] ufs: use devres functions for ufshcd [SCSI] ufs: Fix the response UPIU length setting [SCSI] ufs: rework link start-up process [SCSI] ufs: remove version check before IS reg clear [SCSI] ufs: amend interrupt configuration [SCSI] ufs: wrap the i/o access operations [SCSI] storvsc: Update the storage protocol to win8 level [SCSI] storvsc: Increase the value of scsi timeout for storvsc devices [SCSI] MAINTAINERS: Add myself as the maintainer for BusLogic SCSI driver [SCSI] BusLogic: Port driver to 64-bit. [SCSI] BusLogic: Fix style issues [SCSI] libiscsi: Added new boot entries in the session sysfs [SCSI] aacraid: Fix for arrays are going offline in the system. System hangs [SCSI] ipr: IOA Status Code(IOASC) update [SCSI] sd: Update WRITE SAME heuristics [SCSI] fnic: potential dead lock in fnic_is_abts_pending() ...
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c23
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c38
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c129
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c125
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c52
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h6
17 files changed, 220 insertions, 178 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index bcc56cac4fd8..93f222d66716 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.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-2012 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 *
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 3c5625b8b1f4..5cb08ae3e8c2 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.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-2012 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 *
@@ -4070,11 +4070,28 @@ LPFC_VPORT_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands "
4070 "during discovery"); 4070 "during discovery");
4071 4071
4072/* 4072/*
4073# lpfc_max_luns: maximum allowed LUN. 4073# lpfc_max_luns: maximum allowed LUN ID. This is the highest LUN ID that
4074# will be scanned by the SCSI midlayer when sequential scanning is
4075# used; and is also the highest LUN ID allowed when the SCSI midlayer
4076# parses REPORT_LUN responses. The lpfc driver has no LUN count or
4077# LUN ID limit, but the SCSI midlayer requires this field for the uses
4078# above. The lpfc driver limits the default value to 255 for two reasons.
4079# As it bounds the sequential scan loop, scanning for thousands of luns
4080# on a target can take minutes of wall clock time. Additionally,
4081# there are FC targets, such as JBODs, that only recognize 8-bits of
4082# LUN ID. When they receive a value greater than 8 bits, they chop off
4083# the high order bits. In other words, they see LUN IDs 0, 256, 512,
4084# and so on all as LUN ID 0. This causes the linux kernel, which sees
4085# valid responses at each of the LUN IDs, to believe there are multiple
4086# devices present, when in fact, there is only 1.
4087# A customer that is aware of their target behaviors, and the results as
4088# indicated above, is welcome to increase the lpfc_max_luns value.
4089# As mentioned, this value is not used by the lpfc driver, only the
4090# SCSI midlayer.
4074# Value range is [0,65535]. Default value is 255. 4091# Value range is [0,65535]. Default value is 255.
4075# NOTE: The SCSI layer might probe all allowed LUN on some old targets. 4092# NOTE: The SCSI layer might probe all allowed LUN on some old targets.
4076*/ 4093*/
4077LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN"); 4094LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN ID");
4078 4095
4079/* 4096/*
4080# lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. 4097# lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring.
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 094be2cad65b..6630520d295c 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.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) 2009-2012 Emulex. All rights reserved. * 4 * Copyright (C) 2009-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 * *
@@ -3392,6 +3392,7 @@ static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba,
3392 case MBX_DOWN_LOAD: 3392 case MBX_DOWN_LOAD:
3393 case MBX_UPDATE_CFG: 3393 case MBX_UPDATE_CFG:
3394 case MBX_KILL_BOARD: 3394 case MBX_KILL_BOARD:
3395 case MBX_READ_TOPOLOGY:
3395 case MBX_LOAD_AREA: 3396 case MBX_LOAD_AREA:
3396 case MBX_LOAD_EXP_ROM: 3397 case MBX_LOAD_EXP_ROM:
3397 case MBX_BEACON: 3398 case MBX_BEACON:
@@ -3422,7 +3423,6 @@ static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba,
3422 } 3423 }
3423 break; 3424 break;
3424 case MBX_READ_SPARM64: 3425 case MBX_READ_SPARM64:
3425 case MBX_READ_TOPOLOGY:
3426 case MBX_REG_LOGIN: 3426 case MBX_REG_LOGIN:
3427 case MBX_REG_LOGIN64: 3427 case MBX_REG_LOGIN64:
3428 case MBX_CONFIG_PORT: 3428 case MBX_CONFIG_PORT:
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index d41456e5f814..cda076a84239 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.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-2011 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 * *
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index ae1a07c57cae..68391177432b 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.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-2010 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 * *
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 3cae0a92e8bd..6b8ee7449f16 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.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-2012 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 *
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 0f6e2548f35d..60d6ca2f68c2 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.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-2012 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 *
@@ -6158,12 +6158,44 @@ lpfc_read_fcf_conn_tbl(struct lpfc_hba *phba,
6158 memcpy(&conn_entry->conn_rec, &conn_rec[i], 6158 memcpy(&conn_entry->conn_rec, &conn_rec[i],
6159 sizeof(struct lpfc_fcf_conn_rec)); 6159 sizeof(struct lpfc_fcf_conn_rec));
6160 conn_entry->conn_rec.vlan_tag = 6160 conn_entry->conn_rec.vlan_tag =
6161 le16_to_cpu(conn_entry->conn_rec.vlan_tag) & 0xFFF; 6161 conn_entry->conn_rec.vlan_tag;
6162 conn_entry->conn_rec.flags = 6162 conn_entry->conn_rec.flags =
6163 le16_to_cpu(conn_entry->conn_rec.flags); 6163 conn_entry->conn_rec.flags;
6164 list_add_tail(&conn_entry->list, 6164 list_add_tail(&conn_entry->list,
6165 &phba->fcf_conn_rec_list); 6165 &phba->fcf_conn_rec_list);
6166 } 6166 }
6167
6168 if (!list_empty(&phba->fcf_conn_rec_list)) {
6169 i = 0;
6170 list_for_each_entry(conn_entry, &phba->fcf_conn_rec_list,
6171 list) {
6172 conn_rec = &conn_entry->conn_rec;
6173 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
6174 "3345 FCF connection list rec[%02d]: "
6175 "flags:x%04x, vtag:x%04x, "
6176 "fabric_name:x%02x:%02x:%02x:%02x:"
6177 "%02x:%02x:%02x:%02x, "
6178 "switch_name:x%02x:%02x:%02x:%02x:"
6179 "%02x:%02x:%02x:%02x\n", i++,
6180 conn_rec->flags, conn_rec->vlan_tag,
6181 conn_rec->fabric_name[0],
6182 conn_rec->fabric_name[1],
6183 conn_rec->fabric_name[2],
6184 conn_rec->fabric_name[3],
6185 conn_rec->fabric_name[4],
6186 conn_rec->fabric_name[5],
6187 conn_rec->fabric_name[6],
6188 conn_rec->fabric_name[7],
6189 conn_rec->switch_name[0],
6190 conn_rec->switch_name[1],
6191 conn_rec->switch_name[2],
6192 conn_rec->switch_name[3],
6193 conn_rec->switch_name[4],
6194 conn_rec->switch_name[5],
6195 conn_rec->switch_name[6],
6196 conn_rec->switch_name[7]);
6197 }
6198 }
6167} 6199}
6168 6200
6169/** 6201/**
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 83700c18f468..6f927d30ca69 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.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-2011 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 * *
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 713a4613ec3a..4ec3d7c044c2 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.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) 2009-2012 Emulex. All rights reserved. * 4 * Copyright (C) 2009-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 * *
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index cb465b253910..e0b20fad8502 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.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-2012 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 *
@@ -60,7 +60,8 @@ unsigned long _dump_buf_dif_order;
60spinlock_t _dump_buf_lock; 60spinlock_t _dump_buf_lock;
61 61
62/* Used when mapping IRQ vectors in a driver centric manner */ 62/* Used when mapping IRQ vectors in a driver centric manner */
63uint16_t lpfc_used_cpu[LPFC_MAX_CPU]; 63uint16_t *lpfc_used_cpu;
64uint32_t lpfc_present_cpu;
64 65
65static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); 66static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *);
66static int lpfc_post_rcv_buf(struct lpfc_hba *); 67static int lpfc_post_rcv_buf(struct lpfc_hba *);
@@ -4049,52 +4050,6 @@ lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba)
4049} 4050}
4050 4051
4051/** 4052/**
4052 * lpfc_sli4_perform_inuse_fcf_recovery - Perform inuse fcf recovery
4053 * @vport: pointer to lpfc hba data structure.
4054 *
4055 * This routine is to perform FCF recovery when the in-use FCF either dead or
4056 * got modified.
4057 **/
4058static void
4059lpfc_sli4_perform_inuse_fcf_recovery(struct lpfc_hba *phba,
4060 struct lpfc_acqe_fip *acqe_fip)
4061{
4062 int rc;
4063
4064 spin_lock_irq(&phba->hbalock);
4065 /* Mark the fast failover process in progress */
4066 phba->fcf.fcf_flag |= FCF_DEAD_DISC;
4067 spin_unlock_irq(&phba->hbalock);
4068
4069 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
4070 "2771 Start FCF fast failover process due to in-use "
4071 "FCF DEAD/MODIFIED event: evt_tag:x%x, index:x%x\n",
4072 acqe_fip->event_tag, acqe_fip->index);
4073 rc = lpfc_sli4_redisc_fcf_table(phba);
4074 if (rc) {
4075 lpfc_printf_log(phba, KERN_ERR, LOG_FIP | LOG_DISCOVERY,
4076 "2772 Issue FCF rediscover mabilbox command "
4077 "failed, fail through to FCF dead event\n");
4078 spin_lock_irq(&phba->hbalock);
4079 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC;
4080 spin_unlock_irq(&phba->hbalock);
4081 /*
4082 * Last resort will fail over by treating this as a link
4083 * down to FCF registration.
4084 */
4085 lpfc_sli4_fcf_dead_failthrough(phba);
4086 } else {
4087 /* Reset FCF roundrobin bmask for new discovery */
4088 lpfc_sli4_clear_fcf_rr_bmask(phba);
4089 /*
4090 * Handling fast FCF failover to a DEAD FCF event is
4091 * considered equalivant to receiving CVL to all vports.
4092 */
4093 lpfc_sli4_perform_all_vport_cvl(phba);
4094 }
4095}
4096
4097/**
4098 * lpfc_sli4_async_fip_evt - Process the asynchronous FCoE FIP event 4053 * lpfc_sli4_async_fip_evt - Process the asynchronous FCoE FIP event
4099 * @phba: pointer to lpfc hba data structure. 4054 * @phba: pointer to lpfc hba data structure.
4100 * @acqe_link: pointer to the async fcoe completion queue entry. 4055 * @acqe_link: pointer to the async fcoe completion queue entry.
@@ -4159,22 +4114,9 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
4159 break; 4114 break;
4160 } 4115 }
4161 4116
4162 /* If FCF has been in discovered state, perform rediscovery 4117 /* If the FCF has been in discovered state, do nothing. */
4163 * only if the FCF with the same index of the in-use FCF got 4118 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) {
4164 * modified during normal operation. Otherwise, do nothing.
4165 */
4166 if (phba->pport->port_state > LPFC_FLOGI) {
4167 spin_unlock_irq(&phba->hbalock); 4119 spin_unlock_irq(&phba->hbalock);
4168 if (phba->fcf.current_rec.fcf_indx ==
4169 acqe_fip->index) {
4170 lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
4171 "3300 In-use FCF (%d) "
4172 "modified, perform FCF "
4173 "rediscovery\n",
4174 acqe_fip->index);
4175 lpfc_sli4_perform_inuse_fcf_recovery(phba,
4176 acqe_fip);
4177 }
4178 break; 4120 break;
4179 } 4121 }
4180 spin_unlock_irq(&phba->hbalock); 4122 spin_unlock_irq(&phba->hbalock);
@@ -4227,7 +4169,39 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
4227 * is no longer valid as we are not in the middle of FCF 4169 * is no longer valid as we are not in the middle of FCF
4228 * failover process already. 4170 * failover process already.
4229 */ 4171 */
4230 lpfc_sli4_perform_inuse_fcf_recovery(phba, acqe_fip); 4172 spin_lock_irq(&phba->hbalock);
4173 /* Mark the fast failover process in progress */
4174 phba->fcf.fcf_flag |= FCF_DEAD_DISC;
4175 spin_unlock_irq(&phba->hbalock);
4176
4177 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
4178 "2771 Start FCF fast failover process due to "
4179 "FCF DEAD event: evt_tag:x%x, fcf_index:x%x "
4180 "\n", acqe_fip->event_tag, acqe_fip->index);
4181 rc = lpfc_sli4_redisc_fcf_table(phba);
4182 if (rc) {
4183 lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
4184 LOG_DISCOVERY,
4185 "2772 Issue FCF rediscover mabilbox "
4186 "command failed, fail through to FCF "
4187 "dead event\n");
4188 spin_lock_irq(&phba->hbalock);
4189 phba->fcf.fcf_flag &= ~FCF_DEAD_DISC;
4190 spin_unlock_irq(&phba->hbalock);
4191 /*
4192 * Last resort will fail over by treating this
4193 * as a link down to FCF registration.
4194 */
4195 lpfc_sli4_fcf_dead_failthrough(phba);
4196 } else {
4197 /* Reset FCF roundrobin bmask for new discovery */
4198 lpfc_sli4_clear_fcf_rr_bmask(phba);
4199 /*
4200 * Handling fast FCF failover to a DEAD FCF event is
4201 * considered equalivant to receiving CVL to all vports.
4202 */
4203 lpfc_sli4_perform_all_vport_cvl(phba);
4204 }
4231 break; 4205 break;
4232 case LPFC_FIP_EVENT_TYPE_CVL: 4206 case LPFC_FIP_EVENT_TYPE_CVL:
4233 phba->fcoe_cvl_eventtag = acqe_fip->event_tag; 4207 phba->fcoe_cvl_eventtag = acqe_fip->event_tag;
@@ -5213,6 +5187,21 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
5213 rc = -ENOMEM; 5187 rc = -ENOMEM;
5214 goto out_free_msix; 5188 goto out_free_msix;
5215 } 5189 }
5190 if (lpfc_used_cpu == NULL) {
5191 lpfc_used_cpu = kzalloc((sizeof(uint16_t) * lpfc_present_cpu),
5192 GFP_KERNEL);
5193 if (!lpfc_used_cpu) {
5194 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
5195 "3335 Failed allocate memory for msi-x "
5196 "interrupt vector mapping\n");
5197 kfree(phba->sli4_hba.cpu_map);
5198 rc = -ENOMEM;
5199 goto out_free_msix;
5200 }
5201 for (i = 0; i < lpfc_present_cpu; i++)
5202 lpfc_used_cpu[i] = LPFC_VECTOR_MAP_EMPTY;
5203 }
5204
5216 /* Initialize io channels for round robin */ 5205 /* Initialize io channels for round robin */
5217 cpup = phba->sli4_hba.cpu_map; 5206 cpup = phba->sli4_hba.cpu_map;
5218 rc = 0; 5207 rc = 0;
@@ -6824,8 +6813,6 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba)
6824 int cfg_fcp_io_channel; 6813 int cfg_fcp_io_channel;
6825 uint32_t cpu; 6814 uint32_t cpu;
6826 uint32_t i = 0; 6815 uint32_t i = 0;
6827 uint32_t j = 0;
6828
6829 6816
6830 /* 6817 /*
6831 * Sanity check for configured queue parameters against the run-time 6818 * Sanity check for configured queue parameters against the run-time
@@ -6839,10 +6826,9 @@ lpfc_sli4_queue_verify(struct lpfc_hba *phba)
6839 for_each_present_cpu(cpu) { 6826 for_each_present_cpu(cpu) {
6840 if (cpu_online(cpu)) 6827 if (cpu_online(cpu))
6841 i++; 6828 i++;
6842 j++;
6843 } 6829 }
6844 phba->sli4_hba.num_online_cpu = i; 6830 phba->sli4_hba.num_online_cpu = i;
6845 phba->sli4_hba.num_present_cpu = j; 6831 phba->sli4_hba.num_present_cpu = lpfc_present_cpu;
6846 6832
6847 if (i < cfg_fcp_io_channel) { 6833 if (i < cfg_fcp_io_channel) {
6848 lpfc_printf_log(phba, 6834 lpfc_printf_log(phba,
@@ -10967,8 +10953,10 @@ lpfc_init(void)
10967 } 10953 }
10968 10954
10969 /* Initialize in case vector mapping is needed */ 10955 /* Initialize in case vector mapping is needed */
10970 for (cpu = 0; cpu < LPFC_MAX_CPU; cpu++) 10956 lpfc_used_cpu = NULL;
10971 lpfc_used_cpu[cpu] = LPFC_VECTOR_MAP_EMPTY; 10957 lpfc_present_cpu = 0;
10958 for_each_present_cpu(cpu)
10959 lpfc_present_cpu++;
10972 10960
10973 error = pci_register_driver(&lpfc_driver); 10961 error = pci_register_driver(&lpfc_driver);
10974 if (error) { 10962 if (error) {
@@ -11008,6 +10996,7 @@ lpfc_exit(void)
11008 (1L << _dump_buf_dif_order), _dump_buf_dif); 10996 (1L << _dump_buf_dif_order), _dump_buf_dif);
11009 free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order); 10997 free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order);
11010 } 10998 }
10999 kfree(lpfc_used_cpu);
11011} 11000}
11012 11001
11013module_init(lpfc_init); 11002module_init(lpfc_init);
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 41363db7d426..b1c510f6b8f0 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.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-2009 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 *
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 31e9b92f5a9b..6aaf39a1f1c5 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.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-2012 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 *
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 8523b278ec9d..243de1d324b7 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.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-2012 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 *
@@ -68,14 +68,12 @@ struct scsi_dif_tuple {
68 __be32 ref_tag; /* Target LBA or indirect LBA */ 68 __be32 ref_tag; /* Target LBA or indirect LBA */
69}; 69};
70 70
71#if !defined(SCSI_PROT_GUARD_CHECK) || !defined(SCSI_PROT_REF_CHECK)
72#define scsi_prot_flagged(sc, flg) sc
73#endif
74
75static void 71static void
76lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); 72lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb);
77static void 73static void
78lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb); 74lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb);
75static int
76lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc);
79 77
80static void 78static void
81lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) 79lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd)
@@ -134,6 +132,30 @@ lpfc_debug_save_dif(struct lpfc_hba *phba, struct scsi_cmnd *cmnd)
134 } 132 }
135} 133}
136 134
135static inline unsigned
136lpfc_cmd_blksize(struct scsi_cmnd *sc)
137{
138 return sc->device->sector_size;
139}
140
141#define LPFC_CHECK_PROTECT_GUARD 1
142#define LPFC_CHECK_PROTECT_REF 2
143static inline unsigned
144lpfc_cmd_protect(struct scsi_cmnd *sc, int flag)
145{
146 return 1;
147}
148
149static inline unsigned
150lpfc_cmd_guard_csum(struct scsi_cmnd *sc)
151{
152 if (lpfc_prot_group_type(NULL, sc) == LPFC_PG_TYPE_NO_DIF)
153 return 0;
154 if (scsi_host_get_guard(sc->device->host) == SHOST_DIX_GUARD_IP)
155 return 1;
156 return 0;
157}
158
137/** 159/**
138 * lpfc_sli4_set_rsp_sgl_last - Set the last bit in the response sge. 160 * lpfc_sli4_set_rsp_sgl_last - Set the last bit in the response sge.
139 * @phba: Pointer to HBA object. 161 * @phba: Pointer to HBA object.
@@ -1144,13 +1166,14 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
1144static struct lpfc_scsi_buf* 1166static struct lpfc_scsi_buf*
1145lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) 1167lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
1146{ 1168{
1147 struct lpfc_scsi_buf *lpfc_cmd ; 1169 struct lpfc_scsi_buf *lpfc_cmd, *lpfc_cmd_next;
1148 unsigned long gflag = 0; 1170 unsigned long gflag = 0;
1149 unsigned long pflag = 0; 1171 unsigned long pflag = 0;
1150 int found = 0; 1172 int found = 0;
1151 1173
1152 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); 1174 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag);
1153 list_for_each_entry(lpfc_cmd, &phba->lpfc_scsi_buf_list_get, list) { 1175 list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next,
1176 &phba->lpfc_scsi_buf_list_get, list) {
1154 if (lpfc_test_rrq_active(phba, ndlp, 1177 if (lpfc_test_rrq_active(phba, ndlp,
1155 lpfc_cmd->cur_iocbq.sli4_lxritag)) 1178 lpfc_cmd->cur_iocbq.sli4_lxritag))
1156 continue; 1179 continue;
@@ -1164,8 +1187,8 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
1164 &phba->lpfc_scsi_buf_list_get); 1187 &phba->lpfc_scsi_buf_list_get);
1165 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); 1188 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put);
1166 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); 1189 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag);
1167 list_for_each_entry(lpfc_cmd, &phba->lpfc_scsi_buf_list_get, 1190 list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next,
1168 list) { 1191 &phba->lpfc_scsi_buf_list_get, list) {
1169 if (lpfc_test_rrq_active( 1192 if (lpfc_test_rrq_active(
1170 phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag)) 1193 phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag))
1171 continue; 1194 continue;
@@ -1409,12 +1432,6 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
1409 return 0; 1432 return 0;
1410} 1433}
1411 1434
1412static inline unsigned
1413lpfc_cmd_blksize(struct scsi_cmnd *sc)
1414{
1415 return sc->device->sector_size;
1416}
1417
1418#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 1435#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
1419 1436
1420/* Return if if error injection is detected by Initiator */ 1437/* Return if if error injection is detected by Initiator */
@@ -1847,10 +1864,9 @@ static int
1847lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, 1864lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1848 uint8_t *txop, uint8_t *rxop) 1865 uint8_t *txop, uint8_t *rxop)
1849{ 1866{
1850 uint8_t guard_type = scsi_host_get_guard(sc->device->host);
1851 uint8_t ret = 0; 1867 uint8_t ret = 0;
1852 1868
1853 if (guard_type == SHOST_DIX_GUARD_IP) { 1869 if (lpfc_cmd_guard_csum(sc)) {
1854 switch (scsi_get_prot_op(sc)) { 1870 switch (scsi_get_prot_op(sc)) {
1855 case SCSI_PROT_READ_INSERT: 1871 case SCSI_PROT_READ_INSERT:
1856 case SCSI_PROT_WRITE_STRIP: 1872 case SCSI_PROT_WRITE_STRIP:
@@ -1928,10 +1944,9 @@ static int
1928lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, 1944lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1929 uint8_t *txop, uint8_t *rxop) 1945 uint8_t *txop, uint8_t *rxop)
1930{ 1946{
1931 uint8_t guard_type = scsi_host_get_guard(sc->device->host);
1932 uint8_t ret = 0; 1947 uint8_t ret = 0;
1933 1948
1934 if (guard_type == SHOST_DIX_GUARD_IP) { 1949 if (lpfc_cmd_guard_csum(sc)) {
1935 switch (scsi_get_prot_op(sc)) { 1950 switch (scsi_get_prot_op(sc)) {
1936 case SCSI_PROT_READ_INSERT: 1951 case SCSI_PROT_READ_INSERT:
1937 case SCSI_PROT_WRITE_STRIP: 1952 case SCSI_PROT_WRITE_STRIP:
@@ -2078,12 +2093,12 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2078 * protection data is automatically generated, not checked. 2093 * protection data is automatically generated, not checked.
2079 */ 2094 */
2080 if (datadir == DMA_FROM_DEVICE) { 2095 if (datadir == DMA_FROM_DEVICE) {
2081 if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK)) 2096 if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD))
2082 bf_set(pde6_ce, pde6, checking); 2097 bf_set(pde6_ce, pde6, checking);
2083 else 2098 else
2084 bf_set(pde6_ce, pde6, 0); 2099 bf_set(pde6_ce, pde6, 0);
2085 2100
2086 if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK)) 2101 if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF))
2087 bf_set(pde6_re, pde6, checking); 2102 bf_set(pde6_re, pde6, checking);
2088 else 2103 else
2089 bf_set(pde6_re, pde6, 0); 2104 bf_set(pde6_re, pde6, 0);
@@ -2240,12 +2255,12 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2240 bf_set(pde6_optx, pde6, txop); 2255 bf_set(pde6_optx, pde6, txop);
2241 bf_set(pde6_oprx, pde6, rxop); 2256 bf_set(pde6_oprx, pde6, rxop);
2242 2257
2243 if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK)) 2258 if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD))
2244 bf_set(pde6_ce, pde6, checking); 2259 bf_set(pde6_ce, pde6, checking);
2245 else 2260 else
2246 bf_set(pde6_ce, pde6, 0); 2261 bf_set(pde6_ce, pde6, 0);
2247 2262
2248 if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK)) 2263 if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF))
2249 bf_set(pde6_re, pde6, checking); 2264 bf_set(pde6_re, pde6, checking);
2250 else 2265 else
2251 bf_set(pde6_re, pde6, 0); 2266 bf_set(pde6_re, pde6, 0);
@@ -2454,12 +2469,12 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2454 * protection data is automatically generated, not checked. 2469 * protection data is automatically generated, not checked.
2455 */ 2470 */
2456 if (sc->sc_data_direction == DMA_FROM_DEVICE) { 2471 if (sc->sc_data_direction == DMA_FROM_DEVICE) {
2457 if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK)) 2472 if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD))
2458 bf_set(lpfc_sli4_sge_dif_ce, diseed, checking); 2473 bf_set(lpfc_sli4_sge_dif_ce, diseed, checking);
2459 else 2474 else
2460 bf_set(lpfc_sli4_sge_dif_ce, diseed, 0); 2475 bf_set(lpfc_sli4_sge_dif_ce, diseed, 0);
2461 2476
2462 if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK)) 2477 if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF))
2463 bf_set(lpfc_sli4_sge_dif_re, diseed, checking); 2478 bf_set(lpfc_sli4_sge_dif_re, diseed, checking);
2464 else 2479 else
2465 bf_set(lpfc_sli4_sge_dif_re, diseed, 0); 2480 bf_set(lpfc_sli4_sge_dif_re, diseed, 0);
@@ -2610,7 +2625,7 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2610 diseed->ref_tag = cpu_to_le32(reftag); 2625 diseed->ref_tag = cpu_to_le32(reftag);
2611 diseed->ref_tag_tran = diseed->ref_tag; 2626 diseed->ref_tag_tran = diseed->ref_tag;
2612 2627
2613 if (scsi_prot_flagged(sc, SCSI_PROT_GUARD_CHECK)) { 2628 if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_GUARD)) {
2614 bf_set(lpfc_sli4_sge_dif_ce, diseed, checking); 2629 bf_set(lpfc_sli4_sge_dif_ce, diseed, checking);
2615 2630
2616 } else { 2631 } else {
@@ -2629,7 +2644,7 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2629 } 2644 }
2630 2645
2631 2646
2632 if (scsi_prot_flagged(sc, SCSI_PROT_REF_CHECK)) 2647 if (lpfc_cmd_protect(sc, LPFC_CHECK_PROTECT_REF))
2633 bf_set(lpfc_sli4_sge_dif_re, diseed, checking); 2648 bf_set(lpfc_sli4_sge_dif_re, diseed, checking);
2634 else 2649 else
2635 bf_set(lpfc_sli4_sge_dif_re, diseed, 0); 2650 bf_set(lpfc_sli4_sge_dif_re, diseed, 0);
@@ -2792,11 +2807,12 @@ lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc)
2792 ret = LPFC_PG_TYPE_DIF_BUF; 2807 ret = LPFC_PG_TYPE_DIF_BUF;
2793 break; 2808 break;
2794 default: 2809 default:
2795 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 2810 if (phba)
2796 "9021 Unsupported protection op:%d\n", op); 2811 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
2812 "9021 Unsupported protection op:%d\n",
2813 op);
2797 break; 2814 break;
2798 } 2815 }
2799
2800 return ret; 2816 return ret;
2801} 2817}
2802 2818
@@ -2821,22 +2837,22 @@ lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba,
2821 2837
2822 /* Check if there is protection data on the wire */ 2838 /* Check if there is protection data on the wire */
2823 if (sc->sc_data_direction == DMA_FROM_DEVICE) { 2839 if (sc->sc_data_direction == DMA_FROM_DEVICE) {
2824 /* Read */ 2840 /* Read check for protection data */
2825 if (scsi_get_prot_op(sc) == SCSI_PROT_READ_INSERT) 2841 if (scsi_get_prot_op(sc) == SCSI_PROT_READ_INSERT)
2826 return fcpdl; 2842 return fcpdl;
2827 2843
2828 } else { 2844 } else {
2829 /* Write */ 2845 /* Write check for protection data */
2830 if (scsi_get_prot_op(sc) == SCSI_PROT_WRITE_STRIP) 2846 if (scsi_get_prot_op(sc) == SCSI_PROT_WRITE_STRIP)
2831 return fcpdl; 2847 return fcpdl;
2832 } 2848 }
2833 2849
2834 /* 2850 /*
2835 * If we are in DIF Type 1 mode every data block has a 8 byte 2851 * If we are in DIF Type 1 mode every data block has a 8 byte
2836 * DIF (trailer) attached to it. Must ajust FCP data length. 2852 * DIF (trailer) attached to it. Must ajust FCP data length
2853 * to account for the protection data.
2837 */ 2854 */
2838 if (scsi_prot_flagged(sc, SCSI_PROT_TRANSFER_PI)) 2855 fcpdl += (fcpdl / lpfc_cmd_blksize(sc)) * 8;
2839 fcpdl += (fcpdl / lpfc_cmd_blksize(sc)) * 8;
2840 2856
2841 return fcpdl; 2857 return fcpdl;
2842} 2858}
@@ -3073,9 +3089,9 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
3073 chk_guard = 1; 3089 chk_guard = 1;
3074 guard_type = scsi_host_get_guard(cmd->device->host); 3090 guard_type = scsi_host_get_guard(cmd->device->host);
3075 3091
3092 src = (struct scsi_dif_tuple *)sg_virt(sgpe);
3076 start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */ 3093 start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */
3077 start_app_tag = src->app_tag; 3094 start_app_tag = src->app_tag;
3078 src = (struct scsi_dif_tuple *)sg_virt(sgpe);
3079 len = sgpe->length; 3095 len = sgpe->length;
3080 while (src && protsegcnt) { 3096 while (src && protsegcnt) {
3081 while (len) { 3097 while (len) {
@@ -3090,25 +3106,10 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
3090 goto skipit; 3106 goto skipit;
3091 } 3107 }
3092 3108
3093 /* App Tag checking */ 3109 /* First Guard Tag checking */
3094 app_tag = src->app_tag;
3095 if (chk_app && (app_tag != start_app_tag)) {
3096 err_type = BGS_APPTAG_ERR_MASK;
3097 goto out;
3098 }
3099
3100 /* Reference Tag checking */
3101 ref_tag = be32_to_cpu(src->ref_tag);
3102 if (chk_ref && (ref_tag != start_ref_tag)) {
3103 err_type = BGS_REFTAG_ERR_MASK;
3104 goto out;
3105 }
3106 start_ref_tag++;
3107
3108 /* Guard Tag checking */
3109 if (chk_guard) { 3110 if (chk_guard) {
3110 guard_tag = src->guard_tag; 3111 guard_tag = src->guard_tag;
3111 if (guard_type == SHOST_DIX_GUARD_IP) 3112 if (lpfc_cmd_guard_csum(cmd))
3112 sum = lpfc_bg_csum(data_src, 3113 sum = lpfc_bg_csum(data_src,
3113 blksize); 3114 blksize);
3114 else 3115 else
@@ -3119,6 +3120,21 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
3119 goto out; 3120 goto out;
3120 } 3121 }
3121 } 3122 }
3123
3124 /* Reference Tag checking */
3125 ref_tag = be32_to_cpu(src->ref_tag);
3126 if (chk_ref && (ref_tag != start_ref_tag)) {
3127 err_type = BGS_REFTAG_ERR_MASK;
3128 goto out;
3129 }
3130 start_ref_tag++;
3131
3132 /* App Tag checking */
3133 app_tag = src->app_tag;
3134 if (chk_app && (app_tag != start_app_tag)) {
3135 err_type = BGS_APPTAG_ERR_MASK;
3136 goto out;
3137 }
3122skipit: 3138skipit:
3123 len -= sizeof(struct scsi_dif_tuple); 3139 len -= sizeof(struct scsi_dif_tuple);
3124 if (len < 0) 3140 if (len < 0)
@@ -4074,7 +4090,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
4074 cmd->device ? cmd->device->id : 0xffff, 4090 cmd->device ? cmd->device->id : 0xffff,
4075 cmd->device ? cmd->device->lun : 0xffff, 4091 cmd->device ? cmd->device->lun : 0xffff,
4076 lpfc_cmd->status, lpfc_cmd->result, 4092 lpfc_cmd->status, lpfc_cmd->result,
4077 vport->fc_myDID, pnode->nlp_DID, 4093 vport->fc_myDID,
4094 (pnode) ? pnode->nlp_DID : 0,
4078 phba->sli_rev == LPFC_SLI_REV4 ? 4095 phba->sli_rev == LPFC_SLI_REV4 ?
4079 lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff, 4096 lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff,
4080 pIocbOut->iocb.ulpContext, 4097 pIocbOut->iocb.ulpContext,
diff --git a/drivers/scsi/lpfc/lpfc_scsi.h b/drivers/scsi/lpfc/lpfc_scsi.h
index 21a2ffe67eac..b1d9f7fcb911 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.h
+++ b/drivers/scsi/lpfc/lpfc_scsi.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-2012 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 * *
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 572579f87de4..43440ca16f46 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.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-2012 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 *
@@ -1011,17 +1011,6 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1011 else 1011 else
1012 sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_lxritag); 1012 sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_lxritag);
1013 1013
1014 /*
1015 ** This should have been removed from the txcmplq before calling
1016 ** iocbq_release. The normal completion
1017 ** path should have already done the list_del_init.
1018 */
1019 if (unlikely(!list_empty(&iocbq->list))) {
1020 if (iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ)
1021 iocbq->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ;
1022 list_del_init(&iocbq->list);
1023 }
1024
1025 1014
1026 if (sglq) { 1015 if (sglq) {
1027 if ((iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) && 1016 if ((iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) &&
@@ -1070,13 +1059,6 @@ __lpfc_sli_release_iocbq_s3(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1070{ 1059{
1071 size_t start_clean = offsetof(struct lpfc_iocbq, iocb); 1060 size_t start_clean = offsetof(struct lpfc_iocbq, iocb);
1072 1061
1073 /*
1074 ** This should have been removed from the txcmplq before calling
1075 ** iocbq_release. The normal completion
1076 ** path should have already done the list_del_init.
1077 */
1078 if (unlikely(!list_empty(&iocbq->list)))
1079 list_del_init(&iocbq->list);
1080 1062
1081 /* 1063 /*
1082 * Clean all volatile data fields, preserve iotag and node struct. 1064 * Clean all volatile data fields, preserve iotag and node struct.
@@ -3279,7 +3261,7 @@ lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3279 if (free_saveq) { 3261 if (free_saveq) {
3280 list_for_each_entry_safe(rspiocbp, next_iocb, 3262 list_for_each_entry_safe(rspiocbp, next_iocb,
3281 &saveq->list, list) { 3263 &saveq->list, list) {
3282 list_del(&rspiocbp->list); 3264 list_del_init(&rspiocbp->list);
3283 __lpfc_sli_release_iocbq(phba, rspiocbp); 3265 __lpfc_sli_release_iocbq(phba, rspiocbp);
3284 } 3266 }
3285 __lpfc_sli_release_iocbq(phba, saveq); 3267 __lpfc_sli_release_iocbq(phba, saveq);
@@ -4584,7 +4566,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
4584 } else { 4566 } else {
4585 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 4567 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
4586 "2708 This device does not support " 4568 "2708 This device does not support "
4587 "Advanced Error Reporting (AER)\n"); 4569 "Advanced Error Reporting (AER): %d\n",
4570 rc);
4588 phba->cfg_aer_support = 0; 4571 phba->cfg_aer_support = 0;
4589 } 4572 }
4590 } 4573 }
@@ -8731,7 +8714,7 @@ lpfc_sli4_abts_err_handler(struct lpfc_hba *phba,
8731 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 8714 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
8732 "3116 Port generated FCP XRI ABORT event on " 8715 "3116 Port generated FCP XRI ABORT event on "
8733 "vpi %d rpi %d xri x%x status 0x%x parameter x%x\n", 8716 "vpi %d rpi %d xri x%x status 0x%x parameter x%x\n",
8734 ndlp->vport->vpi, ndlp->nlp_rpi, 8717 ndlp->vport->vpi, phba->sli4_hba.rpi_ids[ndlp->nlp_rpi],
8735 bf_get(lpfc_wcqe_xa_xri, axri), 8718 bf_get(lpfc_wcqe_xa_xri, axri),
8736 bf_get(lpfc_wcqe_xa_status, axri), 8719 bf_get(lpfc_wcqe_xa_status, axri),
8737 axri->parameter); 8720 axri->parameter);
@@ -9787,7 +9770,7 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
9787 struct lpfc_iocbq *rspiocb) 9770 struct lpfc_iocbq *rspiocb)
9788{ 9771{
9789 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 9772 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
9790 "3096 ABORT_XRI_CN completing on xri x%x " 9773 "3096 ABORT_XRI_CN completing on rpi x%x "
9791 "original iotag x%x, abort cmd iotag x%x " 9774 "original iotag x%x, abort cmd iotag x%x "
9792 "status 0x%x, reason 0x%x\n", 9775 "status 0x%x, reason 0x%x\n",
9793 cmdiocb->iocb.un.acxri.abortContextTag, 9776 cmdiocb->iocb.un.acxri.abortContextTag,
@@ -10109,12 +10092,13 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq,
10109 uint32_t timeout) 10092 uint32_t timeout)
10110{ 10093{
10111 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q); 10094 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q);
10095 MAILBOX_t *mb = NULL;
10112 int retval; 10096 int retval;
10113 unsigned long flag; 10097 unsigned long flag;
10114 10098
10115 /* The caller must leave context1 empty. */ 10099 /* The caller might set context1 for extended buffer */
10116 if (pmboxq->context1) 10100 if (pmboxq->context1)
10117 return MBX_NOT_FINISHED; 10101 mb = (MAILBOX_t *)pmboxq->context1;
10118 10102
10119 pmboxq->mbox_flag &= ~LPFC_MBX_WAKE; 10103 pmboxq->mbox_flag &= ~LPFC_MBX_WAKE;
10120 /* setup wake call as IOCB callback */ 10104 /* setup wake call as IOCB callback */
@@ -10130,7 +10114,8 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq,
10130 msecs_to_jiffies(timeout * 1000)); 10114 msecs_to_jiffies(timeout * 1000));
10131 10115
10132 spin_lock_irqsave(&phba->hbalock, flag); 10116 spin_lock_irqsave(&phba->hbalock, flag);
10133 pmboxq->context1 = NULL; 10117 /* restore the possible extended buffer for free resource */
10118 pmboxq->context1 = (uint8_t *)mb;
10134 /* 10119 /*
10135 * if LPFC_MBX_WAKE flag is set the mailbox is completed 10120 * if LPFC_MBX_WAKE flag is set the mailbox is completed
10136 * else do not free the resources. 10121 * else do not free the resources.
@@ -10143,6 +10128,9 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq,
10143 pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 10128 pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
10144 } 10129 }
10145 spin_unlock_irqrestore(&phba->hbalock, flag); 10130 spin_unlock_irqrestore(&phba->hbalock, flag);
10131 } else {
10132 /* restore the possible extended buffer for free resource */
10133 pmboxq->context1 = (uint8_t *)mb;
10146 } 10134 }
10147 10135
10148 return retval; 10136 return retval;
@@ -16304,7 +16292,7 @@ lpfc_drain_txq(struct lpfc_hba *phba)
16304 union lpfc_wqe wqe; 16292 union lpfc_wqe wqe;
16305 int txq_cnt = 0; 16293 int txq_cnt = 0;
16306 16294
16307 spin_lock_irqsave(&phba->hbalock, iflags); 16295 spin_lock_irqsave(&pring->ring_lock, iflags);
16308 list_for_each_entry(piocbq, &pring->txq, list) { 16296 list_for_each_entry(piocbq, &pring->txq, list) {
16309 txq_cnt++; 16297 txq_cnt++;
16310 } 16298 }
@@ -16312,14 +16300,14 @@ lpfc_drain_txq(struct lpfc_hba *phba)
16312 if (txq_cnt > pring->txq_max) 16300 if (txq_cnt > pring->txq_max)
16313 pring->txq_max = txq_cnt; 16301 pring->txq_max = txq_cnt;
16314 16302
16315 spin_unlock_irqrestore(&phba->hbalock, iflags); 16303 spin_unlock_irqrestore(&pring->ring_lock, iflags);
16316 16304
16317 while (!list_empty(&pring->txq)) { 16305 while (!list_empty(&pring->txq)) {
16318 spin_lock_irqsave(&phba->hbalock, iflags); 16306 spin_lock_irqsave(&pring->ring_lock, iflags);
16319 16307
16320 piocbq = lpfc_sli_ringtx_get(phba, pring); 16308 piocbq = lpfc_sli_ringtx_get(phba, pring);
16321 if (!piocbq) { 16309 if (!piocbq) {
16322 spin_unlock_irqrestore(&phba->hbalock, iflags); 16310 spin_unlock_irqrestore(&pring->ring_lock, iflags);
16323 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 16311 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
16324 "2823 txq empty and txq_cnt is %d\n ", 16312 "2823 txq empty and txq_cnt is %d\n ",
16325 txq_cnt); 16313 txq_cnt);
@@ -16328,7 +16316,7 @@ lpfc_drain_txq(struct lpfc_hba *phba)
16328 sglq = __lpfc_sli_get_sglq(phba, piocbq); 16316 sglq = __lpfc_sli_get_sglq(phba, piocbq);
16329 if (!sglq) { 16317 if (!sglq) {
16330 __lpfc_sli_ringtx_put(phba, pring, piocbq); 16318 __lpfc_sli_ringtx_put(phba, pring, piocbq);
16331 spin_unlock_irqrestore(&phba->hbalock, iflags); 16319 spin_unlock_irqrestore(&pring->ring_lock, iflags);
16332 break; 16320 break;
16333 } 16321 }
16334 txq_cnt--; 16322 txq_cnt--;
@@ -16356,7 +16344,7 @@ lpfc_drain_txq(struct lpfc_hba *phba)
16356 piocbq->iotag, piocbq->sli4_xritag); 16344 piocbq->iotag, piocbq->sli4_xritag);
16357 list_add_tail(&piocbq->list, &completions); 16345 list_add_tail(&piocbq->list, &completions);
16358 } 16346 }
16359 spin_unlock_irqrestore(&phba->hbalock, iflags); 16347 spin_unlock_irqrestore(&pring->ring_lock, iflags);
16360 } 16348 }
16361 16349
16362 /* Cancel all the IOCBs that cannot be issued */ 16350 /* Cancel all the IOCBs that cannot be issued */
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index 67af460184ba..d710b87a4417 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.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) 2009-2011 Emulex. All rights reserved. * 4 * Copyright (C) 2009-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 * *
@@ -444,7 +444,6 @@ struct lpfc_vector_map_info {
444 struct cpumask maskbits; 444 struct cpumask maskbits;
445}; 445};
446#define LPFC_VECTOR_MAP_EMPTY 0xffff 446#define LPFC_VECTOR_MAP_EMPTY 0xffff
447#define LPFC_MAX_CPU 256
448 447
449/* SLI4 HBA data structure entries */ 448/* SLI4 HBA data structure entries */
450struct lpfc_sli4_hba { 449struct lpfc_sli4_hba {
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index a38dc3b16969..c6c32eebf3dd 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.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-2012 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 * *
@@ -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.39" 21#define LPFC_DRIVER_VERSION "8.3.40"
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 */
@@ -30,4 +30,4 @@
30 30
31#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ 31#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \
32 LPFC_DRIVER_VERSION 32 LPFC_DRIVER_VERSION
33#define LPFC_COPYRIGHT "Copyright(c) 2004-2009 Emulex. All rights reserved." 33#define LPFC_COPYRIGHT "Copyright(c) 2004-2013 Emulex. All rights reserved."