summaryrefslogtreecommitdiff
path: root/drivers/scsi/isci/remote_node_context.c
AgeCommit message (Collapse)Author
2012-05-17isci: End the RNC resumption wait when the RNC is destroyed.Jeff Skirvin
While the RNC is suspended for I/O cleanup, the remote device can be stopped and the RNC setup for destruction. These changes accomodate that case in the abort path. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Fixed RNC bug that lost the suspension or resumption during destroyJeff Skirvin
This fix corrects the saving of resume parameters when the destruction of the RNC has already been directed, and makes sure not to overwrite the RNC destruction callbacks. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Fix RNC AWAIT_SUSPENSION->INVALIDATING transition.Jeff Skirvin
The RNC state machine would incorrectly transition from SCI_RNC_AWAIT_SUSPENSION directly to SCI_RNC_INVALIDATING when a destruct request was made. This would skip the increment of the suspension count and the abort of pending TCs (although the invalidating state would at least cleanup outstanding TCs). Instead, the RNC will transition to SCI_RNC_SUSPENDED and then start the destruction process. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Don't wait for an RNC suspend if it's being destroyed.Jeff Skirvin
Make sure that the wait for suspend can handle the RNC destruction case. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Added timeouts to RNC suspensions in the abort path.Jeff Skirvin
This change adds timeouts to the RNC suspension wait. It makes the suspend and resume timeouts the same. The previous resume timeout of 5 ms was too short, and timeouts were seen in resumptions of devices in the abort task/LUN reset path - which would receive an RNC resumed message within a tenth of a second later. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Fix RNC suspend call for SCI_RESUMING state.Jeff Skirvin
Instead of immediately transitioning to the SCI_RNC_AWAIT_SUSPENSION state, handle the SCI_RNC_RESUMING suspend transition from the SCI_RNC_READY state like the SCI_RNC_INVALIDATING --> SCI_RNC_POSTING transitions do now, by setting the destination state for the entry into the READY state. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: When in the abort path, defeat other resume calls until done.Jeff Skirvin
Completion of I/Os during the one of the abort path interface calls from libsas can drive remote device state changes and the resumption of the device RNC. This is a problem when the abort path is attempting to cleanup outstanding I/O at the same time - the resumption can prevent the termination from occuring correctly. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Implement waiting for suspend in the abort path.Jeff Skirvin
In order to prevent a device from receiving an I/O request while still in an RNC suspending or resuming state (and therefore failing that I/O back to libsas with a reset required status) wait for the RNC state change before proceding in the abort path. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Manage the LLHANG timer enable/disable per-device.Jeff Skirvin
The LLHANG timer should be enabled once per device. This patch corrects both the timer enable and the timer disable for the remote device. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Save the suspension hint for upcoming suspensions.Jeff Skirvin
In the case of a suspend call while in SCI_RNC_POSTING or INVALIDATING states, the LLHANG detect needed to be saved so the upcoming suspension would enable it correctly. The unused suspend callback parameters were removed. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Distinguish between remote device suspension casesJeff Skirvin
For NCQ error conditions among others, there is no need to enable the link layer hang detect timer. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: All pending TCs are terminated when the RNC is invalidated.Jeff Skirvin
Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Add suspension cases for RNC INVALIDATING, POSTING states.Jeff Skirvin
The RNC can be any of the states in the loop from suspended to ready when the API "suspend" or "resume" are called. This change adds destination states parameters that control the suspension / resumption action of the RNC statemachine for those transition states. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Redesign device suspension, abort, cleanup.Jeff Skirvin
This commit changes the means by which outstanding I/Os are handled for cleanup. The likelihood is that this commit will be broken into smaller pieces, however that will be a later revision. Among the changes: - All completion structures have been removed from the tmf and abort paths. - Now using one completed I/O list, with the I/O completed in host bit being used to select error or normal callback paths. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Terminate outstanding TCs on TX/RX RNC suspensions.Jeff Skirvin
TCs must only be terminated when RNCs are suspended. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Handle all suspending TC completionsJeff Skirvin
Add comprehensive decode for all TC completions that generate RNC suspensions. Note that this commit also removes unconditional resumptions of ATAPI devices when in the SCI_STP_DEV_ATAPI_ERROR state, and STP devices when in the SCI_STP_DEV_IDLE state. This is because the SCI_STP_DEV_IDLE and SCI_STP_DEV_ATAPI state entry functions manage the RNC resumption. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Fixed bug in resumption from RNC Tx/Rx suspend state.Jeff Skirvin
The resumption from the Tx/Rx suspended state should work the same as the Tx suspended state. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: Manage the link layer hang detect timer for RNC suspensions.Jeff Skirvin
For STP devices under certain protocol conditions, an RNC will not suspend until the current transfer state is broken with a SYNC/ESC sequence from the SCU. The SYNC/ESC driven by expiration of the SCU link layer hang detect timer, which has too small a dynamic range to support slow SATA devices, so normally it is disabled. This change enables the timer with the minimum period at the point when the suspension is requested. Note that there is potential collateral damage to other open connections to slow SATA devices on the same port, since there is no alternative but to enable the LLHANG timer on every phy in the port for the current suspension request - there is no way to tell on which phy the RNC in question is currently active. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: kill ->is_direct_attachedDan Williams
domain_device ->parent conveys the same information. Occurrences of ->is_direct_attached appear next to incomplete open-coded versions of dev_is_sata(), clean those up as well. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-05-17isci: improve 'invalid state' warningsDan Williams
Convert controller state machine warnings to emit the state number (it missed the number to string conversion, but since these error rarely happen not much motivation to go further). Fix up the rnc warnings to use the state name. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2012-02-29[SCSI] isci: debug, provide state-enum-to-string conversionsDan Williams
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>
2011-07-03isci: kill 'get/set' macrosDan Williams
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>
2011-07-03isci: retire scic_sds_ and scic_ prefixesDan Williams
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>
2011-07-03isci: unify isci_host and scic_sds_controllerDan Williams
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>
2011-07-03isci: unify isci_remote_device and scic_sds_remote_deviceDan Williams
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>
2011-07-03isci: unify isci_request and scic_sds_requestDan Williams
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>
2011-07-03isci: Explicitly decode remote node ready and suspended statesJeff Skirvin
The remote node context should only signal a device reset condition in a suspended state. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: additional state machine cleanupEdmund Nadolski
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>
2011-07-03isci: state machine cleanupEdmund Nadolski
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>
2011-07-03isci: add some type safety to the state machine interfaceDan Williams
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>
2011-07-03isci: unify rnc start{io|task} handlersDan Williams
Unify rnc start{io|task} handlers and delete the state handler infrastructure. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: unify rnc suspend/resume handlersDan Williams
Unify rnc suspend/resume handlers and delete the state handlers. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: unify rnc destruct handlersDan Williams
Unify rnc destruct handlers and delete the state handler. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: unify rnc event handlersDan Williams
Unify rnc event handlers and delete the state handler. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: uplevel port infrastructureDan Williams
* 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-03isci: uplevel request infrastructureDan Williams
* 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-03isci: uplevel state machineDan Williams
unify core/sci_base_state.h and core/sci_base_state_machine.[ch] into state_machine.[ch] Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: move core/controller to hostDan Williams
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-03isci: rnc state machine table c99 conversionJacek Danecki
This makes the subsequent patches to delete rnc->state_handler more clear. Signed-off-by: Jacek Danecki <Jacek.Danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: Removed sci_base_object from scic_sds_remote_node_context.Maciej Patelczyk
The 'struct sci_base_object' was removed from the struct scic_sds_remote_node_context. Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: Removed struct sci_base_object from state machine.Maciej Patelczyk
Changed any occurrence of struct sci_base_object into void. Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: remove scic_sds_remote_device_get_port_indexDan Williams
Longer to type than the open-coded equivalent. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: remove usage of sci_sas_address in scic_sds_remote_deviceDan Williams
The sas address can be retrieved from the domain device and then converted to the always little-endian format in the remote node context. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: kill smp_discover_responseDan Williams
An lldd need never look at the contents of an smp_discover_response frame. Kill the remaining locations where isci is looking at it: 1/ covering for expanders that do not set the stp_attached bit (already handled by sas_ex_discover_end_dev) 2/ an overkill method to notifiy the rest of the driver about remote_device sas addresses Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2011-07-03isci: kill smp_discover_response_protocols in favor of domain_device.dev_typeDan Williams
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-03isci: move remote_device handling out of the coreDan Williams
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>