Lines Matching refs:scmnd
620 static void srp_unmap_data(struct scsi_cmnd *scmnd, in srp_unmap_data() argument
627 if (!scsi_sglist(scmnd) || in srp_unmap_data()
628 (scmnd->sc_data_direction != DMA_TO_DEVICE && in srp_unmap_data()
629 scmnd->sc_data_direction != DMA_FROM_DEVICE)) in srp_unmap_data()
636 ib_dma_unmap_sg(ibdev, scsi_sglist(scmnd), scsi_sg_count(scmnd), in srp_unmap_data()
637 scmnd->sc_data_direction); in srp_unmap_data()
652 struct scsi_cmnd *scmnd) in srp_claim_req() argument
657 if (!scmnd) { in srp_claim_req()
658 scmnd = req->scmnd; in srp_claim_req()
659 req->scmnd = NULL; in srp_claim_req()
660 } else if (req->scmnd == scmnd) { in srp_claim_req()
661 req->scmnd = NULL; in srp_claim_req()
663 scmnd = NULL; in srp_claim_req()
667 return scmnd; in srp_claim_req()
674 struct srp_request *req, struct scsi_cmnd *scmnd, in srp_free_req() argument
679 srp_unmap_data(scmnd, target, req); in srp_free_req()
689 struct scsi_cmnd *scmnd = srp_claim_req(target, req, NULL); in srp_reset_req() local
691 if (scmnd) { in srp_reset_req()
692 srp_free_req(target, req, scmnd, 0); in srp_reset_req()
693 scmnd->result = DID_RESET << 16; in srp_reset_req()
694 scmnd->scsi_done(scmnd); in srp_reset_req()
724 if (req->scmnd) in srp_reconnect_target()
894 static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, in srp_map_data() argument
907 if (!scsi_sglist(scmnd) || scmnd->sc_data_direction == DMA_NONE) in srp_map_data()
910 if (scmnd->sc_data_direction != DMA_FROM_DEVICE && in srp_map_data()
911 scmnd->sc_data_direction != DMA_TO_DEVICE) { in srp_map_data()
914 scmnd->sc_data_direction); in srp_map_data()
918 nents = scsi_sg_count(scmnd); in srp_map_data()
919 scat = scsi_sglist(scmnd); in srp_map_data()
924 count = ib_dma_map_sg(ibdev, scat, nents, scmnd->sc_data_direction); in srp_map_data()
1027 if (scmnd->sc_data_direction == DMA_TO_DEVICE) in srp_map_data()
1036 if (scmnd->sc_data_direction == DMA_TO_DEVICE) in srp_map_data()
1138 struct scsi_cmnd *scmnd; in srp_process_rsp() local
1152 scmnd = srp_claim_req(target, req, NULL); in srp_process_rsp()
1153 if (!scmnd) { in srp_process_rsp()
1164 scmnd->result = rsp->status; in srp_process_rsp()
1167 memcpy(scmnd->sense_buffer, rsp->data + in srp_process_rsp()
1174 scsi_set_resid(scmnd, be32_to_cpu(rsp->data_out_res_cnt)); in srp_process_rsp()
1176 scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt)); in srp_process_rsp()
1178 srp_free_req(target, req, scmnd, in srp_process_rsp()
1181 scmnd->host_scribble = NULL; in srp_process_rsp()
1182 scmnd->scsi_done(scmnd); in srp_process_rsp()
1347 static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) in srp_queuecommand() argument
1358 scmnd->result = DID_NO_CONNECT << 16; in srp_queuecommand()
1359 scmnd->scsi_done(scmnd); in srp_queuecommand()
1376 scmnd->result = 0; in srp_queuecommand()
1377 scmnd->host_scribble = (void *) req; in srp_queuecommand()
1383 cmd->lun = cpu_to_be64((u64) scmnd->device->lun << 48); in srp_queuecommand()
1385 memcpy(cmd->cdb, scmnd->cmnd, scmnd->cmd_len); in srp_queuecommand()
1387 req->scmnd = scmnd; in srp_queuecommand()
1390 len = srp_map_data(scmnd, target, req); in srp_queuecommand()
1408 srp_unmap_data(scmnd, target, req); in srp_queuecommand()
1743 static int srp_abort(struct scsi_cmnd *scmnd) in srp_abort() argument
1745 struct srp_target_port *target = host_to_target(scmnd->device->host); in srp_abort()
1746 struct srp_request *req = (struct srp_request *) scmnd->host_scribble; in srp_abort()
1750 if (!req || !srp_claim_req(target, req, scmnd)) in srp_abort()
1752 srp_send_tsk_mgmt(target, req->index, scmnd->device->lun, in srp_abort()
1754 srp_free_req(target, req, scmnd, 0); in srp_abort()
1755 scmnd->result = DID_ABORT << 16; in srp_abort()
1756 scmnd->scsi_done(scmnd); in srp_abort()
1761 static int srp_reset_device(struct scsi_cmnd *scmnd) in srp_reset_device() argument
1763 struct srp_target_port *target = host_to_target(scmnd->device->host); in srp_reset_device()
1768 if (srp_send_tsk_mgmt(target, SRP_TAG_NO_REQ, scmnd->device->lun, in srp_reset_device()
1776 if (req->scmnd && req->scmnd->device == scmnd->device) in srp_reset_device()
1783 static int srp_reset_host(struct scsi_cmnd *scmnd) in srp_reset_host() argument
1785 struct srp_target_port *target = host_to_target(scmnd->device->host); in srp_reset_host()