Lines Matching refs:xop
57 static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_locate_se_dev_e4() argument
65 dev_wwn = &xop->dst_tid_wwn[0]; in target_xcopy_locate_se_dev_e4()
67 dev_wwn = &xop->src_tid_wwn[0]; in target_xcopy_locate_se_dev_e4()
83 xop->dst_dev = se_dev; in target_xcopy_locate_se_dev_e4()
85 " se_dev\n", xop->dst_dev); in target_xcopy_locate_se_dev_e4()
87 xop->src_dev = se_dev; in target_xcopy_locate_se_dev_e4()
89 " se_dev\n", xop->src_dev); in target_xcopy_locate_se_dev_e4()
113 static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_tiddesc_e4() argument
160 memcpy(&xop->src_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
164 if (!memcmp(&xop->local_dev_wwn[0], &xop->src_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
166 xop->op_origin = XCOL_SOURCE_RECV_OP; in target_xcopy_parse_tiddesc_e4()
167 xop->src_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
169 " received xop\n", xop->src_dev); in target_xcopy_parse_tiddesc_e4()
172 memcpy(&xop->dst_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
176 if (!memcmp(&xop->local_dev_wwn[0], &xop->dst_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
178 xop->op_origin = XCOL_DEST_RECV_OP; in target_xcopy_parse_tiddesc_e4()
179 xop->dst_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
181 " received xop\n", xop->dst_dev); in target_xcopy_parse_tiddesc_e4()
189 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_target_descriptors() argument
212 memset(&xop->local_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_target_descriptors()
213 target_xcopy_gen_naa_ieee(local_dev, &xop->local_dev_wwn[0]); in target_xcopy_parse_target_descriptors()
222 rc = target_xcopy_parse_tiddesc_e4(se_cmd, xop, in target_xcopy_parse_target_descriptors()
244 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in target_xcopy_parse_target_descriptors()
245 rc = target_xcopy_locate_se_dev_e4(se_cmd, xop, true); in target_xcopy_parse_target_descriptors()
247 rc = target_xcopy_locate_se_dev_e4(se_cmd, xop, false); in target_xcopy_parse_target_descriptors()
253 xop->src_dev, &xop->src_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
255 xop->dst_dev, &xop->dst_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
263 static int target_xcopy_parse_segdesc_02(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_segdesc_02() argument
277 xop->stdi = get_unaligned_be16(&desc[4]); in target_xcopy_parse_segdesc_02()
278 xop->dtdi = get_unaligned_be16(&desc[6]); in target_xcopy_parse_segdesc_02()
280 desc_len, xop->stdi, xop->dtdi, dc); in target_xcopy_parse_segdesc_02()
282 xop->nolb = get_unaligned_be16(&desc[10]); in target_xcopy_parse_segdesc_02()
283 xop->src_lba = get_unaligned_be64(&desc[12]); in target_xcopy_parse_segdesc_02()
284 xop->dst_lba = get_unaligned_be64(&desc[20]); in target_xcopy_parse_segdesc_02()
286 xop->nolb, (unsigned long long)xop->src_lba, in target_xcopy_parse_segdesc_02()
287 (unsigned long long)xop->dst_lba); in target_xcopy_parse_segdesc_02()
290 xop->dbl = (desc[29] & 0xff) << 16; in target_xcopy_parse_segdesc_02()
291 xop->dbl |= (desc[30] & 0xff) << 8; in target_xcopy_parse_segdesc_02()
292 xop->dbl |= desc[31] & 0xff; in target_xcopy_parse_segdesc_02()
294 pr_debug("XCOPY seg desc 0x02: DC=1 w/ dbl: %u\n", xop->dbl); in target_xcopy_parse_segdesc_02()
300 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_segment_descriptors() argument
319 rc = target_xcopy_parse_segdesc_02(se_cmd, xop, desc); in target_xcopy_parse_segment_descriptors()
372 static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) in xcopy_pt_undepend_remotedev() argument
376 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in xcopy_pt_undepend_remotedev()
377 remote_dev = xop->dst_dev; in xcopy_pt_undepend_remotedev()
379 remote_dev = xop->src_dev; in xcopy_pt_undepend_remotedev()
488 struct xcopy_op *xop, in target_xcopy_setup_pt_port() argument
491 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_setup_pt_port()
494 if (xop->op_origin == XCOL_SOURCE_RECV_OP) { in target_xcopy_setup_pt_port()
562 struct xcopy_op *xop, in target_xcopy_setup_pt_cmd() argument
577 xpt_cmd->xcopy_op = xop; in target_xcopy_setup_pt_cmd()
578 target_xcopy_setup_pt_port(xpt_cmd, xop, remote_port); in target_xcopy_setup_pt_cmd()
605 xop->xop_data_sg, xop->xop_data_nents, in target_xcopy_setup_pt_cmd()
644 struct xcopy_op *xop, in target_xcopy_read_source() argument
654 bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); in target_xcopy_read_source()
673 xop->src_pt_cmd = xpt_cmd; in target_xcopy_read_source()
675 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], in target_xcopy_read_source()
682 xop->xop_data_sg = se_cmd->t_data_sg; in target_xcopy_read_source()
683 xop->xop_data_nents = se_cmd->t_data_nents; in target_xcopy_read_source()
685 " memory\n", xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_read_source()
704 struct xcopy_op *xop, in target_xcopy_write_destination() argument
714 bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); in target_xcopy_write_destination()
733 xop->dst_pt_cmd = xpt_cmd; in target_xcopy_write_destination()
735 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, dst_dev, &cdb[0], in target_xcopy_write_destination()
738 struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; in target_xcopy_write_destination()
745 src_cmd->t_data_sg = xop->xop_data_sg; in target_xcopy_write_destination()
746 src_cmd->t_data_nents = xop->xop_data_nents; in target_xcopy_write_destination()
764 struct xcopy_op *xop = container_of(work, struct xcopy_op, xop_work); in target_xcopy_do_work() local
765 struct se_device *src_dev = xop->src_dev, *dst_dev = xop->dst_dev; in target_xcopy_do_work()
766 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_do_work()
767 sector_t src_lba = xop->src_lba, dst_lba = xop->dst_lba, end_lba; in target_xcopy_do_work()
770 unsigned short nolb = xop->nolb, cur_nolb, max_nolb, copied_nolb = 0; in target_xcopy_do_work()
794 rc = target_xcopy_read_source(ec_cmd, xop, src_dev, src_lba, cur_nolb); in target_xcopy_do_work()
805 rc = target_xcopy_write_destination(ec_cmd, xop, dst_dev, in target_xcopy_do_work()
808 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
819 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
820 xop->dst_pt_cmd->se_cmd.se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; in target_xcopy_do_work()
822 transport_generic_free_cmd(&xop->dst_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
825 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
826 kfree(xop); in target_xcopy_do_work()
838 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
839 kfree(xop); in target_xcopy_do_work()
849 struct xcopy_op *xop = NULL; in target_do_xcopy() local
867 xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); in target_do_xcopy()
868 if (!xop) { in target_do_xcopy()
872 xop->xop_se_cmd = se_cmd; in target_do_xcopy()
877 kfree(xop); in target_do_xcopy()
900 rc = target_xcopy_parse_target_descriptors(se_cmd, xop, &p[16], tdll); in target_do_xcopy()
904 if (xop->src_dev->dev_attrib.block_size != in target_do_xcopy()
905 xop->dst_dev->dev_attrib.block_size) { in target_do_xcopy()
908 xop->src_dev->dev_attrib.block_size, in target_do_xcopy()
909 xop->dst_dev->dev_attrib.block_size); in target_do_xcopy()
910 xcopy_pt_undepend_remotedev(xop); in target_do_xcopy()
920 rc = target_xcopy_parse_segment_descriptors(se_cmd, xop, seg_desc, sdll); in target_do_xcopy()
922 xcopy_pt_undepend_remotedev(xop); in target_do_xcopy()
929 INIT_WORK(&xop->xop_work, target_xcopy_do_work); in target_do_xcopy()
930 queue_work(xcopy_wq, &xop->xop_work); in target_do_xcopy()
936 kfree(xop); in target_do_xcopy()