Commit Graph

35 Commits (f4636a7b2ab8288466b83a8459d47c43143a70dc)

Author SHA1 Message Date
Piotr Sawicki f4636a7b2a 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>
2011-07-03 04:04:48 -07:00
Dan Williams f00e6ba499 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>
2011-07-03 04:04:48 -07:00
Dan Williams 5dec6f4e41 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>
2011-07-03 04:04:47 -07:00
Dan Williams c72086e3c2 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>
2011-07-03 04:04:47 -07:00
Dan Williams f139303d17 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>
2011-07-03 04:04:47 -07:00
Dan Williams e2f8db509f 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>
2011-07-03 04:04:47 -07:00
Dan Williams f1f52e7593 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>
2011-07-03 04:04:47 -07:00
Dan Williams cc9203bf38 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>
2011-07-03 04:04:47 -07:00
Dan Williams ce2b3261b6 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>
2011-07-03 04:04:47 -07:00
Dan Williams 67ea838d17 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>
2011-07-03 04:04:47 -07:00
Dan Williams b7645818cf 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>
2011-07-03 04:04:47 -07:00
Dan Williams 0d84366fbe 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>
2011-07-03 04:04:47 -07:00
Dave Jiang 9286a1959c 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>
2011-07-03 04:04:46 -07:00
Artur Wojcik cc3dbd0a91 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>
2011-07-03 04:04:46 -07:00
Dave Jiang 2ec53eb4d5 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>
2011-07-03 04:04:46 -07:00
Dave Jiang 0cfa890e5a 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>
2011-07-03 04:04:46 -07:00
Maciej Patelczyk 890cae9b8a 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>
2011-07-03 04:00:38 -07:00
Dan Williams a1a113b0a1 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>
2011-07-03 04:00:38 -07:00
Dan Williams 88f3b62ac1 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>
2011-07-03 04:00:38 -07:00
Dan Williams 57f20f4ed6 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>
2011-07-03 04:00:38 -07:00
Bartosz Barcinski 6cb4d6b382 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>
2011-07-03 04:00:37 -07:00
Dan Williams 4393aa4e6b 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>
2011-07-03 04:00:36 -07:00
Jeff Skirvin ed8a72d108 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>
2011-07-03 04:00:36 -07:00
Jeff Skirvin ce4f75def3 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>
2011-07-03 04:00:36 -07:00
Dan Williams 35173d579a 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>
2011-07-03 04:00:36 -07:00
Jeff Skirvin c4b9e24c4b 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>
2011-07-03 03:55:30 -07:00
Jeff Skirvin aa14510295 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>
2011-07-03 03:55:30 -07:00
Jeff Skirvin 1fad9e934a 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>
2011-07-03 03:55:30 -07:00
Jeff Skirvin ec6c9638b0 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>
2011-07-03 03:55:29 -07:00
Jeff Skirvin a5fde22536 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>
2011-07-03 03:55:29 -07:00
Jeff Skirvin 11b00c194c 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>
2011-07-03 03:55:29 -07:00
Dan Williams 3a97eec6d7 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>
2011-07-03 03:55:29 -07:00
Dan Williams 83f5eeef59 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>
2011-07-03 03:55:27 -07:00
Dan Williams 82d29928c1 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>
2011-07-03 00:36:31 -07:00
Dan Williams 6f231dda68 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>
2011-07-02 22:56:22 -07:00