openwrt/staging/blogic.git
16 years ago[SCSI] libata: fix corruption induced by relaxed DMA alignment in SCSI
James Bottomley [Tue, 22 Jan 2008 19:43:48 +0000 (13:43 -0600)]
[SCSI] libata: fix corruption induced by relaxed DMA alignment in SCSI

Hugh Dickens noticed that SMART commands issued from user space can
end up corupting memory.  The problem occurs if the buffer used to
read data spans two pages.  The reason is that the PIO sector routines
in libata are expecting physically contiguous pages when they do
sector operations, so the left overs on the second page go into the
next physically adjacent page rather than the next page in the sg
mapping.

Fix this by enforcing strict 512 byte alignment on all buffers from
userspace.

Acked-by: Hugh Dickins <hugh@veritas.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] relax scsi dma alignment
James Bottomley [Tue, 1 Jan 2008 16:00:10 +0000 (10:00 -0600)]
[SCSI] relax scsi dma alignment

This patch relaxes the default SCSI DMA alignment from 512 bytes to 4
bytes.  I remember from previous discussions that usb and firewire have
sector size alignment requirements, so I upped their alignments in the
respective slave allocs.

The reason for doing this is so that we don't get such a huge amount of
copy overhead in bio_copy_user() for udev.  (basically all inquiries it
issues can now be directly mapped).

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] block: Introduce new blk_queue_update_dma_alignment interface
James Bottomley [Mon, 31 Dec 2007 22:37:00 +0000 (16:37 -0600)]
[SCSI] block: Introduce new blk_queue_update_dma_alignment interface

The purpose of this is to allow stacked alignment settings, with the
ultimate queue alignment being set to the largest alignment requirement
in the stack.

The reason for this is so that the SCSI mid-layer can relax the default
alignment requirements (which are basically causing a lot of superfluous
copying to go on in the SG_IO interface) while allowing transports,
devices or HBAs to add stricter limits if they need them.

Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] fix scsi_setup_command_freelist failure path race
FUJITA Tomonori [Mon, 7 Jan 2008 22:59:05 +0000 (07:59 +0900)]
[SCSI] fix scsi_setup_command_freelist failure path race

Looks like that host_cmd_pool_mutex are necessary here.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] sr: update to follow tray status correctly
James Bottomley [Sat, 5 Jan 2008 16:39:51 +0000 (10:39 -0600)]
[SCSI] sr: update to follow tray status correctly

Based on an original patch from: David Martin <tasio@tasio.net>

When trying to get the drive status via ioctl CDROM_DRIVE_STATUS, with
no disk it gives CDS_TRAY_OPEN even if the tray is closed.

ioctl works as expected with ide-cd driver.

Gentoo bug report: http://bugs.gentoo.org/show_bug.cgi?id=196879

Cc: Maarten Bressers <mbres@gentoo.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libsas: don't use made up error codes
James Bottomley [Sun, 30 Dec 2007 18:37:31 +0000 (12:37 -0600)]
[SCSI] libsas: don't use made up error codes

This is bad for two reasons:

     1. If they're returned to outside applications, no-one knows what
        they mean.
     2. Eventually they'll clash with the ever expanding standard error
        codes.

The problem error code in question is ETASK.  I've replaced this by
ECOMM (communications error on send) a network error code that seems to
most closely relay what ETASK meant.

Acked-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libsas, bsg: pass errors through correctly
James Bottomley [Sat, 29 Dec 2007 16:59:53 +0000 (10:59 -0600)]
[SCSI] libsas, bsg: pass errors through correctly

Currently in BSG, errors returned in req->errors aren't passed back to
the calling programme (either via SG_IO or via read/write).  Fix this,
while preserving the SCSI convention of returning status in
req->errors.

Now update libsas to return errors correctly instead of to ignore
them.

Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libsas: don't treat underrun as an error on SMP tasks
James Bottomley [Sat, 29 Dec 2007 17:49:53 +0000 (11:49 -0600)]
[SCSI] libsas: don't treat underrun as an error on SMP tasks

All SMP tasks sent through bsg generate messages like:

sas: smp_execute_task: task to dev 500605b000001450 response: 0x0 status 0x81

Three times (because the task gets retried).  Firstly, don't retry
either overrun or underrun (the data buffer isn't going to change size)
and secondly, just report the underrun but don't set an error for it.
This is necessary so bsg can report back the residual.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libsas: add host SMP processing
James Bottomley [Fri, 28 Dec 2007 22:35:17 +0000 (16:35 -0600)]
[SCSI] libsas: add host SMP processing

This adds support for host side SMP processing, via a separate
SMP interpreter file.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] mpt fusion: make mptsas_smp_handler update resid
FUJITA Tomonori [Sun, 30 Dec 2007 10:34:52 +0000 (19:34 +0900)]
[SCSI] mpt fusion: make mptsas_smp_handler update resid

This patch fixes mptsas_smp_handler to update both din_resid or
dout_resid on success. bsg can report back the residual.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Hold queue lock when checking port/unit handle for task management cmd
Christof Schmitt [Thu, 20 Dec 2007 11:30:27 +0000 (12:30 +0100)]
[SCSI] zfcp: Hold queue lock when checking port/unit handle for task management cmd

We need to hold the queue-lock when checking whether we still have a valid
unit/port handle for the task management command, i.e whether we can issue this
request for this unit/port. If the error recovery is about to close this
unit/port, then it competes for the queue-lock. If the close request issued by
the error recovery wins, then it is guaranteed that this unit/port has been
blocked for other requests.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Hold queue lock when checking port/unit handle for FCP command
Christof Schmitt [Thu, 20 Dec 2007 11:30:26 +0000 (12:30 +0100)]
[SCSI] zfcp: Hold queue lock when checking port/unit handle for FCP command

We need to hold the queue-lock when checking whether we still have a valid
unit/port handle for the FCP command, i.e whether we can issue this request for
this unit/port. If the error recovery is about to close this unit/port, then it
competes for the queue-lock. If the close request issued by the error recovery
wins, then it is guaranteed that this unit/port has been blocked for other
requests.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Hold queue lock when checking port handle for ELS command
Christof Schmitt [Thu, 20 Dec 2007 11:30:25 +0000 (12:30 +0100)]
[SCSI] zfcp: Hold queue lock when checking port handle for ELS command

We need to hold the queue-lock when checking whether we still have a valid port
handle for the ELS command, i.e whether we can issue this request for this
port. If the error recovery is about to close this port, then it competes for
the queue-lock. If the close request issued by the error recovery wins, then it
is guaranteed that this port has been blocked for other requests.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Hold queue lock when checking port/unit handle for abort command
Christof Schmitt [Thu, 20 Dec 2007 11:30:24 +0000 (12:30 +0100)]
[SCSI] zfcp: Hold queue lock when checking port/unit handle for abort command

We need to hold the queue-lock when checking whether we still have a valid
unit/port handle for the abort command, i.e whether we can issue this request
for this unit/port. If the error recovery is about to close this unit/port,
then it competes for the queue-lock. If the close request issued by the error
recovery wins, then it is guaranteed that this unit/port has been blocked for
other requests.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Fix evaluation of port handles in abort handler
Christof Schmitt [Thu, 20 Dec 2007 11:30:23 +0000 (12:30 +0100)]
[SCSI] zfcp: Fix evaluation of port handles in abort handler

According to the FSF spec, word 0 (bytes 0-3) has the handle
specified with the abort command and word 1 (bytes 4-7) has the
handle for the command to be aborted. Fix the if statements
that try to compare those.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: fix use after free bug.
Heiko Carstens [Thu, 20 Dec 2007 11:30:22 +0000 (12:30 +0100)]
[SCSI] zfcp: fix use after free bug.

zfcp_erp_strategy_check_fsfreq() checks if it is safe to access the
fsf_req associated with the erp_action that gets passed. To test if
it is safe it accesses the fsf_req in order to get its index into
the hash list. This is broken since the fsf_req might be freed already
and the read index has no meaning. It could lead to memory corruption.
Fix this by introducing a new zfcp_reqlist_find_safe() method which
just checks if addresses are equal. This is slower, but only gets
called in case of error recovery.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] megaraid: add __devexit annotation
Adrian Bunk [Tue, 11 Dec 2007 22:23:31 +0000 (23:23 +0100)]
[SCSI] megaraid: add __devexit annotation

megaraid_remove_one() can become __devexit.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: "Patro, Sumant" <Sumant.Patro@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] atari_NCR5380, sun3_NCR5380: operator precedence fix
Roel Kluin [Thu, 15 Nov 2007 20:13:46 +0000 (21:13 +0100)]
[SCSI] atari_NCR5380, sun3_NCR5380: operator precedence fix

SR_REQ is defined 0x20, but bitanding has no effect because '!' has a higher
priority than '&'

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: update MAINTAINERS
Swen Schillig [Tue, 18 Dec 2007 10:16:14 +0000 (11:16 +0100)]
[SCSI] zfcp: update MAINTAINERS

we are planning a major rewrite of the zfcp driver,
meaning that a lot of patches will hit the mailing-list in the near future.

Since I can't support this additional work-load along with my other
responsibilities we are shifting the maintainership to
Christof Schmitt as the maintainer and
Martin Peschke as the co-maintainer.

Please support the two in providing us a new and more stable
zfcp environment.

Thanks
Swen

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi class: bump version
Mike Christie [Thu, 13 Dec 2007 18:43:43 +0000 (12:43 -0600)]
[SCSI] iscsi class: bump version

Update version.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi_tcp: fix setting of r2t
Mike Christie [Thu, 13 Dec 2007 18:43:42 +0000 (12:43 -0600)]
[SCSI] iscsi_tcp: fix setting of r2t

If we negotiate for X r2ts we have to use only X r2ts. We cannot
round up (we could send less though). It is ok to fail if it
is not something the driver can handle, so this patch just does
that.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi: use is_power_of_2
vignesh babu [Thu, 13 Dec 2007 18:43:41 +0000 (12:43 -0600)]
[SCSI] libiscsi: use is_power_of_2

Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)

Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi_tcp: hold lock during data rsp processing
Mike Christie [Thu, 13 Dec 2007 18:43:40 +0000 (12:43 -0600)]
[SCSI] iscsi_tcp: hold lock during data rsp processing

iscsi_data_rsp needs to hold the sesison lock when it calls
iscsi_update_cmdsn.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi_tcp: enable sg chaining
Mike Christie [Thu, 13 Dec 2007 18:43:39 +0000 (12:43 -0600)]
[SCSI] iscsi_tcp: enable sg chaining

The previous patches converted iscsi_tcp to support sg chaining.
This patch sets the proper flags and sets sg_table size to
4096. This allows fs io to be capped at max_sectors, but passthrough
IO to be limited by some other part of the kernel.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi, iscsi class: set tmf to a safe default and export in sysfs
Mike Christie [Thu, 13 Dec 2007 18:43:38 +0000 (12:43 -0600)]
[SCSI] libiscsi, iscsi class: set tmf to a safe default and export in sysfs

Older tools will not be setting the tmf time outs since they
did not exists, so set them to a safe default.

And export abort and lu reset timeout values in sysfs.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi_tcp: drop session when itt does not match any command
Mike Christie [Thu, 13 Dec 2007 18:43:37 +0000 (12:43 -0600)]
[SCSI] iscsi_tcp: drop session when itt does not match any command

A target should never send us a itt that does not match a running
task. If it does we do not really know what is coming down after the header,
unless we evaluate the hdr and do some guessing sometimes. However,
even if we know what is coming we probably do not have buffers for it or we
cannot respond (if it is a r2t for example), so just drop the session.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi_tcp: stop leaking r2t_info's when the incoming R2T is bad
Olaf Kirch [Thu, 13 Dec 2007 18:43:36 +0000 (12:43 -0600)]
[SCSI] iscsi_tcp: stop leaking r2t_info's when the incoming R2T is bad

iscsi_r2t_rsp checks the incoming R2T for sanity, and if it
thinks it's fishy, it will drop it silently. In this case, we
leaked an r2t_info object. If we do this often enough, we run
into a BUG_ON some time later.

Removed r2t wrappers and update patch by Mike Christie

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi: convert xmit path to iscsi chunks
Olaf Kirch [Thu, 13 Dec 2007 18:43:35 +0000 (12:43 -0600)]
[SCSI] iscsi: convert xmit path to iscsi chunks

Convert xmit to iscsi chunks.

from michaelc@cs.wisc.edu:

Bug fixes, more digest integration, sg chaining conversion and other
sg wrapper changes, coding style sync up, and removal of io fields,
like pdu_sent, that are not needed.

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi: Drop host lock in queuecommand
Mike Christie [Thu, 13 Dec 2007 18:43:34 +0000 (12:43 -0600)]
[SCSI] libiscsi: Drop host lock in queuecommand

The driver does not need the host lock in queuecommand so drop it.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi: clear conn->ctask when task is completed early
Mike Christie [Thu, 13 Dec 2007 18:43:33 +0000 (12:43 -0600)]
[SCSI] libiscsi: clear conn->ctask when task is completed early

If the current ctask is failed early, we legt the conn->ctask pointer
pointing to a invalid task. When the xmit thread would send data for
it, we would then oops.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi: Do not fail commands immediately during logout
Mike Christie [Thu, 13 Dec 2007 18:43:32 +0000 (12:43 -0600)]
[SCSI] libiscsi: Do not fail commands immediately during logout

If the target requests a logout, then we do not want
to fail commands to scsi-ml right away. This patch just
fails in pending commands for a requeue immediately, and then lets
iscsid handle running commands like normal recovery.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi_tcp: update the website URL
FUJITA Tomonori [Thu, 13 Dec 2007 18:43:31 +0000 (12:43 -0600)]
[SCSI] iscsi_tcp: update the website URL

Use open-iscsi.org instead of linux-iscsi.sf.net, which hasn't been
updated for ages.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi: fix nop handling
Mike Christie [Thu, 13 Dec 2007 18:43:30 +0000 (12:43 -0600)]
[SCSI] libiscsi: fix nop handling

During root boot and shutdown the target could send us nops.
At this time iscsid cannot be running, so the target will drop
the session and the boot or shutdown will hang.

To handle this and allow us to better control when to check the network
this patch moves the nop handling to the kernel.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi: fix shutdown
Mike Christie [Thu, 13 Dec 2007 18:43:29 +0000 (12:43 -0600)]
[SCSI] libiscsi: fix shutdown

We were using the device delete sysfs file to remove each device
then logout. Now in 2.6.21 this will not work because
the sysfs delete file returns immediately and does not wait for
the device removal to complete. This causes a hang if a cache sync
is needed during shutdown. Before .21, that approach had other
problems, so this patch fixes the shutdown code so that we remove the target
and unbind the session before logging out and shut down the session

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi: grab eh_mutex during host reset
Mike Christie [Thu, 13 Dec 2007 18:43:28 +0000 (12:43 -0600)]
[SCSI] libiscsi: grab eh_mutex during host reset

I thought we may not need the eh mutex during host reset, but that is wrong
with the new shutdown code. When start_session_recovery sets the state to
terminate then drops the session lock. The scsi eh thread could then grab the
session lock see that we are terminating and then return failed to scsi-ml.
scsi-ml's eh then owns the command and will do whatever it wants
with it. But then the iscsi eh thread could grab the session lock
and want to complete the scsi commands that we in the LLD, but
it no longer owns them and kaboom.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi class: Use our own workq instead of common system one.
Mike Christie [Thu, 13 Dec 2007 18:43:27 +0000 (12:43 -0600)]
[SCSI] iscsi class: Use our own workq instead of common system one.

There is just too much going on through the common workq and
something like a scsi device removal through sysfs affects
how long it will take to recover the transport, mark it as
failed, or shut it down gracefully.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi: do not block session during logout
Mike Christie [Thu, 13 Dec 2007 18:43:26 +0000 (12:43 -0600)]
[SCSI] libiscsi: do not block session during logout

There is not need to block the session during logout. Since
we are going to fail the commands that were blocked just fail them
immediately instead.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi, iscsi_tcp: iscsi pool cleanup
Olaf Kirch [Thu, 13 Dec 2007 18:43:25 +0000 (12:43 -0600)]
[SCSI] libiscsi, iscsi_tcp: iscsi pool cleanup

iscsi_pool_init simplified

iscsi_pool_init currently has a lot of duplicate kfree() calls it does
when some allocation fails. This patch simplifies the code a little by
using iscsi_pool_free to tear down the pool in case of an error.

iscsi_pool_init also returns a copy of the item array to the caller.
Not all callers use this array, so we make it optional.

Instead of allocating a second array and return that, allocate just one
array, of twice the size.

Update users of iscsi_pool_{init,free}

This patch drops the (now useless) second argument to
iscsi_pool_free, and updates all callers.

It also removes the ctask->r2ts array, which was never
used anyway. Since the items argument to iscsi_pool_init
is now optional, we can pass NULL instead.

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi,iser: patch for AHS support
Boaz Harrosh [Thu, 13 Dec 2007 18:43:24 +0000 (12:43 -0600)]
[SCSI] libiscsi,iser: patch for AHS support

  - The default initialization of hdr_max is the minimum -
    sizeof(struct iscsi_cmd) - Once this patch goes into iser the default
    initialization at libiscsi can be removed.
  - This is not yet full support for AHSs at iser end. But it should be easy.
    Just allocate more space at iser_desc right after iscsi_hdr. Than
    at transmission time use ctask->hdr_len to retrieve the total
    size of all iscsi pdu headers. See previous patch at iscsi_tcp.[ch]

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi_tcp, libiscsi: initial AHS Support
Boaz Harrosh [Thu, 13 Dec 2007 18:43:23 +0000 (12:43 -0600)]
[SCSI] iscsi_tcp, libiscsi: initial AHS Support

  at libiscsi generic code
  - currently code assumes a storage space of pdu header is allocated
    at llds ctask and is pointed to by iscsi_cmd_task->hdr. Here I add
    a hdr_max field pertaining to that storage, and an hdr_len that
    accumulates the current use of the pdu-header.

  - Add an iscsi_next_hdr() inline which returns the next free space
    to write new Header at. Also iscsi_next_hdr() is used to retrieve
    the address at which to write the header-digest.

  - Add iscsi_add_hdr(length). What the user do is calls iscsi_next_hdr()
    for address of the new header, than calls iscsi_add_hdr(length) with
    the size of the new header. iscsi_add_hdr() will check if space is
    available and update to the new size. length must be padded according
    to standard.

  - Add 2 padding inline helpers thanks to Olaf. Current patch does not
    use them but Following patches will.
    Also moved definition of ISCSI_PAD_LEN to iscsi_proto.h which had
    PAD_WORD_LEN that was never used anywhere.

  - Let iscsi_prep_scsi_cmd_pdu() signal an Error return since now  it is
    possible that it will fail.

  - I was tired of yet again writing a "this is a digest" comment next to
    sizeof(__u32) so I defined a new ISCSI_DIGEST_SIZE. Now I don't need
    any comments. Changed all places that used sizeof(__u32) or "4" in
    connection to a digest.

  iscsi_tcp specific code
  - At struct iscsi_tcp_cmd_task allocate maximum space allowed in
    standard for all headers following the iscsi_cmd header. and mark
    it so in iscsi_tcp_session_create()
  - At iscsi_send_cmd_hdr() retrieve the correct headers size and
    write header digest at iscsi_next_hdr().

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi: Prettify resid handling and some extra checks
Boaz Harrosh [Thu, 13 Dec 2007 18:43:22 +0000 (12:43 -0600)]
[SCSI] iscsi: Prettify resid handling and some extra checks

  - Check to see that OVERFLOW is not negative indicating
    a bug.
  - Unify handling of UNDERFLOW and OVERFLOW to the same
    code.
  - Also handle BIDI_OVERFLOW.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] iscsi_tcp: rewrite recv path
Olaf Kirch [Thu, 13 Dec 2007 18:43:21 +0000 (12:43 -0600)]
[SCSI] iscsi_tcp: rewrite recv path

Rewrite recv path. Fixes:
- data digest processing and error handling.
- ahs support.

Some fixups by Mike Christie

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libiscsi, iscsi_tcp: add device support
Mike Christie [Thu, 13 Dec 2007 18:43:20 +0000 (12:43 -0600)]
[SCSI] libiscsi, iscsi_tcp: add device support

This patch adds logical unit reset support. This should work for ib_iser,
but I have not finished testing that driver so it is not hooked in yet.

This patch also temporarily reverts the iscsi_tcp r2t write out patch.
That code is completely rewritten in this patchset.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] make pcmcia directory use obj-y|m instead of subdir-y|m
Tejun Heo [Fri, 7 Dec 2007 13:36:23 +0000 (22:36 +0900)]
[SCSI] make pcmcia directory use obj-y|m instead of subdir-y|m

subdir-y|m isn't supposed to contain modules or built-in components.
Change subdir-$(CONFIG_PCMCIA) to obj-$(CONFIG_PCMCIA).

Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] ipr: use LIST_HEAD instead of LIST_HEAD_INIT
Denis Cheng [Fri, 14 Dec 2007 00:14:27 +0000 (16:14 -0800)]
[SCSI] ipr: use LIST_HEAD instead of LIST_HEAD_INIT

Signed-off-by: Denis Cheng <crquan@gmail.com>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] gdth: kill unneeded 'irq' argument
Jeff Garzik [Fri, 14 Dec 2007 00:14:12 +0000 (16:14 -0800)]
[SCSI] gdth: kill unneeded 'irq' argument

Neither gdth_get_status() nor __gdth_interrupt() need their 'irq' argument,
so remove it.

[akpm@linux-foundation.org: coding style fixes]
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] sym53c416: kill pointless irq handler loop and test
Jeff Garzik [Fri, 14 Dec 2007 00:14:13 +0000 (16:14 -0800)]
[SCSI] sym53c416: kill pointless irq handler loop and test

- kill pointless irq handler loop to find base address, it is already
  passed to irq handler via Scsi_Host.

- kill now-pointless !base test.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] NCR5380: minor irq handler cleanups
Jeff Garzik [Fri, 14 Dec 2007 00:14:14 +0000 (16:14 -0800)]
[SCSI] NCR5380: minor irq handler cleanups

* remove unnecessary cast

* remove unnecessary use of 'irq' function arg

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] sgiwd93: export sgiwd93_reset()
Andrew Morton [Fri, 14 Dec 2007 00:14:23 +0000 (16:14 -0800)]
[SCSI] sgiwd93: export sgiwd93_reset()

mips allmodconfig:

ERROR: "sgiwd93_reset" [drivers/scsi/wd33c93.ko] undefined!

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] aacraid: fix driver failure with Dell PowerEdge Expandable RAID Controller...
Salyzyn, Mark [Fri, 14 Dec 2007 00:14:18 +0000 (16:14 -0800)]
[SCSI] aacraid: fix driver failure with Dell PowerEdge Expandable RAID Controller 3/Di

As reported in http://bugzilla.kernel.org/show_bug.cgi?id=3D9133 it was
discovered that the PERC line of controllers lacked a key 64 bit
ScatterGather capable SCSI pass-through function. The adapters are still
capable of 64 bit ScatterGather I/O commands, but these two can not be
mixed. This problem was exacerbated by the introduction of the SCSI
Generic access to the DASD physical devices.

The fix for users before this patch is applied is aacraid.dacmode=3D0 on
the kernel command line to disable 64 bit I/O.

The enclosed patch introduces a new adapter quirk and tries to limp
along by enabling pass-through in situations where memory is 32 bit
addressable on 64 bit machines, or disable the pass-through functions
altogether. I expect that the check for 32 bit addressable memory to be
controversial in that it can be incorrect in non-Dell non-Intel systems
that PERC would never be installed under, the alternative is to disable
pass-through in all cases which could be reported as another regression.

Pass-through is used for SCSI Generic access to the physical devices, or
for the management applications to properly function.

In systems where this patch has disabled pass-through because it is
unsupportable in combination with I/O performance, the user can choose
to enable pass-through by turning off dacmode (aacraid.dacmode=3D0) or
limiting the discovered kernel memory (mem=3D4G) with an associated loss
in runtime performance. If we chose instead to turn off 64 bit dacmode
for the adapters with this quirk, then this would be reported as another
regression.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] hptiop: add more adapter models and other fixes
HighPoint Linux Team [Fri, 14 Dec 2007 00:14:26 +0000 (16:14 -0800)]
[SCSI] hptiop: add more adapter models and other fixes

Most code changes were made to support adapters based on Marvell IOP, plus some
other fixes.

- add more PCI device IDs
- support for adapters based on Marvell IOP
- fix a result code translation error on big-endian systems
- fix resource releasing bug when scsi_host_alloc() fail in hptiop_probe()
- update scsi_cmnd.resid when finishing a request
- correct some coding style issues

[akpm@linux-foundation.org: type fixes]
Signed-off-by: HighPoint Linux Team <linux@highpoint-tech.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] aic94xx: fix section mismatches
Randy Dunlap [Mon, 29 Oct 2007 18:20:35 +0000 (11:20 -0700)]
[SCSI] aic94xx: fix section mismatches

Fix section mismatch warning:

WARNING: vmlinux.o(.init.text+0x23be6): Section mismatch: reference to .exit.text:asd_unmap_ha (between 'asd_pci_probe' and 'qla4xxx_module_init')
+
WARNING: vmlinux.o(.text+0x1ec8a8): Section mismatch: reference to .exit.text:as
d_unmap_ioport (between 'asd_unmap_ha' and 'asd_remove_dev_attrs')
WARNING: vmlinux.o(.text+0x1ec8b1): Section mismatch: reference to .exit.text:as
d_unmap_memio (between 'asd_unmap_ha' and 'asd_remove_dev_attrs')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] ips: handle scsi_add_host() failure, and other err cleanups
Jeff Garzik [Fri, 14 Dec 2007 00:14:10 +0000 (16:14 -0800)]
[SCSI] ips: handle scsi_add_host() failure, and other err cleanups

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] ips: PCI API cleanups
Jeff Garzik [Fri, 14 Dec 2007 00:14:09 +0000 (16:14 -0800)]
[SCSI] ips: PCI API cleanups

* pass Scsi_Host to ips_remove_device() via pci_set_drvdata(),
  allowing us to eliminate the ips_ha[] search loop and call
  ips_release() directly.

* call pci_{request,release}_regions() and eliminate individual
  request/release_[mem_]region() calls

* call pci_disable_device(), paired with pci_enable_device()

* s/0/NULL/ in a few places

* check ioremap() return value

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] ips: trim trailing whitespace
Jeff Garzik [Fri, 14 Dec 2007 00:14:08 +0000 (16:14 -0800)]
[SCSI] ips: trim trailing whitespace

[akpm@linux-foundation.org: coding style fixes]
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] ips: remove ips_ha members that duplicate struct pci_dev members
Jeff Garzik [Fri, 14 Dec 2007 00:14:07 +0000 (16:14 -0800)]
[SCSI] ips: remove ips_ha members that duplicate struct pci_dev members

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] sym2: fix section mismatch warning
Randy Dunlap [Mon, 29 Oct 2007 18:20:40 +0000 (11:20 -0700)]
[SCSI] sym2: fix section mismatch warning

Fix section mismatch warning:

WARNING: vmlinux.o(.text+0x1ff3a2): Section mismatch: reference to .exit.text:sym2_remove (between 'sym2_io_error_detected' and 'sym_xpt_done')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] lpfc: minor cleanups
Adrian Bunk [Mon, 5 Nov 2007 17:07:33 +0000 (18:07 +0100)]
[SCSI] lpfc: minor cleanups

This patch contains the following minor cleanups:
- make the following needlessly global functions static:
  - lpfc_els.c: lpfc_register_new_vport()
  - lpfc_els.c: lpfc_issue_els_fdisc()
  - lpfc_els.c: lpfc_issue_fabric_iocb()
  - lpfc_els.c: lpfc_fabric_abort_vport()
  - lpfc_hbadisc.c: lpfc_dev_loss_tmo_handler()
  - lpfc_hbadisc.c: lpfc_mbx_cmpl_clear_la()
  - lpfc_hbadisc.c: lpfc_disc_flush_list()
  - lpfc_hbadisc.c: __lpfc_find_node()
  - lpfc_init.c: lpfc_hb_timeout()
  - lpfc_init.c: lpfc_block_mgmt_io()
  - lpfc_sli.c: __lpfc_sli_release_iocbq()
  - lpfc_sli.c: lpfc_sli_next_hbq_slot()
  - lpfc_sli.c: lpfc_sli_hbqbuf_init_hbqs()
  - lpfc_sli.c: lpfc_sli_hbqbuf_find()
  - lpfc_sli.c: __lpfc_sli_issue_iocb()
- #if 0 the following unused global functions:
  - lpfc_els.c: lpfc_fabric_abort_flogi()
  - lpfc_hbadisc.c: lpfc_find_node()
  - lpfc_hbadisc.c: lpfc_findnode_rpi()
- remove the unused exports

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: James Smart <James.Smart@Emulex.Com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] sd,sr: add early detection of medium not present
James Bottomley [Sun, 2 Dec 2007 17:10:40 +0000 (19:10 +0200)]
[SCSI] sd,sr: add early detection of medium not present

The current scsi_test_unit_ready() is updated to return sense code
information (in struct scsi_sense_hdr).  The sd and sr drivers are
changed to interpret the sense code return asc 0x3a as no media and
adjust the device status accordingly.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] BUG_ON() impossible condition in sg list counting
Rusty Russell [Mon, 19 Nov 2007 00:28:48 +0000 (11:28 +1100)]
[SCSI] BUG_ON() impossible condition in sg list counting

If blk_rq_map_sg wrote more than was allocated in the scatterlist,
BUG_ON() is probably the right thing to do.

[jejb: rejections fixed up]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] tgt: fix build when dprintk is defined
Randy Dunlap [Thu, 15 Nov 2007 09:53:25 +0000 (11:53 +0200)]
[SCSI] tgt: fix build when dprintk is defined

Fix scsi_tgt_lib build when dprintk is defined:
Also fix accessors problem when dprintk is defined

drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_cmd_destroy':
drivers/scsi/scsi_tgt_lib.c:183: warning: format '%lu' expects type 'long unsigned int', but argument 6 has type 'unsigned int'
drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_cmd_done':
drivers/scsi/scsi_tgt_lib.c:330: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'unsigned int'
drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_transfer_response':
drivers/scsi/scsi_tgt_lib.c:345: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'unsigned int'
drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_init_cmd':
drivers/scsi/scsi_tgt_lib.c:368: warning: format '%lu' expects type 'long unsigned int', but argument 6 has type 'unsigned int'
drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_kspace_exec':
drivers/scsi/scsi_tgt_lib.c:499: warning: format '%lu' expects type 'long unsigned int', but argument 9 has type 'unsigned int'
drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_kspace_it_nexus_rsp':
drivers/scsi/scsi_tgt_lib.c:620: error: 'mid' undeclared (first use in this function)
drivers/scsi/scsi_tgt_lib.c:620: error: (Each undeclared identifier is reported only once
drivers/scsi/scsi_tgt_lib.c:620: error: for each function it appears in.)
make[2]: *** [drivers/scsi/scsi_tgt_lib.o] Error 1

[tomo:
> -     dprintk("%d %d %llx\n", host_no, result, (unsigned long long) mid);
> +     dprintk("%d %d\n", host_no, result);

'mid' is a typo. I wanted to do:

        dprintk("%d %d %llx\n", host_no, result, (unsigned long long)itn_id);

The rest looks ok. Thanks,
]

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] aacraid: don't assign cpu_to_le32(int) to u8
Christoph Hellwig [Thu, 8 Nov 2007 17:27:47 +0000 (17:27 +0000)]
[SCSI] aacraid: don't assign cpu_to_le32(int) to u8

On Wed, Nov 07, 2007 at 01:51:44PM -0500, Salyzyn, Mark wrote:
> Christoph Hellwig [mailto:hch@infradead.org] sez:
> > Did anyone run the driver through sparse to see if we have
> > more issues like this?
>
> There are some warnings from sparse, none like this one. I will deal
> with the warnings ...

Actually there are a lot of endianess warnings, fortunately most of them
harmless.  The patch below fixes all of them up (including the ones in
the patch I replied to), except for aac_init_adapter which is really odd
and I don't know what to do.

[jejb fixed up rejections and checkpatch issues]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Mark Salyzyn <mark_salyzyn@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] qla2xxx: Update version number to 8.02.00-k6.
Andrew Vasquez [Mon, 12 Nov 2007 18:31:00 +0000 (10:31 -0800)]
[SCSI] qla2xxx: Update version number to 8.02.00-k6.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] qla2xxx: Properly handle Vport state-change-notifications.
Shyam Sundar [Mon, 12 Nov 2007 18:30:59 +0000 (10:30 -0800)]
[SCSI] qla2xxx: Properly handle Vport state-change-notifications.

Drivers do SCRs for each Vport. When something changes in the
fabric, firmware generates one interrupt for each RSCN. Based on
the current implementation, in each case, we make recursive calls
to handle RSCN for physical and each subsequent virtual ports.
The fix is to also take into consideration the vp_idx, which is
set by the firmware to indicate the vport the RSCN was meant for.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] qla2xxx: Correct NPIV support for recent ISPs.
Andrew Vasquez [Mon, 12 Nov 2007 18:30:58 +0000 (10:30 -0800)]
[SCSI] qla2xxx: Correct NPIV support for recent ISPs.

Firmware will export to software the maximum number of vports
supported for any given firmware version and ISP type.  Use this
information rather than the current hardcoding of limitations
within the driver.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] qla2xxx: Don't explicitly read mbx registers while processing a system-error.
Andrew Vasquez [Mon, 12 Nov 2007 18:30:57 +0000 (10:30 -0800)]
[SCSI] qla2xxx: Don't explicitly read mbx registers while processing a system-error.

Callers of qla2x00_async_event() already populate the mb[] array
upon invocation, doing so via the appropriate mailbox register
accessors.  The stale codes removed are leftover-bits kept during
the FWI2 transition.  Though relatively benign, the extra-reads
are not valid for FWI2 boards (ISP24xx and above) and peek into
the incorrect regions of registers.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] ibmvscsi: requeue while CRQ closed
Robert Jennings [Mon, 12 Nov 2007 15:00:23 +0000 (09:00 -0600)]
[SCSI] ibmvscsi: requeue while CRQ closed

CRQ send errors that return with H_CLOSED should return with
SCSI_MLQUEUE_HOST_BUSY until firmware alerts the client of a CRQ
transport event.  The transport event will either reinitialize and
requeue the requests or fail and return IO with DID_ERROR.

To avoid failing the eh_* functions while re-attaching to the server
adapter this will retry for a period of time while ibmvscsi_send_srp_event
returns SCSI_MLQUEUE_HOST_BUSY.

In ibmvscsi_eh_abort_handler() the loop includes the search of the
event list.  The lock on the hostdata is dropped while waiting to try
again after failing ibmvscsi_send_srp_event.  The event could have been
purged if a login was in progress when the function was called.

In ibmvscsi_eh_device_reset_handler() the loop includes the call to
get_event_struct() because a failing call to ibmvscsi_send_srp_event()
will have freed the event struct.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] docbook and kernel-doc updates
Randy Dunlap [Thu, 15 Nov 2007 23:42:30 +0000 (15:42 -0800)]
[SCSI] docbook and kernel-doc updates

- Change title to remove "Mid-Layer" since the doc is about all of the
SCSI layers.
- Use "SCSI" instead of "scsi" in docbook text.
- Use "*/" to end kernel-doc notation blocks.
- A few other minor typo fixes.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] kernel-doc: use correct function name
Randy Dunlap [Fri, 16 Nov 2007 01:07:28 +0000 (17:07 -0800)]
[SCSI] kernel-doc: use correct function name

Use correct function name in kernel-doc.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] boot options: correct option name and tell where to find docs for it
Randy Dunlap [Thu, 15 Nov 2007 00:52:25 +0000 (16:52 -0800)]
[SCSI] boot options: correct option name and tell where to find docs for it

Minor corrections and additions to 'scsi_logging_level', as pointed out
by Chuck Ebbert.
Also point out the IBM S390-tools 'scsi_logging_level' script.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] move single_lun flag from scsi_device to scsi_target
Tony Battersby [Mon, 12 Nov 2007 15:00:44 +0000 (10:00 -0500)]
[SCSI] move single_lun flag from scsi_device to scsi_target

Some SCSI tape medium changers that need the BLIST_SINGLELUN flag have
the medium changer at one LUN and the tape drive at a different LUN.
The inquiry string of the tape drive may be different from that of the
medium changer.  In order for single_lun to be effective, every
scsi_device under a given scsi_target must have it set.  This means that
there needs to be a blacklist entry for BOTH the medium changer AND the
tape drive, which is impractical because some medium changers may be
paired with a variety of different tape drive models.  It makes more
sense to put the single_lun flag in scsi_target instead of scsi_device,
which causes every device at a given target ID to inherit the single_lun
flag from one LUN.  This makes it possible to blacklist just the medium
changer and not the tape drive.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] megaraid_sas: Update version and changelog
bo yang [Fri, 9 Nov 2007 09:44:56 +0000 (04:44 -0500)]
[SCSI] megaraid_sas: Update version and changelog

Update version and changelog

Signed-off-by: Bo Yang <bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] megaraid_sas: support for poll_mode_io (reduced interrupt)
bo yang [Fri, 9 Nov 2007 09:40:16 +0000 (04:40 -0500)]
[SCSI] megaraid_sas: support for poll_mode_io (reduced interrupt)

Added module parameter "poll_mode_io" to support for "polling"
(reduced interrupt operation).  In this mode, IO completion interrupts
are delayed. At the end of initiating IOs, the driver schedules for
cmd completion if there are pending cmds.  A timer-based interrupt has
also been added to prevent IO completion from being delayed
indefinitely in the case that no new IOs are initiated.  Some
formatting issues in resume, suspend comment block also corrected

Signed-off-by: Bo Yang <bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] megaraid_sas: call cmd completion from reset
bo yang [Fri, 9 Nov 2007 09:35:44 +0000 (04:35 -0500)]
[SCSI] megaraid_sas: call cmd completion from reset

Driver will call cmd completion routine from Reset path without waiting for cmd completion from isr context.

Signed-off-by: Bo Yang <bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] megaraid_sas: use unsigned long for sense_buff ptr
bo yang [Fri, 9 Nov 2007 09:28:47 +0000 (04:28 -0500)]
[SCSI] megaraid_sas: use unsigned long for sense_buff ptr

MegaRAID utilities expect sense_buff to be of type unsigned long.

Signed-off-by: Bo Yang <bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] megaraid_sas: check max_sgl reported by FW for setting max_sectors_per_req
bo yang [Fri, 9 Nov 2007 09:14:00 +0000 (04:14 -0500)]
[SCSI] megaraid_sas: check max_sgl reported by FW for setting max_sectors_per_req

1. Setting the max_sectors_per_req based on max SGL supported by the
   FW. Prior versions calculated this value from controller info's
   max_sectors_1, max_sectors_2. For certain controllers/FW, this was
   resulting in a value greater than max SGL supported by the FW. Now
   we take the min of max sgl from FW and max_sectors calculation.

2. Increased MFI_POLL_TIMEOUT_SECS to 60 seconds from 10. FW may take
   a max of 60 seconds to respond to the INIT cmd.

Signed-off-by: Bo Yang <bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] megaraid_sas: add hibernation support
bo yang [Wed, 7 Nov 2007 17:09:50 +0000 (12:09 -0500)]
[SCSI] megaraid_sas: add hibernation support

Adding hibernation support. suspend, resume routine implemented.

Signed-off-by: Bo Yang <bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] 3w-9xxx: fix abysmal write performance on some motherboards
Tony Battersby [Fri, 9 Nov 2007 18:04:35 +0000 (13:04 -0500)]
[SCSI] 3w-9xxx: fix abysmal write performance on some motherboards

The 3ware 9500S-8 SATA RAID controller exhibits terrible write
performance when PCI memory-write-and-invalidate is disabled.  This is
easy to demonstrate by replacing pci_try_set_mwi() in the patch below
with pci_clear_mwi().  My benchmarks show the following:

MWI disabled: 15 MB/s write, 330 MB/s read
MWI enabled:  240 MB/s write, 330 MB/s read

Most motherboards will enable MWI without the driver having to set it
explicitly, so most people probably wouldn't encounter this problem.
For the few motherboards that don't enable it, this patch could give a
16x performance improvement for writing.

This issue does not seem to affect the 9550SX controller, but the patch
doesn't hurt it either.  I haven't tested any of the other 3ware
controllers.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: adam radford <aradford@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libsas: Fix various sparse complaints
Darrick J. Wong [Mon, 5 Nov 2007 19:52:14 +0000 (11:52 -0800)]
[SCSI] libsas: Fix various sparse complaints

Annotate sas_queuecommand with locking details, and clean up a few
more sparse warnings about static/non-static declarations.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] libsas: Convert sas_proto users to sas_protocol
Darrick J. Wong [Mon, 5 Nov 2007 19:51:17 +0000 (11:51 -0800)]
[SCSI] libsas: Convert sas_proto users to sas_protocol

sparse complains about the mixing of enums in libsas.  Since the
underlying numeric values of both enums are the same, combine them
to get rid of the warning.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] megaraid_sas: Convert aen_mutex to the mutex API
Matthias Kaehlcke [Sat, 27 Oct 2007 07:48:46 +0000 (09:48 +0200)]
[SCSI] megaraid_sas: Convert aen_mutex to the mutex API

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: Bo Yang <Bo.Yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] imm: convert to accessors and !use_sg cleanup
Boaz Harrosh [Sun, 9 Sep 2007 18:13:42 +0000 (21:13 +0300)]
[SCSI] imm: convert to accessors and !use_sg cleanup

 - convert to accessors and !use_sg cleanup
 - Not ready for sg-chaining

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Tested-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] ppa: convert to accessors and !use_sg cleanup
Boaz Harrosh [Sun, 9 Sep 2007 18:16:58 +0000 (21:16 +0300)]
[SCSI] ppa: convert to accessors and !use_sg cleanup

 - convert to accessors and !use_sg cleanup

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Tested-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] DocBook scsi_midlayer.tmpl->scsi.tmpl
James Bottomley [Thu, 15 Nov 2007 00:01:21 +0000 (18:01 -0600)]
[SCSI] DocBook scsi_midlayer.tmpl->scsi.tmpl

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] Add Documentation and integrate into docbook build
Rob Landley [Sat, 3 Nov 2007 18:30:39 +0000 (13:30 -0500)]
[SCSI] Add Documentation and integrate into docbook build

Add Documentation/DocBook/scsi_midlayer.tmpl, add to Makefile, and update
lots of kerneldoc comments in drivers/scsi/*.

Updated with comments from Stefan Richter, Stephen M. Cameron,
 James Bottomley and Randy Dunlap.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Reduce flood on hba trace
Christof Schmitt [Mon, 5 Nov 2007 11:37:48 +0000 (12:37 +0100)]
[SCSI] zfcp: Reduce flood on hba trace

Remove tracing for request with a "qualifier" field set in the
response.  The protocol status qualifier now contains measurement
data for "good" commands, so this check would trace every response
by default.

The fix is to simply remove the "qual" tracing: The responses with an
interesting status are also traced as "ferr" or "perr" and all
responses can be traced as "norm" with a higher trace level.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Fix deadlock when adding invalid LUN
Christof Schmitt [Mon, 5 Nov 2007 11:37:47 +0000 (12:37 +0100)]
[SCSI] zfcp: Fix deadlock when adding invalid LUN

When adding an invalid LUN, there is a deadlock between the add
via scsi_scan_target and the slave_destroy handler: The handler
waits for the scan to complete, but for an invalid unit,
scsi_scan_target directly calls the slave_destroy handler.

Fix the deadlock by removing the wait in the slave_destroy
handler, it was not necessary anyway.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Remove SCSI devices when removing complete adapter
Christof Schmitt [Mon, 5 Nov 2007 11:37:46 +0000 (12:37 +0100)]
[SCSI] zfcp: Remove SCSI devices when removing complete adapter

The common I/O layer can call remove a handler to inform zfcp
that a device disappeared. The handler zfcp_ccw_remove then
removes all unit, port and the adapter data structures. Removing
the units requires that the SCSI devices are removed first.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Specify waiting times in ERP in seconds
Christof Schmitt [Mon, 5 Nov 2007 11:37:45 +0000 (12:37 +0100)]
[SCSI] zfcp: Specify waiting times in ERP in seconds

It is not necessary to use jiffies or milliseconds to specify
waiting times that last a couple of seconds.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Use also port and adapter to identify unit in messages.
Christof Schmitt [Mon, 5 Nov 2007 11:37:44 +0000 (12:37 +0100)]
[SCSI] zfcp: Use also port and adapter to identify unit in messages.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] zfcp: Remove unnecessary eh_bus_reset_handler callback
Christof Schmitt [Mon, 5 Nov 2007 11:37:43 +0000 (12:37 +0100)]
[SCSI] zfcp: Remove unnecessary eh_bus_reset_handler callback

The callback function used by zfcp always returns success,
which is an indication for the SCSI midlayer to stop error
handling. Remove the bus_reset callback, since the same
function will be called via the host_reset callback.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] aacraid: forced reset override
Salyzyn, Mark [Tue, 30 Oct 2007 19:50:49 +0000 (15:50 -0400)]
[SCSI] aacraid: forced reset override

Some of our vendors have requested that our adapters ignore the hardware
reset attempts during recovery and have enforced this with changes in
Adapter Firmware. Some of our customers have requested the option to be
able to reset the adapter under adverse adapter failure, we even had a
few defects reported here considering it a regression that the Adapter
could not be reset. This patch addresses this dichotomy. The user can
force the adapter to be reset if it supports the IOP_RESET_ALWAYS
command, in cases where the adapter has been programmed to ignore the
reset, by setting the aacraid.check_reset parameter to a value of -1.

The driver will not reset an Adapter that does not support the reset
command(s).

This patch also fixes and cleans up some of the logic associated with
resetting the adapter.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] NCR5380 family: convert to accessors & !use_sg cleanup
Boaz Harrosh [Mon, 5 Nov 2007 09:23:35 +0000 (11:23 +0200)]
[SCSI] NCR5380 family: convert to accessors & !use_sg cleanup

  - This patch depends on:
      NCR5380: Use scsi_eh API for REQUEST_SENSE invocation
  - convert to accessors and !use_sg cleanup
  - FIXME: Not sg-chain ready look for ++cmd->SCp.buffer

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] wd7000: proper fix for boards without sg support
Boaz Harrosh [Mon, 5 Nov 2007 09:21:40 +0000 (11:21 +0200)]
[SCSI] wd7000: proper fix for boards without sg support

  - code used to set sg_tablesize to zero for board revision
    less than 6. This is no longer supported, therefore I
    use sg_tablesize=1 and open code the sg handling for that case.
  - Get rid of use of SG_NONE which will be removed soon.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] atp870u: convert to accessors and !use_sg cleanup
Boaz Harrosh [Sun, 9 Sep 2007 18:06:23 +0000 (21:06 +0300)]
[SCSI] atp870u: convert to accessors and !use_sg cleanup

 - convert to accessors and !use_sg cleanup
 - Probably not ready for sg-chaining

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Cc: jameshsu <jameshsu@acard.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] scsi_debug: convert to use the data buffer accessors
Boaz Harrosh [Thu, 6 Sep 2007 21:50:20 +0000 (06:50 +0900)]
[SCSI] scsi_debug: convert to use the data buffer accessors

  - remove the unnecessary map_single path.
  - convert to use the new accessors for the sg lists and the
    parameters.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] isd200: use one-element sg list in issuing commands
Boaz Harrosh [Wed, 22 Aug 2007 16:10:45 +0000 (19:10 +0300)]
[SCSI] isd200: use one-element sg list in issuing commands

  - This patch should be commited before:
    usb: transport - convert to accessors and !use_sg code path removal

  - isd200_action() was still using direct liniar pointers in issuing
    commands to the USB transport level. This is no longer supported,
    use one-element scatterlist instead.
  - Adjustment of command's length in the case of scsi-to-ata translation
    is now restored before return to queuecommand, since other wise it can
    leak BIOs.
  - isd200_action() return Error on unknown requests. Used to print an error
    but still try to send garbage cdb.
  - convert few places to scsi data accessors.
  - Todo: This file will need to be changed when scsi_cmnd changes to
    scsi_data_buffer or any other solution.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] usb: transport - convert to accessors and !use_sg code path removal
Boaz Harrosh [Mon, 10 Sep 2007 15:01:08 +0000 (18:01 +0300)]
[SCSI] usb: transport - convert to accessors and !use_sg code path removal

  - This patch depends on:
    usb: transport.c use scsi_eh API in REQUEST_SENSE execution

  - Use scsi data accessors and remove of !use_sg code path.
  - New usb_stor_bulk_srb() for use by drivers

[jejb: updated with corrective fix.

had a bug in residual handling in the new usb_stor_bulk_srb()
function.  Found by Gabriel C. in -mm tree.

Tested-by: Gabriel C <nix.or.die@googlemail.com>
]

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] usb: shuttle_usbat - convert to accessors and !use_sg code path removal
Boaz Harrosh [Sun, 9 Sep 2007 17:40:56 +0000 (20:40 +0300)]
[SCSI] usb: shuttle_usbat - convert to accessors and !use_sg code path removal

 - functions that received char* but where passed scatterlist* mostly
   were changed to receive void*
 - Use scsi data accessors and remove of !use_sg code path

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 years ago[SCSI] usb: freecom & sddr09 - convert to accessors and !use_sg cleanup
Boaz Harrosh [Sun, 9 Sep 2007 17:47:26 +0000 (20:47 +0300)]
[SCSI] usb: freecom & sddr09 - convert to accessors and !use_sg cleanup

 - Use scsi data accessors and remove of !use_sg code path
 - This patch is dependent on cleanup patch to usb transport.c/h

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>