Lines Matching refs:scmnd
1176 static void srp_unmap_data(struct scsi_cmnd *scmnd, in srp_unmap_data() argument
1185 if (!scsi_sglist(scmnd) || in srp_unmap_data()
1186 (scmnd->sc_data_direction != DMA_TO_DEVICE && in srp_unmap_data()
1187 scmnd->sc_data_direction != DMA_FROM_DEVICE)) in srp_unmap_data()
1208 ib_dma_unmap_sg(ibdev, scsi_sglist(scmnd), scsi_sg_count(scmnd), in srp_unmap_data()
1209 scmnd->sc_data_direction); in srp_unmap_data()
1226 struct scsi_cmnd *scmnd) in srp_claim_req() argument
1231 if (req->scmnd && in srp_claim_req()
1232 (!sdev || req->scmnd->device == sdev) && in srp_claim_req()
1233 (!scmnd || req->scmnd == scmnd)) { in srp_claim_req()
1234 scmnd = req->scmnd; in srp_claim_req()
1235 req->scmnd = NULL; in srp_claim_req()
1237 scmnd = NULL; in srp_claim_req()
1241 return scmnd; in srp_claim_req()
1252 struct scsi_cmnd *scmnd, s32 req_lim_delta) in srp_free_req() argument
1256 srp_unmap_data(scmnd, ch, req); in srp_free_req()
1266 struct scsi_cmnd *scmnd = srp_claim_req(ch, req, sdev, NULL); in srp_finish_req() local
1268 if (scmnd) { in srp_finish_req()
1269 srp_free_req(ch, req, scmnd, 0); in srp_finish_req()
1270 scmnd->result = result; in srp_finish_req()
1271 scsi_done(scmnd); in srp_finish_req()
1280 static bool srp_terminate_cmd(struct scsi_cmnd *scmnd, void *context_ptr) in srp_terminate_cmd() argument
1284 u32 tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmnd)); in srp_terminate_cmd()
1286 struct srp_request *req = scsi_cmd_priv(scmnd); in srp_terminate_cmd()
1464 dev_name(&req->scmnd->device->sdev_gendev), sg_nents, in srp_map_finish_fr()
1603 if (desc_len != scsi_bufflen(req->scmnd) || in srp_check_mapping()
1604 mr_len > scsi_bufflen(req->scmnd)) in srp_check_mapping()
1606 scsi_bufflen(req->scmnd), desc_len, mr_len, in srp_check_mapping()
1620 static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, in srp_map_data() argument
1638 if (!scsi_sglist(scmnd) || scmnd->sc_data_direction == DMA_NONE) in srp_map_data()
1641 if (scmnd->sc_data_direction != DMA_FROM_DEVICE && in srp_map_data()
1642 scmnd->sc_data_direction != DMA_TO_DEVICE) { in srp_map_data()
1645 scmnd->sc_data_direction); in srp_map_data()
1649 nents = scsi_sg_count(scmnd); in srp_map_data()
1650 scat = scsi_sglist(scmnd); in srp_map_data()
1651 data_len = scsi_bufflen(scmnd); in srp_map_data()
1656 count = ib_dma_map_sg(ibdev, scat, nents, scmnd->sc_data_direction); in srp_map_data()
1663 scmnd->sc_data_direction == DMA_TO_DEVICE) { in srp_map_data()
1783 if (scmnd->sc_data_direction == DMA_TO_DEVICE) in srp_map_data()
1792 if (scmnd->sc_data_direction == DMA_TO_DEVICE) in srp_map_data()
1800 srp_unmap_data(scmnd, ch, req); in srp_map_data()
1937 struct scsi_cmnd *scmnd; in srp_process_rsp() local
1955 scmnd = scsi_host_find_tag(target->scsi_host, rsp->tag); in srp_process_rsp()
1956 if (scmnd) { in srp_process_rsp()
1957 req = scsi_cmd_priv(scmnd); in srp_process_rsp()
1958 scmnd = srp_claim_req(ch, req, NULL, scmnd); in srp_process_rsp()
1960 if (!scmnd) { in srp_process_rsp()
1971 scmnd->result = rsp->status; in srp_process_rsp()
1974 memcpy(scmnd->sense_buffer, rsp->data + in srp_process_rsp()
1981 scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt)); in srp_process_rsp()
1983 scsi_set_resid(scmnd, be32_to_cpu(rsp->data_out_res_cnt)); in srp_process_rsp()
1985 srp_free_req(ch, req, scmnd, in srp_process_rsp()
1988 scsi_done(scmnd); in srp_process_rsp()
2151 static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) in srp_queuecommand() argument
2153 struct request *rq = scsi_cmd_to_rq(scmnd); in srp_queuecommand()
2156 struct srp_request *req = scsi_cmd_priv(scmnd); in srp_queuecommand()
2164 scmnd->result = srp_chkready(target->rport); in srp_queuecommand()
2165 if (unlikely(scmnd->result)) in srp_queuecommand()
2187 int_to_scsilun(scmnd->device->lun, &cmd->lun); in srp_queuecommand()
2189 memcpy(cmd->cdb, scmnd->cmnd, scmnd->cmd_len); in srp_queuecommand()
2190 if (unlikely(scmnd->cmd_len > sizeof(cmd->cdb))) { in srp_queuecommand()
2191 cmd->add_cdb_len = round_up(scmnd->cmd_len - sizeof(cmd->cdb), in srp_queuecommand()
2197 req->scmnd = scmnd; in srp_queuecommand()
2200 len = srp_map_data(scmnd, ch, req); in srp_queuecommand()
2210 scmnd->result = len == -ENOMEM ? in srp_queuecommand()
2220 scmnd->result = DID_ERROR << 16; in srp_queuecommand()
2227 srp_unmap_data(scmnd, ch, req); in srp_queuecommand()
2236 req->scmnd = NULL; in srp_queuecommand()
2239 if (scmnd->result) { in srp_queuecommand()
2240 scsi_done(scmnd); in srp_queuecommand()
2780 static int srp_abort(struct scsi_cmnd *scmnd) in srp_abort() argument
2782 struct srp_target_port *target = host_to_target(scmnd->device->host); in srp_abort()
2783 struct srp_request *req = scsi_cmd_priv(scmnd); in srp_abort()
2790 tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmnd)); in srp_abort()
2795 if (!srp_claim_req(ch, req, NULL, scmnd)) in srp_abort()
2799 if (srp_send_tsk_mgmt(ch, tag, scmnd->device->lun, in srp_abort()
2801 srp_free_req(ch, req, scmnd, 0); in srp_abort()
2810 static int srp_reset_device(struct scsi_cmnd *scmnd) in srp_reset_device() argument
2812 struct srp_target_port *target = host_to_target(scmnd->device->host); in srp_reset_device()
2819 if (srp_send_tsk_mgmt(ch, SRP_TAG_NO_REQ, scmnd->device->lun, in srp_reset_device()
2828 static int srp_reset_host(struct scsi_cmnd *scmnd) in srp_reset_host() argument
2830 struct srp_target_port *target = host_to_target(scmnd->device->host); in srp_reset_host()