Lines Matching refs:cmnd

34 static int bfad_im_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmnd);
44 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; in bfa_cb_ioim_done() local
53 scsi_set_resid(cmnd, 0); in bfa_cb_ioim_done()
59 memcpy(cmnd->sense_buffer, sns_info, sns_len); in bfa_cb_ioim_done()
64 scsi_set_resid(cmnd, residue); in bfa_cb_ioim_done()
66 (scsi_bufflen(cmnd) - residue) < in bfa_cb_ioim_done()
67 cmnd->underflow) { in bfa_cb_ioim_done()
72 cmnd->result = ScsiResult(host_status, scsi_status); in bfa_cb_ioim_done()
78 cmnd->result = ScsiResult(host_status, 0); in bfa_cb_ioim_done()
82 cmnd->result = ScsiResult(host_status, 0); in bfa_cb_ioim_done()
86 cmnd->result = ScsiResult(host_status, 0); in bfa_cb_ioim_done()
90 if (cmnd->device->host != NULL) in bfa_cb_ioim_done()
91 scsi_dma_unmap(cmnd); in bfa_cb_ioim_done()
93 cmnd->host_scribble = NULL; in bfa_cb_ioim_done()
94 bfa_trc(bfad, cmnd->result); in bfa_cb_ioim_done()
96 itnim_data = cmnd->device->hostdata; in bfa_cb_ioim_done()
99 if (!cmnd->result && itnim && in bfa_cb_ioim_done()
100 (bfa_lun_queue_depth > cmnd->device->queue_depth)) { in bfa_cb_ioim_done()
102 bfad_ramp_up_qdepth(itnim, cmnd->device); in bfa_cb_ioim_done()
103 } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) { in bfa_cb_ioim_done()
105 bfad_handle_qfull(itnim, cmnd->device); in bfa_cb_ioim_done()
109 cmnd->scsi_done(cmnd); in bfa_cb_ioim_done()
115 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; in bfa_cb_ioim_good_comp() local
119 cmnd->result = ScsiResult(DID_OK, SCSI_STATUS_GOOD); in bfa_cb_ioim_good_comp()
122 if (cmnd->device->host != NULL) in bfa_cb_ioim_good_comp()
123 scsi_dma_unmap(cmnd); in bfa_cb_ioim_good_comp()
125 cmnd->host_scribble = NULL; in bfa_cb_ioim_good_comp()
128 if (bfa_lun_queue_depth > cmnd->device->queue_depth) { in bfa_cb_ioim_good_comp()
129 itnim_data = cmnd->device->hostdata; in bfa_cb_ioim_good_comp()
133 bfad_ramp_up_qdepth(itnim, cmnd->device); in bfa_cb_ioim_good_comp()
137 cmnd->scsi_done(cmnd); in bfa_cb_ioim_good_comp()
143 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; in bfa_cb_ioim_abort() local
146 cmnd->result = ScsiResult(DID_ERROR, 0); in bfa_cb_ioim_abort()
149 if (cmnd->device->host != NULL) in bfa_cb_ioim_abort()
150 scsi_dma_unmap(cmnd); in bfa_cb_ioim_abort()
152 bfa_trc(bfad, cmnd->result); in bfa_cb_ioim_abort()
153 cmnd->host_scribble = NULL; in bfa_cb_ioim_abort()
160 struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dtsk; in bfa_cb_tskim_done() local
163 cmnd->SCp.Status |= tsk_status << 1; in bfa_cb_tskim_done()
164 set_bit(IO_DONE_BIT, (unsigned long *)&cmnd->SCp.Status); in bfa_cb_tskim_done()
165 wq = (wait_queue_head_t *) cmnd->SCp.ptr; in bfa_cb_tskim_done()
166 cmnd->SCp.ptr = NULL; in bfa_cb_tskim_done()
200 bfad_im_abort_handler(struct scsi_cmnd *cmnd) in bfad_im_abort_handler() argument
202 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_abort_handler()
212 hal_io = (struct bfa_ioim_s *) cmnd->host_scribble; in bfad_im_abort_handler()
218 if (hal_io->dio != (struct bfad_ioim_s *) cmnd) { in bfad_im_abort_handler()
226 im_port->shost->host_no, cmnd, hal_io->iotag); in bfad_im_abort_handler()
232 while ((struct bfa_ioim_s *) cmnd->host_scribble == hal_io) { in bfad_im_abort_handler()
239 cmnd->scsi_done(cmnd); in bfad_im_abort_handler()
243 im_port->shost->host_no, cmnd, hal_io->iotag); in bfad_im_abort_handler()
251 bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, in bfad_im_target_reset_send() argument
259 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); in bfad_im_target_reset_send()
271 cmnd->host_scribble = NULL; in bfad_im_target_reset_send()
272 cmnd->SCp.Status = 0; in bfad_im_target_reset_send()
288 bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) in bfad_im_reset_lun_handler() argument
290 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_reset_lun_handler()
293 struct bfad_itnim_data_s *itnim_data = cmnd->device->hostdata; in bfad_im_reset_lun_handler()
312 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); in bfad_im_reset_lun_handler()
325 cmnd->host_scribble = NULL; in bfad_im_reset_lun_handler()
326 cmnd->SCp.ptr = (char *)&wq; in bfad_im_reset_lun_handler()
327 cmnd->SCp.Status = 0; in bfad_im_reset_lun_handler()
329 int_to_scsilun(cmnd->device->lun, &scsilun); in bfad_im_reset_lun_handler()
335 (unsigned long *)&cmnd->SCp.Status)); in bfad_im_reset_lun_handler()
337 task_status = cmnd->SCp.Status >> 1; in bfad_im_reset_lun_handler()
352 bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd) in bfad_im_reset_bus_handler() argument
354 struct Scsi_Host *shost = cmnd->device->host; in bfad_im_reset_bus_handler()
368 cmnd->SCp.ptr = (char *)&wq; in bfad_im_reset_bus_handler()
369 rc = bfad_im_target_reset_send(bfad, cmnd, itnim); in bfad_im_reset_bus_handler()
378 (unsigned long *)&cmnd->SCp.Status)); in bfad_im_reset_bus_handler()
381 task_status = cmnd->SCp.Status >> 1; in bfad_im_reset_bus_handler()
1191 bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) in bfad_im_queuecommand_lck() argument
1194 (struct bfad_im_port_s *) cmnd->device->host->hostdata[0]; in bfad_im_queuecommand_lck()
1196 struct bfad_itnim_data_s *itnim_data = cmnd->device->hostdata; in bfad_im_queuecommand_lck()
1202 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); in bfad_im_queuecommand_lck()
1206 cmnd->result = rc; in bfad_im_queuecommand_lck()
1207 done(cmnd); in bfad_im_queuecommand_lck()
1213 cmnd->result = DID_NO_CONNECT << 16; in bfad_im_queuecommand_lck()
1215 cmnd->result = DID_REQUEUE << 16; in bfad_im_queuecommand_lck()
1216 done(cmnd); in bfad_im_queuecommand_lck()
1220 sg_cnt = scsi_dma_map(cmnd); in bfad_im_queuecommand_lck()
1224 cmnd->scsi_done = done; in bfad_im_queuecommand_lck()
1230 bfad->inst_no, cmnd, cmnd->cmnd[0]); in bfad_im_queuecommand_lck()
1231 cmnd->result = ScsiResult(DID_NO_CONNECT, 0); in bfad_im_queuecommand_lck()
1238 cmnd->result = ScsiResult(DID_IMM_RETRY, 0); in bfad_im_queuecommand_lck()
1242 hal_io = bfa_ioim_alloc(&bfad->bfa, (struct bfad_ioim_s *) cmnd, in bfad_im_queuecommand_lck()
1247 scsi_dma_unmap(cmnd); in bfad_im_queuecommand_lck()
1251 cmnd->host_scribble = (char *)hal_io; in bfad_im_queuecommand_lck()
1259 scsi_dma_unmap(cmnd); in bfad_im_queuecommand_lck()
1261 done(cmnd); in bfad_im_queuecommand_lck()