summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/isci/host.c')
-rw-r--r--drivers/scsi/isci/host.c78
1 files changed, 26 insertions, 52 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index ef2790faeab8..45385f531649 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1077,6 +1077,32 @@ static void sci_controller_completion_handler(struct isci_host *ihost)
writel(0, &ihost->smu_registers->interrupt_mask);
}
+void ireq_done(struct isci_host *ihost, struct isci_request *ireq, struct sas_task *task)
+{
+ task->lldd_task = NULL;
+ if (!test_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags) &&
+ !(task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
+ if (test_bit(IREQ_COMPLETE_IN_TARGET, &ireq->flags)) {
+ /* Normal notification (task_done) */
+ dev_dbg(&ihost->pdev->dev,
+ "%s: Normal - ireq/task = %p/%p\n",
+ __func__, ireq, task);
+
+ task->task_done(task);
+ } else {
+ dev_dbg(&ihost->pdev->dev,
+ "%s: Error - ireq/task = %p/%p\n",
+ __func__, ireq, task);
+
+ sas_task_abort(task);
+ }
+ }
+ if (test_and_clear_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags))
+ wake_up_all(&ihost->eventq);
+
+ if (!test_bit(IREQ_NO_AUTO_FREE_TAG, &ireq->flags))
+ isci_free_tag(ihost, ireq->io_tag);
+}
/**
* isci_host_completion_routine() - This function is the delayed service
* routine that calls the sci core library's completion handler. It's
@@ -1088,62 +1114,10 @@ static void sci_controller_completion_handler(struct isci_host *ihost)
void isci_host_completion_routine(unsigned long data)
{
struct isci_host *ihost = (struct isci_host *)data;
- struct list_head completed_request_list;
- struct list_head *current_position;
- struct list_head *next_position;
- struct isci_request *request;
- struct sas_task *task;
u16 active;
- INIT_LIST_HEAD(&completed_request_list);
-
spin_lock_irq(&ihost->scic_lock);
-
sci_controller_completion_handler(ihost);
-
- /* Take the lists of completed I/Os from the host. */
- list_splice_init(&ihost->requests_to_complete,
- &completed_request_list);
-
- /* Process any completions in the list. */
- list_for_each_safe(current_position, next_position,
- &completed_request_list) {
-
- request = list_entry(current_position, struct isci_request,
- completed_node);
- task = isci_request_access_task(request);
-
- /* Return the task to libsas */
- if (task != NULL) {
-
- task->lldd_task = NULL;
- if (!test_bit(IREQ_ABORT_PATH_ACTIVE, &request->flags) &&
- !(task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
- if (test_bit(IREQ_COMPLETE_IN_TARGET,
- &request->flags)) {
-
- /* Normal notification (task_done) */
- dev_dbg(&ihost->pdev->dev, "%s: Normal"
- " - request/task = %p/%p\n",
- __func__, request, task);
-
- task->task_done(task);
- } else {
- dev_warn(&ihost->pdev->dev,
- "%s: Error - request/task"
- " = %p/%p\n",
- __func__, request, task);
-
- sas_task_abort(task);
- }
- }
- }
- if (test_and_clear_bit(IREQ_ABORT_PATH_ACTIVE, &request->flags))
- wake_up_all(&ihost->eventq);
-
- if (!test_bit(IREQ_NO_AUTO_FREE_TAG, &request->flags))
- isci_free_tag(ihost, request->io_tag);
- }
spin_unlock_irq(&ihost->scic_lock);
/* the coalesence timeout doubles at each encoding step, so