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()
860 void sas_task_internal_done(struct sas_task *task) in sas_task_internal_done() argument
862 del_timer(&task->slow_task->timer); in sas_task_internal_done()
863 complete(&task->slow_task->completion); in sas_task_internal_done()
869 struct sas_task *task = slow->task; in sas_task_internal_timedout() local
873 spin_lock_irqsave(&task->task_state_lock, flags); in sas_task_internal_timedout()
874 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { in sas_task_internal_timedout()
875 task->task_state_flags |= SAS_TASK_STATE_ABORTED; in sas_task_internal_timedout()
878 spin_unlock_irqrestore(&task->task_state_lock, flags); in sas_task_internal_timedout()
881 complete(&task->slow_task->completion); in sas_task_internal_timedout()
893 struct sas_task *task = NULL; in sas_execute_internal_abort() local
897 task = sas_alloc_slow_task(GFP_KERNEL); in sas_execute_internal_abort()
898 if (!task) in sas_execute_internal_abort()
901 task->dev = device; in sas_execute_internal_abort()
902 task->task_proto = SAS_PROTOCOL_INTERNAL_ABORT; in sas_execute_internal_abort()
903 task->task_done = sas_task_internal_done; in sas_execute_internal_abort()
904 task->slow_task->timer.function = sas_task_internal_timedout; in sas_execute_internal_abort()
905 task->slow_task->timer.expires = jiffies + TASK_TIMEOUT; in sas_execute_internal_abort()
906 add_timer(&task->slow_task->timer); in sas_execute_internal_abort()
908 task->abort_task.tag = tag; in sas_execute_internal_abort()
909 task->abort_task.type = type; in sas_execute_internal_abort()
910 task->abort_task.qid = qid; in sas_execute_internal_abort()
912 res = i->dft->lldd_execute_task(task, GFP_KERNEL); in sas_execute_internal_abort()
914 del_timer_sync(&task->slow_task->timer); in sas_execute_internal_abort()
920 wait_for_completion(&task->slow_task->completion); in sas_execute_internal_abort()
924 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { in sas_execute_internal_abort()
928 quit = i->dft->lldd_abort_timeout(task, data); in sas_execute_internal_abort()
937 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_internal_abort()
938 task->task_status.stat == SAS_SAM_STAT_GOOD) { in sas_execute_internal_abort()
943 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_internal_abort()
944 task->task_status.stat == TMF_RESP_FUNC_SUCC) { in sas_execute_internal_abort()
950 SAS_ADDR(device->sas_addr), task->task_status.resp, in sas_execute_internal_abort()
951 task->task_status.stat); in sas_execute_internal_abort()
952 sas_free_task(task); in sas_execute_internal_abort()
953 task = NULL; in sas_execute_internal_abort()
955 BUG_ON(retry == TASK_RETRY && task != NULL); in sas_execute_internal_abort()
956 sas_free_task(task); in sas_execute_internal_abort()
980 struct sas_task *task; in sas_execute_tmf() local
986 task = sas_alloc_slow_task(GFP_KERNEL); in sas_execute_tmf()
987 if (!task) in sas_execute_tmf()
990 task->dev = device; in sas_execute_tmf()
991 task->task_proto = device->tproto; in sas_execute_tmf()
994 task->ata_task.device_control_reg_update = 1; in sas_execute_tmf()
996 task->ata_task.force_phy = true; in sas_execute_tmf()
997 task->ata_task.force_phy_id = force_phy_id; in sas_execute_tmf()
999 memcpy(&task->ata_task.fis, parameter, para_len); in sas_execute_tmf()
1001 memcpy(&task->ssp_task, parameter, para_len); in sas_execute_tmf()
1004 task->task_done = sas_task_internal_done; in sas_execute_tmf()
1005 task->tmf = tmf; in sas_execute_tmf()
1007 task->slow_task->timer.function = sas_task_internal_timedout; in sas_execute_tmf()
1008 task->slow_task->timer.expires = jiffies + TASK_TIMEOUT; in sas_execute_tmf()
1009 add_timer(&task->slow_task->timer); in sas_execute_tmf()
1011 res = i->dft->lldd_execute_task(task, GFP_KERNEL); in sas_execute_tmf()
1013 del_timer_sync(&task->slow_task->timer); in sas_execute_tmf()
1019 wait_for_completion(&task->slow_task->completion); in sas_execute_tmf()
1026 if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) { in sas_execute_tmf()
1027 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { in sas_execute_tmf()
1031 i->dft->lldd_tmf_aborted(task); in sas_execute_tmf()
1038 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1039 task->task_status.stat == TMF_RESP_FUNC_COMPLETE) { in sas_execute_tmf()
1044 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1045 task->task_status.stat == TMF_RESP_FUNC_SUCC) { in sas_execute_tmf()
1050 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1051 task->task_status.stat == SAS_DATA_UNDERRUN) { in sas_execute_tmf()
1057 task->task_status.resp, in sas_execute_tmf()
1058 task->task_status.stat); in sas_execute_tmf()
1059 res = task->task_status.residual; in sas_execute_tmf()
1063 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1064 task->task_status.stat == SAS_DATA_OVERRUN) { in sas_execute_tmf()
1071 if (task->task_status.resp == SAS_TASK_COMPLETE && in sas_execute_tmf()
1072 task->task_status.stat == SAS_OPEN_REJECT) { in sas_execute_tmf()
1079 task->task_status.resp, in sas_execute_tmf()
1080 task->task_status.stat); in sas_execute_tmf()
1082 sas_free_task(task); in sas_execute_tmf()
1083 task = NULL; in sas_execute_tmf()
1089 sas_free_task(task); in sas_execute_tmf()
1137 int sas_query_task(struct sas_task *task, u16 tag) in sas_query_task() argument
1143 struct scsi_cmnd *cmnd = task->uldd_task; in sas_query_task()
1144 struct domain_device *dev = task->dev; in sas_query_task()
1153 int sas_abort_task(struct sas_task *task, u16 tag) in sas_abort_task() argument
1159 struct scsi_cmnd *cmnd = task->uldd_task; in sas_abort_task()
1160 struct domain_device *dev = task->dev; in sas_abort_task()
1173 void sas_task_abort(struct sas_task *task) in sas_task_abort() argument
1175 struct scsi_cmnd *sc = task->uldd_task; in sas_task_abort()
1179 struct sas_task_slow *slow = task->slow_task; in sas_task_abort()
1189 if (dev_is_sata(task->dev)) in sas_task_abort()
1190 sas_ata_task_abort(task); in sas_task_abort()