aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-14 20:49:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-14 20:49:48 -0400
commitabf04af74a9f27a65172a43b43ccabcbc2bbdc39 (patch)
treea9336a3797f8f6c445b1439278f558310ceae56a /drivers
parent16d52ef7c026f925893a1c0fc46516349928f319 (diff)
parentc7ee3bd4870ef1d96a1202f92ce858f849670a62 (diff)
Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull more SCSI updates from James Bottomley: "This is just a couple of drivers (hpsa and lpfc) that got left out for further testing in linux-next. We also have one fix to a prior submission (qla2xxx sparse)" * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (36 commits) qla2xxx: fix sparse warnings introduced by previous target mode t10-dif patch lpfc: Update lpfc version to driver version 10.2.8001.0 lpfc: Fix ExpressLane priority setup lpfc: mark old devices as obsolete lpfc: Fix for initializing RRQ bitmap lpfc: Fix for cleaning up stale ring flag and sp_queue_event entries lpfc: Update lpfc version to driver version 10.2.8000.0 lpfc: Update Copyright on changed files from 8.3.45 patches lpfc: Update Copyright on changed files lpfc: Fixed locking for scsi task management commands lpfc: Convert runtime references to old xlane cfg param to fof cfg param lpfc: Fix FW dump using sysfs lpfc: Fix SLI4 s abort loop to process all FCP rings and under ring_lock lpfc: Fixed kernel panic in lpfc_abort_handler lpfc: Fix locking for postbufq when freeing lpfc: Fix locking for lpfc_hba_down_post lpfc: Fix dynamic transitions of FirstBurst from on to off hpsa: fix handling of hpsa_volume_offline return value hpsa: return -ENOMEM not -1 on kzalloc failure in hpsa_get_device_id hpsa: remove messages about volume status VPD inquiry page not supported ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/hpsa.c266
-rw-r--r--drivers/scsi/hpsa.h42
-rw-r--r--drivers/scsi/hpsa_cmd.h49
-rw-r--r--drivers/scsi/lpfc/lpfc.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c23
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h6
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c5
-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.c258
-rw-r--r--drivers/scsi/lpfc/lpfc_mem.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c60
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c297
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h6
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h16
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c15
-rw-r--r--drivers/scsi/qla2xxx/qla_target.h16
24 files changed, 715 insertions, 369 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 5858600bfe59..31184b35370f 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -48,6 +48,7 @@
48#include <linux/bitmap.h> 48#include <linux/bitmap.h>
49#include <linux/atomic.h> 49#include <linux/atomic.h>
50#include <linux/jiffies.h> 50#include <linux/jiffies.h>
51#include <linux/percpu.h>
51#include <asm/div64.h> 52#include <asm/div64.h>
52#include "hpsa_cmd.h" 53#include "hpsa_cmd.h"
53#include "hpsa.h" 54#include "hpsa.h"
@@ -193,7 +194,8 @@ static int number_of_controllers;
193static irqreturn_t do_hpsa_intr_intx(int irq, void *dev_id); 194static irqreturn_t do_hpsa_intr_intx(int irq, void *dev_id);
194static irqreturn_t do_hpsa_intr_msi(int irq, void *dev_id); 195static irqreturn_t do_hpsa_intr_msi(int irq, void *dev_id);
195static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg); 196static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg);
196static void start_io(struct ctlr_info *h); 197static void lock_and_start_io(struct ctlr_info *h);
198static void start_io(struct ctlr_info *h, unsigned long *flags);
197 199
198#ifdef CONFIG_COMPAT 200#ifdef CONFIG_COMPAT
199static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg); 201static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg);
@@ -695,7 +697,7 @@ static inline void addQ(struct list_head *list, struct CommandList *c)
695static inline u32 next_command(struct ctlr_info *h, u8 q) 697static inline u32 next_command(struct ctlr_info *h, u8 q)
696{ 698{
697 u32 a; 699 u32 a;
698 struct reply_pool *rq = &h->reply_queue[q]; 700 struct reply_queue_buffer *rq = &h->reply_queue[q];
699 unsigned long flags; 701 unsigned long flags;
700 702
701 if (h->transMethod & CFGTBL_Trans_io_accel1) 703 if (h->transMethod & CFGTBL_Trans_io_accel1)
@@ -844,8 +846,8 @@ static void enqueue_cmd_and_start_io(struct ctlr_info *h,
844 spin_lock_irqsave(&h->lock, flags); 846 spin_lock_irqsave(&h->lock, flags);
845 addQ(&h->reqQ, c); 847 addQ(&h->reqQ, c);
846 h->Qdepth++; 848 h->Qdepth++;
849 start_io(h, &flags);
847 spin_unlock_irqrestore(&h->lock, flags); 850 spin_unlock_irqrestore(&h->lock, flags);
848 start_io(h);
849} 851}
850 852
851static inline void removeQ(struct CommandList *c) 853static inline void removeQ(struct CommandList *c)
@@ -1554,9 +1556,13 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,
1554 dev_warn(&h->pdev->dev, 1556 dev_warn(&h->pdev->dev,
1555 "%s: task complete with check condition.\n", 1557 "%s: task complete with check condition.\n",
1556 "HP SSD Smart Path"); 1558 "HP SSD Smart Path");
1559 cmd->result |= SAM_STAT_CHECK_CONDITION;
1557 if (c2->error_data.data_present != 1560 if (c2->error_data.data_present !=
1558 IOACCEL2_SENSE_DATA_PRESENT) 1561 IOACCEL2_SENSE_DATA_PRESENT) {
1562 memset(cmd->sense_buffer, 0,
1563 SCSI_SENSE_BUFFERSIZE);
1559 break; 1564 break;
1565 }
1560 /* copy the sense data */ 1566 /* copy the sense data */
1561 data_len = c2->error_data.sense_data_len; 1567 data_len = c2->error_data.sense_data_len;
1562 if (data_len > SCSI_SENSE_BUFFERSIZE) 1568 if (data_len > SCSI_SENSE_BUFFERSIZE)
@@ -1566,7 +1572,6 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,
1566 sizeof(c2->error_data.sense_data_buff); 1572 sizeof(c2->error_data.sense_data_buff);
1567 memcpy(cmd->sense_buffer, 1573 memcpy(cmd->sense_buffer,
1568 c2->error_data.sense_data_buff, data_len); 1574 c2->error_data.sense_data_buff, data_len);
1569 cmd->result |= SAM_STAT_CHECK_CONDITION;
1570 retry = 1; 1575 retry = 1;
1571 break; 1576 break;
1572 case IOACCEL2_STATUS_SR_TASK_COMP_BUSY: 1577 case IOACCEL2_STATUS_SR_TASK_COMP_BUSY:
@@ -1651,16 +1656,6 @@ static void process_ioaccel2_completion(struct ctlr_info *h,
1651 if (is_logical_dev_addr_mode(dev->scsi3addr) && 1656 if (is_logical_dev_addr_mode(dev->scsi3addr) &&
1652 c2->error_data.serv_response == 1657 c2->error_data.serv_response ==
1653 IOACCEL2_SERV_RESPONSE_FAILURE) { 1658 IOACCEL2_SERV_RESPONSE_FAILURE) {
1654 if (c2->error_data.status ==
1655 IOACCEL2_STATUS_SR_IOACCEL_DISABLED)
1656 dev_warn(&h->pdev->dev,
1657 "%s: Path is unavailable, retrying on standard path.\n",
1658 "HP SSD Smart Path");
1659 else
1660 dev_warn(&h->pdev->dev,
1661 "%s: Error 0x%02x, retrying on standard path.\n",
1662 "HP SSD Smart Path", c2->error_data.status);
1663
1664 dev->offload_enabled = 0; 1659 dev->offload_enabled = 0;
1665 h->drv_req_rescan = 1; /* schedule controller for a rescan */ 1660 h->drv_req_rescan = 1; /* schedule controller for a rescan */
1666 cmd->result = DID_SOFT_ERROR << 16; 1661 cmd->result = DID_SOFT_ERROR << 16;
@@ -1991,20 +1986,26 @@ static inline void hpsa_scsi_do_simple_cmd_core(struct ctlr_info *h,
1991 wait_for_completion(&wait); 1986 wait_for_completion(&wait);
1992} 1987}
1993 1988
1989static u32 lockup_detected(struct ctlr_info *h)
1990{
1991 int cpu;
1992 u32 rc, *lockup_detected;
1993
1994 cpu = get_cpu();
1995 lockup_detected = per_cpu_ptr(h->lockup_detected, cpu);
1996 rc = *lockup_detected;
1997 put_cpu();
1998 return rc;
1999}
2000
1994static void hpsa_scsi_do_simple_cmd_core_if_no_lockup(struct ctlr_info *h, 2001static void hpsa_scsi_do_simple_cmd_core_if_no_lockup(struct ctlr_info *h,
1995 struct CommandList *c) 2002 struct CommandList *c)
1996{ 2003{
1997 unsigned long flags;
1998
1999 /* If controller lockup detected, fake a hardware error. */ 2004 /* If controller lockup detected, fake a hardware error. */
2000 spin_lock_irqsave(&h->lock, flags); 2005 if (unlikely(lockup_detected(h)))
2001 if (unlikely(h->lockup_detected)) {
2002 spin_unlock_irqrestore(&h->lock, flags);
2003 c->err_info->CommandStatus = CMD_HARDWARE_ERR; 2006 c->err_info->CommandStatus = CMD_HARDWARE_ERR;
2004 } else { 2007 else
2005 spin_unlock_irqrestore(&h->lock, flags);
2006 hpsa_scsi_do_simple_cmd_core(h, c); 2008 hpsa_scsi_do_simple_cmd_core(h, c);
2007 }
2008} 2009}
2009 2010
2010#define MAX_DRIVER_CMD_RETRIES 25 2011#define MAX_DRIVER_CMD_RETRIES 25
@@ -2429,7 +2430,7 @@ static int hpsa_get_device_id(struct ctlr_info *h, unsigned char *scsi3addr,
2429 buflen = 16; 2430 buflen = 16;
2430 buf = kzalloc(64, GFP_KERNEL); 2431 buf = kzalloc(64, GFP_KERNEL);
2431 if (!buf) 2432 if (!buf)
2432 return -1; 2433 return -ENOMEM;
2433 rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | 0x83, buf, 64); 2434 rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | 0x83, buf, 64);
2434 if (rc == 0) 2435 if (rc == 0)
2435 memcpy(device_id, &buf[8], buflen); 2436 memcpy(device_id, &buf[8], buflen);
@@ -2515,27 +2516,21 @@ static int hpsa_get_volume_status(struct ctlr_info *h,
2515 return HPSA_VPD_LV_STATUS_UNSUPPORTED; 2516 return HPSA_VPD_LV_STATUS_UNSUPPORTED;
2516 2517
2517 /* Does controller have VPD for logical volume status? */ 2518 /* Does controller have VPD for logical volume status? */
2518 if (!hpsa_vpd_page_supported(h, scsi3addr, HPSA_VPD_LV_STATUS)) { 2519 if (!hpsa_vpd_page_supported(h, scsi3addr, HPSA_VPD_LV_STATUS))
2519 dev_warn(&h->pdev->dev, "Logical volume status VPD page is unsupported.\n");
2520 goto exit_failed; 2520 goto exit_failed;
2521 }
2522 2521
2523 /* Get the size of the VPD return buffer */ 2522 /* Get the size of the VPD return buffer */
2524 rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | HPSA_VPD_LV_STATUS, 2523 rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | HPSA_VPD_LV_STATUS,
2525 buf, HPSA_VPD_HEADER_SZ); 2524 buf, HPSA_VPD_HEADER_SZ);
2526 if (rc != 0) { 2525 if (rc != 0)
2527 dev_warn(&h->pdev->dev, "Logical volume status VPD inquiry failed.\n");
2528 goto exit_failed; 2526 goto exit_failed;
2529 }
2530 size = buf[3]; 2527 size = buf[3];
2531 2528
2532 /* Now get the whole VPD buffer */ 2529 /* Now get the whole VPD buffer */
2533 rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | HPSA_VPD_LV_STATUS, 2530 rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | HPSA_VPD_LV_STATUS,
2534 buf, size + HPSA_VPD_HEADER_SZ); 2531 buf, size + HPSA_VPD_HEADER_SZ);
2535 if (rc != 0) { 2532 if (rc != 0)
2536 dev_warn(&h->pdev->dev, "Logical volume status VPD inquiry failed.\n");
2537 goto exit_failed; 2533 goto exit_failed;
2538 }
2539 status = buf[4]; /* status byte */ 2534 status = buf[4]; /* status byte */
2540 2535
2541 kfree(buf); 2536 kfree(buf);
@@ -2548,11 +2543,11 @@ exit_failed:
2548/* Determine offline status of a volume. 2543/* Determine offline status of a volume.
2549 * Return either: 2544 * Return either:
2550 * 0 (not offline) 2545 * 0 (not offline)
2551 * -1 (offline for unknown reasons) 2546 * 0xff (offline for unknown reasons)
2552 * # (integer code indicating one of several NOT READY states 2547 * # (integer code indicating one of several NOT READY states
2553 * describing why a volume is to be kept offline) 2548 * describing why a volume is to be kept offline)
2554 */ 2549 */
2555static unsigned char hpsa_volume_offline(struct ctlr_info *h, 2550static int hpsa_volume_offline(struct ctlr_info *h,
2556 unsigned char scsi3addr[]) 2551 unsigned char scsi3addr[])
2557{ 2552{
2558 struct CommandList *c; 2553 struct CommandList *c;
@@ -2651,11 +2646,15 @@ static int hpsa_update_device_info(struct ctlr_info *h,
2651 2646
2652 if (this_device->devtype == TYPE_DISK && 2647 if (this_device->devtype == TYPE_DISK &&
2653 is_logical_dev_addr_mode(scsi3addr)) { 2648 is_logical_dev_addr_mode(scsi3addr)) {
2649 int volume_offline;
2650
2654 hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level); 2651 hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level);
2655 if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC) 2652 if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
2656 hpsa_get_ioaccel_status(h, scsi3addr, this_device); 2653 hpsa_get_ioaccel_status(h, scsi3addr, this_device);
2657 this_device->volume_offline = 2654 volume_offline = hpsa_volume_offline(h, scsi3addr);
2658 hpsa_volume_offline(h, scsi3addr); 2655 if (volume_offline < 0 || volume_offline > 0xff)
2656 volume_offline = HPSA_VPD_LV_STATUS_UNSUPPORTED;
2657 this_device->volume_offline = volume_offline & 0xff;
2659 } else { 2658 } else {
2660 this_device->raid_level = RAID_UNKNOWN; 2659 this_device->raid_level = RAID_UNKNOWN;
2661 this_device->offload_config = 0; 2660 this_device->offload_config = 0;
@@ -2861,26 +2860,20 @@ static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h,
2861 nphysicals = be32_to_cpu(*((__be32 *)physicals->LUNListLength)) / 2860 nphysicals = be32_to_cpu(*((__be32 *)physicals->LUNListLength)) /
2862 responsesize; 2861 responsesize;
2863 2862
2864
2865 /* find ioaccel2 handle in list of physicals: */ 2863 /* find ioaccel2 handle in list of physicals: */
2866 for (i = 0; i < nphysicals; i++) { 2864 for (i = 0; i < nphysicals; i++) {
2865 struct ext_report_lun_entry *entry = &physicals->LUN[i];
2866
2867 /* handle is in bytes 28-31 of each lun */ 2867 /* handle is in bytes 28-31 of each lun */
2868 if (memcmp(&((struct ReportExtendedLUNdata *) 2868 if (entry->ioaccel_handle != find)
2869 physicals)->LUN[i][20], &find, 4) != 0) {
2870 continue; /* didn't match */ 2869 continue; /* didn't match */
2871 }
2872 found = 1; 2870 found = 1;
2873 memcpy(scsi3addr, &((struct ReportExtendedLUNdata *) 2871 memcpy(scsi3addr, entry->lunid, 8);
2874 physicals)->LUN[i][0], 8);
2875 if (h->raid_offload_debug > 0) 2872 if (h->raid_offload_debug > 0)
2876 dev_info(&h->pdev->dev, 2873 dev_info(&h->pdev->dev,
2877 "%s: Searched h=0x%08x, Found h=0x%08x, scsiaddr 0x%02x%02x%02x%02x%02x%02x%02x%02x\n", 2874 "%s: Searched h=0x%08x, Found h=0x%08x, scsiaddr 0x%8phN\n",
2878 __func__, find, 2875 __func__, find,
2879 ((struct ReportExtendedLUNdata *) 2876 entry->ioaccel_handle, scsi3addr);
2880 physicals)->LUN[i][20],
2881 scsi3addr[0], scsi3addr[1], scsi3addr[2],
2882 scsi3addr[3], scsi3addr[4], scsi3addr[5],
2883 scsi3addr[6], scsi3addr[7]);
2884 break; /* found it */ 2877 break; /* found it */
2885 } 2878 }
2886 2879
@@ -2965,7 +2958,8 @@ u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position, int i,
2965 return RAID_CTLR_LUNID; 2958 return RAID_CTLR_LUNID;
2966 2959
2967 if (i < logicals_start) 2960 if (i < logicals_start)
2968 return &physdev_list->LUN[i - (raid_ctlr_position == 0)][0]; 2961 return &physdev_list->LUN[i -
2962 (raid_ctlr_position == 0)].lunid[0];
2969 2963
2970 if (i < last_device) 2964 if (i < last_device)
2971 return &logdev_list->LUN[i - nphysicals - 2965 return &logdev_list->LUN[i - nphysicals -
@@ -3074,7 +3068,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
3074 ndev_allocated++; 3068 ndev_allocated++;
3075 } 3069 }
3076 3070
3077 if (unlikely(is_scsi_rev_5(h))) 3071 if (is_scsi_rev_5(h))
3078 raid_ctlr_position = 0; 3072 raid_ctlr_position = 0;
3079 else 3073 else
3080 raid_ctlr_position = nphysicals + nlogicals; 3074 raid_ctlr_position = nphysicals + nlogicals;
@@ -3971,7 +3965,6 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
3971 struct hpsa_scsi_dev_t *dev; 3965 struct hpsa_scsi_dev_t *dev;
3972 unsigned char scsi3addr[8]; 3966 unsigned char scsi3addr[8];
3973 struct CommandList *c; 3967 struct CommandList *c;
3974 unsigned long flags;
3975 int rc = 0; 3968 int rc = 0;
3976 3969
3977 /* Get the ptr to our adapter structure out of cmd->host. */ 3970 /* Get the ptr to our adapter structure out of cmd->host. */
@@ -3984,14 +3977,11 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
3984 } 3977 }
3985 memcpy(scsi3addr, dev->scsi3addr, sizeof(scsi3addr)); 3978 memcpy(scsi3addr, dev->scsi3addr, sizeof(scsi3addr));
3986 3979
3987 spin_lock_irqsave(&h->lock, flags); 3980 if (unlikely(lockup_detected(h))) {
3988 if (unlikely(h->lockup_detected)) {
3989 spin_unlock_irqrestore(&h->lock, flags);
3990 cmd->result = DID_ERROR << 16; 3981 cmd->result = DID_ERROR << 16;
3991 done(cmd); 3982 done(cmd);
3992 return 0; 3983 return 0;
3993 } 3984 }
3994 spin_unlock_irqrestore(&h->lock, flags);
3995 c = cmd_alloc(h); 3985 c = cmd_alloc(h);
3996 if (c == NULL) { /* trouble... */ 3986 if (c == NULL) { /* trouble... */
3997 dev_err(&h->pdev->dev, "cmd_alloc returned NULL!\n"); 3987 dev_err(&h->pdev->dev, "cmd_alloc returned NULL!\n");
@@ -4103,16 +4093,13 @@ static int do_not_scan_if_controller_locked_up(struct ctlr_info *h)
4103 * we can prevent new rescan threads from piling up on a 4093 * we can prevent new rescan threads from piling up on a
4104 * locked up controller. 4094 * locked up controller.
4105 */ 4095 */
4106 spin_lock_irqsave(&h->lock, flags); 4096 if (unlikely(lockup_detected(h))) {
4107 if (unlikely(h->lockup_detected)) {
4108 spin_unlock_irqrestore(&h->lock, flags);
4109 spin_lock_irqsave(&h->scan_lock, flags); 4097 spin_lock_irqsave(&h->scan_lock, flags);
4110 h->scan_finished = 1; 4098 h->scan_finished = 1;
4111 wake_up_all(&h->scan_wait_queue); 4099 wake_up_all(&h->scan_wait_queue);
4112 spin_unlock_irqrestore(&h->scan_lock, flags); 4100 spin_unlock_irqrestore(&h->scan_lock, flags);
4113 return 1; 4101 return 1;
4114 } 4102 }
4115 spin_unlock_irqrestore(&h->lock, flags);
4116 return 0; 4103 return 0;
4117} 4104}
4118 4105
@@ -4963,7 +4950,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
4963 buff = kmalloc(iocommand.buf_size, GFP_KERNEL); 4950 buff = kmalloc(iocommand.buf_size, GFP_KERNEL);
4964 if (buff == NULL) 4951 if (buff == NULL)
4965 return -EFAULT; 4952 return -EFAULT;
4966 if (iocommand.Request.Type.Direction == XFER_WRITE) { 4953 if (iocommand.Request.Type.Direction & XFER_WRITE) {
4967 /* Copy the data into the buffer we created */ 4954 /* Copy the data into the buffer we created */
4968 if (copy_from_user(buff, iocommand.buf, 4955 if (copy_from_user(buff, iocommand.buf,
4969 iocommand.buf_size)) { 4956 iocommand.buf_size)) {
@@ -5026,7 +5013,7 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
5026 rc = -EFAULT; 5013 rc = -EFAULT;
5027 goto out; 5014 goto out;
5028 } 5015 }
5029 if (iocommand.Request.Type.Direction == XFER_READ && 5016 if ((iocommand.Request.Type.Direction & XFER_READ) &&
5030 iocommand.buf_size > 0) { 5017 iocommand.buf_size > 0) {
5031 /* Copy the data out of the buffer we created */ 5018 /* Copy the data out of the buffer we created */
5032 if (copy_to_user(iocommand.buf, buff, iocommand.buf_size)) { 5019 if (copy_to_user(iocommand.buf, buff, iocommand.buf_size)) {
@@ -5103,7 +5090,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
5103 status = -ENOMEM; 5090 status = -ENOMEM;
5104 goto cleanup1; 5091 goto cleanup1;
5105 } 5092 }
5106 if (ioc->Request.Type.Direction == XFER_WRITE) { 5093 if (ioc->Request.Type.Direction & XFER_WRITE) {
5107 if (copy_from_user(buff[sg_used], data_ptr, sz)) { 5094 if (copy_from_user(buff[sg_used], data_ptr, sz)) {
5108 status = -ENOMEM; 5095 status = -ENOMEM;
5109 goto cleanup1; 5096 goto cleanup1;
@@ -5155,7 +5142,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
5155 status = -EFAULT; 5142 status = -EFAULT;
5156 goto cleanup0; 5143 goto cleanup0;
5157 } 5144 }
5158 if (ioc->Request.Type.Direction == XFER_READ && ioc->buf_size > 0) { 5145 if ((ioc->Request.Type.Direction & XFER_READ) && ioc->buf_size > 0) {
5159 /* Copy the data out of the buffer we created */ 5146 /* Copy the data out of the buffer we created */
5160 BYTE __user *ptr = ioc->buf; 5147 BYTE __user *ptr = ioc->buf;
5161 for (i = 0; i < sg_used; i++) { 5148 for (i = 0; i < sg_used; i++) {
@@ -5459,13 +5446,12 @@ static void __iomem *remap_pci_mem(ulong base, ulong size)
5459 5446
5460/* Takes cmds off the submission queue and sends them to the hardware, 5447/* Takes cmds off the submission queue and sends them to the hardware,
5461 * then puts them on the queue of cmds waiting for completion. 5448 * then puts them on the queue of cmds waiting for completion.
5449 * Assumes h->lock is held
5462 */ 5450 */
5463static void start_io(struct ctlr_info *h) 5451static void start_io(struct ctlr_info *h, unsigned long *flags)
5464{ 5452{
5465 struct CommandList *c; 5453 struct CommandList *c;
5466 unsigned long flags;
5467 5454
5468 spin_lock_irqsave(&h->lock, flags);
5469 while (!list_empty(&h->reqQ)) { 5455 while (!list_empty(&h->reqQ)) {
5470 c = list_entry(h->reqQ.next, struct CommandList, list); 5456 c = list_entry(h->reqQ.next, struct CommandList, list);
5471 /* can't do anything if fifo is full */ 5457 /* can't do anything if fifo is full */
@@ -5488,14 +5474,20 @@ static void start_io(struct ctlr_info *h)
5488 * condition. 5474 * condition.
5489 */ 5475 */
5490 h->commands_outstanding++; 5476 h->commands_outstanding++;
5491 if (h->commands_outstanding > h->max_outstanding)
5492 h->max_outstanding = h->commands_outstanding;
5493 5477
5494 /* Tell the controller execute command */ 5478 /* Tell the controller execute command */
5495 spin_unlock_irqrestore(&h->lock, flags); 5479 spin_unlock_irqrestore(&h->lock, *flags);
5496 h->access.submit_command(h, c); 5480 h->access.submit_command(h, c);
5497 spin_lock_irqsave(&h->lock, flags); 5481 spin_lock_irqsave(&h->lock, *flags);
5498 } 5482 }
5483}
5484
5485static void lock_and_start_io(struct ctlr_info *h)
5486{
5487 unsigned long flags;
5488
5489 spin_lock_irqsave(&h->lock, flags);
5490 start_io(h, &flags);
5499 spin_unlock_irqrestore(&h->lock, flags); 5491 spin_unlock_irqrestore(&h->lock, flags);
5500} 5492}
5501 5493
@@ -5563,7 +5555,7 @@ static inline void finish_cmd(struct CommandList *c)
5563 else if (c->cmd_type == CMD_IOCTL_PEND) 5555 else if (c->cmd_type == CMD_IOCTL_PEND)
5564 complete(c->waiting); 5556 complete(c->waiting);
5565 if (unlikely(io_may_be_stalled)) 5557 if (unlikely(io_may_be_stalled))
5566 start_io(h); 5558 lock_and_start_io(h);
5567} 5559}
5568 5560
5569static inline u32 hpsa_tag_contains_index(u32 tag) 5561static inline u32 hpsa_tag_contains_index(u32 tag)
@@ -5840,12 +5832,12 @@ static int hpsa_controller_hard_reset(struct pci_dev *pdev,
5840 dev_info(&pdev->dev, "using doorbell to reset controller\n"); 5832 dev_info(&pdev->dev, "using doorbell to reset controller\n");
5841 writel(use_doorbell, vaddr + SA5_DOORBELL); 5833 writel(use_doorbell, vaddr + SA5_DOORBELL);
5842 5834
5843 /* PMC hardware guys tell us we need a 5 second delay after 5835 /* PMC hardware guys tell us we need a 10 second delay after
5844 * doorbell reset and before any attempt to talk to the board 5836 * doorbell reset and before any attempt to talk to the board
5845 * at all to ensure that this actually works and doesn't fall 5837 * at all to ensure that this actually works and doesn't fall
5846 * over in some weird corner cases. 5838 * over in some weird corner cases.
5847 */ 5839 */
5848 msleep(5000); 5840 msleep(10000);
5849 } else { /* Try to do it the PCI power state way */ 5841 } else { /* Try to do it the PCI power state way */
5850 5842
5851 /* Quoting from the Open CISS Specification: "The Power 5843 /* Quoting from the Open CISS Specification: "The Power
@@ -6166,6 +6158,8 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
6166 if (pci_find_capability(h->pdev, PCI_CAP_ID_MSIX)) { 6158 if (pci_find_capability(h->pdev, PCI_CAP_ID_MSIX)) {
6167 dev_info(&h->pdev->dev, "MSIX\n"); 6159 dev_info(&h->pdev->dev, "MSIX\n");
6168 h->msix_vector = MAX_REPLY_QUEUES; 6160 h->msix_vector = MAX_REPLY_QUEUES;
6161 if (h->msix_vector > num_online_cpus())
6162 h->msix_vector = num_online_cpus();
6169 err = pci_enable_msix(h->pdev, hpsa_msix_entries, 6163 err = pci_enable_msix(h->pdev, hpsa_msix_entries,
6170 h->msix_vector); 6164 h->msix_vector);
6171 if (err > 0) { 6165 if (err > 0) {
@@ -6615,6 +6609,17 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h)
6615 h->ioaccel_cmd_pool, h->ioaccel_cmd_pool_dhandle); 6609 h->ioaccel_cmd_pool, h->ioaccel_cmd_pool_dhandle);
6616} 6610}
6617 6611
6612static void hpsa_irq_affinity_hints(struct ctlr_info *h)
6613{
6614 int i, cpu, rc;
6615
6616 cpu = cpumask_first(cpu_online_mask);
6617 for (i = 0; i < h->msix_vector; i++) {
6618 rc = irq_set_affinity_hint(h->intr[i], get_cpu_mask(cpu));
6619 cpu = cpumask_next(cpu, cpu_online_mask);
6620 }
6621}
6622
6618static int hpsa_request_irq(struct ctlr_info *h, 6623static int hpsa_request_irq(struct ctlr_info *h,
6619 irqreturn_t (*msixhandler)(int, void *), 6624 irqreturn_t (*msixhandler)(int, void *),
6620 irqreturn_t (*intxhandler)(int, void *)) 6625 irqreturn_t (*intxhandler)(int, void *))
@@ -6634,6 +6639,7 @@ static int hpsa_request_irq(struct ctlr_info *h,
6634 rc = request_irq(h->intr[i], msixhandler, 6639 rc = request_irq(h->intr[i], msixhandler,
6635 0, h->devname, 6640 0, h->devname,
6636 &h->q[i]); 6641 &h->q[i]);
6642 hpsa_irq_affinity_hints(h);
6637 } else { 6643 } else {
6638 /* Use single reply pool */ 6644 /* Use single reply pool */
6639 if (h->msix_vector > 0 || h->msi_vector) { 6645 if (h->msix_vector > 0 || h->msi_vector) {
@@ -6685,12 +6691,15 @@ static void free_irqs(struct ctlr_info *h)
6685 if (!h->msix_vector || h->intr_mode != PERF_MODE_INT) { 6691 if (!h->msix_vector || h->intr_mode != PERF_MODE_INT) {
6686 /* Single reply queue, only one irq to free */ 6692 /* Single reply queue, only one irq to free */
6687 i = h->intr_mode; 6693 i = h->intr_mode;
6694 irq_set_affinity_hint(h->intr[i], NULL);
6688 free_irq(h->intr[i], &h->q[i]); 6695 free_irq(h->intr[i], &h->q[i]);
6689 return; 6696 return;
6690 } 6697 }
6691 6698
6692 for (i = 0; i < h->msix_vector; i++) 6699 for (i = 0; i < h->msix_vector; i++) {
6700 irq_set_affinity_hint(h->intr[i], NULL);
6693 free_irq(h->intr[i], &h->q[i]); 6701 free_irq(h->intr[i], &h->q[i]);
6702 }
6694} 6703}
6695 6704
6696static void hpsa_free_irqs_and_disable_msix(struct ctlr_info *h) 6705static void hpsa_free_irqs_and_disable_msix(struct ctlr_info *h)
@@ -6707,6 +6716,20 @@ static void hpsa_free_irqs_and_disable_msix(struct ctlr_info *h)
6707#endif /* CONFIG_PCI_MSI */ 6716#endif /* CONFIG_PCI_MSI */
6708} 6717}
6709 6718
6719static void hpsa_free_reply_queues(struct ctlr_info *h)
6720{
6721 int i;
6722
6723 for (i = 0; i < h->nreply_queues; i++) {
6724 if (!h->reply_queue[i].head)
6725 continue;
6726 pci_free_consistent(h->pdev, h->reply_queue_size,
6727 h->reply_queue[i].head, h->reply_queue[i].busaddr);
6728 h->reply_queue[i].head = NULL;
6729 h->reply_queue[i].busaddr = 0;
6730 }
6731}
6732
6710static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h) 6733static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
6711{ 6734{
6712 hpsa_free_irqs_and_disable_msix(h); 6735 hpsa_free_irqs_and_disable_msix(h);
@@ -6714,8 +6737,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
6714 hpsa_free_cmd_pool(h); 6737 hpsa_free_cmd_pool(h);
6715 kfree(h->ioaccel1_blockFetchTable); 6738 kfree(h->ioaccel1_blockFetchTable);
6716 kfree(h->blockFetchTable); 6739 kfree(h->blockFetchTable);
6717 pci_free_consistent(h->pdev, h->reply_pool_size, 6740 hpsa_free_reply_queues(h);
6718 h->reply_pool, h->reply_pool_dhandle);
6719 if (h->vaddr) 6741 if (h->vaddr)
6720 iounmap(h->vaddr); 6742 iounmap(h->vaddr);
6721 if (h->transtable) 6743 if (h->transtable)
@@ -6740,16 +6762,38 @@ static void fail_all_cmds_on_list(struct ctlr_info *h, struct list_head *list)
6740 } 6762 }
6741} 6763}
6742 6764
6765static void set_lockup_detected_for_all_cpus(struct ctlr_info *h, u32 value)
6766{
6767 int i, cpu;
6768
6769 cpu = cpumask_first(cpu_online_mask);
6770 for (i = 0; i < num_online_cpus(); i++) {
6771 u32 *lockup_detected;
6772 lockup_detected = per_cpu_ptr(h->lockup_detected, cpu);
6773 *lockup_detected = value;
6774 cpu = cpumask_next(cpu, cpu_online_mask);
6775 }
6776 wmb(); /* be sure the per-cpu variables are out to memory */
6777}
6778
6743static void controller_lockup_detected(struct ctlr_info *h) 6779static void controller_lockup_detected(struct ctlr_info *h)
6744{ 6780{
6745 unsigned long flags; 6781 unsigned long flags;
6782 u32 lockup_detected;
6746 6783
6747 h->access.set_intr_mask(h, HPSA_INTR_OFF); 6784 h->access.set_intr_mask(h, HPSA_INTR_OFF);
6748 spin_lock_irqsave(&h->lock, flags); 6785 spin_lock_irqsave(&h->lock, flags);
6749 h->lockup_detected = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET); 6786 lockup_detected = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
6787 if (!lockup_detected) {
6788 /* no heartbeat, but controller gave us a zero. */
6789 dev_warn(&h->pdev->dev,
6790 "lockup detected but scratchpad register is zero\n");
6791 lockup_detected = 0xffffffff;
6792 }
6793 set_lockup_detected_for_all_cpus(h, lockup_detected);
6750 spin_unlock_irqrestore(&h->lock, flags); 6794 spin_unlock_irqrestore(&h->lock, flags);
6751 dev_warn(&h->pdev->dev, "Controller lockup detected: 0x%08x\n", 6795 dev_warn(&h->pdev->dev, "Controller lockup detected: 0x%08x\n",
6752 h->lockup_detected); 6796 lockup_detected);
6753 pci_disable_device(h->pdev); 6797 pci_disable_device(h->pdev);
6754 spin_lock_irqsave(&h->lock, flags); 6798 spin_lock_irqsave(&h->lock, flags);
6755 fail_all_cmds_on_list(h, &h->cmpQ); 6799 fail_all_cmds_on_list(h, &h->cmpQ);
@@ -6884,7 +6928,7 @@ static void hpsa_monitor_ctlr_worker(struct work_struct *work)
6884 struct ctlr_info *h = container_of(to_delayed_work(work), 6928 struct ctlr_info *h = container_of(to_delayed_work(work),
6885 struct ctlr_info, monitor_ctlr_work); 6929 struct ctlr_info, monitor_ctlr_work);
6886 detect_controller_lockup(h); 6930 detect_controller_lockup(h);
6887 if (h->lockup_detected) 6931 if (lockup_detected(h))
6888 return; 6932 return;
6889 6933
6890 if (hpsa_ctlr_needs_rescan(h) || hpsa_offline_devices_ready(h)) { 6934 if (hpsa_ctlr_needs_rescan(h) || hpsa_offline_devices_ready(h)) {
@@ -6934,7 +6978,6 @@ reinit_after_soft_reset:
6934 * the 5 lower bits of the address are used by the hardware. and by 6978 * the 5 lower bits of the address are used by the hardware. and by
6935 * the driver. See comments in hpsa.h for more info. 6979 * the driver. See comments in hpsa.h for more info.
6936 */ 6980 */
6937#define COMMANDLIST_ALIGNMENT 128
6938 BUILD_BUG_ON(sizeof(struct CommandList) % COMMANDLIST_ALIGNMENT); 6981 BUILD_BUG_ON(sizeof(struct CommandList) % COMMANDLIST_ALIGNMENT);
6939 h = kzalloc(sizeof(*h), GFP_KERNEL); 6982 h = kzalloc(sizeof(*h), GFP_KERNEL);
6940 if (!h) 6983 if (!h)
@@ -6949,6 +6992,13 @@ reinit_after_soft_reset:
6949 spin_lock_init(&h->offline_device_lock); 6992 spin_lock_init(&h->offline_device_lock);
6950 spin_lock_init(&h->scan_lock); 6993 spin_lock_init(&h->scan_lock);
6951 spin_lock_init(&h->passthru_count_lock); 6994 spin_lock_init(&h->passthru_count_lock);
6995
6996 /* Allocate and clear per-cpu variable lockup_detected */
6997 h->lockup_detected = alloc_percpu(u32);
6998 if (!h->lockup_detected)
6999 goto clean1;
7000 set_lockup_detected_for_all_cpus(h, 0);
7001
6952 rc = hpsa_pci_init(h); 7002 rc = hpsa_pci_init(h);
6953 if (rc != 0) 7003 if (rc != 0)
6954 goto clean1; 7004 goto clean1;
@@ -7072,6 +7122,8 @@ clean4:
7072 free_irqs(h); 7122 free_irqs(h);
7073clean2: 7123clean2:
7074clean1: 7124clean1:
7125 if (h->lockup_detected)
7126 free_percpu(h->lockup_detected);
7075 kfree(h); 7127 kfree(h);
7076 return rc; 7128 return rc;
7077} 7129}
@@ -7080,16 +7132,10 @@ static void hpsa_flush_cache(struct ctlr_info *h)
7080{ 7132{
7081 char *flush_buf; 7133 char *flush_buf;
7082 struct CommandList *c; 7134 struct CommandList *c;
7083 unsigned long flags;
7084 7135
7085 /* Don't bother trying to flush the cache if locked up */ 7136 /* Don't bother trying to flush the cache if locked up */
7086 spin_lock_irqsave(&h->lock, flags); 7137 if (unlikely(lockup_detected(h)))
7087 if (unlikely(h->lockup_detected)) {
7088 spin_unlock_irqrestore(&h->lock, flags);
7089 return; 7138 return;
7090 }
7091 spin_unlock_irqrestore(&h->lock, flags);
7092
7093 flush_buf = kzalloc(4, GFP_KERNEL); 7139 flush_buf = kzalloc(4, GFP_KERNEL);
7094 if (!flush_buf) 7140 if (!flush_buf)
7095 return; 7141 return;
@@ -7165,8 +7211,7 @@ static void hpsa_remove_one(struct pci_dev *pdev)
7165 pci_free_consistent(h->pdev, 7211 pci_free_consistent(h->pdev,
7166 h->nr_cmds * sizeof(struct ErrorInfo), 7212 h->nr_cmds * sizeof(struct ErrorInfo),
7167 h->errinfo_pool, h->errinfo_pool_dhandle); 7213 h->errinfo_pool, h->errinfo_pool_dhandle);
7168 pci_free_consistent(h->pdev, h->reply_pool_size, 7214 hpsa_free_reply_queues(h);
7169 h->reply_pool, h->reply_pool_dhandle);
7170 kfree(h->cmd_pool_bits); 7215 kfree(h->cmd_pool_bits);
7171 kfree(h->blockFetchTable); 7216 kfree(h->blockFetchTable);
7172 kfree(h->ioaccel1_blockFetchTable); 7217 kfree(h->ioaccel1_blockFetchTable);
@@ -7174,6 +7219,7 @@ static void hpsa_remove_one(struct pci_dev *pdev)
7174 kfree(h->hba_inquiry_data); 7219 kfree(h->hba_inquiry_data);
7175 pci_disable_device(pdev); 7220 pci_disable_device(pdev);
7176 pci_release_regions(pdev); 7221 pci_release_regions(pdev);
7222 free_percpu(h->lockup_detected);
7177 kfree(h); 7223 kfree(h);
7178} 7224}
7179 7225
@@ -7278,8 +7324,16 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
7278 * 10 = 6 s/g entry or 24k 7324 * 10 = 6 s/g entry or 24k
7279 */ 7325 */
7280 7326
7327 /* If the controller supports either ioaccel method then
7328 * we can also use the RAID stack submit path that does not
7329 * perform the superfluous readl() after each command submission.
7330 */
7331 if (trans_support & (CFGTBL_Trans_io_accel1 | CFGTBL_Trans_io_accel2))
7332 access = SA5_performant_access_no_read;
7333
7281 /* Controller spec: zero out this buffer. */ 7334 /* Controller spec: zero out this buffer. */
7282 memset(h->reply_pool, 0, h->reply_pool_size); 7335 for (i = 0; i < h->nreply_queues; i++)
7336 memset(h->reply_queue[i].head, 0, h->reply_queue_size);
7283 7337
7284 bft[7] = SG_ENTRIES_IN_CMD + 4; 7338 bft[7] = SG_ENTRIES_IN_CMD + 4;
7285 calc_bucket_map(bft, ARRAY_SIZE(bft), 7339 calc_bucket_map(bft, ARRAY_SIZE(bft),
@@ -7295,8 +7349,7 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
7295 7349
7296 for (i = 0; i < h->nreply_queues; i++) { 7350 for (i = 0; i < h->nreply_queues; i++) {
7297 writel(0, &h->transtable->RepQAddr[i].upper); 7351 writel(0, &h->transtable->RepQAddr[i].upper);
7298 writel(h->reply_pool_dhandle + 7352 writel(h->reply_queue[i].busaddr,
7299 (h->max_commands * sizeof(u64) * i),
7300 &h->transtable->RepQAddr[i].lower); 7353 &h->transtable->RepQAddr[i].lower);
7301 } 7354 }
7302 7355
@@ -7344,8 +7397,10 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 trans_support)
7344 h->ioaccel1_blockFetchTable); 7397 h->ioaccel1_blockFetchTable);
7345 7398
7346 /* initialize all reply queue entries to unused */ 7399 /* initialize all reply queue entries to unused */
7347 memset(h->reply_pool, (u8) IOACCEL_MODE1_REPLY_UNUSED, 7400 for (i = 0; i < h->nreply_queues; i++)
7348 h->reply_pool_size); 7401 memset(h->reply_queue[i].head,
7402 (u8) IOACCEL_MODE1_REPLY_UNUSED,
7403 h->reply_queue_size);
7349 7404
7350 /* set all the constant fields in the accelerator command 7405 /* set all the constant fields in the accelerator command
7351 * frames once at init time to save CPU cycles later. 7406 * frames once at init time to save CPU cycles later.
@@ -7407,7 +7462,6 @@ static int hpsa_alloc_ioaccel_cmd_and_bft(struct ctlr_info *h)
7407 * because the 7 lower bits of the address are used by the 7462 * because the 7 lower bits of the address are used by the
7408 * hardware. 7463 * hardware.
7409 */ 7464 */
7410#define IOACCEL1_COMMANDLIST_ALIGNMENT 128
7411 BUILD_BUG_ON(sizeof(struct io_accel1_cmd) % 7465 BUILD_BUG_ON(sizeof(struct io_accel1_cmd) %
7412 IOACCEL1_COMMANDLIST_ALIGNMENT); 7466 IOACCEL1_COMMANDLIST_ALIGNMENT);
7413 h->ioaccel_cmd_pool = 7467 h->ioaccel_cmd_pool =
@@ -7445,7 +7499,6 @@ static int ioaccel2_alloc_cmds_and_bft(struct ctlr_info *h)
7445 if (h->ioaccel_maxsg > IOACCEL2_MAXSGENTRIES) 7499 if (h->ioaccel_maxsg > IOACCEL2_MAXSGENTRIES)
7446 h->ioaccel_maxsg = IOACCEL2_MAXSGENTRIES; 7500 h->ioaccel_maxsg = IOACCEL2_MAXSGENTRIES;
7447 7501
7448#define IOACCEL2_COMMANDLIST_ALIGNMENT 128
7449 BUILD_BUG_ON(sizeof(struct io_accel2_cmd) % 7502 BUILD_BUG_ON(sizeof(struct io_accel2_cmd) %
7450 IOACCEL2_COMMANDLIST_ALIGNMENT); 7503 IOACCEL2_COMMANDLIST_ALIGNMENT);
7451 h->ioaccel2_cmd_pool = 7504 h->ioaccel2_cmd_pool =
@@ -7503,16 +7556,17 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
7503 } 7556 }
7504 } 7557 }
7505 7558
7506 /* TODO, check that this next line h->nreply_queues is correct */
7507 h->nreply_queues = h->msix_vector > 0 ? h->msix_vector : 1; 7559 h->nreply_queues = h->msix_vector > 0 ? h->msix_vector : 1;
7508 hpsa_get_max_perf_mode_cmds(h); 7560 hpsa_get_max_perf_mode_cmds(h);
7509 /* Performant mode ring buffer and supporting data structures */ 7561 /* Performant mode ring buffer and supporting data structures */
7510 h->reply_pool_size = h->max_commands * sizeof(u64) * h->nreply_queues; 7562 h->reply_queue_size = h->max_commands * sizeof(u64);
7511 h->reply_pool = pci_alloc_consistent(h->pdev, h->reply_pool_size,
7512 &(h->reply_pool_dhandle));
7513 7563
7514 for (i = 0; i < h->nreply_queues; i++) { 7564 for (i = 0; i < h->nreply_queues; i++) {
7515 h->reply_queue[i].head = &h->reply_pool[h->max_commands * i]; 7565 h->reply_queue[i].head = pci_alloc_consistent(h->pdev,
7566 h->reply_queue_size,
7567 &(h->reply_queue[i].busaddr));
7568 if (!h->reply_queue[i].head)
7569 goto clean_up;
7516 h->reply_queue[i].size = h->max_commands; 7570 h->reply_queue[i].size = h->max_commands;
7517 h->reply_queue[i].wraparound = 1; /* spec: init to 1 */ 7571 h->reply_queue[i].wraparound = 1; /* spec: init to 1 */
7518 h->reply_queue[i].current_entry = 0; 7572 h->reply_queue[i].current_entry = 0;
@@ -7521,18 +7575,14 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
7521 /* Need a block fetch table for performant mode */ 7575 /* Need a block fetch table for performant mode */
7522 h->blockFetchTable = kmalloc(((SG_ENTRIES_IN_CMD + 1) * 7576 h->blockFetchTable = kmalloc(((SG_ENTRIES_IN_CMD + 1) *
7523 sizeof(u32)), GFP_KERNEL); 7577 sizeof(u32)), GFP_KERNEL);
7524 7578 if (!h->blockFetchTable)
7525 if ((h->reply_pool == NULL)
7526 || (h->blockFetchTable == NULL))
7527 goto clean_up; 7579 goto clean_up;
7528 7580
7529 hpsa_enter_performant_mode(h, trans_support); 7581 hpsa_enter_performant_mode(h, trans_support);
7530 return; 7582 return;
7531 7583
7532clean_up: 7584clean_up:
7533 if (h->reply_pool) 7585 hpsa_free_reply_queues(h);
7534 pci_free_consistent(h->pdev, h->reply_pool_size,
7535 h->reply_pool, h->reply_pool_dhandle);
7536 kfree(h->blockFetchTable); 7586 kfree(h->blockFetchTable);
7537} 7587}
7538 7588
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 1e3cf33a82cf..24472cec7de3 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -57,11 +57,12 @@ struct hpsa_scsi_dev_t {
57 57
58}; 58};
59 59
60struct reply_pool { 60struct reply_queue_buffer {
61 u64 *head; 61 u64 *head;
62 size_t size; 62 size_t size;
63 u8 wraparound; 63 u8 wraparound;
64 u32 current_entry; 64 u32 current_entry;
65 dma_addr_t busaddr;
65}; 66};
66 67
67#pragma pack(1) 68#pragma pack(1)
@@ -116,11 +117,8 @@ struct ctlr_info {
116 int nr_cmds; /* Number of commands allowed on this controller */ 117 int nr_cmds; /* Number of commands allowed on this controller */
117 struct CfgTable __iomem *cfgtable; 118 struct CfgTable __iomem *cfgtable;
118 int interrupts_enabled; 119 int interrupts_enabled;
119 int major;
120 int max_commands; 120 int max_commands;
121 int commands_outstanding; 121 int commands_outstanding;
122 int max_outstanding; /* Debug */
123 int usage_count; /* number of opens all all minor devices */
124# define PERF_MODE_INT 0 122# define PERF_MODE_INT 0
125# define DOORBELL_INT 1 123# define DOORBELL_INT 1
126# define SIMPLE_MODE_INT 2 124# define SIMPLE_MODE_INT 2
@@ -177,11 +175,9 @@ struct ctlr_info {
177 /* 175 /*
178 * Performant mode completion buffers 176 * Performant mode completion buffers
179 */ 177 */
180 u64 *reply_pool; 178 size_t reply_queue_size;
181 size_t reply_pool_size; 179 struct reply_queue_buffer reply_queue[MAX_REPLY_QUEUES];
182 struct reply_pool reply_queue[MAX_REPLY_QUEUES];
183 u8 nreply_queues; 180 u8 nreply_queues;
184 dma_addr_t reply_pool_dhandle;
185 u32 *blockFetchTable; 181 u32 *blockFetchTable;
186 u32 *ioaccel1_blockFetchTable; 182 u32 *ioaccel1_blockFetchTable;
187 u32 *ioaccel2_blockFetchTable; 183 u32 *ioaccel2_blockFetchTable;
@@ -196,7 +192,7 @@ struct ctlr_info {
196 u64 last_heartbeat_timestamp; 192 u64 last_heartbeat_timestamp;
197 u32 heartbeat_sample_interval; 193 u32 heartbeat_sample_interval;
198 atomic_t firmware_flash_in_progress; 194 atomic_t firmware_flash_in_progress;
199 u32 lockup_detected; 195 u32 *lockup_detected;
200 struct delayed_work monitor_ctlr_work; 196 struct delayed_work monitor_ctlr_work;
201 int remove_in_progress; 197 int remove_in_progress;
202 u32 fifo_recently_full; 198 u32 fifo_recently_full;
@@ -233,11 +229,9 @@ struct ctlr_info {
233#define CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE (1 << 31) 229#define CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE (1 << 31)
234 230
235#define RESCAN_REQUIRED_EVENT_BITS \ 231#define RESCAN_REQUIRED_EVENT_BITS \
236 (CTLR_STATE_CHANGE_EVENT | \ 232 (CTLR_ENCLOSURE_HOT_PLUG_EVENT | \
237 CTLR_ENCLOSURE_HOT_PLUG_EVENT | \
238 CTLR_STATE_CHANGE_EVENT_PHYSICAL_DRV | \ 233 CTLR_STATE_CHANGE_EVENT_PHYSICAL_DRV | \
239 CTLR_STATE_CHANGE_EVENT_LOGICAL_DRV | \ 234 CTLR_STATE_CHANGE_EVENT_LOGICAL_DRV | \
240 CTLR_STATE_CHANGE_EVENT_REDUNDANT_CNTRL | \
241 CTLR_STATE_CHANGE_EVENT_AIO_ENABLED_DISABLED | \ 235 CTLR_STATE_CHANGE_EVENT_AIO_ENABLED_DISABLED | \
242 CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE) 236 CTLR_STATE_CHANGE_EVENT_AIO_CONFIG_CHANGE)
243 spinlock_t offline_device_lock; 237 spinlock_t offline_device_lock;
@@ -346,22 +340,23 @@ struct offline_device_entry {
346static void SA5_submit_command(struct ctlr_info *h, 340static void SA5_submit_command(struct ctlr_info *h,
347 struct CommandList *c) 341 struct CommandList *c)
348{ 342{
349 dev_dbg(&h->pdev->dev, "Sending %x, tag = %x\n", c->busaddr,
350 c->Header.Tag.lower);
351 writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET); 343 writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
352 (void) readl(h->vaddr + SA5_SCRATCHPAD_OFFSET); 344 (void) readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
353} 345}
354 346
347static void SA5_submit_command_no_read(struct ctlr_info *h,
348 struct CommandList *c)
349{
350 writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
351}
352
355static void SA5_submit_command_ioaccel2(struct ctlr_info *h, 353static void SA5_submit_command_ioaccel2(struct ctlr_info *h,
356 struct CommandList *c) 354 struct CommandList *c)
357{ 355{
358 dev_dbg(&h->pdev->dev, "Sending %x, tag = %x\n", c->busaddr,
359 c->Header.Tag.lower);
360 if (c->cmd_type == CMD_IOACCEL2) 356 if (c->cmd_type == CMD_IOACCEL2)
361 writel(c->busaddr, h->vaddr + IOACCEL2_INBOUND_POSTQ_32); 357 writel(c->busaddr, h->vaddr + IOACCEL2_INBOUND_POSTQ_32);
362 else 358 else
363 writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET); 359 writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
364 (void) readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
365} 360}
366 361
367/* 362/*
@@ -399,7 +394,7 @@ static void SA5_performant_intr_mask(struct ctlr_info *h, unsigned long val)
399 394
400static unsigned long SA5_performant_completed(struct ctlr_info *h, u8 q) 395static unsigned long SA5_performant_completed(struct ctlr_info *h, u8 q)
401{ 396{
402 struct reply_pool *rq = &h->reply_queue[q]; 397 struct reply_queue_buffer *rq = &h->reply_queue[q];
403 unsigned long flags, register_value = FIFO_EMPTY; 398 unsigned long flags, register_value = FIFO_EMPTY;
404 399
405 /* msi auto clears the interrupt pending bit. */ 400 /* msi auto clears the interrupt pending bit. */
@@ -478,7 +473,6 @@ static bool SA5_intr_pending(struct ctlr_info *h)
478{ 473{
479 unsigned long register_value = 474 unsigned long register_value =
480 readl(h->vaddr + SA5_INTR_STATUS); 475 readl(h->vaddr + SA5_INTR_STATUS);
481 dev_dbg(&h->pdev->dev, "intr_pending %lx\n", register_value);
482 return register_value & SA5_INTR_PENDING; 476 return register_value & SA5_INTR_PENDING;
483} 477}
484 478
@@ -515,7 +509,7 @@ static bool SA5_ioaccel_mode1_intr_pending(struct ctlr_info *h)
515static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q) 509static unsigned long SA5_ioaccel_mode1_completed(struct ctlr_info *h, u8 q)
516{ 510{
517 u64 register_value; 511 u64 register_value;
518 struct reply_pool *rq = &h->reply_queue[q]; 512 struct reply_queue_buffer *rq = &h->reply_queue[q];
519 unsigned long flags; 513 unsigned long flags;
520 514
521 BUG_ON(q >= h->nreply_queues); 515 BUG_ON(q >= h->nreply_queues);
@@ -573,6 +567,14 @@ static struct access_method SA5_performant_access = {
573 SA5_performant_completed, 567 SA5_performant_completed,
574}; 568};
575 569
570static struct access_method SA5_performant_access_no_read = {
571 SA5_submit_command_no_read,
572 SA5_performant_intr_mask,
573 SA5_fifo_full,
574 SA5_performant_intr_pending,
575 SA5_performant_completed,
576};
577
576struct board_type { 578struct board_type {
577 u32 board_id; 579 u32 board_id;
578 char *product_name; 580 char *product_name;
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index b5cc7052339f..b5125dc31439 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -151,7 +151,7 @@
151#define HPSA_VPD_HEADER_SZ 4 151#define HPSA_VPD_HEADER_SZ 4
152 152
153/* Logical volume states */ 153/* Logical volume states */
154#define HPSA_VPD_LV_STATUS_UNSUPPORTED -1 154#define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff
155#define HPSA_LV_OK 0x0 155#define HPSA_LV_OK 0x0
156#define HPSA_LV_UNDERGOING_ERASE 0x0F 156#define HPSA_LV_UNDERGOING_ERASE 0x0F
157#define HPSA_LV_UNDERGOING_RPI 0x12 157#define HPSA_LV_UNDERGOING_RPI 0x12
@@ -238,11 +238,21 @@ struct ReportLUNdata {
238 u8 LUN[HPSA_MAX_LUN][8]; 238 u8 LUN[HPSA_MAX_LUN][8];
239}; 239};
240 240
241struct ext_report_lun_entry {
242 u8 lunid[8];
243 u8 wwid[8];
244 u8 device_type;
245 u8 device_flags;
246 u8 lun_count; /* multi-lun device, how many luns */
247 u8 redundant_paths;
248 u32 ioaccel_handle; /* ioaccel1 only uses lower 16 bits */
249};
250
241struct ReportExtendedLUNdata { 251struct ReportExtendedLUNdata {
242 u8 LUNListLength[4]; 252 u8 LUNListLength[4];
243 u8 extended_response_flag; 253 u8 extended_response_flag;
244 u8 reserved[3]; 254 u8 reserved[3];
245 u8 LUN[HPSA_MAX_LUN][24]; 255 struct ext_report_lun_entry LUN[HPSA_MAX_LUN];
246}; 256};
247 257
248struct SenseSubsystem_info { 258struct SenseSubsystem_info {
@@ -375,6 +385,7 @@ struct ctlr_info; /* defined in hpsa.h */
375 * or a bus address. 385 * or a bus address.
376 */ 386 */
377 387
388#define COMMANDLIST_ALIGNMENT 128
378struct CommandList { 389struct CommandList {
379 struct CommandListHeader Header; 390 struct CommandListHeader Header;
380 struct RequestBlock Request; 391 struct RequestBlock Request;
@@ -389,21 +400,7 @@ struct CommandList {
389 struct list_head list; 400 struct list_head list;
390 struct completion *waiting; 401 struct completion *waiting;
391 void *scsi_cmd; 402 void *scsi_cmd;
392 403} __aligned(COMMANDLIST_ALIGNMENT);
393/* on 64 bit architectures, to get this to be 32-byte-aligned
394 * it so happens we need PAD_64 bytes of padding, on 32 bit systems,
395 * we need PAD_32 bytes of padding (see below). This does that.
396 * If it happens that 64 bit and 32 bit systems need different
397 * padding, PAD_32 and PAD_64 can be set independently, and.
398 * the code below will do the right thing.
399 */
400#define IS_32_BIT ((8 - sizeof(long))/4)
401#define IS_64_BIT (!IS_32_BIT)
402#define PAD_32 (40)
403#define PAD_64 (12)
404#define COMMANDLIST_PAD (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
405 u8 pad[COMMANDLIST_PAD];
406};
407 404
408/* Max S/G elements in I/O accelerator command */ 405/* Max S/G elements in I/O accelerator command */
409#define IOACCEL1_MAXSGENTRIES 24 406#define IOACCEL1_MAXSGENTRIES 24
@@ -413,6 +410,7 @@ struct CommandList {
413 * Structure for I/O accelerator (mode 1) commands. 410 * Structure for I/O accelerator (mode 1) commands.
414 * Note that this structure must be 128-byte aligned in size. 411 * Note that this structure must be 128-byte aligned in size.
415 */ 412 */
413#define IOACCEL1_COMMANDLIST_ALIGNMENT 128
416struct io_accel1_cmd { 414struct io_accel1_cmd {
417 u16 dev_handle; /* 0x00 - 0x01 */ 415 u16 dev_handle; /* 0x00 - 0x01 */
418 u8 reserved1; /* 0x02 */ 416 u8 reserved1; /* 0x02 */
@@ -440,12 +438,7 @@ struct io_accel1_cmd {
440 struct vals32 host_addr; /* 0x70 - 0x77 */ 438 struct vals32 host_addr; /* 0x70 - 0x77 */
441 u8 CISS_LUN[8]; /* 0x78 - 0x7F */ 439 u8 CISS_LUN[8]; /* 0x78 - 0x7F */
442 struct SGDescriptor SG[IOACCEL1_MAXSGENTRIES]; 440 struct SGDescriptor SG[IOACCEL1_MAXSGENTRIES];
443#define IOACCEL1_PAD_64 0 441} __aligned(IOACCEL1_COMMANDLIST_ALIGNMENT);
444#define IOACCEL1_PAD_32 0
445#define IOACCEL1_PAD (IS_32_BIT * IOACCEL1_PAD_32 + \
446 IS_64_BIT * IOACCEL1_PAD_64)
447 u8 pad[IOACCEL1_PAD];
448};
449 442
450#define IOACCEL1_FUNCTION_SCSIIO 0x00 443#define IOACCEL1_FUNCTION_SCSIIO 0x00
451#define IOACCEL1_SGLOFFSET 32 444#define IOACCEL1_SGLOFFSET 32
@@ -510,14 +503,11 @@ struct io_accel2_scsi_response {
510 u8 sense_data_buff[32]; /* sense/response data buffer */ 503 u8 sense_data_buff[32]; /* sense/response data buffer */
511}; 504};
512 505
513#define IOACCEL2_64_PAD 76
514#define IOACCEL2_32_PAD 76
515#define IOACCEL2_PAD (IS_32_BIT * IOACCEL2_32_PAD + \
516 IS_64_BIT * IOACCEL2_64_PAD)
517/* 506/*
518 * Structure for I/O accelerator (mode 2 or m2) commands. 507 * Structure for I/O accelerator (mode 2 or m2) commands.
519 * Note that this structure must be 128-byte aligned in size. 508 * Note that this structure must be 128-byte aligned in size.
520 */ 509 */
510#define IOACCEL2_COMMANDLIST_ALIGNMENT 128
521struct io_accel2_cmd { 511struct io_accel2_cmd {
522 u8 IU_type; /* IU Type */ 512 u8 IU_type; /* IU Type */
523 u8 direction; /* direction, memtype, and encryption */ 513 u8 direction; /* direction, memtype, and encryption */
@@ -544,8 +534,7 @@ struct io_accel2_cmd {
544 u32 tweak_upper; /* Encryption tweak, upper 4 bytes */ 534 u32 tweak_upper; /* Encryption tweak, upper 4 bytes */
545 struct ioaccel2_sg_element sg[IOACCEL2_MAXSGENTRIES]; 535 struct ioaccel2_sg_element sg[IOACCEL2_MAXSGENTRIES];
546 struct io_accel2_scsi_response error_data; 536 struct io_accel2_scsi_response error_data;
547 u8 pad[IOACCEL2_PAD]; 537} __aligned(IOACCEL2_COMMANDLIST_ALIGNMENT);
548};
549 538
550/* 539/*
551 * defines for Mode 2 command struct 540 * defines for Mode 2 command struct
@@ -636,7 +625,7 @@ struct TransTable_struct {
636 u32 RepQCount; 625 u32 RepQCount;
637 u32 RepQCtrAddrLow32; 626 u32 RepQCtrAddrLow32;
638 u32 RepQCtrAddrHigh32; 627 u32 RepQCtrAddrHigh32;
639#define MAX_REPLY_QUEUES 8 628#define MAX_REPLY_QUEUES 64
640 struct vals32 RepQAddr[MAX_REPLY_QUEUES]; 629 struct vals32 RepQAddr[MAX_REPLY_QUEUES];
641}; 630};
642 631
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 94a3cafe7197..434e9037908e 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 *
@@ -640,6 +640,7 @@ struct lpfc_hba {
640#define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */ 640#define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */
641#define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */ 641#define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */
642#define HBA_FCP_IOQ_FLUSH 0x8000 /* FCP I/O queues being flushed */ 642#define HBA_FCP_IOQ_FLUSH 0x8000 /* FCP I/O queues being flushed */
643#define HBA_FW_DUMP_OP 0x10000 /* Skips fn reset before FW dump */
643 uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/ 644 uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/
644 struct lpfc_dmabuf slim2p; 645 struct lpfc_dmabuf slim2p;
645 646
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 8d5b6ceec9c9..1d7a5c34ee8c 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 *
@@ -919,10 +919,15 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode)
919 phba->cfg_sriov_nr_virtfn = 0; 919 phba->cfg_sriov_nr_virtfn = 0;
920 } 920 }
921 921
922 if (opcode == LPFC_FW_DUMP)
923 phba->hba_flag |= HBA_FW_DUMP_OP;
924
922 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); 925 status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
923 926
924 if (status != 0) 927 if (status != 0) {
928 phba->hba_flag &= ~HBA_FW_DUMP_OP;
925 return status; 929 return status;
930 }
926 931
927 /* wait for the device to be quiesced before firmware reset */ 932 /* wait for the device to be quiesced before firmware reset */
928 msleep(100); 933 msleep(100);
@@ -2364,7 +2369,7 @@ lpfc_oas_tgt_store(struct device *dev, struct device_attribute *attr,
2364 uint8_t wwpn[WWN_SZ]; 2369 uint8_t wwpn[WWN_SZ];
2365 int rc; 2370 int rc;
2366 2371
2367 if (!phba->cfg_EnableXLane) 2372 if (!phba->cfg_fof)
2368 return -EPERM; 2373 return -EPERM;
2369 2374
2370 /* count may include a LF at end of string */ 2375 /* count may include a LF at end of string */
@@ -2432,7 +2437,7 @@ lpfc_oas_vpt_store(struct device *dev, struct device_attribute *attr,
2432 uint8_t wwpn[WWN_SZ]; 2437 uint8_t wwpn[WWN_SZ];
2433 int rc; 2438 int rc;
2434 2439
2435 if (!phba->cfg_EnableXLane) 2440 if (!phba->cfg_fof)
2436 return -EPERM; 2441 return -EPERM;
2437 2442
2438 /* count may include a LF at end of string */ 2443 /* count may include a LF at end of string */
@@ -2499,7 +2504,7 @@ lpfc_oas_lun_state_store(struct device *dev, struct device_attribute *attr,
2499 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; 2504 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
2500 int val = 0; 2505 int val = 0;
2501 2506
2502 if (!phba->cfg_EnableXLane) 2507 if (!phba->cfg_fof)
2503 return -EPERM; 2508 return -EPERM;
2504 2509
2505 if (!isdigit(buf[0])) 2510 if (!isdigit(buf[0]))
@@ -2565,7 +2570,7 @@ lpfc_oas_lun_state_set(struct lpfc_hba *phba, uint8_t vpt_wwpn[],
2565 2570
2566 int rc = 0; 2571 int rc = 0;
2567 2572
2568 if (!phba->cfg_EnableXLane) 2573 if (!phba->cfg_fof)
2569 return -EPERM; 2574 return -EPERM;
2570 2575
2571 if (oas_state) { 2576 if (oas_state) {
@@ -2670,7 +2675,7 @@ lpfc_oas_lun_show(struct device *dev, struct device_attribute *attr,
2670 uint64_t oas_lun; 2675 uint64_t oas_lun;
2671 int len = 0; 2676 int len = 0;
2672 2677
2673 if (!phba->cfg_EnableXLane) 2678 if (!phba->cfg_fof)
2674 return -EPERM; 2679 return -EPERM;
2675 2680
2676 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) 2681 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0)
@@ -2716,7 +2721,7 @@ lpfc_oas_lun_store(struct device *dev, struct device_attribute *attr,
2716 uint64_t scsi_lun; 2721 uint64_t scsi_lun;
2717 ssize_t rc; 2722 ssize_t rc;
2718 2723
2719 if (!phba->cfg_EnableXLane) 2724 if (!phba->cfg_fof)
2720 return -EPERM; 2725 return -EPERM;
2721 2726
2722 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) 2727 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0)
@@ -4655,7 +4660,7 @@ LPFC_ATTR_R(EnableXLane, 0, 0, 1, "Enable Express Lane Feature.");
4655# 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits) 4660# 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
4656# Value range is [0x0,0x7f]. Default value is 0 4661# Value range is [0x0,0x7f]. Default value is 0
4657*/ 4662*/
4658LPFC_ATTR_R(XLanePriority, 0, 0x0, 0x7f, "CS_CTL for Express Lane Feature."); 4663LPFC_ATTR_RW(XLanePriority, 0, 0x0, 0x7f, "CS_CTL for Express Lane Feature.");
4659 4664
4660/* 4665/*
4661# lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF) 4666# lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index ca2f4ea7cdef..5b5c825d9576 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2009-2014 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_bsg.h b/drivers/scsi/lpfc/lpfc_bsg.h
index a94d4c9dfaa5..928ef609f363 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.h
+++ b/drivers/scsi/lpfc/lpfc_bsg.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) 2010-2012 Emulex. All rights reserved. * 4 * Copyright (C) 2010-2014 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_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index adda0bf7a244..db5604f01a1a 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 * *
@@ -289,6 +289,7 @@ int lpfc_sli_issue_iocb(struct lpfc_hba *, uint32_t,
289void lpfc_sli_pcimem_bcopy(void *, void *, uint32_t); 289void lpfc_sli_pcimem_bcopy(void *, void *, uint32_t);
290void lpfc_sli_bemem_bcopy(void *, void *, uint32_t); 290void lpfc_sli_bemem_bcopy(void *, void *, uint32_t);
291void lpfc_sli_abort_iocb_ring(struct lpfc_hba *, struct lpfc_sli_ring *); 291void lpfc_sli_abort_iocb_ring(struct lpfc_hba *, struct lpfc_sli_ring *);
292void lpfc_sli_abort_fcp_rings(struct lpfc_hba *phba);
292void lpfc_sli_hba_iocb_abort(struct lpfc_hba *); 293void lpfc_sli_hba_iocb_abort(struct lpfc_hba *);
293void lpfc_sli_flush_fcp_rings(struct lpfc_hba *); 294void lpfc_sli_flush_fcp_rings(struct lpfc_hba *);
294int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *, 295int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *,
@@ -310,6 +311,9 @@ int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *,
310int lpfc_sli_sum_iocb(struct lpfc_vport *, uint16_t, uint64_t, lpfc_ctx_cmd); 311int lpfc_sli_sum_iocb(struct lpfc_vport *, uint16_t, uint64_t, lpfc_ctx_cmd);
311int lpfc_sli_abort_iocb(struct lpfc_vport *, struct lpfc_sli_ring *, uint16_t, 312int lpfc_sli_abort_iocb(struct lpfc_vport *, struct lpfc_sli_ring *, uint16_t,
312 uint64_t, lpfc_ctx_cmd); 313 uint64_t, lpfc_ctx_cmd);
314int
315lpfc_sli_abort_taskmgmt(struct lpfc_vport *, struct lpfc_sli_ring *,
316 uint16_t, uint64_t, lpfc_ctx_cmd);
313 317
314void lpfc_mbox_timeout(unsigned long); 318void lpfc_mbox_timeout(unsigned long);
315void lpfc_mbox_timeout_handler(struct lpfc_hba *); 319void lpfc_mbox_timeout_handler(struct lpfc_hba *);
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 828c08e9389e..b0aedce3f54b 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.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) 2007-2012 Emulex. All rights reserved. * 4 * Copyright (C) 2007-2014 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 * *
@@ -2314,7 +2314,7 @@ proc_cq:
2314 goto too_big; 2314 goto too_big;
2315 } 2315 }
2316 2316
2317 if (phba->cfg_EnableXLane) { 2317 if (phba->cfg_fof) {
2318 2318
2319 /* OAS CQ */ 2319 /* OAS CQ */
2320 qp = phba->sli4_hba.oas_cq; 2320 qp = phba->sli4_hba.oas_cq;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 624fe0b3cc0b..7a5d81a65be8 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 294c072e9083..2a17e31265b8 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 *
@@ -5634,6 +5634,9 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
5634 ndlp->active_rrqs_xri_bitmap = 5634 ndlp->active_rrqs_xri_bitmap =
5635 mempool_alloc(vport->phba->active_rrq_pool, 5635 mempool_alloc(vport->phba->active_rrq_pool,
5636 GFP_KERNEL); 5636 GFP_KERNEL);
5637 if (ndlp->active_rrqs_xri_bitmap)
5638 memset(ndlp->active_rrqs_xri_bitmap, 0,
5639 ndlp->phba->cfg_rrq_xri_bitmap_sz);
5637 } 5640 }
5638 5641
5639 5642
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 3d9438ce59ab..236259252379 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 fd79f7de7666..f432ec180cf8 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2009-2014 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 635eeb3d6987..06f9a5b79e66 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 *
@@ -820,57 +820,153 @@ lpfc_hba_down_prep(struct lpfc_hba *phba)
820} 820}
821 821
822/** 822/**
823 * lpfc_hba_down_post_s3 - Perform lpfc uninitialization after HBA reset 823 * lpfc_sli4_free_sp_events - Cleanup sp_queue_events to free
824 * rspiocb which got deferred
825 *
824 * @phba: pointer to lpfc HBA data structure. 826 * @phba: pointer to lpfc HBA data structure.
825 * 827 *
826 * This routine will do uninitialization after the HBA is reset when bring 828 * This routine will cleanup completed slow path events after HBA is reset
827 * down the SLI Layer. 829 * when bringing down the SLI Layer.
830 *
828 * 831 *
829 * Return codes 832 * Return codes
830 * 0 - success. 833 * void.
831 * Any other value - error.
832 **/ 834 **/
833static int 835static void
834lpfc_hba_down_post_s3(struct lpfc_hba *phba) 836lpfc_sli4_free_sp_events(struct lpfc_hba *phba)
837{
838 struct lpfc_iocbq *rspiocbq;
839 struct hbq_dmabuf *dmabuf;
840 struct lpfc_cq_event *cq_event;
841
842 spin_lock_irq(&phba->hbalock);
843 phba->hba_flag &= ~HBA_SP_QUEUE_EVT;
844 spin_unlock_irq(&phba->hbalock);
845
846 while (!list_empty(&phba->sli4_hba.sp_queue_event)) {
847 /* Get the response iocb from the head of work queue */
848 spin_lock_irq(&phba->hbalock);
849 list_remove_head(&phba->sli4_hba.sp_queue_event,
850 cq_event, struct lpfc_cq_event, list);
851 spin_unlock_irq(&phba->hbalock);
852
853 switch (bf_get(lpfc_wcqe_c_code, &cq_event->cqe.wcqe_cmpl)) {
854 case CQE_CODE_COMPL_WQE:
855 rspiocbq = container_of(cq_event, struct lpfc_iocbq,
856 cq_event);
857 lpfc_sli_release_iocbq(phba, rspiocbq);
858 break;
859 case CQE_CODE_RECEIVE:
860 case CQE_CODE_RECEIVE_V1:
861 dmabuf = container_of(cq_event, struct hbq_dmabuf,
862 cq_event);
863 lpfc_in_buf_free(phba, &dmabuf->dbuf);
864 }
865 }
866}
867
868/**
869 * lpfc_hba_free_post_buf - Perform lpfc uninitialization after HBA reset
870 * @phba: pointer to lpfc HBA data structure.
871 *
872 * This routine will cleanup posted ELS buffers after the HBA is reset
873 * when bringing down the SLI Layer.
874 *
875 *
876 * Return codes
877 * void.
878 **/
879static void
880lpfc_hba_free_post_buf(struct lpfc_hba *phba)
835{ 881{
836 struct lpfc_sli *psli = &phba->sli; 882 struct lpfc_sli *psli = &phba->sli;
837 struct lpfc_sli_ring *pring; 883 struct lpfc_sli_ring *pring;
838 struct lpfc_dmabuf *mp, *next_mp; 884 struct lpfc_dmabuf *mp, *next_mp;
839 LIST_HEAD(completions); 885 LIST_HEAD(buflist);
840 int i; 886 int count;
841 887
842 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) 888 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)
843 lpfc_sli_hbqbuf_free_all(phba); 889 lpfc_sli_hbqbuf_free_all(phba);
844 else { 890 else {
845 /* Cleanup preposted buffers on the ELS ring */ 891 /* Cleanup preposted buffers on the ELS ring */
846 pring = &psli->ring[LPFC_ELS_RING]; 892 pring = &psli->ring[LPFC_ELS_RING];
847 list_for_each_entry_safe(mp, next_mp, &pring->postbufq, list) { 893 spin_lock_irq(&phba->hbalock);
894 list_splice_init(&pring->postbufq, &buflist);
895 spin_unlock_irq(&phba->hbalock);
896
897 count = 0;
898 list_for_each_entry_safe(mp, next_mp, &buflist, list) {
848 list_del(&mp->list); 899 list_del(&mp->list);
849 pring->postbufq_cnt--; 900 count++;
850 lpfc_mbuf_free(phba, mp->virt, mp->phys); 901 lpfc_mbuf_free(phba, mp->virt, mp->phys);
851 kfree(mp); 902 kfree(mp);
852 } 903 }
904
905 spin_lock_irq(&phba->hbalock);
906 pring->postbufq_cnt -= count;
907 spin_unlock_irq(&phba->hbalock);
853 } 908 }
909}
910
911/**
912 * lpfc_hba_clean_txcmplq - Perform lpfc uninitialization after HBA reset
913 * @phba: pointer to lpfc HBA data structure.
914 *
915 * This routine will cleanup the txcmplq after the HBA is reset when bringing
916 * down the SLI Layer.
917 *
918 * Return codes
919 * void
920 **/
921static void
922lpfc_hba_clean_txcmplq(struct lpfc_hba *phba)
923{
924 struct lpfc_sli *psli = &phba->sli;
925 struct lpfc_sli_ring *pring;
926 LIST_HEAD(completions);
927 int i;
854 928
855 spin_lock_irq(&phba->hbalock);
856 for (i = 0; i < psli->num_rings; i++) { 929 for (i = 0; i < psli->num_rings; i++) {
857 pring = &psli->ring[i]; 930 pring = &psli->ring[i];
858 931 if (phba->sli_rev >= LPFC_SLI_REV4)
932 spin_lock_irq(&pring->ring_lock);
933 else
934 spin_lock_irq(&phba->hbalock);
859 /* At this point in time the HBA is either reset or DOA. Either 935 /* At this point in time the HBA is either reset or DOA. Either
860 * way, nothing should be on txcmplq as it will NEVER complete. 936 * way, nothing should be on txcmplq as it will NEVER complete.
861 */ 937 */
862 list_splice_init(&pring->txcmplq, &completions); 938 list_splice_init(&pring->txcmplq, &completions);
863 spin_unlock_irq(&phba->hbalock); 939 pring->txcmplq_cnt = 0;
940
941 if (phba->sli_rev >= LPFC_SLI_REV4)
942 spin_unlock_irq(&pring->ring_lock);
943 else
944 spin_unlock_irq(&phba->hbalock);
864 945
865 /* Cancel all the IOCBs from the completions list */ 946 /* Cancel all the IOCBs from the completions list */
866 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, 947 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
867 IOERR_SLI_ABORTED); 948 IOERR_SLI_ABORTED);
868
869 lpfc_sli_abort_iocb_ring(phba, pring); 949 lpfc_sli_abort_iocb_ring(phba, pring);
870 spin_lock_irq(&phba->hbalock);
871 } 950 }
872 spin_unlock_irq(&phba->hbalock); 951}
873 952
953/**
954 * lpfc_hba_down_post_s3 - Perform lpfc uninitialization after HBA reset
955 int i;
956 * @phba: pointer to lpfc HBA data structure.
957 *
958 * This routine will do uninitialization after the HBA is reset when bring
959 * down the SLI Layer.
960 *
961 * Return codes
962 * 0 - success.
963 * Any other value - error.
964 **/
965static int
966lpfc_hba_down_post_s3(struct lpfc_hba *phba)
967{
968 lpfc_hba_free_post_buf(phba);
969 lpfc_hba_clean_txcmplq(phba);
874 return 0; 970 return 0;
875} 971}
876 972
@@ -890,13 +986,12 @@ lpfc_hba_down_post_s4(struct lpfc_hba *phba)
890{ 986{
891 struct lpfc_scsi_buf *psb, *psb_next; 987 struct lpfc_scsi_buf *psb, *psb_next;
892 LIST_HEAD(aborts); 988 LIST_HEAD(aborts);
893 int ret;
894 unsigned long iflag = 0; 989 unsigned long iflag = 0;
895 struct lpfc_sglq *sglq_entry = NULL; 990 struct lpfc_sglq *sglq_entry = NULL;
896 991
897 ret = lpfc_hba_down_post_s3(phba); 992 lpfc_hba_free_post_buf(phba);
898 if (ret) 993 lpfc_hba_clean_txcmplq(phba);
899 return ret; 994
900 /* At this point in time the HBA is either reset or DOA. Either 995 /* At this point in time the HBA is either reset or DOA. Either
901 * way, nothing should be on lpfc_abts_els_sgl_list, it needs to be 996 * way, nothing should be on lpfc_abts_els_sgl_list, it needs to be
902 * on the lpfc_sgl_list so that it can either be freed if the 997 * on the lpfc_sgl_list so that it can either be freed if the
@@ -932,6 +1027,8 @@ lpfc_hba_down_post_s4(struct lpfc_hba *phba)
932 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); 1027 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag);
933 list_splice(&aborts, &phba->lpfc_scsi_buf_list_put); 1028 list_splice(&aborts, &phba->lpfc_scsi_buf_list_put);
934 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); 1029 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag);
1030
1031 lpfc_sli4_free_sp_events(phba);
935 return 0; 1032 return 0;
936} 1033}
937 1034
@@ -1250,7 +1347,6 @@ static void
1250lpfc_handle_deferred_eratt(struct lpfc_hba *phba) 1347lpfc_handle_deferred_eratt(struct lpfc_hba *phba)
1251{ 1348{
1252 uint32_t old_host_status = phba->work_hs; 1349 uint32_t old_host_status = phba->work_hs;
1253 struct lpfc_sli_ring *pring;
1254 struct lpfc_sli *psli = &phba->sli; 1350 struct lpfc_sli *psli = &phba->sli;
1255 1351
1256 /* If the pci channel is offline, ignore possible errors, 1352 /* If the pci channel is offline, ignore possible errors,
@@ -1279,8 +1375,7 @@ lpfc_handle_deferred_eratt(struct lpfc_hba *phba)
1279 * dropped by the firmware. Error iocb (I/O) on txcmplq and let the 1375 * dropped by the firmware. Error iocb (I/O) on txcmplq and let the
1280 * SCSI layer retry it after re-establishing link. 1376 * SCSI layer retry it after re-establishing link.
1281 */ 1377 */
1282 pring = &psli->ring[psli->fcp_ring]; 1378 lpfc_sli_abort_fcp_rings(phba);
1283 lpfc_sli_abort_iocb_ring(phba, pring);
1284 1379
1285 /* 1380 /*
1286 * There was a firmware error. Take the hba offline and then 1381 * There was a firmware error. Take the hba offline and then
@@ -1348,7 +1443,6 @@ lpfc_handle_eratt_s3(struct lpfc_hba *phba)
1348{ 1443{
1349 struct lpfc_vport *vport = phba->pport; 1444 struct lpfc_vport *vport = phba->pport;
1350 struct lpfc_sli *psli = &phba->sli; 1445 struct lpfc_sli *psli = &phba->sli;
1351 struct lpfc_sli_ring *pring;
1352 uint32_t event_data; 1446 uint32_t event_data;
1353 unsigned long temperature; 1447 unsigned long temperature;
1354 struct temp_event temp_event_data; 1448 struct temp_event temp_event_data;
@@ -1400,8 +1494,7 @@ lpfc_handle_eratt_s3(struct lpfc_hba *phba)
1400 * Error iocb (I/O) on txcmplq and let the SCSI layer 1494 * Error iocb (I/O) on txcmplq and let the SCSI layer
1401 * retry it after re-establishing link. 1495 * retry it after re-establishing link.
1402 */ 1496 */
1403 pring = &psli->ring[psli->fcp_ring]; 1497 lpfc_sli_abort_fcp_rings(phba);
1404 lpfc_sli_abort_iocb_ring(phba, pring);
1405 1498
1406 /* 1499 /*
1407 * There was a firmware error. Take the hba offline and then 1500 * There was a firmware error. Take the hba offline and then
@@ -1940,78 +2033,81 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
1940 2033
1941 switch (dev_id) { 2034 switch (dev_id) {
1942 case PCI_DEVICE_ID_FIREFLY: 2035 case PCI_DEVICE_ID_FIREFLY:
1943 m = (typeof(m)){"LP6000", "PCI", "Fibre Channel Adapter"}; 2036 m = (typeof(m)){"LP6000", "PCI",
2037 "Obsolete, Unsupported Fibre Channel Adapter"};
1944 break; 2038 break;
1945 case PCI_DEVICE_ID_SUPERFLY: 2039 case PCI_DEVICE_ID_SUPERFLY:
1946 if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3) 2040 if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3)
1947 m = (typeof(m)){"LP7000", "PCI", 2041 m = (typeof(m)){"LP7000", "PCI", ""};
1948 "Fibre Channel Adapter"};
1949 else 2042 else
1950 m = (typeof(m)){"LP7000E", "PCI", 2043 m = (typeof(m)){"LP7000E", "PCI", ""};
1951 "Fibre Channel Adapter"}; 2044 m.function = "Obsolete, Unsupported Fibre Channel Adapter";
1952 break; 2045 break;
1953 case PCI_DEVICE_ID_DRAGONFLY: 2046 case PCI_DEVICE_ID_DRAGONFLY:
1954 m = (typeof(m)){"LP8000", "PCI", 2047 m = (typeof(m)){"LP8000", "PCI",
1955 "Fibre Channel Adapter"}; 2048 "Obsolete, Unsupported Fibre Channel Adapter"};
1956 break; 2049 break;
1957 case PCI_DEVICE_ID_CENTAUR: 2050 case PCI_DEVICE_ID_CENTAUR:
1958 if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID) 2051 if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID)
1959 m = (typeof(m)){"LP9002", "PCI", 2052 m = (typeof(m)){"LP9002", "PCI", ""};
1960 "Fibre Channel Adapter"};
1961 else 2053 else
1962 m = (typeof(m)){"LP9000", "PCI", 2054 m = (typeof(m)){"LP9000", "PCI", ""};
1963 "Fibre Channel Adapter"}; 2055 m.function = "Obsolete, Unsupported Fibre Channel Adapter";
1964 break; 2056 break;
1965 case PCI_DEVICE_ID_RFLY: 2057 case PCI_DEVICE_ID_RFLY:
1966 m = (typeof(m)){"LP952", "PCI", 2058 m = (typeof(m)){"LP952", "PCI",
1967 "Fibre Channel Adapter"}; 2059 "Obsolete, Unsupported Fibre Channel Adapter"};
1968 break; 2060 break;
1969 case PCI_DEVICE_ID_PEGASUS: 2061 case PCI_DEVICE_ID_PEGASUS:
1970 m = (typeof(m)){"LP9802", "PCI-X", 2062 m = (typeof(m)){"LP9802", "PCI-X",
1971 "Fibre Channel Adapter"}; 2063 "Obsolete, Unsupported Fibre Channel Adapter"};
1972 break; 2064 break;
1973 case PCI_DEVICE_ID_THOR: 2065 case PCI_DEVICE_ID_THOR:
1974 m = (typeof(m)){"LP10000", "PCI-X", 2066 m = (typeof(m)){"LP10000", "PCI-X",
1975 "Fibre Channel Adapter"}; 2067 "Obsolete, Unsupported Fibre Channel Adapter"};
1976 break; 2068 break;
1977 case PCI_DEVICE_ID_VIPER: 2069 case PCI_DEVICE_ID_VIPER:
1978 m = (typeof(m)){"LPX1000", "PCI-X", 2070 m = (typeof(m)){"LPX1000", "PCI-X",
1979 "Fibre Channel Adapter"}; 2071 "Obsolete, Unsupported Fibre Channel Adapter"};
1980 break; 2072 break;
1981 case PCI_DEVICE_ID_PFLY: 2073 case PCI_DEVICE_ID_PFLY:
1982 m = (typeof(m)){"LP982", "PCI-X", 2074 m = (typeof(m)){"LP982", "PCI-X",
1983 "Fibre Channel Adapter"}; 2075 "Obsolete, Unsupported Fibre Channel Adapter"};
1984 break; 2076 break;
1985 case PCI_DEVICE_ID_TFLY: 2077 case PCI_DEVICE_ID_TFLY:
1986 m = (typeof(m)){"LP1050", "PCI-X", 2078 m = (typeof(m)){"LP1050", "PCI-X",
1987 "Fibre Channel Adapter"}; 2079 "Obsolete, Unsupported Fibre Channel Adapter"};
1988 break; 2080 break;
1989 case PCI_DEVICE_ID_HELIOS: 2081 case PCI_DEVICE_ID_HELIOS:
1990 m = (typeof(m)){"LP11000", "PCI-X2", 2082 m = (typeof(m)){"LP11000", "PCI-X2",
1991 "Fibre Channel Adapter"}; 2083 "Obsolete, Unsupported Fibre Channel Adapter"};
1992 break; 2084 break;
1993 case PCI_DEVICE_ID_HELIOS_SCSP: 2085 case PCI_DEVICE_ID_HELIOS_SCSP:
1994 m = (typeof(m)){"LP11000-SP", "PCI-X2", 2086 m = (typeof(m)){"LP11000-SP", "PCI-X2",
1995 "Fibre Channel Adapter"}; 2087 "Obsolete, Unsupported Fibre Channel Adapter"};
1996 break; 2088 break;
1997 case PCI_DEVICE_ID_HELIOS_DCSP: 2089 case PCI_DEVICE_ID_HELIOS_DCSP:
1998 m = (typeof(m)){"LP11002-SP", "PCI-X2", 2090 m = (typeof(m)){"LP11002-SP", "PCI-X2",
1999 "Fibre Channel Adapter"}; 2091 "Obsolete, Unsupported Fibre Channel Adapter"};
2000 break; 2092 break;
2001 case PCI_DEVICE_ID_NEPTUNE: 2093 case PCI_DEVICE_ID_NEPTUNE:
2002 m = (typeof(m)){"LPe1000", "PCIe", "Fibre Channel Adapter"}; 2094 m = (typeof(m)){"LPe1000", "PCIe",
2095 "Obsolete, Unsupported Fibre Channel Adapter"};
2003 break; 2096 break;
2004 case PCI_DEVICE_ID_NEPTUNE_SCSP: 2097 case PCI_DEVICE_ID_NEPTUNE_SCSP:
2005 m = (typeof(m)){"LPe1000-SP", "PCIe", "Fibre Channel Adapter"}; 2098 m = (typeof(m)){"LPe1000-SP", "PCIe",
2099 "Obsolete, Unsupported Fibre Channel Adapter"};
2006 break; 2100 break;
2007 case PCI_DEVICE_ID_NEPTUNE_DCSP: 2101 case PCI_DEVICE_ID_NEPTUNE_DCSP:
2008 m = (typeof(m)){"LPe1002-SP", "PCIe", "Fibre Channel Adapter"}; 2102 m = (typeof(m)){"LPe1002-SP", "PCIe",
2103 "Obsolete, Unsupported Fibre Channel Adapter"};
2009 break; 2104 break;
2010 case PCI_DEVICE_ID_BMID: 2105 case PCI_DEVICE_ID_BMID:
2011 m = (typeof(m)){"LP1150", "PCI-X2", "Fibre Channel Adapter"}; 2106 m = (typeof(m)){"LP1150", "PCI-X2", "Fibre Channel Adapter"};
2012 break; 2107 break;
2013 case PCI_DEVICE_ID_BSMB: 2108 case PCI_DEVICE_ID_BSMB:
2014 m = (typeof(m)){"LP111", "PCI-X2", "Fibre Channel Adapter"}; 2109 m = (typeof(m)){"LP111", "PCI-X2",
2110 "Obsolete, Unsupported Fibre Channel Adapter"};
2015 break; 2111 break;
2016 case PCI_DEVICE_ID_ZEPHYR: 2112 case PCI_DEVICE_ID_ZEPHYR:
2017 m = (typeof(m)){"LPe11000", "PCIe", "Fibre Channel Adapter"}; 2113 m = (typeof(m)){"LPe11000", "PCIe", "Fibre Channel Adapter"};
@@ -2030,16 +2126,20 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
2030 m = (typeof(m)){"LPe111", "PCIe", "Fibre Channel Adapter"}; 2126 m = (typeof(m)){"LPe111", "PCIe", "Fibre Channel Adapter"};
2031 break; 2127 break;
2032 case PCI_DEVICE_ID_LP101: 2128 case PCI_DEVICE_ID_LP101:
2033 m = (typeof(m)){"LP101", "PCI-X", "Fibre Channel Adapter"}; 2129 m = (typeof(m)){"LP101", "PCI-X",
2130 "Obsolete, Unsupported Fibre Channel Adapter"};
2034 break; 2131 break;
2035 case PCI_DEVICE_ID_LP10000S: 2132 case PCI_DEVICE_ID_LP10000S:
2036 m = (typeof(m)){"LP10000-S", "PCI", "Fibre Channel Adapter"}; 2133 m = (typeof(m)){"LP10000-S", "PCI",
2134 "Obsolete, Unsupported Fibre Channel Adapter"};
2037 break; 2135 break;
2038 case PCI_DEVICE_ID_LP11000S: 2136 case PCI_DEVICE_ID_LP11000S:
2039 m = (typeof(m)){"LP11000-S", "PCI-X2", "Fibre Channel Adapter"}; 2137 m = (typeof(m)){"LP11000-S", "PCI-X2",
2138 "Obsolete, Unsupported Fibre Channel Adapter"};
2040 break; 2139 break;
2041 case PCI_DEVICE_ID_LPE11000S: 2140 case PCI_DEVICE_ID_LPE11000S:
2042 m = (typeof(m)){"LPe11000-S", "PCIe", "Fibre Channel Adapter"}; 2141 m = (typeof(m)){"LPe11000-S", "PCIe",
2142 "Obsolete, Unsupported Fibre Channel Adapter"};
2043 break; 2143 break;
2044 case PCI_DEVICE_ID_SAT: 2144 case PCI_DEVICE_ID_SAT:
2045 m = (typeof(m)){"LPe12000", "PCIe", "Fibre Channel Adapter"}; 2145 m = (typeof(m)){"LPe12000", "PCIe", "Fibre Channel Adapter"};
@@ -2060,20 +2160,21 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
2060 m = (typeof(m)){"LPe12000-S", "PCIe", "Fibre Channel Adapter"}; 2160 m = (typeof(m)){"LPe12000-S", "PCIe", "Fibre Channel Adapter"};
2061 break; 2161 break;
2062 case PCI_DEVICE_ID_HORNET: 2162 case PCI_DEVICE_ID_HORNET:
2063 m = (typeof(m)){"LP21000", "PCIe", "FCoE Adapter"}; 2163 m = (typeof(m)){"LP21000", "PCIe",
2164 "Obsolete, Unsupported FCoE Adapter"};
2064 GE = 1; 2165 GE = 1;
2065 break; 2166 break;
2066 case PCI_DEVICE_ID_PROTEUS_VF: 2167 case PCI_DEVICE_ID_PROTEUS_VF:
2067 m = (typeof(m)){"LPev12000", "PCIe IOV", 2168 m = (typeof(m)){"LPev12000", "PCIe IOV",
2068 "Fibre Channel Adapter"}; 2169 "Obsolete, Unsupported Fibre Channel Adapter"};
2069 break; 2170 break;
2070 case PCI_DEVICE_ID_PROTEUS_PF: 2171 case PCI_DEVICE_ID_PROTEUS_PF:
2071 m = (typeof(m)){"LPev12000", "PCIe IOV", 2172 m = (typeof(m)){"LPev12000", "PCIe IOV",
2072 "Fibre Channel Adapter"}; 2173 "Obsolete, Unsupported Fibre Channel Adapter"};
2073 break; 2174 break;
2074 case PCI_DEVICE_ID_PROTEUS_S: 2175 case PCI_DEVICE_ID_PROTEUS_S:
2075 m = (typeof(m)){"LPemv12002-S", "PCIe IOV", 2176 m = (typeof(m)){"LPemv12002-S", "PCIe IOV",
2076 "Fibre Channel Adapter"}; 2177 "Obsolete, Unsupported Fibre Channel Adapter"};
2077 break; 2178 break;
2078 case PCI_DEVICE_ID_TIGERSHARK: 2179 case PCI_DEVICE_ID_TIGERSHARK:
2079 oneConnect = 1; 2180 oneConnect = 1;
@@ -2089,17 +2190,24 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
2089 break; 2190 break;
2090 case PCI_DEVICE_ID_BALIUS: 2191 case PCI_DEVICE_ID_BALIUS:
2091 m = (typeof(m)){"LPVe12002", "PCIe Shared I/O", 2192 m = (typeof(m)){"LPVe12002", "PCIe Shared I/O",
2092 "Fibre Channel Adapter"}; 2193 "Obsolete, Unsupported Fibre Channel Adapter"};
2093 break; 2194 break;
2094 case PCI_DEVICE_ID_LANCER_FC: 2195 case PCI_DEVICE_ID_LANCER_FC:
2095 case PCI_DEVICE_ID_LANCER_FC_VF:
2096 m = (typeof(m)){"LPe16000", "PCIe", "Fibre Channel Adapter"}; 2196 m = (typeof(m)){"LPe16000", "PCIe", "Fibre Channel Adapter"};
2097 break; 2197 break;
2198 case PCI_DEVICE_ID_LANCER_FC_VF:
2199 m = (typeof(m)){"LPe16000", "PCIe",
2200 "Obsolete, Unsupported Fibre Channel Adapter"};
2201 break;
2098 case PCI_DEVICE_ID_LANCER_FCOE: 2202 case PCI_DEVICE_ID_LANCER_FCOE:
2099 case PCI_DEVICE_ID_LANCER_FCOE_VF:
2100 oneConnect = 1; 2203 oneConnect = 1;
2101 m = (typeof(m)){"OCe15100", "PCIe", "FCoE"}; 2204 m = (typeof(m)){"OCe15100", "PCIe", "FCoE"};
2102 break; 2205 break;
2206 case PCI_DEVICE_ID_LANCER_FCOE_VF:
2207 oneConnect = 1;
2208 m = (typeof(m)){"OCe15100", "PCIe",
2209 "Obsolete, Unsupported FCoE"};
2210 break;
2103 case PCI_DEVICE_ID_SKYHAWK: 2211 case PCI_DEVICE_ID_SKYHAWK:
2104 case PCI_DEVICE_ID_SKYHAWK_VF: 2212 case PCI_DEVICE_ID_SKYHAWK_VF:
2105 oneConnect = 1; 2213 oneConnect = 1;
@@ -4614,7 +4722,10 @@ lpfc_reset_hba(struct lpfc_hba *phba)
4614 phba->link_state = LPFC_HBA_ERROR; 4722 phba->link_state = LPFC_HBA_ERROR;
4615 return; 4723 return;
4616 } 4724 }
4617 lpfc_offline_prep(phba, LPFC_MBX_WAIT); 4725 if (phba->sli.sli_flag & LPFC_SLI_ACTIVE)
4726 lpfc_offline_prep(phba, LPFC_MBX_WAIT);
4727 else
4728 lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT);
4618 lpfc_offline(phba); 4729 lpfc_offline(phba);
4619 lpfc_sli_brdrestart(phba); 4730 lpfc_sli_brdrestart(phba);
4620 lpfc_online(phba); 4731 lpfc_online(phba);
@@ -9663,9 +9774,6 @@ lpfc_pci_resume_one_s3(struct pci_dev *pdev)
9663static void 9774static void
9664lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba) 9775lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba)
9665{ 9776{
9666 struct lpfc_sli *psli = &phba->sli;
9667 struct lpfc_sli_ring *pring;
9668
9669 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 9777 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
9670 "2723 PCI channel I/O abort preparing for recovery\n"); 9778 "2723 PCI channel I/O abort preparing for recovery\n");
9671 9779
@@ -9673,8 +9781,7 @@ lpfc_sli_prep_dev_for_recover(struct lpfc_hba *phba)
9673 * There may be errored I/Os through HBA, abort all I/Os on txcmplq 9781 * There may be errored I/Os through HBA, abort all I/Os on txcmplq
9674 * and let the SCSI mid-layer to retry them to recover. 9782 * and let the SCSI mid-layer to retry them to recover.
9675 */ 9783 */
9676 pring = &psli->ring[psli->fcp_ring]; 9784 lpfc_sli_abort_fcp_rings(phba);
9677 lpfc_sli_abort_iocb_ring(phba, pring);
9678} 9785}
9679 9786
9680/** 9787/**
@@ -10417,17 +10524,13 @@ lpfc_pci_resume_one_s4(struct pci_dev *pdev)
10417static void 10524static void
10418lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) 10525lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba)
10419{ 10526{
10420 struct lpfc_sli *psli = &phba->sli;
10421 struct lpfc_sli_ring *pring;
10422
10423 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 10527 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
10424 "2828 PCI channel I/O abort preparing for recovery\n"); 10528 "2828 PCI channel I/O abort preparing for recovery\n");
10425 /* 10529 /*
10426 * There may be errored I/Os through HBA, abort all I/Os on txcmplq 10530 * There may be errored I/Os through HBA, abort all I/Os on txcmplq
10427 * and let the SCSI mid-layer to retry them to recover. 10531 * and let the SCSI mid-layer to retry them to recover.
10428 */ 10532 */
10429 pring = &psli->ring[psli->fcp_ring]; 10533 lpfc_sli_abort_fcp_rings(phba);
10430 lpfc_sli_abort_iocb_ring(phba, pring);
10431} 10534}
10432 10535
10433/** 10536/**
@@ -10898,7 +11001,7 @@ lpfc_sli4_oas_verify(struct lpfc_hba *phba)
10898 if (phba->sli4_hba.pc_sli4_params.oas_supported) { 11001 if (phba->sli4_hba.pc_sli4_params.oas_supported) {
10899 phba->cfg_fof = 1; 11002 phba->cfg_fof = 1;
10900 } else { 11003 } else {
10901 phba->cfg_EnableXLane = 0; 11004 phba->cfg_fof = 0;
10902 if (phba->device_data_mem_pool) 11005 if (phba->device_data_mem_pool)
10903 mempool_destroy(phba->device_data_mem_pool); 11006 mempool_destroy(phba->device_data_mem_pool);
10904 phba->device_data_mem_pool = NULL; 11007 phba->device_data_mem_pool = NULL;
@@ -10928,7 +11031,7 @@ lpfc_fof_queue_setup(struct lpfc_hba *phba)
10928 if (rc) 11031 if (rc)
10929 return -ENOMEM; 11032 return -ENOMEM;
10930 11033
10931 if (phba->cfg_EnableXLane) { 11034 if (phba->cfg_fof) {
10932 11035
10933 rc = lpfc_cq_create(phba, phba->sli4_hba.oas_cq, 11036 rc = lpfc_cq_create(phba, phba->sli4_hba.oas_cq,
10934 phba->sli4_hba.fof_eq, LPFC_WCQ, LPFC_FCP); 11037 phba->sli4_hba.fof_eq, LPFC_WCQ, LPFC_FCP);
@@ -10947,8 +11050,7 @@ lpfc_fof_queue_setup(struct lpfc_hba *phba)
10947 return 0; 11050 return 0;
10948 11051
10949out_oas_wq: 11052out_oas_wq:
10950 if (phba->cfg_EnableXLane) 11053 lpfc_cq_destroy(phba, phba->sli4_hba.oas_cq);
10951 lpfc_cq_destroy(phba, phba->sli4_hba.oas_cq);
10952out_oas_cq: 11054out_oas_cq:
10953 lpfc_eq_destroy(phba, phba->sli4_hba.fof_eq); 11055 lpfc_eq_destroy(phba, phba->sli4_hba.fof_eq);
10954 return rc; 11056 return rc;
@@ -10982,7 +11084,7 @@ lpfc_fof_queue_create(struct lpfc_hba *phba)
10982 11084
10983 phba->sli4_hba.fof_eq = qdesc; 11085 phba->sli4_hba.fof_eq = qdesc;
10984 11086
10985 if (phba->cfg_EnableXLane) { 11087 if (phba->cfg_fof) {
10986 11088
10987 /* Create OAS CQ */ 11089 /* Create OAS CQ */
10988 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize, 11090 qdesc = lpfc_sli4_queue_alloc(phba, phba->sli4_hba.cq_esize,
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index ed419aad2b1f..3fa65338d3f5 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.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-2014 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 462453ee0bda..2df11daad85b 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 *
@@ -73,7 +73,7 @@ lpfc_rport_data_from_scsi_device(struct scsi_device *sdev)
73{ 73{
74 struct lpfc_vport *vport = (struct lpfc_vport *)sdev->host->hostdata; 74 struct lpfc_vport *vport = (struct lpfc_vport *)sdev->host->hostdata;
75 75
76 if (vport->phba->cfg_EnableXLane) 76 if (vport->phba->cfg_fof)
77 return ((struct lpfc_device_data *)sdev->hostdata)->rport_data; 77 return ((struct lpfc_device_data *)sdev->hostdata)->rport_data;
78 else 78 else
79 return (struct lpfc_rport_data *)sdev->hostdata; 79 return (struct lpfc_rport_data *)sdev->hostdata;
@@ -3462,7 +3462,7 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
3462 * If the OAS driver feature is enabled and the lun is enabled for 3462 * If the OAS driver feature is enabled and the lun is enabled for
3463 * OAS, set the oas iocb related flags. 3463 * OAS, set the oas iocb related flags.
3464 */ 3464 */
3465 if ((phba->cfg_EnableXLane) && ((struct lpfc_device_data *) 3465 if ((phba->cfg_fof) && ((struct lpfc_device_data *)
3466 scsi_cmnd->device->hostdata)->oas_enabled) 3466 scsi_cmnd->device->hostdata)->oas_enabled)
3467 lpfc_cmd->cur_iocbq.iocb_flag |= LPFC_IO_OAS; 3467 lpfc_cmd->cur_iocbq.iocb_flag |= LPFC_IO_OAS;
3468 return 0; 3468 return 0;
@@ -4314,6 +4314,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
4314 fcp_cmnd->fcpCntl1 = SIMPLE_Q; 4314 fcp_cmnd->fcpCntl1 = SIMPLE_Q;
4315 4315
4316 sli4 = (phba->sli_rev == LPFC_SLI_REV4); 4316 sli4 = (phba->sli_rev == LPFC_SLI_REV4);
4317 piocbq->iocb.un.fcpi.fcpi_XRdy = 0;
4317 4318
4318 /* 4319 /*
4319 * There are three possibilities here - use scatter-gather segment, use 4320 * There are three possibilities here - use scatter-gather segment, use
@@ -4782,7 +4783,9 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
4782 struct lpfc_scsi_buf *lpfc_cmd; 4783 struct lpfc_scsi_buf *lpfc_cmd;
4783 IOCB_t *cmd, *icmd; 4784 IOCB_t *cmd, *icmd;
4784 int ret = SUCCESS, status = 0; 4785 int ret = SUCCESS, status = 0;
4785 unsigned long flags; 4786 struct lpfc_sli_ring *pring_s4;
4787 int ring_number, ret_val;
4788 unsigned long flags, iflags;
4786 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); 4789 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq);
4787 4790
4788 status = fc_block_scsi_eh(cmnd); 4791 status = fc_block_scsi_eh(cmnd);
@@ -4833,6 +4836,14 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
4833 4836
4834 BUG_ON(iocb->context1 != lpfc_cmd); 4837 BUG_ON(iocb->context1 != lpfc_cmd);
4835 4838
4839 /* abort issued in recovery is still in progress */
4840 if (iocb->iocb_flag & LPFC_DRIVER_ABORTED) {
4841 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
4842 "3389 SCSI Layer I/O Abort Request is pending\n");
4843 spin_unlock_irqrestore(&phba->hbalock, flags);
4844 goto wait_for_cmpl;
4845 }
4846
4836 abtsiocb = __lpfc_sli_get_iocbq(phba); 4847 abtsiocb = __lpfc_sli_get_iocbq(phba);
4837 if (abtsiocb == NULL) { 4848 if (abtsiocb == NULL) {
4838 ret = FAILED; 4849 ret = FAILED;
@@ -4871,11 +4882,23 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
4871 4882
4872 abtsiocb->iocb_cmpl = lpfc_sli_abort_fcp_cmpl; 4883 abtsiocb->iocb_cmpl = lpfc_sli_abort_fcp_cmpl;
4873 abtsiocb->vport = vport; 4884 abtsiocb->vport = vport;
4885 if (phba->sli_rev == LPFC_SLI_REV4) {
4886 ring_number = MAX_SLI3_CONFIGURED_RINGS + iocb->fcp_wqidx;
4887 pring_s4 = &phba->sli.ring[ring_number];
4888 /* Note: both hbalock and ring_lock must be set here */
4889 spin_lock_irqsave(&pring_s4->ring_lock, iflags);
4890 ret_val = __lpfc_sli_issue_iocb(phba, pring_s4->ringno,
4891 abtsiocb, 0);
4892 spin_unlock_irqrestore(&pring_s4->ring_lock, iflags);
4893 } else {
4894 ret_val = __lpfc_sli_issue_iocb(phba, LPFC_FCP_RING,
4895 abtsiocb, 0);
4896 }
4874 /* no longer need the lock after this point */ 4897 /* no longer need the lock after this point */
4875 spin_unlock_irqrestore(&phba->hbalock, flags); 4898 spin_unlock_irqrestore(&phba->hbalock, flags);
4876 4899
4877 if (lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, abtsiocb, 0) == 4900
4878 IOCB_ERROR) { 4901 if (ret_val == IOCB_ERROR) {
4879 lpfc_sli_release_iocbq(phba, abtsiocb); 4902 lpfc_sli_release_iocbq(phba, abtsiocb);
4880 ret = FAILED; 4903 ret = FAILED;
4881 goto out; 4904 goto out;
@@ -4885,12 +4908,16 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
4885 lpfc_sli_handle_fast_ring_event(phba, 4908 lpfc_sli_handle_fast_ring_event(phba,
4886 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); 4909 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ);
4887 4910
4911wait_for_cmpl:
4888 lpfc_cmd->waitq = &waitq; 4912 lpfc_cmd->waitq = &waitq;
4889 /* Wait for abort to complete */ 4913 /* Wait for abort to complete */
4890 wait_event_timeout(waitq, 4914 wait_event_timeout(waitq,
4891 (lpfc_cmd->pCmd != cmnd), 4915 (lpfc_cmd->pCmd != cmnd),
4892 msecs_to_jiffies(2*vport->cfg_devloss_tmo*1000)); 4916 msecs_to_jiffies(2*vport->cfg_devloss_tmo*1000));
4917
4918 spin_lock_irqsave(shost->host_lock, flags);
4893 lpfc_cmd->waitq = NULL; 4919 lpfc_cmd->waitq = NULL;
4920 spin_unlock_irqrestore(shost->host_lock, flags);
4894 4921
4895 if (lpfc_cmd->pCmd == cmnd) { 4922 if (lpfc_cmd->pCmd == cmnd) {
4896 ret = FAILED; 4923 ret = FAILED;
@@ -5172,8 +5199,9 @@ lpfc_reset_flush_io_context(struct lpfc_vport *vport, uint16_t tgt_id,
5172 5199
5173 cnt = lpfc_sli_sum_iocb(vport, tgt_id, lun_id, context); 5200 cnt = lpfc_sli_sum_iocb(vport, tgt_id, lun_id, context);
5174 if (cnt) 5201 if (cnt)
5175 lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring], 5202 lpfc_sli_abort_taskmgmt(vport,
5176 tgt_id, lun_id, context); 5203 &phba->sli.ring[phba->sli.fcp_ring],
5204 tgt_id, lun_id, context);
5177 later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies; 5205 later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies;
5178 while (time_after(later, jiffies) && cnt) { 5206 while (time_after(later, jiffies) && cnt) {
5179 schedule_timeout_uninterruptible(msecs_to_jiffies(20)); 5207 schedule_timeout_uninterruptible(msecs_to_jiffies(20));
@@ -5491,7 +5519,7 @@ lpfc_slave_alloc(struct scsi_device *sdev)
5491 if (!rport || fc_remote_port_chkready(rport)) 5519 if (!rport || fc_remote_port_chkready(rport))
5492 return -ENXIO; 5520 return -ENXIO;
5493 5521
5494 if (phba->cfg_EnableXLane) { 5522 if (phba->cfg_fof) {
5495 5523
5496 /* 5524 /*
5497 * Check to see if the device data structure for the lun 5525 * Check to see if the device data structure for the lun
@@ -5616,7 +5644,7 @@ lpfc_slave_destroy(struct scsi_device *sdev)
5616 struct lpfc_device_data *device_data = sdev->hostdata; 5644 struct lpfc_device_data *device_data = sdev->hostdata;
5617 5645
5618 atomic_dec(&phba->sdev_cnt); 5646 atomic_dec(&phba->sdev_cnt);
5619 if ((phba->cfg_EnableXLane) && (device_data)) { 5647 if ((phba->cfg_fof) && (device_data)) {
5620 spin_lock_irqsave(&phba->devicelock, flags); 5648 spin_lock_irqsave(&phba->devicelock, flags);
5621 device_data->available = false; 5649 device_data->available = false;
5622 if (!device_data->oas_enabled) 5650 if (!device_data->oas_enabled)
@@ -5655,7 +5683,7 @@ lpfc_create_device_data(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn,
5655 int memory_flags; 5683 int memory_flags;
5656 5684
5657 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || 5685 if (unlikely(!phba) || !vport_wwpn || !target_wwpn ||
5658 !(phba->cfg_EnableXLane)) 5686 !(phba->cfg_fof))
5659 return NULL; 5687 return NULL;
5660 5688
5661 /* Attempt to create the device data to contain lun info */ 5689 /* Attempt to create the device data to contain lun info */
@@ -5693,7 +5721,7 @@ lpfc_delete_device_data(struct lpfc_hba *phba,
5693{ 5721{
5694 5722
5695 if (unlikely(!phba) || !lun_info || 5723 if (unlikely(!phba) || !lun_info ||
5696 !(phba->cfg_EnableXLane)) 5724 !(phba->cfg_fof))
5697 return; 5725 return;
5698 5726
5699 if (!list_empty(&lun_info->listentry)) 5727 if (!list_empty(&lun_info->listentry))
@@ -5727,7 +5755,7 @@ __lpfc_get_device_data(struct lpfc_hba *phba, struct list_head *list,
5727 struct lpfc_device_data *lun_info; 5755 struct lpfc_device_data *lun_info;
5728 5756
5729 if (unlikely(!phba) || !list || !vport_wwpn || !target_wwpn || 5757 if (unlikely(!phba) || !list || !vport_wwpn || !target_wwpn ||
5730 !phba->cfg_EnableXLane) 5758 !phba->cfg_fof)
5731 return NULL; 5759 return NULL;
5732 5760
5733 /* Check to see if the lun is already enabled for OAS. */ 5761 /* Check to see if the lun is already enabled for OAS. */
@@ -5789,7 +5817,7 @@ lpfc_find_next_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn,
5789 !starting_lun || !found_vport_wwpn || 5817 !starting_lun || !found_vport_wwpn ||
5790 !found_target_wwpn || !found_lun || !found_lun_status || 5818 !found_target_wwpn || !found_lun || !found_lun_status ||
5791 (*starting_lun == NO_MORE_OAS_LUN) || 5819 (*starting_lun == NO_MORE_OAS_LUN) ||
5792 !phba->cfg_EnableXLane) 5820 !phba->cfg_fof)
5793 return false; 5821 return false;
5794 5822
5795 lun = *starting_lun; 5823 lun = *starting_lun;
@@ -5873,7 +5901,7 @@ lpfc_enable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn,
5873 unsigned long flags; 5901 unsigned long flags;
5874 5902
5875 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || 5903 if (unlikely(!phba) || !vport_wwpn || !target_wwpn ||
5876 !phba->cfg_EnableXLane) 5904 !phba->cfg_fof)
5877 return false; 5905 return false;
5878 5906
5879 spin_lock_irqsave(&phba->devicelock, flags); 5907 spin_lock_irqsave(&phba->devicelock, flags);
@@ -5930,7 +5958,7 @@ lpfc_disable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn,
5930 unsigned long flags; 5958 unsigned long flags;
5931 5959
5932 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || 5960 if (unlikely(!phba) || !vport_wwpn || !target_wwpn ||
5933 !phba->cfg_EnableXLane) 5961 !phba->cfg_fof)
5934 return false; 5962 return false;
5935 5963
5936 spin_lock_irqsave(&phba->devicelock, flags); 5964 spin_lock_irqsave(&phba->devicelock, flags);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.h b/drivers/scsi/lpfc/lpfc_scsi.h
index 0120bfccf50b..0389ac1e7b83 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 393662c24df5..32ada0505576 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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 *
@@ -3532,14 +3532,27 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
3532 /* Error everything on txq and txcmplq 3532 /* Error everything on txq and txcmplq
3533 * First do the txq. 3533 * First do the txq.
3534 */ 3534 */
3535 spin_lock_irq(&phba->hbalock); 3535 if (phba->sli_rev >= LPFC_SLI_REV4) {
3536 list_splice_init(&pring->txq, &completions); 3536 spin_lock_irq(&pring->ring_lock);
3537 list_splice_init(&pring->txq, &completions);
3538 pring->txq_cnt = 0;
3539 spin_unlock_irq(&pring->ring_lock);
3537 3540
3538 /* Next issue ABTS for everything on the txcmplq */ 3541 spin_lock_irq(&phba->hbalock);
3539 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) 3542 /* Next issue ABTS for everything on the txcmplq */
3540 lpfc_sli_issue_abort_iotag(phba, pring, iocb); 3543 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
3544 lpfc_sli_issue_abort_iotag(phba, pring, iocb);
3545 spin_unlock_irq(&phba->hbalock);
3546 } else {
3547 spin_lock_irq(&phba->hbalock);
3548 list_splice_init(&pring->txq, &completions);
3549 pring->txq_cnt = 0;
3541 3550
3542 spin_unlock_irq(&phba->hbalock); 3551 /* Next issue ABTS for everything on the txcmplq */
3552 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
3553 lpfc_sli_issue_abort_iotag(phba, pring, iocb);
3554 spin_unlock_irq(&phba->hbalock);
3555 }
3543 3556
3544 /* Cancel all the IOCBs from the completions list */ 3557 /* Cancel all the IOCBs from the completions list */
3545 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, 3558 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
@@ -3547,6 +3560,36 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
3547} 3560}
3548 3561
3549/** 3562/**
3563 * lpfc_sli_abort_fcp_rings - Abort all iocbs in all FCP rings
3564 * @phba: Pointer to HBA context object.
3565 * @pring: Pointer to driver SLI ring object.
3566 *
3567 * This function aborts all iocbs in FCP rings and frees all the iocb
3568 * objects in txq. This function issues an abort iocb for all the iocb commands
3569 * in txcmplq. The iocbs in the txcmplq is not guaranteed to complete before
3570 * the return of this function. The caller is not required to hold any locks.
3571 **/
3572void
3573lpfc_sli_abort_fcp_rings(struct lpfc_hba *phba)
3574{
3575 struct lpfc_sli *psli = &phba->sli;
3576 struct lpfc_sli_ring *pring;
3577 uint32_t i;
3578
3579 /* Look on all the FCP Rings for the iotag */
3580 if (phba->sli_rev >= LPFC_SLI_REV4) {
3581 for (i = 0; i < phba->cfg_fcp_io_channel; i++) {
3582 pring = &psli->ring[i + MAX_SLI3_CONFIGURED_RINGS];
3583 lpfc_sli_abort_iocb_ring(phba, pring);
3584 }
3585 } else {
3586 pring = &psli->ring[psli->fcp_ring];
3587 lpfc_sli_abort_iocb_ring(phba, pring);
3588 }
3589}
3590
3591
3592/**
3550 * lpfc_sli_flush_fcp_rings - flush all iocbs in the fcp ring 3593 * lpfc_sli_flush_fcp_rings - flush all iocbs in the fcp ring
3551 * @phba: Pointer to HBA context object. 3594 * @phba: Pointer to HBA context object.
3552 * 3595 *
@@ -3563,28 +3606,55 @@ lpfc_sli_flush_fcp_rings(struct lpfc_hba *phba)
3563 LIST_HEAD(txcmplq); 3606 LIST_HEAD(txcmplq);
3564 struct lpfc_sli *psli = &phba->sli; 3607 struct lpfc_sli *psli = &phba->sli;
3565 struct lpfc_sli_ring *pring; 3608 struct lpfc_sli_ring *pring;
3566 3609 uint32_t i;
3567 /* Currently, only one fcp ring */
3568 pring = &psli->ring[psli->fcp_ring];
3569 3610
3570 spin_lock_irq(&phba->hbalock); 3611 spin_lock_irq(&phba->hbalock);
3571 /* Retrieve everything on txq */
3572 list_splice_init(&pring->txq, &txq);
3573
3574 /* Retrieve everything on the txcmplq */
3575 list_splice_init(&pring->txcmplq, &txcmplq);
3576
3577 /* Indicate the I/O queues are flushed */ 3612 /* Indicate the I/O queues are flushed */
3578 phba->hba_flag |= HBA_FCP_IOQ_FLUSH; 3613 phba->hba_flag |= HBA_FCP_IOQ_FLUSH;
3579 spin_unlock_irq(&phba->hbalock); 3614 spin_unlock_irq(&phba->hbalock);
3580 3615
3581 /* Flush the txq */ 3616 /* Look on all the FCP Rings for the iotag */
3582 lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT, 3617 if (phba->sli_rev >= LPFC_SLI_REV4) {
3583 IOERR_SLI_DOWN); 3618 for (i = 0; i < phba->cfg_fcp_io_channel; i++) {
3619 pring = &psli->ring[i + MAX_SLI3_CONFIGURED_RINGS];
3620
3621 spin_lock_irq(&pring->ring_lock);
3622 /* Retrieve everything on txq */
3623 list_splice_init(&pring->txq, &txq);
3624 /* Retrieve everything on the txcmplq */
3625 list_splice_init(&pring->txcmplq, &txcmplq);
3626 pring->txq_cnt = 0;
3627 pring->txcmplq_cnt = 0;
3628 spin_unlock_irq(&pring->ring_lock);
3629
3630 /* Flush the txq */
3631 lpfc_sli_cancel_iocbs(phba, &txq,
3632 IOSTAT_LOCAL_REJECT,
3633 IOERR_SLI_DOWN);
3634 /* Flush the txcmpq */
3635 lpfc_sli_cancel_iocbs(phba, &txcmplq,
3636 IOSTAT_LOCAL_REJECT,
3637 IOERR_SLI_DOWN);
3638 }
3639 } else {
3640 pring = &psli->ring[psli->fcp_ring];
3584 3641
3585 /* Flush the txcmpq */ 3642 spin_lock_irq(&phba->hbalock);
3586 lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT, 3643 /* Retrieve everything on txq */
3587 IOERR_SLI_DOWN); 3644 list_splice_init(&pring->txq, &txq);
3645 /* Retrieve everything on the txcmplq */
3646 list_splice_init(&pring->txcmplq, &txcmplq);
3647 pring->txq_cnt = 0;
3648 pring->txcmplq_cnt = 0;
3649 spin_unlock_irq(&phba->hbalock);
3650
3651 /* Flush the txq */
3652 lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT,
3653 IOERR_SLI_DOWN);
3654 /* Flush the txcmpq */
3655 lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT,
3656 IOERR_SLI_DOWN);
3657 }
3588} 3658}
3589 3659
3590/** 3660/**
@@ -3987,12 +4057,13 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba)
3987{ 4057{
3988 struct lpfc_sli *psli = &phba->sli; 4058 struct lpfc_sli *psli = &phba->sli;
3989 uint16_t cfg_value; 4059 uint16_t cfg_value;
3990 int rc; 4060 int rc = 0;
3991 4061
3992 /* Reset HBA */ 4062 /* Reset HBA */
3993 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 4063 lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
3994 "0295 Reset HBA Data: x%x x%x\n", 4064 "0295 Reset HBA Data: x%x x%x x%x\n",
3995 phba->pport->port_state, psli->sli_flag); 4065 phba->pport->port_state, psli->sli_flag,
4066 phba->hba_flag);
3996 4067
3997 /* perform board reset */ 4068 /* perform board reset */
3998 phba->fc_eventTag = 0; 4069 phba->fc_eventTag = 0;
@@ -4005,6 +4076,12 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba)
4005 phba->fcf.fcf_flag = 0; 4076 phba->fcf.fcf_flag = 0;
4006 spin_unlock_irq(&phba->hbalock); 4077 spin_unlock_irq(&phba->hbalock);
4007 4078
4079 /* SLI4 INTF 2: if FW dump is being taken skip INIT_PORT */
4080 if (phba->hba_flag & HBA_FW_DUMP_OP) {
4081 phba->hba_flag &= ~HBA_FW_DUMP_OP;
4082 return rc;
4083 }
4084
4008 /* Now physically reset the device */ 4085 /* Now physically reset the device */
4009 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 4086 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
4010 "0389 Performing PCI function reset!\n"); 4087 "0389 Performing PCI function reset!\n");
@@ -5002,7 +5079,7 @@ lpfc_sli4_arm_cqeq_intr(struct lpfc_hba *phba)
5002 } while (++fcp_eqidx < phba->cfg_fcp_io_channel); 5079 } while (++fcp_eqidx < phba->cfg_fcp_io_channel);
5003 } 5080 }
5004 5081
5005 if (phba->cfg_EnableXLane) 5082 if (phba->cfg_fof)
5006 lpfc_sli4_cq_release(phba->sli4_hba.oas_cq, LPFC_QUEUE_REARM); 5083 lpfc_sli4_cq_release(phba->sli4_hba.oas_cq, LPFC_QUEUE_REARM);
5007 5084
5008 if (phba->sli4_hba.hba_eq) { 5085 if (phba->sli4_hba.hba_eq) {
@@ -6722,7 +6799,6 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
6722 LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active; 6799 LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active;
6723 MAILBOX_t *mb = &pmbox->u.mb; 6800 MAILBOX_t *mb = &pmbox->u.mb;
6724 struct lpfc_sli *psli = &phba->sli; 6801 struct lpfc_sli *psli = &phba->sli;
6725 struct lpfc_sli_ring *pring;
6726 6802
6727 /* If the mailbox completed, process the completion and return */ 6803 /* If the mailbox completed, process the completion and return */
6728 if (lpfc_sli4_process_missed_mbox_completions(phba)) 6804 if (lpfc_sli4_process_missed_mbox_completions(phba))
@@ -6764,8 +6840,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
6764 psli->sli_flag &= ~LPFC_SLI_ACTIVE; 6840 psli->sli_flag &= ~LPFC_SLI_ACTIVE;
6765 spin_unlock_irq(&phba->hbalock); 6841 spin_unlock_irq(&phba->hbalock);
6766 6842
6767 pring = &psli->ring[psli->fcp_ring]; 6843 lpfc_sli_abort_fcp_rings(phba);
6768 lpfc_sli_abort_iocb_ring(phba, pring);
6769 6844
6770 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 6845 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
6771 "0345 Resetting board due to mailbox timeout\n"); 6846 "0345 Resetting board due to mailbox timeout\n");
@@ -8133,6 +8208,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
8133 abort_tag = (uint32_t) iocbq->iotag; 8208 abort_tag = (uint32_t) iocbq->iotag;
8134 xritag = iocbq->sli4_xritag; 8209 xritag = iocbq->sli4_xritag;
8135 wqe->generic.wqe_com.word7 = 0; /* The ct field has moved so reset */ 8210 wqe->generic.wqe_com.word7 = 0; /* The ct field has moved so reset */
8211 wqe->generic.wqe_com.word10 = 0;
8136 /* words0-2 bpl convert bde */ 8212 /* words0-2 bpl convert bde */
8137 if (iocbq->iocb.un.genreq64.bdl.bdeFlags == BUFF_TYPE_BLP_64) { 8213 if (iocbq->iocb.un.genreq64.bdl.bdeFlags == BUFF_TYPE_BLP_64) {
8138 numBdes = iocbq->iocb.un.genreq64.bdl.bdeSize / 8214 numBdes = iocbq->iocb.un.genreq64.bdl.bdeSize /
@@ -8639,8 +8715,7 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, uint32_t ring_number,
8639 8715
8640 if ((piocb->iocb_flag & LPFC_IO_FCP) || 8716 if ((piocb->iocb_flag & LPFC_IO_FCP) ||
8641 (piocb->iocb_flag & LPFC_USE_FCPWQIDX)) { 8717 (piocb->iocb_flag & LPFC_USE_FCPWQIDX)) {
8642 if (!phba->cfg_EnableXLane || (!(piocb->iocb_flag & 8718 if (!phba->cfg_fof || (!(piocb->iocb_flag & LPFC_IO_OAS))) {
8643 LPFC_IO_OAS))) {
8644 wq = phba->sli4_hba.fcp_wq[piocb->fcp_wqidx]; 8719 wq = phba->sli4_hba.fcp_wq[piocb->fcp_wqidx];
8645 } else { 8720 } else {
8646 wq = phba->sli4_hba.oas_wq; 8721 wq = phba->sli4_hba.oas_wq;
@@ -8735,7 +8810,7 @@ lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number,
8735 8810
8736 if (phba->sli_rev == LPFC_SLI_REV4) { 8811 if (phba->sli_rev == LPFC_SLI_REV4) {
8737 if (piocb->iocb_flag & LPFC_IO_FCP) { 8812 if (piocb->iocb_flag & LPFC_IO_FCP) {
8738 if (!phba->cfg_EnableXLane || (!(piocb->iocb_flag & 8813 if (!phba->cfg_fof || (!(piocb->iocb_flag &
8739 LPFC_IO_OAS))) { 8814 LPFC_IO_OAS))) {
8740 if (unlikely(!phba->sli4_hba.fcp_wq)) 8815 if (unlikely(!phba->sli4_hba.fcp_wq))
8741 return IOCB_ERROR; 8816 return IOCB_ERROR;
@@ -9170,6 +9245,7 @@ lpfc_sli_queue_setup(struct lpfc_hba *phba)
9170 pring->sli.sli3.next_cmdidx = 0; 9245 pring->sli.sli3.next_cmdidx = 0;
9171 pring->sli.sli3.local_getidx = 0; 9246 pring->sli.sli3.local_getidx = 0;
9172 pring->sli.sli3.cmdidx = 0; 9247 pring->sli.sli3.cmdidx = 0;
9248 pring->flag = 0;
9173 INIT_LIST_HEAD(&pring->txq); 9249 INIT_LIST_HEAD(&pring->txq);
9174 INIT_LIST_HEAD(&pring->txcmplq); 9250 INIT_LIST_HEAD(&pring->txcmplq);
9175 INIT_LIST_HEAD(&pring->iocb_continueq); 9251 INIT_LIST_HEAD(&pring->iocb_continueq);
@@ -9805,43 +9881,6 @@ abort_iotag_exit:
9805} 9881}
9806 9882
9807/** 9883/**
9808 * lpfc_sli_iocb_ring_abort - Unconditionally abort all iocbs on an iocb ring
9809 * @phba: Pointer to HBA context object.
9810 * @pring: Pointer to driver SLI ring object.
9811 *
9812 * This function aborts all iocbs in the given ring and frees all the iocb
9813 * objects in txq. This function issues abort iocbs unconditionally for all
9814 * the iocb commands in txcmplq. The iocbs in the txcmplq is not guaranteed
9815 * to complete before the return of this function. The caller is not required
9816 * to hold any locks.
9817 **/
9818static void
9819lpfc_sli_iocb_ring_abort(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
9820{
9821 LIST_HEAD(completions);
9822 struct lpfc_iocbq *iocb, *next_iocb;
9823
9824 if (pring->ringno == LPFC_ELS_RING)
9825 lpfc_fabric_abort_hba(phba);
9826
9827 spin_lock_irq(&phba->hbalock);
9828
9829 /* Take off all the iocbs on txq for cancelling */
9830 list_splice_init(&pring->txq, &completions);
9831 pring->txq_cnt = 0;
9832
9833 /* Next issue ABTS for everything on the txcmplq */
9834 list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
9835 lpfc_sli_abort_iotag_issue(phba, pring, iocb);
9836
9837 spin_unlock_irq(&phba->hbalock);
9838
9839 /* Cancel all the IOCBs from the completions list */
9840 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
9841 IOERR_SLI_ABORTED);
9842}
9843
9844/**
9845 * lpfc_sli_hba_iocb_abort - Abort all iocbs to an hba. 9884 * lpfc_sli_hba_iocb_abort - Abort all iocbs to an hba.
9846 * @phba: pointer to lpfc HBA data structure. 9885 * @phba: pointer to lpfc HBA data structure.
9847 * 9886 *
@@ -9856,7 +9895,7 @@ lpfc_sli_hba_iocb_abort(struct lpfc_hba *phba)
9856 9895
9857 for (i = 0; i < psli->num_rings; i++) { 9896 for (i = 0; i < psli->num_rings; i++) {
9858 pring = &psli->ring[i]; 9897 pring = &psli->ring[i];
9859 lpfc_sli_iocb_ring_abort(phba, pring); 9898 lpfc_sli_abort_iocb_ring(phba, pring);
9860 } 9899 }
9861} 9900}
9862 9901
@@ -10081,6 +10120,124 @@ lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring,
10081} 10120}
10082 10121
10083/** 10122/**
10123 * lpfc_sli_abort_taskmgmt - issue abort for all commands on a host/target/LUN
10124 * @vport: Pointer to virtual port.
10125 * @pring: Pointer to driver SLI ring object.
10126 * @tgt_id: SCSI ID of the target.
10127 * @lun_id: LUN ID of the scsi device.
10128 * @taskmgmt_cmd: LPFC_CTX_LUN/LPFC_CTX_TGT/LPFC_CTX_HOST.
10129 *
10130 * This function sends an abort command for every SCSI command
10131 * associated with the given virtual port pending on the ring
10132 * filtered by lpfc_sli_validate_fcp_iocb function.
10133 * When taskmgmt_cmd == LPFC_CTX_LUN, the function sends abort only to the
10134 * FCP iocbs associated with lun specified by tgt_id and lun_id
10135 * parameters
10136 * When taskmgmt_cmd == LPFC_CTX_TGT, the function sends abort only to the
10137 * FCP iocbs associated with SCSI target specified by tgt_id parameter.
10138 * When taskmgmt_cmd == LPFC_CTX_HOST, the function sends abort to all
10139 * FCP iocbs associated with virtual port.
10140 * This function returns number of iocbs it aborted .
10141 * This function is called with no locks held right after a taskmgmt
10142 * command is sent.
10143 **/
10144int
10145lpfc_sli_abort_taskmgmt(struct lpfc_vport *vport, struct lpfc_sli_ring *pring,
10146 uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd cmd)
10147{
10148 struct lpfc_hba *phba = vport->phba;
10149 struct lpfc_iocbq *abtsiocbq;
10150 struct lpfc_iocbq *iocbq;
10151 IOCB_t *icmd;
10152 int sum, i, ret_val;
10153 unsigned long iflags;
10154 struct lpfc_sli_ring *pring_s4;
10155 uint32_t ring_number;
10156
10157 spin_lock_irq(&phba->hbalock);
10158
10159 /* all I/Os are in process of being flushed */
10160 if (phba->hba_flag & HBA_FCP_IOQ_FLUSH) {
10161 spin_unlock_irq(&phba->hbalock);
10162 return 0;
10163 }
10164 sum = 0;
10165
10166 for (i = 1; i <= phba->sli.last_iotag; i++) {
10167 iocbq = phba->sli.iocbq_lookup[i];
10168
10169 if (lpfc_sli_validate_fcp_iocb(iocbq, vport, tgt_id, lun_id,
10170 cmd) != 0)
10171 continue;
10172
10173 /*
10174 * If the iocbq is already being aborted, don't take a second
10175 * action, but do count it.
10176 */
10177 if (iocbq->iocb_flag & LPFC_DRIVER_ABORTED)
10178 continue;
10179
10180 /* issue ABTS for this IOCB based on iotag */
10181 abtsiocbq = __lpfc_sli_get_iocbq(phba);
10182 if (abtsiocbq == NULL)
10183 continue;
10184
10185 icmd = &iocbq->iocb;
10186 abtsiocbq->iocb.un.acxri.abortType = ABORT_TYPE_ABTS;
10187 abtsiocbq->iocb.un.acxri.abortContextTag = icmd->ulpContext;
10188 if (phba->sli_rev == LPFC_SLI_REV4)
10189 abtsiocbq->iocb.un.acxri.abortIoTag =
10190 iocbq->sli4_xritag;
10191 else
10192 abtsiocbq->iocb.un.acxri.abortIoTag = icmd->ulpIoTag;
10193 abtsiocbq->iocb.ulpLe = 1;
10194 abtsiocbq->iocb.ulpClass = icmd->ulpClass;
10195 abtsiocbq->vport = vport;
10196
10197 /* ABTS WQE must go to the same WQ as the WQE to be aborted */
10198 abtsiocbq->fcp_wqidx = iocbq->fcp_wqidx;
10199 if (iocbq->iocb_flag & LPFC_IO_FCP)
10200 abtsiocbq->iocb_flag |= LPFC_USE_FCPWQIDX;
10201
10202 if (lpfc_is_link_up(phba))
10203 abtsiocbq->iocb.ulpCommand = CMD_ABORT_XRI_CN;
10204 else
10205 abtsiocbq->iocb.ulpCommand = CMD_CLOSE_XRI_CN;
10206
10207 /* Setup callback routine and issue the command. */
10208 abtsiocbq->iocb_cmpl = lpfc_sli_abort_fcp_cmpl;
10209
10210 /*
10211 * Indicate the IO is being aborted by the driver and set
10212 * the caller's flag into the aborted IO.
10213 */
10214 iocbq->iocb_flag |= LPFC_DRIVER_ABORTED;
10215
10216 if (phba->sli_rev == LPFC_SLI_REV4) {
10217 ring_number = MAX_SLI3_CONFIGURED_RINGS +
10218 iocbq->fcp_wqidx;
10219 pring_s4 = &phba->sli.ring[ring_number];
10220 /* Note: both hbalock and ring_lock must be set here */
10221 spin_lock_irqsave(&pring_s4->ring_lock, iflags);
10222 ret_val = __lpfc_sli_issue_iocb(phba, pring_s4->ringno,
10223 abtsiocbq, 0);
10224 spin_unlock_irqrestore(&pring_s4->ring_lock, iflags);
10225 } else {
10226 ret_val = __lpfc_sli_issue_iocb(phba, pring->ringno,
10227 abtsiocbq, 0);
10228 }
10229
10230
10231 if (ret_val == IOCB_ERROR)
10232 __lpfc_sli_release_iocbq(phba, abtsiocbq);
10233 else
10234 sum++;
10235 }
10236 spin_unlock_irq(&phba->hbalock);
10237 return sum;
10238}
10239
10240/**
10084 * lpfc_sli_wake_iocb_wait - lpfc_sli_issue_iocb_wait's completion handler 10241 * lpfc_sli_wake_iocb_wait - lpfc_sli_issue_iocb_wait's completion handler
10085 * @phba: Pointer to HBA context object. 10242 * @phba: Pointer to HBA context object.
10086 * @cmdiocbq: Pointer to command iocb. 10243 * @cmdiocbq: Pointer to command iocb.
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
index 6f04080f4ea8..edb48832c39b 100644
--- a/drivers/scsi/lpfc/lpfc_sli.h
+++ b/drivers/scsi/lpfc/lpfc_sli.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index 9b8cda866176..7f50aa04d66a 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2009-2014 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_version.h b/drivers/scsi/lpfc/lpfc_version.h
index e32cbec70324..41675c1193e7 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-2013 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2014 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.45" 21#define LPFC_DRIVER_VERSION "10.2.8001.0."
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-2013 Emulex. All rights reserved." 33#define LPFC_COPYRIGHT "Copyright(c) 2004-2014 Emulex. All rights reserved."
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 1fa010448666..de5d0ae19d83 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1648,16 +1648,16 @@ typedef struct {
1648 */ 1648 */
1649struct crc_context { 1649struct crc_context {
1650 uint32_t handle; /* System handle. */ 1650 uint32_t handle; /* System handle. */
1651 uint32_t ref_tag; 1651 __le32 ref_tag;
1652 uint16_t app_tag; 1652 __le16 app_tag;
1653 uint8_t ref_tag_mask[4]; /* Validation/Replacement Mask*/ 1653 uint8_t ref_tag_mask[4]; /* Validation/Replacement Mask*/
1654 uint8_t app_tag_mask[2]; /* Validation/Replacement Mask*/ 1654 uint8_t app_tag_mask[2]; /* Validation/Replacement Mask*/
1655 uint16_t guard_seed; /* Initial Guard Seed */ 1655 __le16 guard_seed; /* Initial Guard Seed */
1656 uint16_t prot_opts; /* Requested Data Protection Mode */ 1656 __le16 prot_opts; /* Requested Data Protection Mode */
1657 uint16_t blk_size; /* Data size in bytes */ 1657 __le16 blk_size; /* Data size in bytes */
1658 uint16_t runt_blk_guard; /* Guard value for runt block (tape 1658 uint16_t runt_blk_guard; /* Guard value for runt block (tape
1659 * only) */ 1659 * only) */
1660 uint32_t byte_count; /* Total byte count/ total data 1660 __le32 byte_count; /* Total byte count/ total data
1661 * transfer count */ 1661 * transfer count */
1662 union { 1662 union {
1663 struct { 1663 struct {
@@ -1671,10 +1671,10 @@ struct crc_context {
1671 uint32_t reserved_6; 1671 uint32_t reserved_6;
1672 } nobundling; 1672 } nobundling;
1673 struct { 1673 struct {
1674 uint32_t dif_byte_count; /* Total DIF byte 1674 __le32 dif_byte_count; /* Total DIF byte
1675 * count */ 1675 * count */
1676 uint16_t reserved_1; 1676 uint16_t reserved_1;
1677 uint16_t dseg_count; /* Data segment count */ 1677 __le16 dseg_count; /* Data segment count */
1678 uint32_t reserved_2; 1678 uint32_t reserved_2;
1679 uint32_t data_address[2]; 1679 uint32_t data_address[2];
1680 uint32_t data_length; 1680 uint32_t data_length;
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 8d85ed8d8917..4b188b0164e9 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1996,7 +1996,7 @@ qlt_set_t10dif_tags(struct se_cmd *se_cmd, struct crc_context *ctx)
1996 * have been immplemented by TCM, before AppTag is avail. 1996 * have been immplemented by TCM, before AppTag is avail.
1997 * Look for modesense_handlers[] 1997 * Look for modesense_handlers[]
1998 */ 1998 */
1999 ctx->app_tag = __constant_cpu_to_le16(0); 1999 ctx->app_tag = 0;
2000 ctx->app_tag_mask[0] = 0x0; 2000 ctx->app_tag_mask[0] = 0x0;
2001 ctx->app_tag_mask[1] = 0x0; 2001 ctx->app_tag_mask[1] = 0x0;
2002 2002
@@ -2078,6 +2078,7 @@ qlt_build_ctio_crc2_pkt(struct qla_tgt_prm *prm, scsi_qla_host_t *vha)
2078 struct se_cmd *se_cmd = &cmd->se_cmd; 2078 struct se_cmd *se_cmd = &cmd->se_cmd;
2079 uint32_t h; 2079 uint32_t h;
2080 struct atio_from_isp *atio = &prm->cmd->atio; 2080 struct atio_from_isp *atio = &prm->cmd->atio;
2081 uint16_t t16;
2081 2082
2082 sgc = 0; 2083 sgc = 0;
2083 ha = vha->hw; 2084 ha = vha->hw;
@@ -2174,8 +2175,13 @@ qlt_build_ctio_crc2_pkt(struct qla_tgt_prm *prm, scsi_qla_host_t *vha)
2174 pkt->initiator_id[1] = atio->u.isp24.fcp_hdr.s_id[1]; 2175 pkt->initiator_id[1] = atio->u.isp24.fcp_hdr.s_id[1];
2175 pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0]; 2176 pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0];
2176 pkt->exchange_addr = atio->u.isp24.exchange_addr; 2177 pkt->exchange_addr = atio->u.isp24.exchange_addr;
2177 pkt->ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); 2178
2178 pkt->flags |= (atio->u.isp24.attr << 9); 2179 /* silence compile warning */
2180 t16 = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id);
2181 pkt->ox_id = cpu_to_le16(t16);
2182
2183 t16 = (atio->u.isp24.attr << 9);
2184 pkt->flags |= cpu_to_le16(t16);
2179 pkt->relative_offset = cpu_to_le32(prm->cmd->offset); 2185 pkt->relative_offset = cpu_to_le32(prm->cmd->offset);
2180 2186
2181 /* Set transfer direction */ 2187 /* Set transfer direction */
@@ -2250,8 +2256,7 @@ qlt_build_ctio_crc2_pkt(struct qla_tgt_prm *prm, scsi_qla_host_t *vha)
2250 2256
2251 if (bundling && prm->prot_seg_cnt) { 2257 if (bundling && prm->prot_seg_cnt) {
2252 /* Walks dif segments */ 2258 /* Walks dif segments */
2253 pkt->add_flags |= 2259 pkt->add_flags |= CTIO_CRC2_AF_DIF_DSD_ENA;
2254 __constant_cpu_to_le16(CTIO_CRC2_AF_DIF_DSD_ENA);
2255 2260
2256 cur_dsd = (uint32_t *) &crc_ctx_pkt->u.bundling.dif_address; 2261 cur_dsd = (uint32_t *) &crc_ctx_pkt->u.bundling.dif_address;
2257 if (qla24xx_walk_and_build_prot_sglist(ha, NULL, cur_dsd, 2262 if (qla24xx_walk_and_build_prot_sglist(ha, NULL, cur_dsd,
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index 5c9f185a8ebd..e0a58fd13f66 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -316,7 +316,7 @@ struct fcp_hdr {
316 uint8_t seq_id; 316 uint8_t seq_id;
317 uint8_t df_ctl; 317 uint8_t df_ctl;
318 uint16_t seq_cnt; 318 uint16_t seq_cnt;
319 uint16_t ox_id; 319 __be16 ox_id;
320 uint16_t rx_id; 320 uint16_t rx_id;
321 uint32_t parameter; 321 uint32_t parameter;
322} __packed; 322} __packed;
@@ -441,7 +441,7 @@ struct ctio7_to_24xx {
441 union { 441 union {
442 struct { 442 struct {
443 uint16_t reserved1; 443 uint16_t reserved1;
444 uint16_t flags; 444 __le16 flags;
445 uint32_t residual; 445 uint32_t residual;
446 uint16_t ox_id; 446 uint16_t ox_id;
447 uint16_t scsi_status; 447 uint16_t scsi_status;
@@ -527,7 +527,7 @@ struct ctio_crc2_to_fw {
527 527
528 uint32_t handle; /* System handle. */ 528 uint32_t handle; /* System handle. */
529 uint16_t nport_handle; /* N_PORT handle. */ 529 uint16_t nport_handle; /* N_PORT handle. */
530 uint16_t timeout; /* Command timeout. */ 530 __le16 timeout; /* Command timeout. */
531 531
532 uint16_t dseg_count; /* Data segment count. */ 532 uint16_t dseg_count; /* Data segment count. */
533 uint8_t vp_index; 533 uint8_t vp_index;
@@ -538,15 +538,15 @@ struct ctio_crc2_to_fw {
538 uint8_t reserved1; 538 uint8_t reserved1;
539 uint32_t exchange_addr; /* rcv exchange address */ 539 uint32_t exchange_addr; /* rcv exchange address */
540 uint16_t reserved2; 540 uint16_t reserved2;
541 uint16_t flags; /* refer to CTIO7 flags values */ 541 __le16 flags; /* refer to CTIO7 flags values */
542 uint32_t residual; 542 uint32_t residual;
543 uint16_t ox_id; 543 __le16 ox_id;
544 uint16_t scsi_status; 544 uint16_t scsi_status;
545 uint32_t relative_offset; 545 __le32 relative_offset;
546 uint32_t reserved5; 546 uint32_t reserved5;
547 uint32_t transfer_length; /* total fc transfer length */ 547 __le32 transfer_length; /* total fc transfer length */
548 uint32_t reserved6; 548 uint32_t reserved6;
549 uint32_t crc_context_address[2];/* Data segment address. */ 549 __le32 crc_context_address[2];/* Data segment address. */
550 uint16_t crc_context_len; /* Data segment length. */ 550 uint16_t crc_context_len; /* Data segment length. */
551 uint16_t reserved_1; /* MUST be set to 0. */ 551 uint16_t reserved_1; /* MUST be set to 0. */
552} __packed; 552} __packed;