Lines Matching refs:xop
134 static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_tiddesc_e4() argument
180 if (cscd_index != xop->stdi && cscd_index != xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
186 if (cscd_index == xop->stdi) { in target_xcopy_parse_tiddesc_e4()
187 memcpy(&xop->src_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
191 if (!memcmp(&xop->local_dev_wwn[0], &xop->src_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
193 xop->op_origin = XCOL_SOURCE_RECV_OP; in target_xcopy_parse_tiddesc_e4()
194 xop->src_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
196 " received xop\n", xop->src_dev); in target_xcopy_parse_tiddesc_e4()
200 if (cscd_index == xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
201 memcpy(&xop->dst_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
208 if (!memcmp(&xop->local_dev_wwn[0], &xop->dst_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
210 xop->op_origin = XCOL_DEST_RECV_OP; in target_xcopy_parse_tiddesc_e4()
211 xop->dst_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
213 " received xop\n", xop->dst_dev); in target_xcopy_parse_tiddesc_e4()
221 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_target_descriptors() argument
246 memset(&xop->local_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_target_descriptors()
247 target_xcopy_gen_naa_ieee(local_dev, &xop->local_dev_wwn[0]); in target_xcopy_parse_target_descriptors()
257 rc = target_xcopy_parse_tiddesc_e4(se_cmd, xop, in target_xcopy_parse_target_descriptors()
272 switch (xop->op_origin) { in target_xcopy_parse_target_descriptors()
275 xop->dst_tid_wwn, in target_xcopy_parse_target_descriptors()
276 &xop->dst_dev, in target_xcopy_parse_target_descriptors()
277 &xop->remote_lun_ref); in target_xcopy_parse_target_descriptors()
281 xop->src_tid_wwn, in target_xcopy_parse_target_descriptors()
282 &xop->src_dev, in target_xcopy_parse_target_descriptors()
283 &xop->remote_lun_ref); in target_xcopy_parse_target_descriptors()
287 "stdi: %hu dtdi: %hu\n", xop->stdi, xop->dtdi); in target_xcopy_parse_target_descriptors()
303 xop->src_dev, &xop->src_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
305 xop->dst_dev, &xop->dst_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
313 static int target_xcopy_parse_segdesc_02(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_segdesc_02() argument
327 xop->stdi = get_unaligned_be16(&desc[4]); in target_xcopy_parse_segdesc_02()
328 xop->dtdi = get_unaligned_be16(&desc[6]); in target_xcopy_parse_segdesc_02()
330 desc_len, xop->stdi, xop->dtdi, dc); in target_xcopy_parse_segdesc_02()
332 xop->nolb = get_unaligned_be16(&desc[10]); in target_xcopy_parse_segdesc_02()
333 xop->src_lba = get_unaligned_be64(&desc[12]); in target_xcopy_parse_segdesc_02()
334 xop->dst_lba = get_unaligned_be64(&desc[20]); in target_xcopy_parse_segdesc_02()
336 xop->nolb, (unsigned long long)xop->src_lba, in target_xcopy_parse_segdesc_02()
337 (unsigned long long)xop->dst_lba); in target_xcopy_parse_segdesc_02()
340 xop->dbl = (desc[29] & 0xff) << 16; in target_xcopy_parse_segdesc_02()
341 xop->dbl |= (desc[30] & 0xff) << 8; in target_xcopy_parse_segdesc_02()
342 xop->dbl |= desc[31] & 0xff; in target_xcopy_parse_segdesc_02()
344 pr_debug("XCOPY seg desc 0x02: DC=1 w/ dbl: %u\n", xop->dbl); in target_xcopy_parse_segdesc_02()
350 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_segment_descriptors() argument
378 rc = target_xcopy_parse_segdesc_02(se_cmd, xop, desc); in target_xcopy_parse_segment_descriptors()
425 static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) in xcopy_pt_undepend_remotedev() argument
427 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in xcopy_pt_undepend_remotedev()
428 pr_debug("putting dst lun_ref for %p\n", xop->dst_dev); in xcopy_pt_undepend_remotedev()
430 pr_debug("putting src lun_ref for %p\n", xop->src_dev); in xcopy_pt_undepend_remotedev()
432 percpu_ref_put(xop->remote_lun_ref); in xcopy_pt_undepend_remotedev()
528 struct xcopy_op *xop, in target_xcopy_setup_pt_port() argument
531 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_setup_pt_port()
534 if (xop->op_origin == XCOL_SOURCE_RECV_OP) { in target_xcopy_setup_pt_port()
594 struct xcopy_op *xop, in target_xcopy_setup_pt_cmd() argument
609 xpt_cmd->xcopy_op = xop; in target_xcopy_setup_pt_cmd()
610 target_xcopy_setup_pt_port(xpt_cmd, xop, remote_port); in target_xcopy_setup_pt_cmd()
638 xop->xop_data_sg, xop->xop_data_nents, in target_xcopy_setup_pt_cmd()
677 struct xcopy_op *xop, in target_xcopy_read_source() argument
687 bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); in target_xcopy_read_source()
706 xop->src_pt_cmd = xpt_cmd; in target_xcopy_read_source()
708 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], in target_xcopy_read_source()
716 xop->xop_data_sg = se_cmd->t_data_sg; in target_xcopy_read_source()
717 xop->xop_data_nents = se_cmd->t_data_nents; in target_xcopy_read_source()
719 " memory\n", xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_read_source()
739 struct xcopy_op *xop, in target_xcopy_write_destination() argument
749 bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); in target_xcopy_write_destination()
768 xop->dst_pt_cmd = xpt_cmd; in target_xcopy_write_destination()
770 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, dst_dev, &cdb[0], in target_xcopy_write_destination()
773 struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; in target_xcopy_write_destination()
781 src_cmd->t_data_sg = xop->xop_data_sg; in target_xcopy_write_destination()
782 src_cmd->t_data_nents = xop->xop_data_nents; in target_xcopy_write_destination()
801 struct xcopy_op *xop = container_of(work, struct xcopy_op, xop_work); in target_xcopy_do_work() local
802 struct se_device *src_dev = xop->src_dev, *dst_dev = xop->dst_dev; in target_xcopy_do_work()
803 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_do_work()
804 sector_t src_lba = xop->src_lba, dst_lba = xop->dst_lba, end_lba; in target_xcopy_do_work()
807 unsigned short nolb = xop->nolb, cur_nolb, max_nolb, copied_nolb = 0; in target_xcopy_do_work()
831 rc = target_xcopy_read_source(ec_cmd, xop, src_dev, src_lba, cur_nolb); in target_xcopy_do_work()
842 rc = target_xcopy_write_destination(ec_cmd, xop, dst_dev, in target_xcopy_do_work()
845 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
856 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
857 xop->dst_pt_cmd->se_cmd.se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; in target_xcopy_do_work()
859 transport_generic_free_cmd(&xop->dst_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
862 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
863 kfree(xop); in target_xcopy_do_work()
875 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
876 kfree(xop); in target_xcopy_do_work()
891 struct xcopy_op *xop = NULL; in target_do_xcopy() local
909 xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); in target_do_xcopy()
910 if (!xop) { in target_do_xcopy()
914 xop->xop_se_cmd = se_cmd; in target_do_xcopy()
919 kfree(xop); in target_do_xcopy()
948 rc = target_xcopy_parse_segment_descriptors(se_cmd, xop, seg_desc, in target_do_xcopy()
956 rc = target_xcopy_parse_target_descriptors(se_cmd, xop, &p[16], tdll, &ret); in target_do_xcopy()
960 if (xop->src_dev->dev_attrib.block_size != in target_do_xcopy()
961 xop->dst_dev->dev_attrib.block_size) { in target_do_xcopy()
964 xop->src_dev->dev_attrib.block_size, in target_do_xcopy()
965 xop->dst_dev->dev_attrib.block_size); in target_do_xcopy()
966 xcopy_pt_undepend_remotedev(xop); in target_do_xcopy()
975 INIT_WORK(&xop->xop_work, target_xcopy_do_work); in target_do_xcopy()
976 queue_work(xcopy_wq, &xop->xop_work); in target_do_xcopy()
982 kfree(xop); in target_do_xcopy()