Lines Matching full:task
3 * Aic94xx Task Management Functions
214 static int asd_clear_nexus_tag(struct sas_task *task) in asd_clear_nexus_tag() argument
216 struct asd_ha_struct *asd_ha = task->dev->port->ha->lldd_ha; in asd_clear_nexus_tag()
217 struct asd_ascb *tascb = task->lldd_task; in asd_clear_nexus_tag()
221 memcpy(scb->clear_nexus.ssp_task.lun, task->ssp_task.LUN, 8); in asd_clear_nexus_tag()
223 if (task->dev->tproto) in asd_clear_nexus_tag()
225 task->dev->lldd_dev); in asd_clear_nexus_tag()
229 static int asd_clear_nexus_index(struct sas_task *task) in asd_clear_nexus_index() argument
231 struct asd_ha_struct *asd_ha = task->dev->port->ha->lldd_ha; in asd_clear_nexus_index()
232 struct asd_ascb *tascb = task->lldd_task; in asd_clear_nexus_index()
236 if (task->dev->tproto) in asd_clear_nexus_index()
238 task->dev->lldd_dev); in asd_clear_nexus_index()
324 static int asd_clear_nexus(struct sas_task *task) in asd_clear_nexus() argument
328 struct asd_ascb *tascb = task->lldd_task; in asd_clear_nexus()
334 ASD_DPRINTK("task not done, clearing nexus\n"); in asd_clear_nexus()
336 res = asd_clear_nexus_tag(task); in asd_clear_nexus()
338 res = asd_clear_nexus_index(task); in asd_clear_nexus()
343 spin_lock_irqsave(&task->task_state_lock, flags); in asd_clear_nexus()
346 if (task->task_state_flags & SAS_TASK_STATE_DONE) in asd_clear_nexus()
348 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_clear_nexus()
354 * asd_abort_task -- ABORT TASK TMF
355 * @task: the task to be aborted
357 * Before calling ABORT TASK the task state flags should be ORed with
359 * the task_state_lock IRQ spinlock, then ABORT TASK *must* be called.
361 * Implements the ABORT TASK TMF, I_T_L_Q nexus.
366 * When ABORT TASK returns, the caller of ABORT TASK checks first the
367 * task->task_state_flags, and then the return value of ABORT TASK.
369 * If the task has task state bit SAS_TASK_STATE_DONE set, then the
370 * task was completed successfully prior to it being aborted. The
371 * caller of ABORT TASK has responsibility to call task->task_done()
372 * xor free the task, depending on their framework. The return code
377 * the task was aborted successfully. The caller of
378 * ABORT TASK has responsibility to call task->task_done()
379 * to finish the task, xor free the task depending on their
382 * the ABORT TASK returned some kind of error. The task
384 * The caller of ABORT TASK may wish to retry.
386 int asd_abort_task(struct sas_task *task) in asd_abort_task() argument
388 struct asd_ascb *tascb = task->lldd_task; in asd_abort_task()
401 spin_lock_irqsave(&task->task_state_lock, flags); in asd_abort_task()
402 if (task->task_state_flags & SAS_TASK_STATE_DONE) { in asd_abort_task()
403 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_abort_task()
405 ASD_DPRINTK("%s: task 0x%p done\n", __func__, task); in asd_abort_task()
408 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_abort_task()
419 switch (task->task_proto) { in asd_abort_task()
426 scb->abort_task.proto_conn_rate |= task->dev->linkrate; in asd_abort_task()
434 if (task->task_proto == SAS_PROTOCOL_SSP) { in asd_abort_task()
437 task->dev->hashed_sas_addr, HASHED_SAS_ADDR_SIZE); in asd_abort_task()
439 task->dev->port->ha->hashed_sas_addr, in asd_abort_task()
443 memcpy(scb->abort_task.ssp_task.lun, task->ssp_task.LUN, 8); in asd_abort_task()
450 (u16)(unsigned long)task->dev->lldd_dev); in asd_abort_task()
465 spin_lock_irqsave(&task->task_state_lock, flags); in asd_abort_task()
466 if (task->task_state_flags & SAS_TASK_STATE_DONE) { in asd_abort_task()
467 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_abort_task()
469 ASD_DPRINTK("%s: task 0x%p done\n", __func__, task); in asd_abort_task()
472 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_abort_task()
475 /* The task to be aborted has been sent to the device. in asd_abort_task()
476 * We got a Response IU for the ABORT TASK TMF. */ in asd_abort_task()
478 res = asd_clear_nexus(task); in asd_abort_task()
488 * TASK. in asd_abort_task()
492 res = asd_clear_nexus(task); in asd_abort_task()
496 /* The task hasn't been sent to the device xor in asd_abort_task()
498 * ABORT TASK TMF. in asd_abort_task()
508 spin_lock_irqsave(&task->task_state_lock, flags); in asd_abort_task()
511 if (task->task_state_flags & SAS_TASK_STATE_DONE) in asd_abort_task()
513 spin_unlock_irqrestore(&task->task_state_lock, flags); in asd_abort_task()
528 task->lldd_task = NULL; in asd_abort_task()
532 ASD_DPRINTK("task 0x%p aborted, res: 0x%x\n", task, res); in asd_abort_task()
537 ASD_DPRINTK("task 0x%p aborted, res: 0x%x\n", task, res); in asd_abort_task()
546 * @index: the transaction context of the task to be queried if QT TMF
548 * This function is used to send ABORT TASK SET, CLEAR ACA,
549 * CLEAR TASK SET, LU RESET and QUERY TASK TMFs.
591 /* SSP Task IU */ in asd_initiate_ssp_tmf()
666 * asd_query_task -- send a QUERY TASK TMF to an I_T_L_Q nexus
667 * @task: pointer to sas_task struct of interest
669 * Returns: TMF_RESP_FUNC_COMPLETE if the task is not in the task set,
670 * or TMF_RESP_FUNC_SUCC if the task is in the task set.
672 * Normally the management layer sets the task to aborted state,
673 * and then calls query task and then abort task.
675 int asd_query_task(struct sas_task *task) in asd_query_task() argument
677 struct asd_ascb *ascb = task->lldd_task; in asd_query_task()
682 return asd_initiate_ssp_tmf(task->dev, task->ssp_task.LUN, in asd_query_task()