isci: Implement waiting for suspend in the abort path.

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>
This commit is contained in:
Jeff Skirvin
2012-03-08 22:42:01 -08:00
committed by Dan Williams
parent 08c031e4e3
commit 31a38ef0a5
5 changed files with 66 additions and 22 deletions

View File

@@ -90,6 +90,15 @@ bool sci_remote_node_context_is_ready(
return false;
}
bool sci_remote_node_context_is_suspended(struct sci_remote_node_context *sci_rnc)
{
u32 current_state = sci_rnc->sm.current_state_id;
if (current_state == SCI_RNC_TX_RX_SUSPENDED)
return true;
return false;
}
static union scu_remote_node_context *sci_rnc_by_id(struct isci_host *ihost, u16 id)
{
if (id < ihost->remote_node_entries &&
@@ -339,6 +348,13 @@ static void sci_remote_node_context_tx_rx_suspended_state_enter(struct sci_base_
struct sci_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm);
struct isci_remote_device *idev = rnc_to_dev(rnc);
struct isci_host *ihost = idev->owning_port->owning_controller;
u32 new_count = rnc->suspend_count + 1;
if (new_count == 0)
rnc->suspend_count = 1;
else
rnc->suspend_count = new_count;
smp_wmb();
/* Terminate outstanding requests pending abort. */
sci_remote_device_abort_requests_pending_abort(idev);
@@ -634,6 +650,11 @@ enum sci_status sci_remote_node_context_resume(struct sci_remote_node_context *s
enum scis_sds_remote_node_context_states state;
state = sci_rnc->sm.current_state_id;
dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: state %s, cb_fn = %p, cb_p = %p; dest_state = %d\n",
__func__, rnc_state_name(state), cb_fn, cb_p,
sci_rnc->destination_state);
switch (state) {
case SCI_RNC_INITIAL:
if (sci_rnc->remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX)