Lines Matching refs:xop
55 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
63 dev_wwn = &xop->dst_tid_wwn[0]; in target_xcopy_locate_se_dev_e4()
65 dev_wwn = &xop->src_tid_wwn[0]; in target_xcopy_locate_se_dev_e4()
81 xop->dst_dev = se_dev; in target_xcopy_locate_se_dev_e4()
83 " se_dev\n", xop->dst_dev); in target_xcopy_locate_se_dev_e4()
85 xop->src_dev = se_dev; in target_xcopy_locate_se_dev_e4()
87 " se_dev\n", xop->src_dev); in target_xcopy_locate_se_dev_e4()
111 static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_tiddesc_e4() argument
158 memcpy(&xop->src_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
162 if (!memcmp(&xop->local_dev_wwn[0], &xop->src_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
164 xop->op_origin = XCOL_SOURCE_RECV_OP; in target_xcopy_parse_tiddesc_e4()
165 xop->src_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
167 " received xop\n", xop->src_dev); in target_xcopy_parse_tiddesc_e4()
170 memcpy(&xop->dst_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
174 if (!memcmp(&xop->local_dev_wwn[0], &xop->dst_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
176 xop->op_origin = XCOL_DEST_RECV_OP; in target_xcopy_parse_tiddesc_e4()
177 xop->dst_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
179 " received xop\n", xop->dst_dev); in target_xcopy_parse_tiddesc_e4()
187 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_target_descriptors() argument
210 memset(&xop->local_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_target_descriptors()
211 target_xcopy_gen_naa_ieee(local_dev, &xop->local_dev_wwn[0]); in target_xcopy_parse_target_descriptors()
220 rc = target_xcopy_parse_tiddesc_e4(se_cmd, xop, in target_xcopy_parse_target_descriptors()
242 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in target_xcopy_parse_target_descriptors()
243 rc = target_xcopy_locate_se_dev_e4(se_cmd, xop, true); in target_xcopy_parse_target_descriptors()
245 rc = target_xcopy_locate_se_dev_e4(se_cmd, xop, false); in target_xcopy_parse_target_descriptors()
251 xop->src_dev, &xop->src_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
253 xop->dst_dev, &xop->dst_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
261 static int target_xcopy_parse_segdesc_02(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_segdesc_02() argument
275 xop->stdi = get_unaligned_be16(&desc[4]); in target_xcopy_parse_segdesc_02()
276 xop->dtdi = get_unaligned_be16(&desc[6]); in target_xcopy_parse_segdesc_02()
278 desc_len, xop->stdi, xop->dtdi, dc); in target_xcopy_parse_segdesc_02()
280 xop->nolb = get_unaligned_be16(&desc[10]); in target_xcopy_parse_segdesc_02()
281 xop->src_lba = get_unaligned_be64(&desc[12]); in target_xcopy_parse_segdesc_02()
282 xop->dst_lba = get_unaligned_be64(&desc[20]); in target_xcopy_parse_segdesc_02()
284 xop->nolb, (unsigned long long)xop->src_lba, in target_xcopy_parse_segdesc_02()
285 (unsigned long long)xop->dst_lba); in target_xcopy_parse_segdesc_02()
288 xop->dbl = (desc[29] & 0xff) << 16; in target_xcopy_parse_segdesc_02()
289 xop->dbl |= (desc[30] & 0xff) << 8; in target_xcopy_parse_segdesc_02()
290 xop->dbl |= desc[31] & 0xff; in target_xcopy_parse_segdesc_02()
292 pr_debug("XCOPY seg desc 0x02: DC=1 w/ dbl: %u\n", xop->dbl); in target_xcopy_parse_segdesc_02()
298 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_segment_descriptors() argument
317 rc = target_xcopy_parse_segdesc_02(se_cmd, xop, desc); in target_xcopy_parse_segment_descriptors()
364 static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) in xcopy_pt_undepend_remotedev() argument
368 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in xcopy_pt_undepend_remotedev()
369 remote_dev = xop->dst_dev; in xcopy_pt_undepend_remotedev()
371 remote_dev = xop->src_dev; in xcopy_pt_undepend_remotedev()
473 struct xcopy_op *xop, in target_xcopy_setup_pt_port() argument
476 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_setup_pt_port()
479 if (xop->op_origin == XCOL_SOURCE_RECV_OP) { in target_xcopy_setup_pt_port()
539 struct xcopy_op *xop, in target_xcopy_setup_pt_cmd() argument
554 xpt_cmd->xcopy_op = xop; in target_xcopy_setup_pt_cmd()
555 target_xcopy_setup_pt_port(xpt_cmd, xop, remote_port); in target_xcopy_setup_pt_cmd()
583 xop->xop_data_sg, xop->xop_data_nents, in target_xcopy_setup_pt_cmd()
622 struct xcopy_op *xop, in target_xcopy_read_source() argument
632 bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); in target_xcopy_read_source()
651 xop->src_pt_cmd = xpt_cmd; in target_xcopy_read_source()
653 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], in target_xcopy_read_source()
660 xop->xop_data_sg = se_cmd->t_data_sg; in target_xcopy_read_source()
661 xop->xop_data_nents = se_cmd->t_data_nents; in target_xcopy_read_source()
663 " memory\n", xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_read_source()
682 struct xcopy_op *xop, in target_xcopy_write_destination() argument
692 bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); in target_xcopy_write_destination()
711 xop->dst_pt_cmd = xpt_cmd; in target_xcopy_write_destination()
713 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, dst_dev, &cdb[0], in target_xcopy_write_destination()
716 struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; in target_xcopy_write_destination()
723 src_cmd->t_data_sg = xop->xop_data_sg; in target_xcopy_write_destination()
724 src_cmd->t_data_nents = xop->xop_data_nents; in target_xcopy_write_destination()
742 struct xcopy_op *xop = container_of(work, struct xcopy_op, xop_work); in target_xcopy_do_work() local
743 struct se_device *src_dev = xop->src_dev, *dst_dev = xop->dst_dev; in target_xcopy_do_work()
744 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_do_work()
745 sector_t src_lba = xop->src_lba, dst_lba = xop->dst_lba, end_lba; in target_xcopy_do_work()
748 unsigned short nolb = xop->nolb, cur_nolb, max_nolb, copied_nolb = 0; in target_xcopy_do_work()
772 rc = target_xcopy_read_source(ec_cmd, xop, src_dev, src_lba, cur_nolb); in target_xcopy_do_work()
783 rc = target_xcopy_write_destination(ec_cmd, xop, dst_dev, in target_xcopy_do_work()
786 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
797 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
798 xop->dst_pt_cmd->se_cmd.se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; in target_xcopy_do_work()
800 transport_generic_free_cmd(&xop->dst_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
803 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
804 kfree(xop); in target_xcopy_do_work()
816 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
817 kfree(xop); in target_xcopy_do_work()
827 struct xcopy_op *xop = NULL; in target_do_xcopy() local
845 xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); in target_do_xcopy()
846 if (!xop) { in target_do_xcopy()
850 xop->xop_se_cmd = se_cmd; in target_do_xcopy()
855 kfree(xop); in target_do_xcopy()
878 rc = target_xcopy_parse_target_descriptors(se_cmd, xop, &p[16], tdll); in target_do_xcopy()
882 if (xop->src_dev->dev_attrib.block_size != in target_do_xcopy()
883 xop->dst_dev->dev_attrib.block_size) { in target_do_xcopy()
886 xop->src_dev->dev_attrib.block_size, in target_do_xcopy()
887 xop->dst_dev->dev_attrib.block_size); in target_do_xcopy()
888 xcopy_pt_undepend_remotedev(xop); in target_do_xcopy()
898 rc = target_xcopy_parse_segment_descriptors(se_cmd, xop, seg_desc, sdll); in target_do_xcopy()
900 xcopy_pt_undepend_remotedev(xop); in target_do_xcopy()
907 INIT_WORK(&xop->xop_work, target_xcopy_do_work); in target_do_xcopy()
908 queue_work(xcopy_wq, &xop->xop_work); in target_do_xcopy()
914 kfree(xop); in target_do_xcopy()