Lines Matching refs:task

37 static void sas_end_task(struct scsi_cmnd *sc, struct sas_task *task)  in sas_end_task()  argument
39 struct task_status_struct *ts = &task->task_status; in sas_end_task()
78 task->dev->port->ha->sas_ha_name); in sas_end_task()
96 sas_free_task(task); in sas_end_task()
99 static void sas_scsi_task_done(struct sas_task *task) in sas_scsi_task_done() argument
101 struct scsi_cmnd *sc = task->uldd_task; in sas_scsi_task_done()
102 struct domain_device *dev = task->dev; in sas_scsi_task_done()
108 task = NULL; in sas_scsi_task_done()
113 if (unlikely(!task)) { in sas_scsi_task_done()
121 sas_free_task(task); in sas_scsi_task_done()
125 sas_end_task(sc, task); in sas_scsi_task_done()
133 struct sas_task *task = sas_alloc_task(gfp_flags); in sas_create_task() local
136 if (!task) in sas_create_task()
139 task->uldd_task = cmd; in sas_create_task()
140 ASSIGN_SAS_TASK(cmd, task); in sas_create_task()
142 task->dev = dev; in sas_create_task()
143 task->task_proto = task->dev->tproto; /* BUG_ON(!SSP) */ in sas_create_task()
146 memcpy(task->ssp_task.LUN, &lun.scsi_lun, 8); in sas_create_task()
147 task->ssp_task.task_attr = TASK_ATTR_SIMPLE; in sas_create_task()
148 task->ssp_task.cmd = cmd; in sas_create_task()
150 task->scatter = scsi_sglist(cmd); in sas_create_task()
151 task->num_scatter = scsi_sg_count(cmd); in sas_create_task()
152 task->total_xfer_len = scsi_bufflen(cmd); in sas_create_task()
153 task->data_dir = cmd->sc_data_direction; in sas_create_task()
155 task->task_done = sas_scsi_task_done; in sas_create_task()
157 return task; in sas_create_task()
164 struct sas_task *task; in sas_queuecommand() local
180 task = sas_create_task(cmd, dev, GFP_ATOMIC); in sas_queuecommand()
181 if (!task) in sas_queuecommand()
184 res = i->dft->lldd_execute_task(task, GFP_ATOMIC); in sas_queuecommand()
192 sas_free_task(task); in sas_queuecommand()
207 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_finish_cmd() local
213 sas_end_task(cmd, task); in sas_eh_finish_cmd()
276 static enum task_disposition sas_scsi_find_task(struct sas_task *task) in sas_scsi_find_task() argument
281 to_sas_internal(task->dev->port->ha->shost->transportt); in sas_scsi_find_task()
284 pr_notice("%s: aborting task 0x%p\n", __func__, task); in sas_scsi_find_task()
285 res = si->dft->lldd_abort_task(task); in sas_scsi_find_task()
287 spin_lock_irqsave(&task->task_state_lock, flags); in sas_scsi_find_task()
288 if (task->task_state_flags & SAS_TASK_STATE_DONE) { in sas_scsi_find_task()
289 spin_unlock_irqrestore(&task->task_state_lock, flags); in sas_scsi_find_task()
290 pr_debug("%s: task 0x%p is done\n", __func__, task); in sas_scsi_find_task()
293 spin_unlock_irqrestore(&task->task_state_lock, flags); in sas_scsi_find_task()
297 __func__, task); in sas_scsi_find_task()
300 pr_notice("%s: querying task 0x%p\n", __func__, task); in sas_scsi_find_task()
301 res = si->dft->lldd_query_task(task); in sas_scsi_find_task()
305 task); in sas_scsi_find_task()
309 __func__, task); in sas_scsi_find_task()
313 __func__, task); in sas_scsi_find_task()
317 __func__, task, res); in sas_scsi_find_task()
428 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_abort_handler() local
445 if (task) in sas_eh_abort_handler()
446 res = i->dft->lldd_abort_task(task); in sas_eh_abort_handler()
536 struct sas_task *task; in sas_eh_handle_sas_errors() local
543 task = TO_SAS_TASK(cmd); in sas_eh_handle_sas_errors()
546 if (!task) in sas_eh_handle_sas_errors()
552 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_handle_sas_errors() local
556 spin_lock_irqsave(&task->task_state_lock, flags); in sas_eh_handle_sas_errors()
557 need_reset = task->task_state_flags & SAS_TASK_NEED_DEV_RESET; in sas_eh_handle_sas_errors()
558 spin_unlock_irqrestore(&task->task_state_lock, flags); in sas_eh_handle_sas_errors()
562 __func__, task); in sas_eh_handle_sas_errors()
566 pr_debug("trying to find task 0x%p\n", task); in sas_eh_handle_sas_errors()
567 res = sas_scsi_find_task(task); in sas_eh_handle_sas_errors()
572 task); in sas_eh_handle_sas_errors()
577 __func__, task); in sas_eh_handle_sas_errors()
581 pr_info("task 0x%p is at LU: lu recover\n", task); in sas_eh_handle_sas_errors()
583 tmf_resp = sas_recover_lu(task->dev, cmd); in sas_eh_handle_sas_errors()
586 SAS_ADDR(task->dev), in sas_eh_handle_sas_errors()
596 task); in sas_eh_handle_sas_errors()
597 tmf_resp = sas_recover_I_T(task->dev); in sas_eh_handle_sas_errors()
600 struct domain_device *dev = task->dev; in sas_eh_handle_sas_errors()
602 SAS_ADDR(task->dev->sas_addr)); in sas_eh_handle_sas_errors()
610 struct asd_sas_port *port = task->dev->port; in sas_eh_handle_sas_errors()
637 SAS_ADDR(task->dev->sas_addr), in sas_eh_handle_sas_errors()
861 void sas_task_internal_done(struct sas_task *task) in sas_task_internal_done() argument
863 del_timer(&task->slow_task->timer); in sas_task_internal_done()
864 complete(&task->slow_task->completion); in sas_task_internal_done()
870 struct sas_task *task = slow->task; in sas_task_internal_timedout() local
874 spin_lock_irqsave(&task->task_state_lock, flags); in sas_task_internal_timedout()
875 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { in sas_task_internal_timedout()
876 task->task_state_flags |= SAS_TASK_STATE_ABORTED; in sas_task_internal_timedout()
879 spin_unlock_irqrestore(&task->task_state_lock, flags); in sas_task_internal_timedout()
882 complete(&task->slow_task->completion); in sas_task_internal_timedout()
894 struct sas_task *task = NULL; in sas_execute_internal_abort() local
898 task = sas_alloc_slow_task(GFP_KERNEL); in sas_execute_internal_abort()
899 if (!task) in sas_execute_internal_abort()
902 task->dev = device; in sas_execute_internal_abort()
903 task->task_proto = SAS_PROTOCOL_INTERNAL_ABORT; in sas_execute_internal_abort()
904 task->task_done = sas_task_internal_done; in sas_execute_internal_abort()
905 task->slow_task->timer.function = sas_task_internal_timedout; in sas_execute_internal_abort()
906 task->slow_task->timer.expires = jiffies + TASK_TIMEOUT; in sas_execute_internal_abort()
907 add_timer(&task->slow_task->timer); in sas_execute_internal_abort()
909 task->abort_task.tag = tag; in sas_execute_internal_abort()
910 task->abort_task.type = type; in sas_execute_internal_abort()
911 task->abort_task.qid = qid; in sas_execute_internal_abort()
913 res = i->dft->lldd_execute_task(task, GFP_KERNEL); in sas_execute_internal_abort()
915 del_timer_sync(&task->slow_task->timer); in sas_execute_internal_abort()
921 wait_for_completion(&task->slow_task->completion); in sas_execute_internal_abort()
925 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { in sas_execute_internal_abort()
929 quit = i->dft->lldd_abort_timeout(task, data); in sas_execute_internal_abort()
938 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_internal_abort()
939 task->task_status.stat == SAS_SAM_STAT_GOOD) { in sas_execute_internal_abort()
944 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_internal_abort()
945 task->task_status.stat == TMF_RESP_FUNC_SUCC) { in sas_execute_internal_abort()
951 SAS_ADDR(device->sas_addr), task->task_status.resp, in sas_execute_internal_abort()
952 task->task_status.stat); in sas_execute_internal_abort()
953 sas_free_task(task); in sas_execute_internal_abort()
954 task = NULL; in sas_execute_internal_abort()
956 BUG_ON(retry == TASK_RETRY && task != NULL); in sas_execute_internal_abort()
957 sas_free_task(task); in sas_execute_internal_abort()
981 struct sas_task *task; in sas_execute_tmf() local
987 task = sas_alloc_slow_task(GFP_KERNEL); in sas_execute_tmf()
988 if (!task) in sas_execute_tmf()
991 task->dev = device; in sas_execute_tmf()
992 task->task_proto = device->tproto; in sas_execute_tmf()
995 task->ata_task.device_control_reg_update = 1; in sas_execute_tmf()
997 task->ata_task.force_phy = true; in sas_execute_tmf()
998 task->ata_task.force_phy_id = force_phy_id; in sas_execute_tmf()
1000 memcpy(&task->ata_task.fis, parameter, para_len); in sas_execute_tmf()
1002 memcpy(&task->ssp_task, parameter, para_len); in sas_execute_tmf()
1005 task->task_done = sas_task_internal_done; in sas_execute_tmf()
1006 task->tmf = tmf; in sas_execute_tmf()
1008 task->slow_task->timer.function = sas_task_internal_timedout; in sas_execute_tmf()
1009 task->slow_task->timer.expires = jiffies + TASK_TIMEOUT; in sas_execute_tmf()
1010 add_timer(&task->slow_task->timer); in sas_execute_tmf()
1012 res = i->dft->lldd_execute_task(task, GFP_KERNEL); in sas_execute_tmf()
1014 del_timer_sync(&task->slow_task->timer); in sas_execute_tmf()
1020 wait_for_completion(&task->slow_task->completion); in sas_execute_tmf()
1027 if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) { in sas_execute_tmf()
1028 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { in sas_execute_tmf()
1032 i->dft->lldd_tmf_aborted(task); in sas_execute_tmf()
1039 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1040 task->task_status.stat == TMF_RESP_FUNC_COMPLETE) { in sas_execute_tmf()
1045 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1046 task->task_status.stat == TMF_RESP_FUNC_SUCC) { in sas_execute_tmf()
1051 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1052 task->task_status.stat == SAS_DATA_UNDERRUN) { in sas_execute_tmf()
1058 task->task_status.resp, in sas_execute_tmf()
1059 task->task_status.stat); in sas_execute_tmf()
1060 res = task->task_status.residual; in sas_execute_tmf()
1064 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1065 task->task_status.stat == SAS_DATA_OVERRUN) { in sas_execute_tmf()
1072 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1073 task->task_status.stat == SAS_OPEN_REJECT) { in sas_execute_tmf()
1080 task->task_status.resp, in sas_execute_tmf()
1081 task->task_status.stat); in sas_execute_tmf()
1083 sas_free_task(task); in sas_execute_tmf()
1084 task = NULL; in sas_execute_tmf()
1090 sas_free_task(task); in sas_execute_tmf()
1138 int sas_query_task(struct sas_task *task, u16 tag) in sas_query_task() argument
1144 struct scsi_cmnd *cmnd = task->uldd_task; in sas_query_task()
1145 struct domain_device *dev = task->dev; in sas_query_task()
1154 int sas_abort_task(struct sas_task *task, u16 tag) in sas_abort_task() argument
1160 struct scsi_cmnd *cmnd = task->uldd_task; in sas_abort_task()
1161 struct domain_device *dev = task->dev; in sas_abort_task()
1174 void sas_task_abort(struct sas_task *task) in sas_task_abort() argument
1176 struct scsi_cmnd *sc = task->uldd_task; in sas_task_abort()
1180 struct sas_task_slow *slow = task->slow_task; in sas_task_abort()
1190 if (dev_is_sata(task->dev)) in sas_task_abort()
1191 sas_ata_task_abort(task); in sas_task_abort()