Lines Matching refs:xop
34 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop);
105 static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_tiddesc_e4() argument
151 if (cscd_index != xop->stdi && cscd_index != xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
157 if (cscd_index == xop->stdi) { in target_xcopy_parse_tiddesc_e4()
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()
171 if (cscd_index == xop->dtdi) { 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()
179 if (!memcmp(&xop->local_dev_wwn[0], &xop->dst_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
181 xop->op_origin = XCOL_DEST_RECV_OP; in target_xcopy_parse_tiddesc_e4()
182 xop->dst_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
184 " received xop\n", xop->dst_dev); in target_xcopy_parse_tiddesc_e4()
192 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_target_descriptors() argument
220 memset(&xop->local_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_target_descriptors()
221 target_xcopy_gen_naa_ieee(local_dev, &xop->local_dev_wwn[0]); in target_xcopy_parse_target_descriptors()
231 rc = target_xcopy_parse_tiddesc_e4(se_cmd, xop, in target_xcopy_parse_target_descriptors()
247 switch (xop->op_origin) { in target_xcopy_parse_target_descriptors()
249 rc = target_xcopy_locate_se_dev_e4(xop->dst_tid_wwn, in target_xcopy_parse_target_descriptors()
250 &xop->dst_dev); in target_xcopy_parse_target_descriptors()
253 rc = target_xcopy_locate_se_dev_e4(xop->src_tid_wwn, in target_xcopy_parse_target_descriptors()
254 &xop->src_dev); in target_xcopy_parse_target_descriptors()
258 "stdi: %hu dtdi: %hu\n", xop->stdi, xop->dtdi); in target_xcopy_parse_target_descriptors()
274 xop->src_dev, &xop->src_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
276 xop->dst_dev, &xop->dst_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
284 static int target_xcopy_parse_segdesc_02(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_segdesc_02() argument
298 xop->stdi = get_unaligned_be16(&desc[4]); in target_xcopy_parse_segdesc_02()
299 xop->dtdi = get_unaligned_be16(&desc[6]); in target_xcopy_parse_segdesc_02()
301 if (xop->stdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX || in target_xcopy_parse_segdesc_02()
302 xop->dtdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX) { in target_xcopy_parse_segdesc_02()
304 XCOPY_CSCD_DESC_ID_LIST_OFF_MAX, xop->stdi, xop->dtdi); in target_xcopy_parse_segdesc_02()
309 desc_len, xop->stdi, xop->dtdi, dc); in target_xcopy_parse_segdesc_02()
311 xop->nolb = get_unaligned_be16(&desc[10]); in target_xcopy_parse_segdesc_02()
312 xop->src_lba = get_unaligned_be64(&desc[12]); in target_xcopy_parse_segdesc_02()
313 xop->dst_lba = get_unaligned_be64(&desc[20]); in target_xcopy_parse_segdesc_02()
315 xop->nolb, (unsigned long long)xop->src_lba, in target_xcopy_parse_segdesc_02()
316 (unsigned long long)xop->dst_lba); in target_xcopy_parse_segdesc_02()
319 xop->dbl = get_unaligned_be24(&desc[29]); in target_xcopy_parse_segdesc_02()
321 pr_debug("XCOPY seg desc 0x02: DC=1 w/ dbl: %u\n", xop->dbl); in target_xcopy_parse_segdesc_02()
327 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_segment_descriptors() argument
356 rc = target_xcopy_parse_segdesc_02(se_cmd, xop, desc); in target_xcopy_parse_segment_descriptors()
397 static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) in xcopy_pt_undepend_remotedev() argument
401 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in xcopy_pt_undepend_remotedev()
402 remote_dev = xop->dst_dev; in xcopy_pt_undepend_remotedev()
404 remote_dev = xop->src_dev; in xcopy_pt_undepend_remotedev()
515 struct xcopy_op *xop, in target_xcopy_setup_pt_cmd() argument
533 cmd->se_lun = xop->xop_se_cmd->se_lun; in target_xcopy_setup_pt_cmd()
534 cmd->se_dev = xop->xop_se_cmd->se_dev; in target_xcopy_setup_pt_cmd()
564 xop->xop_data_sg, xop->xop_data_nents, in target_xcopy_setup_pt_cmd()
603 struct xcopy_op *xop, in target_xcopy_read_source() argument
613 bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); in target_xcopy_read_source()
632 xop->src_pt_cmd = xpt_cmd; in target_xcopy_read_source()
634 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], in target_xcopy_read_source()
642 xop->xop_data_sg = se_cmd->t_data_sg; in target_xcopy_read_source()
643 xop->xop_data_nents = se_cmd->t_data_nents; in target_xcopy_read_source()
645 " memory\n", xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_read_source()
665 struct xcopy_op *xop, in target_xcopy_write_destination() argument
675 bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); in target_xcopy_write_destination()
694 xop->dst_pt_cmd = xpt_cmd; in target_xcopy_write_destination()
696 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, dst_dev, &cdb[0], in target_xcopy_write_destination()
699 struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; in target_xcopy_write_destination()
707 src_cmd->t_data_sg = xop->xop_data_sg; in target_xcopy_write_destination()
708 src_cmd->t_data_nents = xop->xop_data_nents; in target_xcopy_write_destination()
727 struct xcopy_op *xop = container_of(work, struct xcopy_op, xop_work); in target_xcopy_do_work() local
728 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_do_work()
735 if (target_parse_xcopy_cmd(xop) != TCM_NO_SENSE) in target_xcopy_do_work()
738 if (WARN_ON_ONCE(!xop->src_dev) || WARN_ON_ONCE(!xop->dst_dev)) in target_xcopy_do_work()
741 src_dev = xop->src_dev; in target_xcopy_do_work()
742 dst_dev = xop->dst_dev; in target_xcopy_do_work()
743 src_lba = xop->src_lba; in target_xcopy_do_work()
744 dst_lba = xop->dst_lba; in target_xcopy_do_work()
745 nolb = xop->nolb; in target_xcopy_do_work()
768 rc = target_xcopy_read_source(ec_cmd, xop, src_dev, src_lba, cur_nolb); in target_xcopy_do_work()
779 rc = target_xcopy_write_destination(ec_cmd, xop, dst_dev, in target_xcopy_do_work()
782 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
793 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
794 xop->dst_pt_cmd->se_cmd.se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; in target_xcopy_do_work()
796 transport_generic_free_cmd(&xop->dst_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
799 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
800 kfree(xop); in target_xcopy_do_work()
812 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
815 kfree(xop); in target_xcopy_do_work()
831 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop) in target_parse_xcopy_cmd() argument
833 struct se_cmd *se_cmd = xop->xop_se_cmd; in target_parse_xcopy_cmd()
885 rc = target_xcopy_parse_segment_descriptors(se_cmd, xop, seg_desc, in target_parse_xcopy_cmd()
893 rc = target_xcopy_parse_target_descriptors(se_cmd, xop, &p[16], tdll, &ret); in target_parse_xcopy_cmd()
897 if (xop->src_dev->dev_attrib.block_size != in target_parse_xcopy_cmd()
898 xop->dst_dev->dev_attrib.block_size) { in target_parse_xcopy_cmd()
901 xop->src_dev->dev_attrib.block_size, in target_parse_xcopy_cmd()
902 xop->dst_dev->dev_attrib.block_size); in target_parse_xcopy_cmd()
903 xcopy_pt_undepend_remotedev(xop); in target_parse_xcopy_cmd()
922 struct xcopy_op *xop; in target_do_xcopy() local
946 xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); in target_do_xcopy()
947 if (!xop) in target_do_xcopy()
949 xop->xop_se_cmd = se_cmd; in target_do_xcopy()
950 INIT_WORK(&xop->xop_work, target_xcopy_do_work); in target_do_xcopy()
951 if (WARN_ON_ONCE(!queue_work(xcopy_wq, &xop->xop_work))) in target_do_xcopy()
956 kfree(xop); in target_do_xcopy()