pandora-kernel.git
13 years ago[SCSI] fix medium error problems with some arrays which can cause data corruption
James Bottomley [Fri, 17 Dec 2010 20:36:34 +0000 (15:36 -0500)]
[SCSI] fix medium error problems with some arrays which can cause data corruption

Our current handling of medium error assumes that data is returned up
to the bad sector.  This assumption holds good for all disk devices,
all DIF arrays and most ordinary arrays.  However, an LSI array engine
was recently discovered which reports a medium error without returning
any data.  This means that when we report good data up to the medium
error, we've reported junk originally in the buffer as good.  Worse,
if the read consists of requested data plus a readahead, and the error
occurs in readahead, we'll just strip off the readahead and report
junk up to userspace as good data with no error.

The fix for this is to have the error position computation take into
account the amount of data returned by the driver using the scsi
residual data.  Unfortunately, not every driver fills in this data,
but for those who don't, it's set to zero, which means we'll think a
full set of data was transferred and the behaviour will be identical
to the prior behaviour of the code (believe the buffer up to the error
sector).  All modern drivers seem to set the residual, so that should
fix up the LSI failure/corruption case.

Reported-by: Douglas Gilbert <dgilbert@interlog.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] Add missing SPC-4 CDB and MAINTENANCE_[IN,OUT] service action definitions
Nicholas Bellinger [Fri, 17 Dec 2010 21:11:16 +0000 (13:11 -0800)]
[SCSI] Add missing SPC-4 CDB and MAINTENANCE_[IN,OUT] service action definitions

This patch adds a handful of missing CDBs defs that are used by TCM
persistent reservation logic in the SPC-4 defined CDB exclusion table for
registrations and reservations.

This includes a number of missing MI_* and MO_* prefixed service actions defs
for MAINTENANCE_IN and MAINTENANCE_OUT that are mentioned wrt to persistent
registration and reservation status for the SCSI Initiator Port.

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] megaraid_sas: Update GPL headers.
adam radford [Wed, 15 Dec 2010 02:51:48 +0000 (18:51 -0800)]
[SCSI] megaraid_sas: Update GPL headers.

This patch updates the GPL headers in megaraid_sas_base.c and megaraid_sas.h.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] megaraid_sas: Rename megaraid_sas.c to megaraid_sas_base.c
adam radford [Wed, 15 Dec 2010 03:17:17 +0000 (19:17 -0800)]
[SCSI] megaraid_sas: Rename megaraid_sas.c to megaraid_sas_base.c

This patch renames megaraid_sas.c to megaraid_sas_base.c to facilitate
other files in the compile.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] fix the return value of scsi_target_queue_read()
Hillf Danton [Thu, 16 Dec 2010 20:26:37 +0000 (14:26 -0600)]
[SCSI] fix the return value of scsi_target_queue_read()

It seems that zero should be returned if scsi_target_is_busy(starget) is
true, no matter if sdev is on the starved list.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] scsi_dh: propagate SCSI device deletion
Menny Hamburger [Thu, 16 Dec 2010 19:57:07 +0000 (14:57 -0500)]
[SCSI] scsi_dh: propagate SCSI device deletion

Currently, when scsi_dh_activate() returns with an error
(e.g. SCSI_DH_NOSYS) the activate_complete callback is not called and
the error is not propagated to DM mpath.

When a SCSI device attached to a device handler is deleted, userland
processes currently performing I/O on the device will have their I/O
hang forever.

- Set SCSI_DH_NOSYS error when the handler is in the process of being
  deleted (e.g. the SCSI device is in a SDEV_CANCEL or SDEV_DEL state).

- Set SCSI_DH_DEV_OFFLINED error when device is in SDEV_OFFLINE state.

- Call the activate_complete callback function directly from
  scsi_dh_activate if an error has been set (when either the scsi_dh
  internal data has already been deleted or is in the process of being
  deleted).

The patch was tested in an iSCSI environment, RDAC H/W handler and
multipath.  In the following reproduction process, dd will I/O hang
forever and the only way to release it will be to reboot the machine:
1) Perform I/O on a multipath device:
    dd if=/dev/dm-0 of=/dev/zero bs=8k count=1000000 &
2) Delete all slave SCSI devices contained in the mpath device:
   I)  In an iSCSI environment, the easiest way to do this is by
   stopping iSCSI:
       /etc/init.d/iscsi stop
   II) Another way to delete the devices is by applying the following
   bash scriptlet:
       dm_devs=$(ls /sys/block/ | grep dm- | xargs)
       for dm_dev in $dm_devs; do
         devices=$(ls /sys/block/$dm_dev/slaves)
         for device in $devices; do
            echo 1 > /sys/block/$device/device/delete
         done
       done

NOTE: when DM mpath's fail_path uses blk_abort_queue this scsi_dh change
isn't strictly required.  However, DM mpath's call to blk_abort_queue
will soon be reverted because it has proven to be unsafe due to a race
(between blk_abort_queue and scsi_request_fn) that can lead to list
corruption.  Therefore we cannot rely on blk_abort_queue via fail_path,
but even if we could this scsi_dh change is still preferrable.

Signed-off-by: Menny Hamburger <Menny_Hamburger@Dell.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Babu Moger <babu.moger@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] hpsa: do not consider RAID level to be part of device identity
Stephen M. Cameron [Thu, 16 Dec 2010 19:01:03 +0000 (13:01 -0600)]
[SCSI] hpsa: do not consider RAID level to be part of device identity

Otherwise, after doing a RAID level migration, the disk will be
disruptively removed and re-added as a different disk on rescan.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] hpsa: do not consider firmware revision when looking for device changes.
Stephen M. Cameron [Thu, 16 Dec 2010 19:00:58 +0000 (13:00 -0600)]
[SCSI] hpsa: do not consider firmware revision when looking for device changes.

The firmware may have been updated, in which case, it's the same device,
and in that case, we do not want to remove and add the device, we want to
let it continue as is.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] lpfc 8.3.20: Update lpfc driver version to 8.3.20
James Smart [Wed, 15 Dec 2010 22:58:20 +0000 (17:58 -0500)]
[SCSI] lpfc 8.3.20: Update lpfc driver version to 8.3.20

Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] lpfc 8.3.20: Updates to FC discovery commands
James Smart [Wed, 15 Dec 2010 22:58:10 +0000 (17:58 -0500)]
[SCSI] lpfc 8.3.20: Updates to FC discovery commands

Updated commands used for ELS to utilize VPI
Allocate RPI at node creation time and pass in ELS commnads.

Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] lpfc 8.3.20: Implement new SLI4 init procedures based on if_type
James Smart [Wed, 15 Dec 2010 22:57:46 +0000 (17:57 -0500)]
[SCSI] lpfc 8.3.20: Implement new SLI4 init procedures based on if_type

Implement new SLI4 init procedures based on if_type:

- Add structure changes for new SLIPORT registers and BAR changes.
- Update register names to be consistent with inteface spec terms.
- Added union to encapsulate Hardward error registers.
- Rework lpfc_sli4_post_status_check() around SLI-4's SLI_INTF type
- Removed the lpfc_sli4_fw_cfg_check routine
- Segmented driver logic to include evaluation of the if_type to
  engage different behaviors.

Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] lpfc 8.3.20: Implement the FC and SLI async event handlers
James Smart [Wed, 15 Dec 2010 22:57:33 +0000 (17:57 -0500)]
[SCSI] lpfc 8.3.20: Implement the FC and SLI async event handlers

Implement the FC and SLI async event handlers:

- Updated MQ_CREATE_EXT mailbox structure to include fc and SLI async events.
- Added the SLI trailer code.
- Split physical field into type and number to reflect latest SLI spec.
- Changed lpfc_acqe_fcoe to lpfc_acqe_fip to reflect latest Spec changes.
- Added lpfc_acqe_fc_la structure for FC link attention async events.
- Added lpfc_acqe_sli structure for sli async events.
- Added lpfc_sli4_async_fc_evt routine to handle fc la async events.
- Added lpfc_sli4_async_sli routine to handle sli async events.
- Moved LPFC_TRAILER_CODE_FC to be handled by its own handler function.

Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] lpfc 8.3.20: Critical fixes
James Smart [Wed, 15 Dec 2010 22:57:20 +0000 (17:57 -0500)]
[SCSI] lpfc 8.3.20: Critical fixes

- Use for iocbq->context1 to hold the ndlp pointer.
- Set ndlp in all iocbs generated from ioctl functions.
- Turn parity and serr bits back on after performing sli4 board reset.

Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: Update the driver version to 2.3.2.3
Krishna Gudipati [Tue, 14 Dec 2010 00:23:51 +0000 (16:23 -0800)]
[SCSI] bfa: Update the driver version to 2.3.2.3

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: io tag handling and minor bug fix.
Krishna Gudipati [Tue, 14 Dec 2010 00:23:27 +0000 (16:23 -0800)]
[SCSI] bfa: io tag handling and minor bug fix.

Fix iotag handling:

1) Update and check io tag for retry case.
2) Clearing upper 3 bits in io tag when an IO completes.
   The 3 upper bits in io tags are used for counting FCP exchange retry.
   Un-cleared bits will cause firmware to access invalid memory when the
   same io tag is used for an IO to a target that doesn't support FCP
   exchange retry.
3) Only check the effective bits when validating an iotag.

Other minor fixes:

1) Added trace to get FC header type with assert of unhandled packet received.
   Ignore the type FC_TYPE_FC_FSS (FC_XS).
2) Fixed the adapter info display check - to check for fcmode flag even.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: direct attach mode fix.
Krishna Gudipati [Tue, 14 Dec 2010 00:17:42 +0000 (16:17 -0800)]
[SCSI] bfa: direct attach mode fix.

- Direct attach is not working due to the check of PID in fcxp_send request.
- Added logic to set the lps->lp_pid with the PID assigned for n2n mode.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: IOC auto recovery fix.
Krishna Gudipati [Tue, 14 Dec 2010 00:17:11 +0000 (16:17 -0800)]
[SCSI] bfa: IOC auto recovery fix.

- Made IOC auto_recovery synchronized and not timer based.
- Only one PCI function will attempt to recover and reinitialize
  the ASIC on a failure, after all the active PCI fns
  acknowledge the IOC failure.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: Store port configuration in flash for persistency.
Krishna Gudipati [Tue, 14 Dec 2010 00:16:50 +0000 (16:16 -0800)]
[SCSI] bfa: Store port configuration in flash for persistency.

When the bfa driver is loaded a flogi is sent without the knowledge of
trunking configuration. This normal flogi causes the switch ports
which had trunking enabled to go to persistent offline.  Solution is
to store the port configuration (which has trunking info) in the flash
for persistency. The firmware will read this configuration when the
very first fcport enable is received.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: IOC fwtrace save logic & state machine fixes.
Krishna Gudipati [Tue, 14 Dec 2010 00:16:09 +0000 (16:16 -0800)]
[SCSI] bfa: IOC fwtrace save logic & state machine fixes.

- Move fw trace save logic to bfa_ioc_sm_fail_entry(),
  so that fw trace is saved irrespective of the cause of the failure.
- Make bfa_ioc_sm_fail() a failure parking state.
- Rename bfa_ioc_sm_initfail() to a more appropriate bfa_ioc_sm_fail_retry()
  as it is no longer a parking state.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: remove unused functions and misc cleanups
Maggie Zhang [Fri, 10 Dec 2010 03:13:20 +0000 (19:13 -0800)]
[SCSI] bfa: remove unused functions and misc cleanups

Remove unused functions and fix checkpatch errors. Misc cleanups in
comment and formatting.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: remove all OS wrappers
Maggie Zhang [Fri, 10 Dec 2010 03:12:32 +0000 (19:12 -0800)]
[SCSI] bfa: remove all OS wrappers

Remove OS wrapper functions/macros, and as a result remove bfa_os_inc.h.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: remove all SCSI IO callbacks
Maggie Zhang [Fri, 10 Dec 2010 03:11:39 +0000 (19:11 -0800)]
[SCSI] bfa: remove all SCSI IO callbacks

Remove SCSI IO callbacks, and as a result remove bfa_cb_ioim.h.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: scatter gather processing change
Maggie Zhang [Fri, 10 Dec 2010 03:10:27 +0000 (19:10 -0800)]
[SCSI] bfa: scatter gather processing change

Modified scatter gather processing to use the kernel provided
scsi_for_each_sg() macro.

1) Instead of allocating and setting up sgpg in bfa_ioim_sge_setup(),
   we only do allocation.  As a result, we remove
   bfa_ioim_sgpg_setup() and rename bfa_ioim_sge_setup() to
   bfa_ioim_sgpg_alloc().

2) bfa_ioim_send_ioreq() call scsi_for_each_sg() to handle both inline
   and sgpg setup.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: remove a file with small size
Maggie Zhang [Fri, 10 Dec 2010 03:09:26 +0000 (19:09 -0800)]
[SCSI] bfa: remove a file with small size

Removed bfa_drv.c, merged it to bfa_core.c and modified Makefile.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: clean up one line functions
Maggie Zhang [Fri, 10 Dec 2010 03:08:43 +0000 (19:08 -0800)]
[SCSI] bfa: clean up one line functions

Cleaned up one line functions.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: remove unused and empty functions
Maggie Zhang [Fri, 10 Dec 2010 03:07:46 +0000 (19:07 -0800)]
[SCSI] bfa: remove unused and empty functions

Removed unused and empty functions.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <xmzhang@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] ibmvfc: Improve ibmvfc_async_desc memory layout
Robert Jennings [Thu, 9 Dec 2010 20:03:59 +0000 (14:03 -0600)]
[SCSI] ibmvfc: Improve ibmvfc_async_desc memory layout

By changing field ordering we can avoid a couple of memory holes in
the tables that use the ibmvfc_async_desc structure.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] iscsi: add module alias
Stephen Hemminger [Thu, 9 Dec 2010 17:37:56 +0000 (09:37 -0800)]
[SCSI] iscsi: add module alias

Since iscsi transport can be built as a module and uses netlink socket
to communicate. The module should have an alias to autoload when socket
of NETLINK_ISCSI type is requested.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] zfcp: Add allow_lun_scan module parameter
Christof Schmitt [Wed, 8 Dec 2010 16:30:46 +0000 (17:30 +0100)]
[SCSI] zfcp: Add allow_lun_scan module parameter

The zfcpdump tool requires a method to attach exactly one LUN. The
easiest way to achieve this is to add a new zfcp module parameter.
When allow_lun_scan is set to "false", zfcp only accepts LUNs that
have been configured through the unit_add sysfs interface.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] zfcp: Add __init declaration to zfcp_cache_hw_align
Christof Schmitt [Thu, 2 Dec 2010 14:16:18 +0000 (15:16 +0100)]
[SCSI] zfcp: Add __init declaration to zfcp_cache_hw_align

The function zfcp_cache_hw_align is only called from zfcp_module_init,
so it should be declared with __init as well.

Reviewed-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] zfcp: Move qdio setup from erp to zfcp_qdio.c
Christof Schmitt [Thu, 2 Dec 2010 14:16:17 +0000 (15:16 +0100)]
[SCSI] zfcp: Move qdio setup from erp to zfcp_qdio.c

Initialization of the qdio waitqueue should happen when the qdio data
is initialized and the QDIOUP flag should be handled in the qdio code
as well. Adjust the code accordingly and remove the superfluos
function zfcp_erp_adapter_strategy_open_qdio.

Reviewed-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] zfcp: Redesign of the debug tracing final cleanup.
Swen Schillig [Thu, 2 Dec 2010 14:16:16 +0000 (15:16 +0100)]
[SCSI] zfcp: Redesign of the debug tracing final cleanup.

This patch is the final cleanup of the redesign from the zfcp tracing.
Structures and elements which were used by multiple areas of the
former debug tracing are now changed to the new scheme.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] zfcp: Redesign of the debug tracing for SCSI records.
Swen Schillig [Thu, 2 Dec 2010 14:16:15 +0000 (15:16 +0100)]
[SCSI] zfcp: Redesign of the debug tracing for SCSI records.

This patch is the continuation to redesign the zfcp tracing to a more
straight-forward and easy to extend scheme.

This patch deals with all trace records of the zfcp SCSI area.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] zfcp: Redesign of the debug tracing for HBA records.
Swen Schillig [Thu, 2 Dec 2010 14:16:14 +0000 (15:16 +0100)]
[SCSI] zfcp: Redesign of the debug tracing for HBA records.

This patch is the continuation to redesign the zfcp tracing to a more
straight-forward and easy to extend scheme.

This patch deals with all trace records of the zfcp HBA area.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] zfcp: Redesign of the debug tracing for SAN records.
Swen Schillig [Thu, 2 Dec 2010 14:16:13 +0000 (15:16 +0100)]
[SCSI] zfcp: Redesign of the debug tracing for SAN records.

This patch is the continuation to redesign the zfcp tracing to a more
straight-forward and easy to extend scheme.

This patch deals with all trace records of the zfcp SAN area.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] zfcp: Redesign of the debug tracing for recovery actions.
Swen Schillig [Thu, 2 Dec 2010 14:16:12 +0000 (15:16 +0100)]
[SCSI] zfcp: Redesign of the debug tracing for recovery actions.

The tracing environment of the zfcp LLD has become very bulky and hard
to maintain. Small changes involve a large modification process which
is error-prone and not effective.  This patch is the first of a set to
redesign the zfcp tracing to a more straight-forward and easy to
extend scheme.  It removes all interpretation and visualization parts
and focuses on bare logging of the information.

This patch deals with all trace records of the zfcp error recovery.

Signed-off-by: Swen schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: Update driver version to 5.02.00-k5
Vikas Chaudhary [Fri, 3 Dec 2010 06:13:00 +0000 (22:13 -0800)]
[SCSI] qla4xxx: Update driver version to 5.02.00-k5

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: Updated the Copyright header
Vikas Chaudhary [Fri, 3 Dec 2010 06:12:51 +0000 (22:12 -0800)]
[SCSI] qla4xxx: Updated the Copyright header

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: do not reset hba if ql4xdontresethba is set
Vikas Chaudhary [Fri, 3 Dec 2010 06:12:47 +0000 (22:12 -0800)]
[SCSI] qla4xxx: do not reset hba if ql4xdontresethba is set

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: do not check for fw hung if reset retry is in progress
Lalit Chandivade [Fri, 3 Dec 2010 06:12:45 +0000 (22:12 -0800)]
[SCSI] qla4xxx: do not check for fw hung if reset retry is in progress

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: cache new IP address acquired via DHCP
Prasanna Mumbai [Fri, 3 Dec 2010 06:12:43 +0000 (22:12 -0800)]
[SCSI] qla4xxx: cache new IP address acquired via DHCP

Prior to firmware state change from ACQUIRING to READY, an
0x8029 AEN is received. Added code to check previous state
being ACQUIRING in order to update the ip address in the driver.

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Prasanna Mumbai <prasanna.mumbai@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: Fail initialization if qla4_8xxx_pci_mem_write_2M fails
Lalit Chandivade [Fri, 3 Dec 2010 06:12:40 +0000 (22:12 -0800)]
[SCSI] qla4xxx: Fail initialization if qla4_8xxx_pci_mem_write_2M fails

Since if fw load is failing, running on incomplete fw load would
be fatal.

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: put device in FAILED state for 82XX initialization failure
Lalit Chandivade [Fri, 3 Dec 2010 06:12:36 +0000 (22:12 -0800)]
[SCSI] qla4xxx: put device in FAILED state for 82XX initialization failure

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: do not process interrupt unconditionally
Lalit Chandivade [Fri, 3 Dec 2010 06:12:27 +0000 (22:12 -0800)]
[SCSI] qla4xxx: do not process interrupt unconditionally

in mailbox command do not process interrupt unconditionally,
process interrupt only in polling mode

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: use correct fw_ddb_index in abort task
Karen Higgins [Fri, 3 Dec 2010 06:12:22 +0000 (22:12 -0800)]
[SCSI] qla4xxx: use correct fw_ddb_index in abort task

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: memory wedge with peg_halt test in loop
Swapnil Nagle [Fri, 3 Dec 2010 06:12:15 +0000 (22:12 -0800)]
[SCSI] qla4xxx: memory wedge with peg_halt test in loop

Signed-off-by: Swapnil Nagle <swapnil.nagle@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: initialize MSI in correct way
Shyam Sundar [Fri, 3 Dec 2010 06:12:08 +0000 (22:12 -0800)]
[SCSI] qla4xxx: initialize MSI in correct way

IRQF_SHARED flag should not be set when calling request_irq for MSI since
this interrupt mechanism cannot be shared like standard INTx

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Shyam Sundar <shyam.sundar@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] qla4xxx: Drop use of IRQF_DISABLE
Vikas Chaudhary [Fri, 3 Dec 2010 06:12:03 +0000 (22:12 -0800)]
[SCSI] qla4xxx: Drop use of IRQF_DISABLE

IRQF_DISABLE flag is deprecated and this flag is a NOOP in kernel.

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix statistics for FCP input/output megabytes
Joe Eykholt [Wed, 1 Dec 2010 00:20:18 +0000 (16:20 -0800)]
[SCSI] libfc: fix statistics for FCP input/output megabytes

The statistics for InputMegabytes and OutputMegabytes are
misnamed.  They're accumulating bytes, not megabytes.

The statistic returned via /sys must be in megabytes, however,
which is what the HBA-API wants.  The FCP code needs to accumulate
it in bytes and then divide by 1,000,000 (not 2^20) before it
presented via sysfs.

This affects fcoe.ko only, not fnic.  The fnic driver
correctly by accumulating bytes and then converts to megabytes.

I checked that libhbalinux is using the /sys file directly without
conversion.

BTW, qla2xxx does divide by 2^20, which I'm not fixing here.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfcoe: change fip_select to return new FCF
Joe Eykholt [Wed, 1 Dec 2010 00:20:12 +0000 (16:20 -0800)]
[SCSI] libfcoe: change fip_select to return new FCF

Neaten several calls to fip_select() by having it return the
pointer to the new FCF.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfcoe: reorder FCF list to put latest advertiser first
Joe Eykholt [Wed, 1 Dec 2010 00:20:07 +0000 (16:20 -0800)]
[SCSI] libfcoe: reorder FCF list to put latest advertiser first

When there are several FCFs to choose from, the one most likely
to accept a FLOGI on certian switches is the one that last
answered a multicast solicit.

So, when receiving an advertisement, move the FCF to the front
of the list so that it gets chosen first among those with the
same priority.

Without this, more FLOGIs need to be sent in a test with
multiple FCFs and a switch in NPV mode, but it still
eventually finds one that accepts the FLOGI.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfcoe: add debug message for FCF destination MAC
Joe Eykholt [Wed, 1 Dec 2010 00:20:02 +0000 (16:20 -0800)]
[SCSI] libfcoe: add debug message for FCF destination MAC

When multiple FCFs to the same fabric exist, the debug messages
all look alike.   Change the message to include the MAC address.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfcoe: retry rejected FLOGI to another FCF if possible
Joe Eykholt [Wed, 1 Dec 2010 00:19:56 +0000 (16:19 -0800)]
[SCSI] libfcoe: retry rejected FLOGI to another FCF if possible

Switches using multiple-FCFs may reject FLOGI in order to
balance the load between multiple FCFs.  Even though the FCF
was available, it may have more load at the point we actually
send the FLOGI.

If the FLOGI fails, select a different FCF
if possible, among those with the same priority.  If no other
FCF is available, just deliver the reject to libfc for retry.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfcoe: fix checking of conflicting fabrics in fcoe_ctlr_select()
Joe Eykholt [Wed, 1 Dec 2010 00:19:51 +0000 (16:19 -0800)]
[SCSI] libfcoe: fix checking of conflicting fabrics in fcoe_ctlr_select()

The check for conflicting fabrics in fcoe_ctlr_select()
ignores any FCFs that aren't usable.  This is a minor
problem now but becomes more pronounced after later patches.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfcoe: move some timer code to make it reusable.
Joe Eykholt [Wed, 1 Dec 2010 00:19:46 +0000 (16:19 -0800)]
[SCSI] libfcoe: move some timer code to make it reusable.

Move some of the code in fcoe_ctlr_timer_work() to
fcoe_ctlr_select() so that it can be shared
with another function in a forthcoming patch.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfcoe: update FIP FCF announcements
Joe Eykholt [Wed, 1 Dec 2010 00:19:40 +0000 (16:19 -0800)]
[SCSI] libfcoe: update FIP FCF announcements

Move the announcement code to a separate function for reuse in
a forthcoming patch.

For messages regarding FCF timeout and selection, use the
previously-announced FCF MAC address (dest_addr) in the fcoe_ctlr struct.
Only print (announce) the FCF if it is new.   Print MAC for
timed-out or deselected FCFs.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix fc_tm_done not freeing the allocated fsp pkt
Yi Zou [Wed, 1 Dec 2010 00:19:35 +0000 (16:19 -0800)]
[SCSI] libfc: fix fc_tm_done not freeing the allocated fsp pkt

Frame should be freed in fc_tm_done, this is an updated patch on the one
initially submitted by Hillf Danton.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: the timeout for the REC itself is 2 * R_A_TOV_els
Yi Zou [Wed, 1 Dec 2010 00:19:30 +0000 (16:19 -0800)]
[SCSI] libfc: the timeout for the REC itself is 2 * R_A_TOV_els

The timeout for the exchange carrying REC itself is 2 * R_A_TOV_els.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix exchange being deleted when the abort itself is timed out
Yi Zou [Wed, 1 Dec 2010 00:19:25 +0000 (16:19 -0800)]
[SCSI] libfc: fix exchange being deleted when the abort itself is timed out

Should not continue when the abort itself is being timeout since in that case
the exchange will be deleted and relesased. We still want to call the
associated response handler to let the layer, e.g., fcp, know the exchange
itself is being timed out.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: do not fc_io_compl on fsp w/o any scsi_cmnd associated
Yi Zou [Wed, 1 Dec 2010 00:19:20 +0000 (16:19 -0800)]
[SCSI] libfc: do not fc_io_compl on fsp w/o any scsi_cmnd associated

Do not call fc_io_compl() on fsp w/o any scsi_cmnd, e.g., lun reset is built
inside fc_fcp, not from a scsi command from queuecommnd from scsi-ml, so in
in case target is buggy that is invalid flags in the FCP_RSP, as we have seen
in some SAN Blaze target where all bits in flags are 0, we do not want to call
io_compl on this fsp.

[ Comment block added by Robert Love ]

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: add print of exchange id for debugging fc_fcp
Yi Zou [Wed, 1 Dec 2010 00:19:15 +0000 (16:19 -0800)]
[SCSI] libfc: add print of exchange id for debugging fc_fcp

This is very helpful to match up the corresponding exchange to the actual I/O
described by the fsp, particularly when you do a side-by-side comparison of
the syslog with your trace.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] drivers/scsi/fcoe: Update WARN uses
Joe Perches [Wed, 1 Dec 2010 00:19:09 +0000 (16:19 -0800)]
[SCSI] drivers/scsi/fcoe: Update WARN uses

Add missing newlines.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix memory leakage in remote port
Hillf Danton [Wed, 1 Dec 2010 00:19:04 +0000 (16:19 -0800)]
[SCSI] libfc: fix memory leakage in remote port

There seems rdata should get put before return.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix memory leakage in local port
Hillf Danton [Wed, 1 Dec 2010 00:18:59 +0000 (16:18 -0800)]
[SCSI] libfc: fix memory leakage in local port

There seems info should get freed when error encountered.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix memory leakage in local port
Hillf Danton [Wed, 1 Dec 2010 00:18:54 +0000 (16:18 -0800)]
[SCSI] libfc: fix memory leakage in local port

There seems info should get freed when error encountered.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: remove tgt_flags from fc_fcp_pkt struct
john fastabend [Wed, 1 Dec 2010 00:18:49 +0000 (16:18 -0800)]
[SCSI] libfc: remove tgt_flags from fc_fcp_pkt struct

We can easily remove the tgt_flags from fc_fcp_pkt struct
and use rpriv->tgt_flags directly where needed.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: use rport timeout values for fcp recovery
john fastabend [Wed, 1 Dec 2010 00:18:44 +0000 (16:18 -0800)]
[SCSI] libfc: use rport timeout values for fcp recovery

Use the rport value for rec_tov for timeout values when
sending fcp commands. Currently, defaults are being used
which may or may not match the advertised values.

The default may cause i/o to timeout on networks that
set this value larger then the default value. To make
the timeout more configurable in the non-REC mode we
remove the FC_SCSI_ER_TIMEOUT completely allowing the
scsi-ml to do the timeout. This removes an unneeded
timer and allows the i/o timeout to be configured
using the scsi-ml knobs.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: incorrect scsi host byte codes returned to scsi-ml
john fastabend [Wed, 1 Dec 2010 00:18:39 +0000 (16:18 -0800)]
[SCSI] libfc: incorrect scsi host byte codes returned to scsi-ml

The fcp packet recovery handler fc_fcp_recover() is called
when errors occurr in a fcp session. Currently it is
generically setting the status code to FC_CMD_RECOVERY for
all error types. This results in DID_BUS_BUSY errors
being returned to the scsi-ml.

DID_BUS_BUSY errors indicate "BUS stayed busy through time
out period" according to scsi.h. Many of the error reported
by fc_rcp_recovery() are pkt errors. Here we update
fc_fcp_recovery to use better host byte codes.

With certain FAST FAIL flags set DID_BUS_BUSY and DID_ERROR
will have different behaviors this was causing dm multipath
to fail quickly in some cases where a retry would be a
better action.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix stats computation in fc_queuecommand()
Hillf Danton [Wed, 1 Dec 2010 00:18:33 +0000 (16:18 -0800)]
[SCSI] libfc: fix stats computation in fc_queuecommand()

There seems accumulation needed.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix mem leak in fc_seq_assign()
Hillf Danton [Wed, 1 Dec 2010 00:18:28 +0000 (16:18 -0800)]
[SCSI] libfc: fix mem leak in fc_seq_assign()

There is a typo cleaned, which triggers memory leakage.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: Fix incorrect locking and unlocking in FCP
Robert Love [Wed, 1 Dec 2010 00:18:23 +0000 (16:18 -0800)]
[SCSI] libfc: Fix incorrect locking and unlocking in FCP

The error handler grabs the si->scsi_queue_lock, but
in the case where the fsp pointer is NULL it releases
the scsi_host lock. This can lead to a variety of
system hangs depending on which is used first- the
scsi_host lock or the scsi_queue_lock.

This patch simply unlocks the correct lock when fcp
is NULL.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: tune fc_exch_em_alloc() to be O(2)
Hillf Danton [Wed, 1 Dec 2010 00:18:17 +0000 (16:18 -0800)]
[SCSI] libfc: tune fc_exch_em_alloc() to be O(2)

For allocating new exch from pool,  scanning for free slot in exch
array fluctuates when exch pool is close to exhaustion.

The fluctuation is smoothed, and the scan looks to be O(2).

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix mem leak in fc_exch_recv_seq_resp()
Hillf Danton [Wed, 1 Dec 2010 00:18:12 +0000 (16:18 -0800)]
[SCSI] libfc: fix mem leak in fc_exch_recv_seq_resp()

There seems that ep should get released, or it will no longer get freed.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: fix NULL pointer dereference bug in fc_fcp_pkt_release
Yi Zou [Wed, 1 Dec 2010 00:18:07 +0000 (16:18 -0800)]
[SCSI] libfc: fix NULL pointer dereference bug in fc_fcp_pkt_release

This happens when then tearing down the fcoe interface with active I/O.
The back trace shows dead000000200200 in RAX, i.e., LIST_POISON2, indicating
that the fsp is already being dequeued, which is probably why no complaining
was seen in fc_fcp_destroy() about outstanding fsp not freed, since we dequeue
it in the end of fc_io_compl() before releasing it. The bug is due to the
fact that we have already destroyed lport's scsi_pkt_pool while on-going i/o
is still accessing it through fc_fcp_pkt_release(), like this trace or the
similar code path from scsi-ml to fc_eh_abort, etc. This is fixed by moving
the fc_fcp_destroy() after lport is detached from scsi-ml since fc_fcp_destroy
is supposed to called only once where no lport lock is taken, otherwise the
fc_fcp_pkt_release() would have to grab the lport lock.

 BUG: unable to handle kernel NULL pointer dereference at (null)
 .......
 RIP: 0010:[<0000000000000000>]
 [<(null)>] (null)
 RSP: 0018:ffff8803270f7b88  EFLAGS: 00010282
 RAX: dead000000200200 RBX: ffff880197d2fbc0 RCX: 0000000000005908
 RDX: ffff880195ea6d08 RSI: 0000000000000282 RDI: ffff880180f4fec0
 RBP: ffff8803270f7bc0 R08: ffff880197d2fbe0 R09: 0000000000000000
 R10: ffff88032867f090 R11: 0000000000000000 R12: ffff880195ea6d08
 R13: 0000000000000282 R14: ffff880180f4fec0 R15: 0000000000000000
 FS:  0000000000000000(0000) GS:ffff8801b5820000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
 CR2: 0000000000000000 CR3: 00000001a6eae000 CR4: 00000000000006e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process fc_rport_eq (pid: 5278, threadinfo ffff8803270f6000, task ffff880326254ab0)
 Stack:
 ffffffffa02c39ca ffff8803270f7ba0 ffff88019331cbc0 ffff880197d2fbc0
 0000000000000000 ffff8801a8c895e0 ffff8801a8c895e0 ffff8803270f7c10
 ffffffffa02c4962 ffff8803270f7be0 ffffffff814c94ab ffff8803270f7c10
 Call Trace:
 [<ffffffffa02c39ca>] ? fc_io_compl+0x10a/0x530 [libfc]
 [<ffffffffa02c4962>] fc_fcp_complete_locked+0x72/0x150 [libfc]
 [<ffffffff814c94ab>] ? _spin_unlock_bh+0x1b/0x20
 [<ffffffffa02b98ff>] ? fc_exch_done+0x3f/0x60 [libfc]
 [<ffffffffa02c4a8f>] fc_fcp_retry_cmd+0x4f/0x60 [libfc]
 [<ffffffffa02c6150>] fc_fcp_recv+0x9b0/0xc30 [libfc]
 [<ffffffff8106ba7a>] ? _call_console_drivers+0x4a/0x80
 [<ffffffff8107d5ec>] ? lock_timer_base+0x3c/0x70
 [<ffffffff8107e06b>] ? try_to_del_timer_sync+0x7b/0xe0
 [<ffffffffa02b9dcf>] fc_exch_mgr_reset+0x1df/0x250 [libfc]
 [<ffffffffa02c57a0>] ? fc_fcp_recv+0x0/0xc30 [libfc]
 [<ffffffffa02c1042>] fc_rport_work+0xf2/0x4e0 [libfc]
 [<ffffffff8109203e>] ? prepare_to_wait+0x4e/0x80
 [<ffffffffa02c0f50>] ? fc_rport_work+0x0/0x4e0 [libfc]
 [<ffffffff8108c6c0>] worker_thread+0x170/0x2a0
 [<ffffffff81091d50>] ? autoremove_wake_function+0x0/0x40
 [<ffffffff8108c550>] ? worker_thread+0x0/0x2a0
 [<ffffffff810919e6>] kthread+0x96/0xa0
 [<ffffffff810141ca>] child_rip+0xa/0x20
 [<ffffffff81091950>] ? kthread+0x0/0xa0
 [<ffffffff810141c0>] ? child_rip+0x0/0x20
 Code:
 Bad RIP value.

 RIP
 [<(null)>] (null)
 RSP <ffff8803270f7b88>
 CR2: 0000000000000000

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] libfc: remove define of fc_seq_exch in fc_exch.c
Hillf Danton [Wed, 1 Dec 2010 00:18:01 +0000 (16:18 -0800)]
[SCSI] libfc: remove define of fc_seq_exch in fc_exch.c

The define for fc_seq_exch is unnecessary, since it also appears in scsi/libfc.h

Signed-off-by: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: fix endianess sparse check warnings
Maggie [Tue, 30 Nov 2010 02:26:32 +0000 (18:26 -0800)]
[SCSI] bfa: fix endianess sparse check warnings

First round of fix for the endianess check warnings from make C=2 CF="-D__CHECK_ENDIAN__".

Signed-off-by: Maggie <xmzhang@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bfa: fix regular sparse check warnings.
Maggie [Tue, 30 Nov 2010 02:21:32 +0000 (18:21 -0800)]
[SCSI] bfa: fix regular sparse check warnings.

Fix all sparse check warnings from make C=2.

Signed-off-by: Maggie <xmzhang@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Updated version to 2.6.2.2
Eddie Wai [Tue, 23 Nov 2010 23:29:32 +0000 (15:29 -0800)]
[SCSI] bnx2i: Updated version to 2.6.2.2

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Updated copyright and maintainer info
Eddie Wai [Tue, 23 Nov 2010 23:29:31 +0000 (15:29 -0800)]
[SCSI] bnx2i: Updated copyright and maintainer info

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Cleaned up various error conditions in ep_connect/disconnect
Eddie Wai [Tue, 23 Nov 2010 23:29:30 +0000 (15:29 -0800)]
[SCSI] bnx2i: Cleaned up various error conditions in ep_connect/disconnect

Various error conditions inside ep_connect and ep_disconnect were
either not being handled or not being handled correctly.  This patch
fixes all those issues.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Added return code check for chip kwqe submission request
Eddie Wai [Tue, 23 Nov 2010 23:29:29 +0000 (15:29 -0800)]
[SCSI] bnx2i: Added return code check for chip kwqe submission request

Added the handling for cases when a chip request is made to the
CNIC module but the hardware is not ready to accept.  This would
lead to many unnecessary wait timeouts.
This code adds check in the connect establishment and destruction
path.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Modified the bnx2i stop path to compensate for in progress ops
Eddie Wai [Tue, 23 Nov 2010 23:29:28 +0000 (15:29 -0800)]
[SCSI] bnx2i: Modified the bnx2i stop path to compensate for in progress ops

The stop path has been augmented to wait a max of 10s for all in
progress offload and destroy activities to complete before proceeding
to terminate all active connections (via iscsid or forcefully).

Note that any new offload and destroy requests are now blocked and
return to the caller immediately.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Removed the dynamic registration of CNIC
Eddie Wai [Tue, 23 Nov 2010 23:29:27 +0000 (15:29 -0800)]
[SCSI] bnx2i: Removed the dynamic registration of CNIC

The code no longer needs to dynamically register and unregister
the CNIC device.  The CNIC device will be kept registered until
module unload.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Added mutex lock protection to conn_get_param
Eddie Wai [Tue, 23 Nov 2010 23:29:26 +0000 (15:29 -0800)]
[SCSI] bnx2i: Added mutex lock protection to conn_get_param

Added net_dev mutex lock protection before accessing the csk
parameters.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Allow to abort the connection if connect request times out
Eddie Wai [Tue, 23 Nov 2010 23:29:25 +0000 (15:29 -0800)]
[SCSI] bnx2i: Allow to abort the connection if connect request times out

In the situation where the connect completion response arrives after
the connect request has already timed out, the connection was not being
aborted but only the resource was being freed.  This creates a problem
for 5771X (10g) as the chip flags this with an assertion.

This change will properly aborts the connection before freeing the
resource.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Fixed the remote TCP RST handling for the 570X (1g)
Eddie Wai [Tue, 23 Nov 2010 23:29:24 +0000 (15:29 -0800)]
[SCSI] bnx2i: Fixed the remote TCP RST handling for the 570X (1g)

Modified the handling of the remote TCP RST code so the chip can now
flush the tx pipe accordingly upon a remote TCP RST reception.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Fixed a cid leak issue for 5771X (10g)
Eddie Wai [Tue, 23 Nov 2010 23:29:23 +0000 (15:29 -0800)]
[SCSI] bnx2i: Fixed a cid leak issue for 5771X (10g)

A cid leak issue was found when the connect destroy request exceeded
the driver's disconnection timeout.  This will lead to a cid resource
leak issue.
The fix is to allow the cid cleanup even when this happens.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Fixed the endian bug in the TMF LUN cmd send
Eddie Wai [Tue, 23 Nov 2010 23:29:22 +0000 (15:29 -0800)]
[SCSI] bnx2i: Fixed the endian bug in the TMF LUN cmd send

Added a be32_to_cpu call for the TMF LUN wqe.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Added fix for NOP-Out response panic from unsolicited NOP-In
Eddie Wai [Tue, 23 Nov 2010 23:29:21 +0000 (15:29 -0800)]
[SCSI] bnx2i: Added fix for NOP-Out response panic from unsolicited NOP-In

The patch fixes the following situations where NOP-Out pkt is called for:
- local unsolicited NOP-Out requests (requesting no NOP-In response)
- local NOP-Out responses to unsolicited NOP-In requests

kernel panic is observed due to double session spin_lock requests; one in the
bnx2i_process_nopin_local_cmpl routine in bnx2i_hwi.c and the other in the
iscsi_put_task routine in libiscsi.c

The proposed fix is to export the currently static __iscsi_put_task() routine
and have bnx2i call it directly instead of the iscsi_put_task() routine which
holds the session spin lock.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Acked-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] bnx2i: Fixed bugs in the handling of unsolicited NOP-Ins
Eddie Wai [Tue, 23 Nov 2010 23:29:20 +0000 (15:29 -0800)]
[SCSI] bnx2i: Fixed bugs in the handling of unsolicited NOP-Ins

Unsolicited NOP-Ins are placed in the receive queue of the hardware
which requires to be read out regardless if the receive pipe is suspended
or not.  This patch adds the disposal of this RQ element under this
condition.
Also fixed the bug in the unsolicited NOP-In handling routine which
checks for the RESERVED_ITT.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: Bump version 07.100.00.00
Kashyap, Desai [Fri, 12 Nov 2010 23:12:28 +0000 (04:42 +0530)]
[SCSI] mpt2sas: Bump version 07.100.00.00

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: Debug string changes from target to device.
Kashyap, Desai [Fri, 12 Nov 2010 23:11:32 +0000 (04:41 +0530)]
[SCSI] mpt2sas: Debug string changes from target to device.

Changing debug print to correct string.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: Sanity check for phy count is added using max phy count
Kashyap, Desai [Fri, 12 Nov 2010 23:10:51 +0000 (04:40 +0530)]
[SCSI] mpt2sas: Sanity check for phy count is added using max phy count

Fix oops loading driver when there is direct attached
SEP device

The driver set max phys count to the value reported in sas iounit page
zero.  However this page doesn't take into account additional virutal
phys.  When sas topology event arrives, the phy count is larger than
expected, and the driver accesses memory array beyond the end of
allocated space, then oops.  Manufacturing page 8 contains the info
on direct attached phys.

For this fix will making sure that sas topology event is not
processing phys greater than the expected phy count.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: change queue depth with reason argument more appropriately
Kashyap, Desai [Fri, 12 Nov 2010 23:09:11 +0000 (04:39 +0530)]
[SCSI] mpt2sas: change queue depth with reason argument more appropriately

change_queue_depth callback API changed
The change_queue_depth callback changed where there is now an additional
parameter called reason, with SCSI_QDEPTH_DEFAULT, SCSI_QDEPTH_QFULL,
and SCSI_QDEPTH_RAMP_UP codes.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: Remove code for TASK_SET_FULL from driver.
Kashyap, Desai [Fri, 12 Nov 2010 23:07:36 +0000 (04:37 +0530)]
[SCSI] mpt2sas: Remove code for TASK_SET_FULL from driver.

remove support for MPI2_EVENT_TASK_SET_FULL
This event is obsoleted, so this processing of this event
needs to be removed from the driver.  The controller firmware is going
to handle TASK_SET_FULL, the driver doesn't need to do anything.
Even though we are removing the EVENT handling, the behavour has not
changed between driver versions becuase fimrware will still be handling
queue throttling, and retrying of commands when the target device queues
are full.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: MPI 2.0 Header updated
Kashyap, Desai [Fri, 12 Nov 2010 23:06:14 +0000 (04:36 +0530)]
[SCSI] mpt2sas: MPI 2.0 Header updated

MPI2 Rev header files.

1) Removed Task Set Full Event. Modified description of Disable SCSI
Initiator Task Set Full Handling bit in the Flags field of IO Unit
Page 1. Modified the descriptions for the three queue depth fields in
SAS IO Unit Page 1.
(2) Added new value for the Current Operation bits of the Flags field
in the RAID Volume Indicator Structure to indicate that the Make Data
Consistent operation is running.
(3) Added a value of 0x6 to various SAS link rate fields to indicate an
attached PHY that is not using any commonly supported settings.
(4) Added Volume Not Consistent bit to the VolumeStatusFlags field of
RAID Volume Page 0.
(5) Added a new value for the IncompatibleReason field of RAID Physical
Disk Page 0 to indicate an incompatible media type.
(6) Added Diagnostic Data Upload tool for the Toolbox Request.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: Modify code to support Expander switch
Kashyap, Desai [Fri, 12 Nov 2010 23:05:30 +0000 (04:35 +0530)]
[SCSI] mpt2sas: Modify code to support Expander switch

Issue : Switch swap doesn't work when device missing delay is enabled.

(1) add support to individually add and remove phys to and from
existing ports. This replaces the routine
_transport_delete_duplicate_port.
(2) _scsih_sas_host_refresh - was modified to change the link rate
from zero to 1.5 GB rate when the firmware reports there is an
attached device with zero link.
(3) add new function mpt2sas_device_remove, this is wrapper function
deletes some redundant code through out driver by combining into one
subrountine
(4) two subroutines were modified so the sas_device, raid_device, and
port lists are traversed once when objects are deleted from the list.
Previously it was looping back each time an object was deleted from the
list.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: Create a pool of chain buffer instead of dedicated per IOs
Kashyap, Desai [Fri, 12 Nov 2010 23:04:06 +0000 (04:34 +0530)]
[SCSI] mpt2sas: Create a pool of chain buffer instead of dedicated per IOs

Create a pool of chain buffers, instead of dedicated per IO:
This enahancment is to address memory allocation failure when asking
for more than 2300 IOs per host.   There is just not enough contiquious
DMA physical memory to make one single allocation to hold both message
frames and chain buffers when asking for more than 2300 request. In order
to address this problem we will have to allocate memory for each chain
buffer in a seperate individual memory allocation, placing each chain
element of 128 bytes onto a pool of available chains, which can be
shared amoung all request.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: Added loadtime para for IOMissingDelay and DMD
Kashyap, Desai [Fri, 12 Nov 2010 23:02:18 +0000 (04:32 +0530)]
[SCSI] mpt2sas: Added loadtime para for IOMissingDelay and DMD

Ability to override/set the ReportDeviceMissingDelay and
IODeviceMissingDelay from driver: Add new command line option missing_delay,
this is an array, where the first element is the device missing delay,
and the second element is io missing delay.  The driver will program
sas iounit page 1 with the new setting when the driver loads. This is
programmed to the current and persistent configuration page so this takes
immediately, as will be sticky across host reboots.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
13 years ago[SCSI] mpt2sas: Added sanity check for cb_idx and smid access.
Kashyap, Desai [Fri, 12 Nov 2010 23:01:14 +0000 (04:31 +0530)]
[SCSI] mpt2sas: Added sanity check for cb_idx and smid access.

Sometime it is seen that controller
firmware returns an invalid system message id (smid).

the oops is occurring becuase mpt_callbacks pointer is referenced to
either null or invalid virtual address.  this is due to cb_idx set
incorrectly from routine _base_get_cb_idx.  the cb_idx was set incorrectly
becuase there is no check to make sure smid is less than maxiumum
anticapted smid.   to fix this issue, we add a check in
_base_get_cb_idx to make sure smid is not greater than
ioc->hba_queue_depth.   in addition, a similar check was added to make
sure the reply address was less than the largest anticapated address.

Newer firmware has sovled this issue, however it good to have this sanity
check.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>