History log of /drivers/scsi/isci/request.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
424a6f6ef990b7e9f56f6627bfc6c46b493faeb4 22-Mar-2012 Linus Torvalds <torvalds@linux-foundation.org> Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6

SCSI updates from James Bottomley:
"The update includes the usual assortment of driver updates (lpfc,
qla2xxx, qla4xxx, bfa, bnx2fc, bnx2i, isci, fcoe, hpsa) plus a huge
amount of infrastructure work in the SAS library and transport class
as well as an iSCSI update. There's also a new SCSI based virtio
driver."

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (177 commits)
[SCSI] qla4xxx: Update driver version to 5.02.00-k15
[SCSI] qla4xxx: trivial cleanup
[SCSI] qla4xxx: Fix sparse warning
[SCSI] qla4xxx: Add support for multiple session per host.
[SCSI] qla4xxx: Export CHAP index as sysfs attribute
[SCSI] scsi_transport: Export CHAP index as sysfs attribute
[SCSI] qla4xxx: Add support to display CHAP list and delete CHAP entry
[SCSI] iscsi_transport: Add support to display CHAP list and delete CHAP entry
[SCSI] pm8001: fix endian issue with code optimization.
[SCSI] pm8001: Fix possible racing condition.
[SCSI] pm8001: Fix bogus interrupt state flag issue.
[SCSI] ipr: update PCI ID definitions for new adapters
[SCSI] qla2xxx: handle default case in qla2x00_request_firmware()
[SCSI] isci: improvements in driver unloading routine
[SCSI] isci: improve phy event warnings
[SCSI] isci: debug, provide state-enum-to-string conversions
[SCSI] scsi_transport_sas: 'enable' phys on reset
[SCSI] libsas: don't recover end devices attached to disabled phys
[SCSI] libsas: fixup target_port_protocols for expanders that don't report sata
[SCSI] libsas: set attached device type and target protocols for local phys
...
77dfce076cbd76c04e90abff188d058cdbff78dd 25-Nov-2011 Cong Wang <amwang@redhat.com> scsi: remove the second argument of k[un]map_atomic()

Signed-off-by: Cong Wang <amwang@redhat.com>
/drivers/scsi/isci/request.c
d7a0ccdd9bd78b5b74d2963ec7ab67c9d896902a 10-Feb-2012 Dan Williams <dan.j.williams@intel.com> [SCSI] isci: debug, provide state-enum-to-string conversions

Debugging the driver requires tracing the state transtions and tracing
state names is less work than decoding numbers.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
43a5ab151f0268459c4368292c2ddb2266b8f243 09-Dec-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] isci: stop interpreting ->lldd_lu_reset() as an ata soft-reset

Driving resets from libsas-eh is pre-mature as libata will make a
decision about performing a softreset. Currently libata determines
whether to perform a softreset based on ata_eh_followup_srst_needed(),
and none of those conditions apply to isci.

Remove the srst implementation and translate ->lldd_lu_reset() for ata
devices as a request to drive a reset via libata-eh.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
312d3e56119a4bc5c36a96818f87f650c069ddc2 18-Nov-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] libsas: remove ata_port.lock management duties from lldds

Each libsas driver (mvsas, pm8001, and isci) has invented a different
method for managing the ap->lock. The lock is held by the ata
->queuecommand() path. mvsas drops it prior to acquiring any internal
locks which allows it to hold its internal lock across calls to
task->task_done(). This capability is important as it is the only way
the driver can flush task->task_done() instances to guarantee that it no
longer has any in-flight references to a domain_device at
->lldd_dev_gone() time.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
3d2d752549150c2706f6bf8d8a2cceb89ef9f42e 10-Feb-2012 Dave Jiang <dave.jiang@intel.com> [SCSI] isci: T10 DIF support

This allows the controller to do WRITE_INSERT and READ_STRIP for SAS
disks that support protection information. SAS disks must be formatted
with protection information to use this feature via sg_format.

sg3_utils-1.32 -- sg_format version 1.19 20110730
sg_format usage:
sg_format --format --verbose --pinfo /dev/sda

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
3b34c169f8197e02529fa3ec703703c2ce418c57 28-Oct-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> [SCSI] isci: Remove redundant isci_request.ttype field.

Use the existing IREQ_TMF flag as a request type indicator.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
0e2e27990e2dcd415f7974e8460a2f05accdddfb 28-Oct-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> [SCSI] isci: Lookup device references through requests in completions.

The LLDD needs to obtain a reference to the device through the request
itself and not through the domain_device, because the
domain_device.lldd_dev is set to NULL early in the lldd_dev_gone call.
This relies on the fact that the isci_remote_device object is keeping a
seperate reference count of outstanding requests. TODO: unify the
request count tracking with the isci_remote_device kref.

The failure signature of this condition looks like the following
log, where the important bits are the call to lldd_dev_gone followed
by a crash in isci_terminate_request_core:

[ 229.151541] isci 0000:0b:00.0: isci_remote_device_gone: domain_device = ffff8801492d4800, isci_device = ffff880143c657d0, isci_port = ffff880143c63658
[ 229.166007] isci 0000:0b:00.0: isci_remote_device_stop: isci_device = ffff880143c657d0
[ 229.175317] isci 0000:0b:00.0: isci_terminate_pending_requests: idev=ffff880143c657d0 request=ffff88014741f000; task=ffff8801470f46c0 old_state=2
[ 229.189702] isci 0000:0b:00.0: isci_terminate_request_core: device = ffff880143c657d0; request = ffff88014741f000
[ 229.201339] isci 0000:0b:00.0: isci_terminate_request_core: before completion wait (ffff88014741f000/ffff880149715ad0)
[ 229.213414] isci 0000:0b:00.0: sci_controller_process_completions: completion queue entry:0x8000a0e9
[ 229.214401] BUG: unable to handle kernel NULL pointer dereference at 0000000000000228
[ 229.214401] IP:jdskirvi-testlbo [<ffffffffa00a58be>] sci_request_completed_state_enter+0x50/0xafb [isci]
[ 229.214401] PGD 13d19e067 PUD 13d104067 PMD 0
[ 229.214401] Oops: 0000 [#1] SMP
[ 229.214401] CPU 0 x kernel: [ 226
[ 229.214401] Modules linked in: ipv6 dm_multipath uinput nouveau snd_hda_codec_realtek snd_hda_intel ttm drm_kms_helper drm snd_hda_codec snd_hwdep snd_pcm snd_timer i2c_algo_bit isci snd libsas ioatdma mxm_wmi iTCO_wdt soundcore snd_page_alloc scsi_transport_sas iTCO_vendor_support wmi dca video i2c_i801 i2c_core [last unloaded: speedstep_lib]
[ 229.214401]
[ 229.214401] Pid: 5, comm: kworker/u:0 Not tainted 3.0.0-isci-11.7.29+ #30.353196] Buffer Intel Corporation Stoakley/Pearlcity Workstation
[ 229.214401] RIP: 0010:[<ffffffffa00a58be>] I/O error on dev [<ffffffffa00a58be>] sci_request_completed_state_enter+0x50/0xafb [isci]
[ 229.214401] RSP: 0018:ffff88014fc03d20 EFLAGS: 00010046
[ 229.214401] RAX: 0000000000000000 RBX: ffff88014741f000 RCX: 0000000000000000
[ 229.214401] RDX: ffffffffa00b2c90 RSI: 0000000000000017 RDI: ffff88014741f0a0
[ 229.214401] RBP: ffff88014fc03d90 R08: 0000000000000018 R09: 0000000000000000
[ 229.214401] R10: 0000000000000000 R11: ffffffff81a17d98 R12: 000000000000001d
[ 229.214401] R13: ffff8801470f46c0 R14: 0000000000000000 R15: 0000000000008000
[ 229.214401] FS: 0000000000000000(0000) GS:ffff88014fc00000(0000) knlGS:0000000000000000
[ 229.214401] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 229.214401] CR2: 0000000000000228 CR3: 000000013ceaa000 CR4: 00000000000406f0
[ 229.214401] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 229.214401] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 229.214401] Process kworker/u:0 (pid: 5, threadinfo ffff880149714000, task ffff880149718000)
[ 229.214401] Call Trace:
[ 229.214401] <IRQ>
[ 229.214401] [<ffffffffa00aa6ce>] sci_change_state+0x4a/0x4f [isci]
[ 229.214401] [<ffffffffa00a4ca6>] sci_io_request_tc_completion+0x79c/0x7a0 [isci]
[ 229.214401] [<ffffffffa00acf35>] sci_controller_process_completions+0x14f/0x396 [isci]
[ 229.214401] [<ffffffffa00abbda>] ? spin_lock_irq+0xe/0x10 [isci]
[ 229.214401] [<ffffffffa00ad2cf>] isci_host_completion_routine+0x71/0x2be [isci]
[ 229.214401] [<ffffffff8107c6b3>] ? mark_held_locks+0x52/0x70
[ 229.214401] [<ffffffff810538e8>] tasklet_action+0x90/0xf1
[ 229.214401] [<ffffffff81054050>] __do_softirq+0xe5/0x1bf
[ 229.214401] [<ffffffff8106d9d1>] ? hrtimer_interrupt+0x129/0x1bb
[ 229.214401] [<ffffffff814ff69c>] call_softirq+0x1c/0x30
[ 229.214401] [<ffffffff8100bb67>] do_softirq+0x4b/0xa3
[ 229.214401] [<ffffffff81053d84>] irq_exit+0x53/0xb4
[ 229.214401] [<ffffffff814fffe7>] smp_apic_timer_interrupt+0x83/0x91
[ 229.214401] [<ffffffff814fee53>] apic_timer_interrupt+0x13/0x20
[ 229.214401] <EOI>
[ 229.214401] [<ffffffff814f7ad4>] ? retint_restore_args+0x13/0x13
[ 229.214401] [<ffffffff8107af29>] ? trace_hardirqs_off+0xd/0xf
[ 229.214401] [<ffffffff8104ea71>] ? vprintk+0x40b/0x452
[ 229.214401] [<ffffffff814f4b5a>] printk+0x41/0x47
[ 229.214401] [<ffffffff81314484>] __dev_printk+0x78/0x7a
[ 229.214401] [<ffffffff8131471e>] dev_printk+0x45/0x47
[ 229.214401] [<ffffffffa00ae2a3>] isci_terminate_request_core+0x15d/0x317 [isci]
[ 229.214401] [<ffffffffa00af1ad>] isci_terminate_pending_requests+0x1a4/0x204 [isci]
[ 229.214401] [<ffffffffa00229f6>] ? sas_phye_oob_error+0xc3/0xc3 [libsas]
[ 229.214401] [<ffffffffa00a7d9e>] isci_remote_device_nuke_requests+0xa6/0xff [isci]
[ 229.214401] [<ffffffffa00a811a>] isci_remote_device_stop+0x7c/0x166 [isci]
[ 229.214401] [<ffffffffa00229f6>] ? sas_phye_oob_error+0xc3/0xc3 [libsas]
[ 229.214401] [<ffffffffa00a827a>] isci_remote_device_gone+0x76/0x7e [isci]
[ 229.214401] [<ffffffffa002363e>] sas_notify_lldd_dev_gone+0x34/0x36 [libsas]
[ 229.214401] [<ffffffffa0023945>] sas_unregister_dev+0x57/0x9c [libsas]
[ 229.214401] [<ffffffffa00239c0>] sas_unregister_domain_devices+0x36/0x65 [libsas]
[ 229.214401] [<ffffffffa0022cb8>] sas_deform_port+0x72/0x1ac [libsas]
[ 229.214401] [<ffffffffa00229f6>] ? sas_phye_oob_error+0xc3/0xc3 [libsas]
[ 229.214401] [<ffffffffa0022a34>] sas_phye_loss_of_signal+0x3e/0x42 [libsas]

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
7582ba8bdf5a119221ef663a327932cfc62bed79 29-Sep-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> [SCSI] isci: fix decode of DONE_CRC_ERR TC completion status

DONE_CRC_ERR is not a RNC suspension condition, so do not change the
state to expect the incoming suspension notification.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
[djbw: dropped DONE_CMD_LL_R_ERR change]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
b50102d3e9a43a75379407c2080f696f61cb286b 01-Oct-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] isci: atapi support

Based on original implementation from Jiangbi Liu and Maciej Trela.

ATAPI transfers happen in two-to-three stages. The two stage atapi
commands are those that include a dma data transfer. The data transfer
portion of these operations is handled by the hardware packet-dma
acceleration. The three-stage commands do not have a data transfer and
are handled without hardware assistance in raw frame mode.

stage1: transmit host-to-device fis to notify the device of an incoming
atapi cdb. Upon reception of the pio-setup-fis repost the task_context
to perform the dma transfer of the cdb+data (go to stage3), or repost
the task_context to transmit the cdb as a raw frame (go to stage 2).

stage2: wait for hardware notification of the cdb transmission and then
go to stage 3.

stage3: wait for the arrival of the terminating device-to-host fis and
terminate the command.

To keep the implementation simple we only support ATAPI packet-dma
protocol (for commands with data) to avoid needing to handle the data
transfer manually (like we do for SATA-PIO). This may affect
compatibility for a small number of devices (see
ATA_HORKAGE_ATAPI_MOD16_DMA).

If the data-transfer underruns, or encounters an error the
device-to-host fis is expected to arrive in the unsolicited frame queue
to pass to libata for disposition. However, in the DONE_UNEXP_FIS (data
underrun) case it appears we need to craft a response. In the
DONE_REG_ERR case we do receive the UF and propagate it to libsas.

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
54b5e3a4bfa3452bc10cd4da672099ccc46b8c09 29-Sep-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] isci: fix support for large smp requests

Kill the local smp response buffer.

Besides being unnecessary, it is too small (currently truncates
responses to 60 bytes). The mid-layer will have already allocated a
sufficiently sized buffer, just kmap and copy into it directly.

Cc: <stable@kernel.org>
Reported-by: Derick Marks <derick.w.marks@intel.com>
Tested-by: Derick Marks <derick.w.marks@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
39ea2c5b5ffaa344467da53e885cfa4ac0105050 30-Jul-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> [SCSI] isci: Leave requests alone if already terminating.

Instead of immediately completing any request that has a second
termination call made on it, wait for the TC done/abort HW event.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
1a878284473284f9577d44babf16d87152a05c33 30-Jul-2011 Dan Williams <dan.j.williams@intel.com> [SCSI] isci: fix sata response handling

A bug (likely copy/paste) that has been carried from the original
implementation. The unsolicited frame handling structure returns the
d2h fis in the isci_request.stp.rsp buffer.

Cc: <stable@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
/drivers/scsi/isci/request.c
a8a0a133b03c6863d0f77229d19befca4de905fa 01-Jul-2011 Dan Williams <dan.j.williams@intel.com> isci: pare back error messsages

The messages emitted from task.c and some from request.c likely
duplicate (in a less undertandable way) what is reported by the
midlayer.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
16ba77091b44af28b3ff3318b4a2aa4fbf7d4c24 01-Jul-2011 Dan Williams <dan.j.williams@intel.com> isci: merge sata.[ch] into request.c

Undo some needless separation.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
34a991587a5cc9f78960c2c9beea217866458c41 01-Jul-2011 Dan Williams <dan.j.williams@intel.com> isci: kill 'get/set' macros

Most of these simple dereference macros are longer than their open coded
equivalent. Deleting enum sci_controller_mode is thrown in for good
measure.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
89a7301f21fb00e753089671eb9e4132aab8ea08 01-Jul-2011 Dan Williams <dan.j.williams@intel.com> isci: retire scic_sds_ and scic_ prefixes

The distinction between scic_sds_ scic_ and sci_ are no longer relevant
so just unify the prefixes on sci_. The distinction between isci_ and
sci_ is historically significant, and useful for comparing the old
'core' to the current Linux driver. 'sci_' represents the former core as
well as the routines that are closer to the hardware and protocol than
their 'isci_' brethren. sci == sas controller interface.

Also unwind the 'sds1' out of the parameter structs.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
d9dcb4ba791de2a06b19ac47cd61601cf3d4e208 01-Jul-2011 Dan Williams <dan.j.williams@intel.com> isci: unify isci_host and scic_sds_controller

Remove the distinction between these two implementations and unify on
isci_host (local instances named ihost). Hmmm, we had two
'oem_parameters' instances, one was unused... nice.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
78a6f06e0e82125787d7aa308fe28c2c8381540c 01-Jul-2011 Dan Williams <dan.j.williams@intel.com> isci: unify isci_remote_device and scic_sds_remote_device

Remove the distinction between these two implementations and unify on
isci_remote_device (local instances named idev).

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
ffe191c92ff195d73f9130b1490045ca2dd4c5e0 29-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: unify isci_port and scic_sds_port

Remove the distinction between these two implementations and unify on
isci_port (local instances named iport). The duplicate '->owning_port' and
'->isci_port' in both isci_phy and isci_remote_device will be fixed in a later
patch... this is just the straightforward rename/unification.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
5076a1a97e2fa61c847a5fdd4b1991faf7716da6 27-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: unify isci_request and scic_sds_request

They are one in the same object so remove the distinction. The near
duplicate fields (owning_controller, and isci_host) will be cleaned up
after the scic_sds_contoller isci_host unification.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
ba7cb22342a66505a831bb7e4541fef90e0193c9 27-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: rename / clean up scic_sds_stp_request

* Rename scic_sds_stp_request to isci_stp_request
* Remove the unused fields and union indirection

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
db0562509800a2d4cb5cb14a66413c30484f165c 17-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: preallocate requests

the dma_pool interface is optimized for object_size << page_size which
is not the case with isci_request objects and the dma_pool routines show
up in the top of the profile.

The old io_request_table which tracked whether tci slots were in-flight
or not is replaced with an IREQ_ACTIVE flag per request.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
38d8879baeb61b6946052739e7c03fa79b3a57f0 23-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: combine request flags

Combine three bools into one unsigned long 'flags'. Doesn't increase the
request size due to packing. (to do: optimize the structure layout).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
312e0c2455c18716cf640d4336dcb1e9e5053818 28-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: unify can_queue tracking on the tci_pool, uplevel tag assignment

The tci_pool tracks our outstanding command slots which are also the 'index'
portion of our tags. Grabbing the tag early in ->lldd_execute_task let's us
drop the isci_host_can_queue() and ->was_tag_assigned_by_user infrastructure.
->was_tag_assigned_by_user required the task context to be duplicated in
request-local buffer. With the tci established early we can build the
task_context directly into its final location and skip a memcpy.

With the task context buffer at a known address at request construction we
have the opportunity/obligation to also fix sgl handling. This rework feels
like it belongs in another patch but the sgl handling and task_context are too
intertwined.
1/ fix the 'ab' pair embedded in the task context to point to the 'cd' pair in
the task context (previously we were prematurely linking to the staging
buffer).
2/ fix the broken iteration of pio sgls that assumes all sgls are relative to
the request, and does a dangerous looking reverse lookup of physical
address to virtual address.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
9274f45ea551421cd3bf329de9dd8d1e6208285a 24-Jun-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Terminate dev requests on FIS err bit rx in NCQ

When the remote device transitions to a not-ready state because of
an NCQ error condition, all outstanding requests to that device
are terminated and completed to libsas on the normal path. The
device then waits for a READ LOG EXT command to issue on the task
management path.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
e9bf709564e90abea25ca7aeae8c3de5cc6468d7 17-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: fix support for arbitrarily large smp requests

Instead of duplicating the smp request buffer reuse the one provided by
libsas. This future proofs the driver to support arbitrarily large smp
requests, and shrinks the request structure size by ~700 bytes.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
ddcc7e347a891937be65358b43f40b7f81185f8f 17-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: fix dma_unmap_sg usage

One bug and a cleanup:
1/ Fix cases where we were unmapping invalid addresses (smp requests were
being unmapped)

[ 604.662770] ------------[ cut here ]------------
[ 604.668026] WARNING: at lib/dma-debug.c:800 check_unmap+0x418/0x740()
[ 604.675315] Hardware name: SandyBridge Platform
[ 604.680465] isci 0000:03:00.0: DMA-API: device driver tries to free an invalid DMA memory address

2/ The unmap routine is too large to be an inline function, and
isci_request_io_request_get_next_sge is unused.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
5edc33480c1c363ab361a881f2957b9fba5185cf 17-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: fix smp response frame overrun

Due to a typo we currently copy way too much when copying over the
response data, but since a request is likely backed by a full page
allocation we don't corrupt live data.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
ff60639dc9a461883db9192d2da0674a00339f12 17-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: kill device_sequence

Now that we have upleveled device reassignment protection to the
isci_remote_device reference count we no longer need this level of
self-defense.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
209fae14fabfd48525e5630bebbbd4ca15090c60 14-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: atomic device lookup and reference counting

We have unsafe references to remote devices that are notified to
disappear at lldd_dev_gone. In order to clean this up we need a single
canonical source for device lookups and stable references once a lookup
succeeds. Towards that end guarantee that domain_device.lldd_dev is
NULL as soon as we start the process of stopping a device. Any code
path that wants to safely lookup a remote device must do so through
task->dev->lldd_dev (isci_lookup_device()).

For in-flight references outside of scic_lock we need reference counting
to ensure that the device is not recycled before we are done with it.
Simplify device back references to just scic_sds_request.target_device
which is now the only permissible internal reference that is maintained
relative to the reference count.

There were two occasions where we wanted new i/o's to be treated as
SAS_TASK_UNDELIVERED but where the domain_dev->lldd_dev link is still
intact. Introduce a 'gone' flag to prevent i/o while waiting for libsas
to take action on the port down event.

One 'core' leftover is that we currently call
scic_remote_device_destruct() from isci_remote_device_deconstruct()
which is called when the 'core' says the device is stopped. It would be
more natural for the final put to trigger
isci_remote_device_deconstruct() but this implementation is deferred as
it requires other changes.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
0d0cf14c9bd2943ed5afd15df459f564d85eacde 13-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: cleanup request allocation

Rather than return an error code and update a pointer that was passed by
reference just return the request object directly (or null if allocation
failed).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
dd047c8e2bca22856050dbe0378a37cf44eecc97 09-Jun-2011 Dan Williams <dan.j.williams@intel.com> isci: cleanup tag macros

A tag is a 16 bit number where the upper four bits is a sequence number
and the remainder is the task context index (tci). Sanitize the macro
names and shave 256-bytes out of scic_sds_controller by reducing the size of
io_request_sequence.

scic_sds_io_tag_construct --> ISCI_TAG
scic_sds_io_tag_get_sequence --> ISCI_TAG_SEQ
scic_sds_io_tag_get_index() --> ISCI_TAG_TCI
scic_sds_io_sequence_increment() [delete / open code]

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
77c852f312243192b1f2ce7fc56d678784786692 20-Jun-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Handle timed-out request terminations correctly

In the situation where a termination of an I/O times-out,
make sure that the linkage from the request to the task
is severed completely. Also make sure that the selection
of tasks to terminate occurs under scic_lock.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
f53a3a32c1e799e27f63bff7b42b4c36749e5e6f 20-Jun-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Requests that do not start must be set to "complete"

Requests that fail at start because of a reset pending condition
must be set to complete in order to allow for later cleanup.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
cde76fbf1f27551a08860227765ae8d5026ac0d9 20-Jun-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Add decode for SMP request retry error condition

There are situations with slow expanders in which a first attempt
to execute an SMP request will fail with a timeout. Immediate
subsequent retries will generally succeed. This change makes sure
SMP I/O failures are immediately failed to libsas so that retries
happen with no discovery process timeout delay.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
12ef65444de9d387a383b9991960848bed5bbe74 02-Jun-2011 Edmund Nadolski <edmund.nadolski@intel.com> isci: additional state machine cleanup

Additional state machine cleanups:

o Remove static functions sci_state_machine_exit_state() and
sci_state_machine_enter_state()
o Combines sci_base_state_machine_construct() and
sci_base_state_machine_start() into a single function,
sci_init_sm()
o Remove sci_base_state_machine_stop() which is unused.
o Kill state_machine.[ch]

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
[fixed too large to inline functions]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
e301370ac553a9a0ac0d1d25e769b86cf60395b3 02-Jun-2011 Edmund Nadolski <edmund.nadolski@intel.com> isci: state machine cleanup

This cleans up several areas of the state machine mechanism:

o Rename sci_base_state_machine_change_state to sci_change_state
o Remove sci_base_state_machine_get_state function
o Rename 'state_machine' struct member to 'sm' in client structs
o Shorten the name of request states
o Shorten state machine state names as follows:
SCI_BASE_CONTROLLER_STATE_xxx to SCIC_xxx
SCI_BASE_PHY_STATE_xxx to SCI_PHY_xxx
SCIC_SDS_PHY_STARTING_SUBSTATE_xxx to SCI_PHY_SUB_xxx
SCI_BASE_PORT_STATE_xxx to SCI_PORT_xxx and
SCIC_SDS_PORT_READY_SUBSTATE_xxx to SCI_PORT_SUB_xxx
SCI_BASE_REMOTE_DEVICE_STATE_xxx to SCI_DEV_xxx
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_STP_DEV_xxx
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_xxx to SCI_SMP_DEV_xxx
SCIC_SDS_REMOTE_NODE_CONTEXT_xxx_STATE to SCI_RNC_xxx

Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
8d2c65c09c9e0adc16070562e7944c1c3277f332 01-Jun-2011 Dave Jiang <dave.jiang@intel.com> isci: Removing unused variables compiler warnings

Newer gcc's are better at identifying "set, but not used" variables.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
77d67385f7b4a630912fd567f104946be137f477 25-May-2011 Dave Jiang <dave.jiang@intel.com> isci: removing the kmalloc in smp request construct

It doesn't look like there is any reason to do a kmalloc. We can do the
byte swap in place and avoid the allocation. This allow us to remove
a kmalloc and a memcpy.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
9269e0e898594c65dee6b20d4ed48e33dbbd4eeb 12-May-2011 Dan Williams <dan.j.williams@intel.com> isci: add some type safety to the state machine interface

Now that any given object type only has one state_machine we can use
container_of() to get back to the given state machine owner.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
79e2b6b27699c916e3c7cda18a26d47fea6017fb 11-May-2011 Dan Williams <dan.j.williams@intel.com> isci: remove the completion and event state handlers

With these handlers gone the rest of the state handler infrastructure is
removed.

Added some WARN_ONCEs where previously we would cause NULL pointer
dereferences or silently run handlers from a previous state.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
a7e255a34220ba57eeeb75637c911974e54c08e7 11-May-2011 Dan Williams <dan.j.williams@intel.com> isci: remove request task context completion state handler

Unlike the other conversions this only updates
scic_sds_io_request_tc_completion() to call the old state handlers directly
(with less verbose names). This was done for future patch readability, the
implementations have only minor differences for different completion codes.
Without a reference to the function name it would be difficult to dicern which
state is being updated. Considered changing the order to look up the
completion code before the state but that was not a clean conversion either.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
d1c637c35b33ddd2b405956e04b50939bb10ed2a 11-May-2011 Dan Williams <dan.j.williams@intel.com> isci: unify request frame handlers

Unify the implementation in scic_sds_io_request_frame_handler and kill
the state handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
f4636a7b2ab8288466b83a8459d47c43143a70dc 11-May-2011 Piotr Sawicki <piotr.sawicki@intel.com> isci: unify request start handlers

Unify the implementation in scic_sds_request_start and kill the state
handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
[remove scic_sds_request_constructed_state_start_handler]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
f00e6ba4996a34f098fe50c78077f0568fd838ec 10-May-2011 Dan Williams <dan.j.williams@intel.com> isci: unify request abort handlers

Unify the implementation in scic_sds_io_request_terminate and kill the state
handler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
5dec6f4e41340196d223caf922578c44dfe2295a 10-May-2011 Dan Williams <dan.j.williams@intel.com> isci: merge stp request substates into primary state machine

Remove usage of the request substate machine for stp requests, and kill
the request substate infrastructure.

Similar to the previous conversions this adds the substates to the
primary state machine and arranges for the 'started' state to transition
to the proper stp substate.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
c72086e3c2897eaca5b99c005dd9844fdc784981 10-May-2011 Dan Williams <dan.j.williams@intel.com> isci: merge smp request substates into primary state machine

Remove usage of the request substate machine for smp requests identified by:
task->task_proto == SAS_PROTOCOL_SMP

While merging over the smp_request infrastructure noticed that all the
assign buffer implementations are now equal, so moved it to
scic_sds_general_request_construct.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
f139303d17c47eff4c5b5407dee0a6d43e8fd146 10-May-2011 Dan Williams <dan.j.williams@intel.com> isci: merge ssp task management substates into primary state machine

Remove usage of the request substate machine for ssp task management
requests identified by:
ireq->ttype == tmf_task && dev->dev_type == SAS_END_DEV;

The only routine that checks the base 'started' state is
scic_sds_io_request_tc_completion which calls the substate machine
handler if we are not in the 'started' state or we are 'started' and no
substate machine is defined. This routine requires no conversion
because we have transitioned out of 'started' and the substate routine
will be called naturally as a result.

There are also no side effects of this conversion on exiting the
'started', state because it only stops the substate machine, which is no
longer relevant for this transaction type.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
e2f8db509fdd354bb7a68c86515e9d2d8909ccc9 10-May-2011 Dan Williams <dan.j.williams@intel.com> isci: uplevel port infrastructure

* Move port configuration agent implementation
* Merge core/scic_sds_port.[ch] into port.[ch]

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
f1f52e75939b56c40b3d153ae99faf2720250242 10-May-2011 Dan Williams <dan.j.williams@intel.com> isci: uplevel request infrastructure

* Consolidate tiny header files
* Move files out of core/ (drop core/scic_sds_ prefix)
* Merge core/scic_sds_request.[ch] into request.[ch]
* Cleanup request.c namespace (clean forward declarations and global
namespace pollution)

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
cc9203bf381a465cd115762b9cf7c9a313c874bc 09-May-2011 Dan Williams <dan.j.williams@intel.com> isci: move core/controller to host

Now that the data structures are unified unify the implementation in
host.[ch] and cleanup namespace pollution.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
ce2b3261b6765c3b80fda95426c73e8d3bb1b035 09-May-2011 Dan Williams <dan.j.williams@intel.com> isci: unify constants

cross driver constants are spread out over multiple header files, consolidate
them into isci.h, and push some includes out to the source files that need
them.

TODO: remove SCI_MODE_SIZE infrastructure.
TODO: task.h is full of inlines that are too large

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
67ea838d17acdad3331aeae848683c768df96aaa 08-May-2011 Dan Williams <dan.j.williams@intel.com> isci: unify request data structures

Make scic_sds_request a proper member of isci_request. Also let's us
get rid of the dma pool object size tracking since we now know that all
requests are sizeof(isci_request). While cleaning up the construct
routine incidentally replaced SCI_FIELD_OFFSET with offsetof.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
b7645818cff1536038c0b21407eefb6b9d5755e6 08-May-2011 Dan Williams <dan.j.williams@intel.com> isci: make command/response iu explicit request object members

Final elimination of the anonymous data at the end of the request
structure.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
0d84366fbef557f92ef82ac9a224c57ffb3318bc 08-May-2011 Dan Williams <dan.j.williams@intel.com> isci: make sgl explicit/aligned request object member

Towards unifying request objects we need all members to be defined in the
object and not carved out of anonymous buffer space.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
9286a1959ce7f3df3c1a8e33eb9b210078318dc8 06-May-2011 Dave Jiang <dave.jiang@intel.com> isci: Removing unnecessary functions in request.c

No need for wrappers, just access sas_task directly.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
cc3dbd0a9178865d4444f8e28b51715808e9ac85 04-May-2011 Artur Wojcik <artur.wojcik@intel.com> isci: unify isci_host data structures

Make it explicit that isci_host and scic_sds_controller are one in the same
object.

Signed-off-by: Artur Wojcik <artur.wojcik@intel.com>
[removed ->ihost back pointer]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
2ec53eb4d5b301e5c9c386da5685894d572772a5 05-May-2011 Dave Jiang <dave.jiang@intel.com> isci: Fixup of smp request

The struct smp_request data structure has be fixed up for Linux consumption.
This probably should go to scsi/sas.h eventually.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
0cfa890e5a8a9e3b01b75c17a7856cf96e026e27 05-May-2011 Dave Jiang <dave.jiang@intel.com> isci: Fixup SSP command IU and task IU

Fixup of SSP command IU and SSP task IU to something that looks like Linux

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
890cae9b8a7defd87feb1ec77a2affd25bd59cce 29-Apr-2011 Maciej Patelczyk <maciej.patelczyk@intel.com> isci: Removed sci_base_object from scic_sds_request.

The 'struct sci_base_object' was removed from the struct
scic_sds_request and was replaced by a pointer to
struct isci_request.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
a1a113b0a1ea437daf099b44f8a39e93a02a3f47 22-Apr-2011 Dan Williams <dan.j.williams@intel.com> isci: kill smp_discover_response_protocols in favor of domain_device.dev_type

This is step 1 of removing the contortions to:
1/ unparse expander phy data into a smp discover frame
2/ open-code-parse the smp discover fram into a domain_device.dev_type equivalent

libsas has already spent cycles determining the dev_type, so now that
scic_sds_remote_device is unified with isci_remote_device we can
directly reference dev_type.

This might also change multi-level expander detection as we previously only
looked at dev_type == EDGE_DEV and we did not consider the FANOUT_DEV case.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
88f3b62ac131e2549b6c262cacbd47e8cca42d6e 23-Apr-2011 Dan Williams <dan.j.williams@intel.com> isci: move remote_device handling out of the core

Now that the core/lldd remote_device data structures are nominally unified
merge the corresponding sources into the top-level directory. Also move the
remote_node_context infrastructure which has no analog at the lldd level.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
57f20f4ed6fb702339be2ef4dea9d15e6a7d0d07 22-Apr-2011 Dan Williams <dan.j.williams@intel.com> isci: unify remote_device data structures

Make it explicit that isci_remote_device and scic_sds_remote_device are
one in the same object.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
6cb4d6b382be6345c2d0c4b1b90dfdf9af32da7e 13-Apr-2011 Bartosz Barcinski <Bartosz.Barcinski@intel.com> isci: audit usage of BUG_ON macro in isci driver

Removes unnecessary usage of BUG_ON macro, excluding core directory.
In some cases macro is unnecesary, check is done in caller function.
In other cases macro is replaced by if construction with
appropriate warning.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
[changed some survivable bug conditions to WARN_ONCE]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
4393aa4e6b9517a666f0ef6b774fd421a9dc4c68 31-Mar-2011 Dan Williams <dan.j.williams@intel.com> isci: fix fragile/conditional isci_host lookups

A domain_device can always reference back to ->lldd_ha unlike local lldd
structures. Fix up cases where the driver uses local objects to look up the
isci_host. This also changes the calling conventions of some routines to
expect a valid isci_host parameter rather than re-lookup the pointer on entry.

Incidentally cleans up some macros that are longer to type than the open-coded
equivalent:
isci_host_from_sas_ha
isci_dev_from_domain_dev

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
ed8a72d108bd951909b28fa4a89aad6489f414e1 31-Mar-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Qualify when the host lock is managed for STP/SATA callbacks.

In the case of internal discovery related STP/SATA I/O started
through sas_execute_task the host lock is not taken by libsas before
calling lldd_execute_task, so the lock should not be managed before
calling back to libsas through task->task_done or sas_task_abort.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
ce4f75def3999fbe454da9aa733ed322bc671b06 31-Mar-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Free host lock for SATA/STP abort escalation at submission time.

In the case of I/O requests that fail at submit time because of a
pending reset condition, the host lock for SATA/STP devices must be
managed for any SCSI-initiated I/O before sas_task_abort is called.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
35173d579a08c0d145b3020039d3ba33fbf2c184 27-Mar-2011 Dan Williams <dan.j.williams@intel.com> isci: namespacecheck cleanups

* mark needlessly global routines static
* delete unused functions
* move kernel-doc blocks from header files to source
* reorder some functions to delete declarations
* more default handler cleanups phy

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
c4b9e24c4be67aeed44cd46ef5ea92948d02a426 16-Mar-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: don't hold scic_lock over calls to sas_task_abort()

In the case where submitted I/Os fail with the status code
SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED, the execute function now waits
until scic_lock is cleared before calling the helper function
"isci_request_signal_device_reset" which sets the flag for the pending
reset condition on the I/O.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
aa14510295d3d87431c915c0b2bc5dd3af7f2c35 08-Mar-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Always set response/status for requests going into the error path.

In the case of I/O requests being failed because of a required device
reset condition, set the response and status to indicate an I/O failure.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
1fad9e934a43407c1ba397b1b6b8882aa8a2cafd 04-Mar-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: save the i/o tag outside the scic request structure.

The pointer to the core representation of a request is marked NULL at
completion, but we need to save the i/o tag for task management.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
[revise changelog]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
ec6c9638b0d0537430f78a3e20503b5e68a537b6 04-Mar-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Any reset indicated on an I/O completion escalates it to the error path.

If there is a pending device reset, the I/O is used to accomplish the reset by setting the
RESET bit in the task status, and then putting the task into the error handler
path using sas abort task.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
a5fde225364df30507ba1a5aafeec85e595000d3 04-Mar-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: fix completion / abort path.

Corrected use of the request state_lock in the completion callback.

In the case where an abort (or reset) thread is trying to terminate an
I/O request, it sets the request state to "aborting" (or "terminating")
if the state is still "starting". One of the bugs was to never set the
state to "completed". Another was to not correctly recognize the
situation where the I/O had completed but the sas_task was still pending
callback to task_done - this was typically a problem in the LUN and
device reset cases.

It is now possible that we leave isci_task_abort_task() with
request->io_request_completion pointing to localy allocated
aborted_io_completion struct. It may result in a system crash.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Maciej Trela <Maciej.Trela@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
11b00c194cfbd0eb0d90f32c096508b2bb8be6ec 04-Mar-2011 Jeff Skirvin <jeffrey.d.skirvin@intel.com> isci: Changes in isci_host_completion_routine

Changes to move management of the reqs_in_process entry for the request here.
Made changes to note when the task is already in the abort path and
cannot be completed through callbacks.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
3a97eec6d7876c541950e23811efd40e0bcd04a0 04-Mar-2011 Dan Williams <dan.j.williams@intel.com> isci: remove sci_device_handle

It belies the fact that isci_remote_device and scic_sds_remote_device
are one in same object with the same lifetime rules.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
83f5eeef59581faed6f002432bafe24da8cbf401 18-Feb-2011 Dan Williams <dan.j.williams@intel.com> isci: debug fixes

Some of the chain walks to get back to our dev are invalid.

isci_remote_device_change_state: delete rather than adding conditional deref
chain walking
isci_request_change_state: fix, it was being called too early
isci_request_ssp_io_request_get_lun: fix compile breakage hidden by ifdef DEBUG

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
82d29928c1c1c6a6605895f8240a9943394244d7 09-Feb-2011 Dan Williams <dan.j.williams@intel.com> isci: kill SCI_IO_REQUEST_DATA_DIRECTION

It's an unnecessary typedef that mirrors the kernel's enum
dma_data_direction.

Also cleanup some long variable names along the way.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c
6f231dda68080759f1aed3769896e94c73099f0f 03-Jul-2011 Dan Williams <dan.j.williams@intel.com> isci: Intel(R) C600 Series Chipset Storage Control Unit Driver

Support for the up to 2x4-port 6Gb/s SAS controllers embedded in the
chipset.

This is a snapshot of the first publicly available version of the driver,
commit 4c1db2d0 in the 'historical' branch.

git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git historical

Signed-off-by: Maciej Trela <maciej.trela@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
/drivers/scsi/isci/request.c