Lines Matching refs:xop

43 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop);
114 static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_tiddesc_e4() argument
160 if (cscd_index != xop->stdi && cscd_index != xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
166 if (cscd_index == xop->stdi) { in target_xcopy_parse_tiddesc_e4()
167 memcpy(&xop->src_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
171 if (!memcmp(&xop->local_dev_wwn[0], &xop->src_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
173 xop->op_origin = XCOL_SOURCE_RECV_OP; in target_xcopy_parse_tiddesc_e4()
174 xop->src_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
176 " received xop\n", xop->src_dev); in target_xcopy_parse_tiddesc_e4()
180 if (cscd_index == xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
181 memcpy(&xop->dst_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
188 if (!memcmp(&xop->local_dev_wwn[0], &xop->dst_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
190 xop->op_origin = XCOL_DEST_RECV_OP; in target_xcopy_parse_tiddesc_e4()
191 xop->dst_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
193 " received xop\n", xop->dst_dev); in target_xcopy_parse_tiddesc_e4()
201 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_target_descriptors() argument
229 memset(&xop->local_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_target_descriptors()
230 target_xcopy_gen_naa_ieee(local_dev, &xop->local_dev_wwn[0]); in target_xcopy_parse_target_descriptors()
240 rc = target_xcopy_parse_tiddesc_e4(se_cmd, xop, in target_xcopy_parse_target_descriptors()
256 switch (xop->op_origin) { in target_xcopy_parse_target_descriptors()
258 rc = target_xcopy_locate_se_dev_e4(xop->dst_tid_wwn, in target_xcopy_parse_target_descriptors()
259 &xop->dst_dev); in target_xcopy_parse_target_descriptors()
262 rc = target_xcopy_locate_se_dev_e4(xop->src_tid_wwn, in target_xcopy_parse_target_descriptors()
263 &xop->src_dev); in target_xcopy_parse_target_descriptors()
267 "stdi: %hu dtdi: %hu\n", xop->stdi, xop->dtdi); in target_xcopy_parse_target_descriptors()
283 xop->src_dev, &xop->src_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
285 xop->dst_dev, &xop->dst_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
293 static int target_xcopy_parse_segdesc_02(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_segdesc_02() argument
307 xop->stdi = get_unaligned_be16(&desc[4]); in target_xcopy_parse_segdesc_02()
308 xop->dtdi = get_unaligned_be16(&desc[6]); in target_xcopy_parse_segdesc_02()
310 if (xop->stdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX || in target_xcopy_parse_segdesc_02()
311 xop->dtdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX) { in target_xcopy_parse_segdesc_02()
313 XCOPY_CSCD_DESC_ID_LIST_OFF_MAX, xop->stdi, xop->dtdi); in target_xcopy_parse_segdesc_02()
318 desc_len, xop->stdi, xop->dtdi, dc); in target_xcopy_parse_segdesc_02()
320 xop->nolb = get_unaligned_be16(&desc[10]); in target_xcopy_parse_segdesc_02()
321 xop->src_lba = get_unaligned_be64(&desc[12]); in target_xcopy_parse_segdesc_02()
322 xop->dst_lba = get_unaligned_be64(&desc[20]); in target_xcopy_parse_segdesc_02()
324 xop->nolb, (unsigned long long)xop->src_lba, in target_xcopy_parse_segdesc_02()
325 (unsigned long long)xop->dst_lba); in target_xcopy_parse_segdesc_02()
328 xop->dbl = get_unaligned_be24(&desc[29]); in target_xcopy_parse_segdesc_02()
330 pr_debug("XCOPY seg desc 0x02: DC=1 w/ dbl: %u\n", xop->dbl); in target_xcopy_parse_segdesc_02()
336 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_segment_descriptors() argument
365 rc = target_xcopy_parse_segdesc_02(se_cmd, xop, desc); in target_xcopy_parse_segment_descriptors()
413 static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) in xcopy_pt_undepend_remotedev() argument
417 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in xcopy_pt_undepend_remotedev()
418 remote_dev = xop->dst_dev; in xcopy_pt_undepend_remotedev()
420 remote_dev = xop->src_dev; in xcopy_pt_undepend_remotedev()
519 struct xcopy_op *xop, in target_xcopy_setup_pt_port() argument
522 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_setup_pt_port()
525 if (xop->op_origin == XCOL_SOURCE_RECV_OP) { in target_xcopy_setup_pt_port()
585 struct xcopy_op *xop, in target_xcopy_setup_pt_cmd() argument
600 xpt_cmd->xcopy_op = xop; in target_xcopy_setup_pt_cmd()
601 target_xcopy_setup_pt_port(xpt_cmd, xop, remote_port); in target_xcopy_setup_pt_cmd()
629 xop->xop_data_sg, xop->xop_data_nents, in target_xcopy_setup_pt_cmd()
668 struct xcopy_op *xop, in target_xcopy_read_source() argument
678 bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); in target_xcopy_read_source()
697 xop->src_pt_cmd = xpt_cmd; in target_xcopy_read_source()
699 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], in target_xcopy_read_source()
707 xop->xop_data_sg = se_cmd->t_data_sg; in target_xcopy_read_source()
708 xop->xop_data_nents = se_cmd->t_data_nents; in target_xcopy_read_source()
710 " memory\n", xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_read_source()
730 struct xcopy_op *xop, in target_xcopy_write_destination() argument
740 bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); in target_xcopy_write_destination()
759 xop->dst_pt_cmd = xpt_cmd; in target_xcopy_write_destination()
761 rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, dst_dev, &cdb[0], in target_xcopy_write_destination()
764 struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; in target_xcopy_write_destination()
772 src_cmd->t_data_sg = xop->xop_data_sg; in target_xcopy_write_destination()
773 src_cmd->t_data_nents = xop->xop_data_nents; in target_xcopy_write_destination()
792 struct xcopy_op *xop = container_of(work, struct xcopy_op, xop_work); in target_xcopy_do_work() local
793 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_do_work()
800 if (target_parse_xcopy_cmd(xop) != TCM_NO_SENSE) in target_xcopy_do_work()
803 if (WARN_ON_ONCE(!xop->src_dev) || WARN_ON_ONCE(!xop->dst_dev)) in target_xcopy_do_work()
806 src_dev = xop->src_dev; in target_xcopy_do_work()
807 dst_dev = xop->dst_dev; in target_xcopy_do_work()
808 src_lba = xop->src_lba; in target_xcopy_do_work()
809 dst_lba = xop->dst_lba; in target_xcopy_do_work()
810 nolb = xop->nolb; in target_xcopy_do_work()
833 rc = target_xcopy_read_source(ec_cmd, xop, src_dev, src_lba, cur_nolb); in target_xcopy_do_work()
844 rc = target_xcopy_write_destination(ec_cmd, xop, dst_dev, in target_xcopy_do_work()
847 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
858 transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
859 xop->dst_pt_cmd->se_cmd.se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; in target_xcopy_do_work()
861 transport_generic_free_cmd(&xop->dst_pt_cmd->se_cmd, 0); in target_xcopy_do_work()
864 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
865 kfree(xop); in target_xcopy_do_work()
877 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
880 kfree(xop); in target_xcopy_do_work()
896 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop) in target_parse_xcopy_cmd() argument
898 struct se_cmd *se_cmd = xop->xop_se_cmd; in target_parse_xcopy_cmd()
950 rc = target_xcopy_parse_segment_descriptors(se_cmd, xop, seg_desc, in target_parse_xcopy_cmd()
958 rc = target_xcopy_parse_target_descriptors(se_cmd, xop, &p[16], tdll, &ret); in target_parse_xcopy_cmd()
962 if (xop->src_dev->dev_attrib.block_size != in target_parse_xcopy_cmd()
963 xop->dst_dev->dev_attrib.block_size) { in target_parse_xcopy_cmd()
966 xop->src_dev->dev_attrib.block_size, in target_parse_xcopy_cmd()
967 xop->dst_dev->dev_attrib.block_size); in target_parse_xcopy_cmd()
968 xcopy_pt_undepend_remotedev(xop); in target_parse_xcopy_cmd()
987 struct xcopy_op *xop; in target_do_xcopy() local
1011 xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); in target_do_xcopy()
1012 if (!xop) in target_do_xcopy()
1014 xop->xop_se_cmd = se_cmd; in target_do_xcopy()
1015 INIT_WORK(&xop->xop_work, target_xcopy_do_work); in target_do_xcopy()
1016 if (WARN_ON_ONCE(!queue_work(xcopy_wq, &xop->xop_work))) in target_do_xcopy()
1021 kfree(xop); in target_do_xcopy()