if (!idev) {
isci_task_refuse(ihost, task, SAS_TASK_UNDELIVERED,
SAS_DEVICE_UNKNOWN);
} elseif (!io_ready || tag == SCI_CONTROLLER_INVALID_IO_TAG) { /* Indicate QUEUE_FULL so that the scsi midlayer *retries.
*/
isci_task_refuse(ihost, task, SAS_TASK_COMPLETE,
SAS_QUEUE_FULL);
} else { /* There is a device and it's ready for I/O. */
spin_lock_irqsave(&task->task_state_lock, flags);
if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { /* The I/O was aborted. */
spin_unlock_irqrestore(&task->task_state_lock, flags);
/* do common allocation and init of request object. */
ireq = isci_io_request_from_tag(ihost, task, tag);
spin_unlock_irqrestore(&task->task_state_lock, flags);
/* build and send the request. */ /* do common allocation and init of request object. */
status = isci_request_execute(ihost, idev, task, ireq);
if (status != SCI_SUCCESS) { if (test_bit(IDEV_GONE, &idev->flags)) { /* Indicate that the device *isgone.
*/
isci_task_refuse(ihost, task,
SAS_TASK_UNDELIVERED,
SAS_DEVICE_UNKNOWN);
} else { /* Indicate QUEUE_FULL so that *thescsimidlayerretries. *Iftherequestfailedfor *remotedevicereasons,it *getsreturnedas *SAS_TASK_UNDELIVEREDnext *timethrough.
*/
isci_task_refuse(ihost, task,
SAS_TASK_COMPLETE,
SAS_QUEUE_FULL);
}
}
}
}
if (status != SCI_SUCCESS && tag != SCI_CONTROLLER_INVALID_IO_TAG) {
spin_lock_irqsave(&ihost->scic_lock, flags); /* command never hit the device, so just free *thetciandskipthesequenceincrement
*/
isci_tci_free(ihost, ISCI_TAG_TCI(tag));
spin_unlock_irqrestore(&ihost->scic_lock, flags);
}
/* XXX convert to get this from task->tproto like other drivers */ if (dev->dev_type == SAS_END_DEVICE) {
isci_tmf->proto = SAS_PROTOCOL_SSP;
sci_task_request_construct_ssp(ireq);
}
/* The RNC must be unsuspended before the TMF can get a response. */
isci_remote_device_resume_from_abort(ihost, idev);
/* Wait for the TMF to complete, or a timeout. */
timeleft = wait_for_completion_timeout(&completion,
msecs_to_jiffies(timeout_ms));
if (timeleft == 0) { /* The TMF did not complete - this could be because *ofanunplug.TerminatetheTMFrequestnow.
*/
isci_remote_device_suspend_terminate(ihost, idev, ireq);
}
isci_print_tmf(ihost, tmf);
if (tmf->status == SCI_SUCCESS)
ret = TMF_RESP_FUNC_COMPLETE; elseif (tmf->status == SCI_FAILURE_IO_RESPONSE_VALID) {
dev_dbg(&ihost->pdev->dev, "%s: tmf.status == " "SCI_FAILURE_IO_RESPONSE_VALID\n",
__func__);
ret = TMF_RESP_FUNC_COMPLETE;
} /* Else - leave the default "failed" status alone. */
dev_dbg(&isci_host->pdev->dev, "%s: isci_host = %p, isci_device = %p\n",
__func__, isci_host, isci_device); /* Send the LUN reset to the target. By the time the call returns, *theTMFhasfullyexectedinthetarget(inwhichcasethereturn *valueis"TMF_RESP_FUNC_COMPLETE",ortherequesttimed-out(or *wasotherwiseunabletobeexecuted("TMF_RESP_FUNC_FAILED").
*/
isci_task_build_tmf(&tmf, isci_tmf_ssp_lun_reset);
#define ISCI_LU_RESET_TIMEOUT_MS 2000/* 2 second timeout. */
ret = isci_task_execute_tmf(isci_host, isci_device, &tmf, ISCI_LU_RESET_TIMEOUT_MS);
if (!idev) { /* If the device is gone, escalate to I_T_Nexus_Reset. */
dev_dbg(&ihost->pdev->dev, "%s: No dev\n", __func__);
ret = TMF_RESP_FUNC_FAILED; goto out;
}
/* Suspend the RNC, kill all TCs */ if (isci_remote_device_suspend_terminate(ihost, idev, NULL)
!= SCI_SUCCESS) { /* The suspend/terminate only fails if isci_get_device fails */
ret = TMF_RESP_FUNC_FAILED; goto out;
} /* All pending I/Os have been terminated and cleaned up. */ if (!test_bit(IDEV_GONE, &idev->flags)) { if (dev_is_sata(dev))
sas_ata_schedule_reset(dev); else /* Send the task management part of the reset. */
ret = isci_task_send_lu_reset_sas(ihost, idev, lun);
}
out:
isci_put_device(idev); return ret;
}
/* int (*lldd_clear_nexus_port)(struct asd_sas_port *); */ int isci_task_clear_nexus_port(struct asd_sas_port *port)
{ return TMF_RESP_FUNC_FAILED;
}
int isci_task_clear_nexus_ha(struct sas_ha_struct *ha)
{ return TMF_RESP_FUNC_FAILED;
}
/* Task Management Functions. Must be called from process context. */
/* Get the isci_request reference from the task. Note that *thischeckdoesnotdependonthependingrequestlist *inthedevice,becausetasksdrivingresetsmaylandhere *aftercompletioninthecore.
*/
spin_lock_irqsave(&ihost->scic_lock, flags);
spin_lock(&task->task_state_lock);
old_request = task->lldd_task;
/* If task is already done, the request isn't valid */ if (!(task->task_state_flags & SAS_TASK_STATE_DONE) &&
old_request) {
idev = isci_get_device(task->dev->lldd_dev);
target_done_already = test_bit(IREQ_COMPLETE_IN_TARGET,
&old_request->flags);
}
spin_unlock(&task->task_state_lock);
spin_unlock_irqrestore(&ihost->scic_lock, flags);
/* Device reset conditions signalled in task_state_flags are the *responsbilityoflibsastoobserveatthestartoftheerror *handlerthread.
*/ if (!idev || !old_request) { /* The request has already completed and there *isnothingtodohereotherthantosetthetask *donebit,andindicatethatthetaskabortfunction *wassuccessful.
*/
spin_lock_irqsave(&task->task_state_lock, flags);
task->task_state_flags |= SAS_TASK_STATE_DONE;
task->task_state_flags &= ~SAS_TASK_STATE_PENDING;
spin_unlock_irqrestore(&task->task_state_lock, flags);
ret = TMF_RESP_FUNC_COMPLETE;
dev_warn(&ihost->pdev->dev, "%s: abort task not needed for %p\n",
__func__, task); goto out;
} /* Suspend the RNC, kill the TC */ if (isci_remote_device_suspend_terminate(ihost, idev, old_request)
!= SCI_SUCCESS) {
dev_warn(&ihost->pdev->dev, "%s: isci_remote_device_reset_terminate(dev=%p, " "req=%p, task=%p) failed\n",
__func__, idev, old_request, task);
ret = TMF_RESP_FUNC_FAILED; goto out;
}
spin_lock_irqsave(&ihost->scic_lock, flags);
/** *isci_task_query_task()-Thisfunctionisimplementedtocauselibsasto *correctlyescalatethefailedaborttoaLUNortargetreset(thisis *becausesas_scsi_find_tasklibsasfunctiondoesnotcorrectlyinterpret *allreturncodesfromtheaborttaskcall).WhenTMF_RESP_FUNC_SUCCis *returned,libsasturnsthisintoaLUNreset;whenFUNC_FAILEDis *returned,libsaswillturnthisintoatargetreset *@task:Thisparameterspecifiesthesastaskbeingqueried. * *status,zeroindicatessuccess.
*/ int isci_task_query_task( struct sas_task *task)
{ /* See if there is a pending device reset for this device. */ if (task->task_state_flags & SAS_TASK_NEED_DEV_RESET) return TMF_RESP_FUNC_FAILED; else return TMF_RESP_FUNC_SUCC;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.