Lines Matching refs:cmnd

27 static int bfad_im_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmnd);
37 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; in bfa_cb_ioim_done() local
46 scsi_set_resid(cmnd, 0); in bfa_cb_ioim_done()
52 memcpy(cmnd->sense_buffer, sns_info, sns_len); in bfa_cb_ioim_done()
57 scsi_set_resid(cmnd, residue); in bfa_cb_ioim_done()
59 (scsi_bufflen(cmnd) - residue) < in bfa_cb_ioim_done()
60 cmnd->underflow) { in bfa_cb_ioim_done()
65 cmnd->result = host_status << 16 | scsi_status; in bfa_cb_ioim_done()
70 cmnd->result = DID_TIME_OUT << 16; in bfa_cb_ioim_done()
73 cmnd->result = DID_TRANSPORT_DISRUPTED << 16; in bfa_cb_ioim_done()
76 cmnd->result = DID_ERROR << 16; in bfa_cb_ioim_done()
80 if (cmnd->device->host != NULL) in bfa_cb_ioim_done()
81 scsi_dma_unmap(cmnd); in bfa_cb_ioim_done()
83 cmnd->host_scribble = NULL; in bfa_cb_ioim_done()
84 bfa_trc(bfad, cmnd->result); in bfa_cb_ioim_done()
86 itnim_data = cmnd->device->hostdata; in bfa_cb_ioim_done()
89 if (!cmnd->result && itnim && in bfa_cb_ioim_done()
90 (bfa_lun_queue_depth > cmnd->device->queue_depth)) { in bfa_cb_ioim_done()
92 bfad_ramp_up_qdepth(itnim, cmnd->device); in bfa_cb_ioim_done()
93 } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) { in bfa_cb_ioim_done()
95 bfad_handle_qfull(itnim, cmnd->device); in bfa_cb_ioim_done()
99 cmnd->scsi_done(cmnd); in bfa_cb_ioim_done()
105 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; in bfa_cb_ioim_good_comp() local
109 cmnd->result = DID_OK << 16 | SAM_STAT_GOOD; in bfa_cb_ioim_good_comp()
112 if (cmnd->device->host != NULL) in bfa_cb_ioim_good_comp()
113 scsi_dma_unmap(cmnd); in bfa_cb_ioim_good_comp()
115 cmnd->host_scribble = NULL; in bfa_cb_ioim_good_comp()
118 if (bfa_lun_queue_depth > cmnd->device->queue_depth) { in bfa_cb_ioim_good_comp()
119 itnim_data = cmnd->device->hostdata; in bfa_cb_ioim_good_comp()
123 bfad_ramp_up_qdepth(itnim, cmnd->device); in bfa_cb_ioim_good_comp()
127 cmnd->scsi_done(cmnd); in bfa_cb_ioim_good_comp()
133 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; in bfa_cb_ioim_abort() local
136 cmnd->result = DID_ERROR << 16; in bfa_cb_ioim_abort()
139 if (cmnd->device->host != NULL) in bfa_cb_ioim_abort()
140 scsi_dma_unmap(cmnd); in bfa_cb_ioim_abort()
142 bfa_trc(bfad, cmnd->result); in bfa_cb_ioim_abort()
143 cmnd->host_scribble = NULL; in bfa_cb_ioim_abort()
150 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dtsk; in bfa_cb_tskim_done() local
153 cmnd->SCp.Status |= tsk_status << 1; in bfa_cb_tskim_done()
154 set_bit(IO_DONE_BIT, (unsigned long *)&cmnd->SCp.Status); in bfa_cb_tskim_done()
155 wq = (wait_queue_head_t *) cmnd->SCp.ptr; in bfa_cb_tskim_done()
156 cmnd->SCp.ptr = NULL; in bfa_cb_tskim_done()
190 bfad_im_abort_handler(struct scsi_cmnd *cmnd) in bfad_im_abort_handler() argument
192 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_abort_handler()
202 hal_io = (struct bfa_ioim_s *) cmnd->host_scribble; in bfad_im_abort_handler()
208 if (hal_io->dio != (struct bfad_ioim_s *) cmnd) { in bfad_im_abort_handler()
216 im_port->shost->host_no, cmnd, hal_io->iotag); in bfad_im_abort_handler()
222 while ((struct bfa_ioim_s *) cmnd->host_scribble == hal_io) { in bfad_im_abort_handler()
229 cmnd->scsi_done(cmnd); in bfad_im_abort_handler()
233 im_port->shost->host_no, cmnd, hal_io->iotag); in bfad_im_abort_handler()
241 bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, in bfad_im_target_reset_send() argument
249 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); in bfad_im_target_reset_send()
261 cmnd->host_scribble = NULL; in bfad_im_target_reset_send()
262 cmnd->SCp.Status = 0; in bfad_im_target_reset_send()
291 bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) in bfad_im_reset_lun_handler() argument
293 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_reset_lun_handler()
296 struct bfad_itnim_data_s *itnim_data = cmnd->device->hostdata; in bfad_im_reset_lun_handler()
315 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); in bfad_im_reset_lun_handler()
328 cmnd->host_scribble = NULL; in bfad_im_reset_lun_handler()
329 cmnd->SCp.ptr = (char *)&wq; in bfad_im_reset_lun_handler()
330 cmnd->SCp.Status = 0; in bfad_im_reset_lun_handler()
345 int_to_scsilun(cmnd->device->lun, &scsilun); in bfad_im_reset_lun_handler()
351 (unsigned long *)&cmnd->SCp.Status)); in bfad_im_reset_lun_handler()
353 task_status = cmnd->SCp.Status >> 1; in bfad_im_reset_lun_handler()
368 bfad_im_reset_target_handler(struct scsi_cmnd *cmnd) in bfad_im_reset_target_handler() argument
370 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_reset_target_handler()
371 struct scsi_target *starget = scsi_target(cmnd->device); in bfad_im_reset_target_handler()
384 cmnd->SCp.ptr = (char *)&wq; in bfad_im_reset_target_handler()
385 rc = bfad_im_target_reset_send(bfad, cmnd, itnim); in bfad_im_reset_target_handler()
390 (unsigned long *)&cmnd->SCp.Status)); in bfad_im_reset_target_handler()
393 task_status = cmnd->SCp.Status >> 1; in bfad_im_reset_target_handler()
1203 bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) in bfad_im_queuecommand_lck() argument
1206 (struct bfad_im_port_s *) cmnd->device->host->hostdata[0]; in bfad_im_queuecommand_lck()
1208 struct bfad_itnim_data_s *itnim_data = cmnd->device->hostdata; in bfad_im_queuecommand_lck()
1214 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); in bfad_im_queuecommand_lck()
1218 cmnd->result = rc; in bfad_im_queuecommand_lck()
1219 done(cmnd); in bfad_im_queuecommand_lck()
1225 cmnd->result = DID_NO_CONNECT << 16; in bfad_im_queuecommand_lck()
1227 cmnd->result = DID_REQUEUE << 16; in bfad_im_queuecommand_lck()
1228 done(cmnd); in bfad_im_queuecommand_lck()
1232 sg_cnt = scsi_dma_map(cmnd); in bfad_im_queuecommand_lck()
1236 cmnd->scsi_done = done; in bfad_im_queuecommand_lck()
1242 bfad->inst_no, cmnd, cmnd->cmnd[0]); in bfad_im_queuecommand_lck()
1243 cmnd->result = DID_NO_CONNECT << 16; in bfad_im_queuecommand_lck()
1250 cmnd->result = DID_IMM_RETRY << 16; in bfad_im_queuecommand_lck()
1254 hal_io = bfa_ioim_alloc(&bfad->bfa, (struct bfad_ioim_s *) cmnd, in bfad_im_queuecommand_lck()
1259 scsi_dma_unmap(cmnd); in bfad_im_queuecommand_lck()
1263 cmnd->host_scribble = (char *)hal_io; in bfad_im_queuecommand_lck()
1271 scsi_dma_unmap(cmnd); in bfad_im_queuecommand_lck()
1273 done(cmnd); in bfad_im_queuecommand_lck()