Lines Matching refs:xop

35 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop);
116 static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_tiddesc_e4() argument
162 if (cscd_index != xop->stdi && cscd_index != xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
168 if (cscd_index == xop->stdi) { in target_xcopy_parse_tiddesc_e4()
169 memcpy(&xop->src_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
173 if (!memcmp(&xop->local_dev_wwn[0], &xop->src_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
175 xop->op_origin = XCOL_SOURCE_RECV_OP; in target_xcopy_parse_tiddesc_e4()
176 xop->src_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
178 " received xop\n", xop->src_dev); in target_xcopy_parse_tiddesc_e4()
182 if (cscd_index == xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
183 memcpy(&xop->dst_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
190 if (!memcmp(&xop->local_dev_wwn[0], &xop->dst_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
192 xop->op_origin = XCOL_DEST_RECV_OP; in target_xcopy_parse_tiddesc_e4()
193 xop->dst_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
195 " received xop\n", xop->dst_dev); in target_xcopy_parse_tiddesc_e4()
203 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_target_descriptors() argument
231 memset(&xop->local_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_target_descriptors()
232 spc_gen_naa_6h_vendor_specific(local_dev, &xop->local_dev_wwn[0]); in target_xcopy_parse_target_descriptors()
242 rc = target_xcopy_parse_tiddesc_e4(se_cmd, xop, in target_xcopy_parse_target_descriptors()
258 switch (xop->op_origin) { in target_xcopy_parse_target_descriptors()
261 xop->dst_tid_wwn, in target_xcopy_parse_target_descriptors()
262 &xop->dst_dev, in target_xcopy_parse_target_descriptors()
263 &xop->remote_lun_ref); in target_xcopy_parse_target_descriptors()
267 xop->src_tid_wwn, in target_xcopy_parse_target_descriptors()
268 &xop->src_dev, in target_xcopy_parse_target_descriptors()
269 &xop->remote_lun_ref); in target_xcopy_parse_target_descriptors()
273 "stdi: %hu dtdi: %hu\n", xop->stdi, xop->dtdi); in target_xcopy_parse_target_descriptors()
289 xop->src_dev, &xop->src_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
291 xop->dst_dev, &xop->dst_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
299 static int target_xcopy_parse_segdesc_02(struct xcopy_op *xop, unsigned char *p) in target_xcopy_parse_segdesc_02() argument
312 xop->stdi = get_unaligned_be16(&desc[4]); in target_xcopy_parse_segdesc_02()
313 xop->dtdi = get_unaligned_be16(&desc[6]); in target_xcopy_parse_segdesc_02()
315 if (xop->stdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX || in target_xcopy_parse_segdesc_02()
316 xop->dtdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX) { in target_xcopy_parse_segdesc_02()
318 XCOPY_CSCD_DESC_ID_LIST_OFF_MAX, xop->stdi, xop->dtdi); in target_xcopy_parse_segdesc_02()
323 desc_len, xop->stdi, xop->dtdi, dc); in target_xcopy_parse_segdesc_02()
325 xop->nolb = get_unaligned_be16(&desc[10]); in target_xcopy_parse_segdesc_02()
326 xop->src_lba = get_unaligned_be64(&desc[12]); in target_xcopy_parse_segdesc_02()
327 xop->dst_lba = get_unaligned_be64(&desc[20]); in target_xcopy_parse_segdesc_02()
329 xop->nolb, (unsigned long long)xop->src_lba, in target_xcopy_parse_segdesc_02()
330 (unsigned long long)xop->dst_lba); in target_xcopy_parse_segdesc_02()
335 static int target_xcopy_parse_segment_descriptors(struct xcopy_op *xop, in target_xcopy_parse_segment_descriptors() argument
365 rc = target_xcopy_parse_segdesc_02(xop, desc); in target_xcopy_parse_segment_descriptors()
406 static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) in xcopy_pt_undepend_remotedev() argument
408 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in xcopy_pt_undepend_remotedev()
409 pr_debug("putting dst lun_ref for %p\n", xop->dst_dev); in xcopy_pt_undepend_remotedev()
411 pr_debug("putting src lun_ref for %p\n", xop->src_dev); in xcopy_pt_undepend_remotedev()
413 percpu_ref_put(xop->remote_lun_ref); in xcopy_pt_undepend_remotedev()
513 struct xcopy_op *xop, in target_xcopy_setup_pt_cmd() argument
528 cmd->se_lun = xop->xop_se_cmd->se_lun; in target_xcopy_setup_pt_cmd()
529 cmd->se_dev = xop->xop_se_cmd->se_dev; in target_xcopy_setup_pt_cmd()
540 if (transport_generic_map_mem_to_cmd(cmd, xop->xop_data_sg, in target_xcopy_setup_pt_cmd()
541 xop->xop_data_nents, NULL, 0)) in target_xcopy_setup_pt_cmd()
572 struct xcopy_op *xop, in target_xcopy_read_source() argument
582 bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); in target_xcopy_read_source()
597 rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, src_dev, &cdb[0], in target_xcopy_read_source()
605 " memory\n", xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_read_source()
617 struct xcopy_op *xop, in target_xcopy_write_destination() argument
627 bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); in target_xcopy_write_destination()
642 rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, dst_dev, &cdb[0], in target_xcopy_write_destination()
659 struct xcopy_op *xop = container_of(work, struct xcopy_op, xop_work); in target_xcopy_do_work() local
660 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_do_work()
669 sense_rc = target_parse_xcopy_cmd(xop); in target_xcopy_do_work()
673 if (WARN_ON_ONCE(!xop->src_dev) || WARN_ON_ONCE(!xop->dst_dev)) { in target_xcopy_do_work()
678 src_dev = xop->src_dev; in target_xcopy_do_work()
679 dst_dev = xop->dst_dev; in target_xcopy_do_work()
680 src_lba = xop->src_lba; in target_xcopy_do_work()
681 dst_lba = xop->dst_lba; in target_xcopy_do_work()
682 nolb = xop->nolb; in target_xcopy_do_work()
711 if (cur_bytes != xop->xop_data_bytes) { in target_xcopy_do_work()
716 target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_do_work()
717 rc = target_alloc_sgl(&xop->xop_data_sg, in target_xcopy_do_work()
718 &xop->xop_data_nents, in target_xcopy_do_work()
723 xop->xop_data_bytes = cur_bytes; in target_xcopy_do_work()
729 rc = target_xcopy_read_source(ec_cmd, xop, src_dev, src_lba, cur_bytes); in target_xcopy_do_work()
740 rc = target_xcopy_write_destination(ec_cmd, xop, dst_dev, in target_xcopy_do_work()
753 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
754 target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_do_work()
755 kfree(xop); in target_xcopy_do_work()
773 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
774 target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_do_work()
777 kfree(xop); in target_xcopy_do_work()
787 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop) in target_parse_xcopy_cmd() argument
789 struct se_cmd *se_cmd = xop->xop_se_cmd; in target_parse_xcopy_cmd()
841 rc = target_xcopy_parse_segment_descriptors(xop, seg_desc, sdll, &ret); in target_parse_xcopy_cmd()
848 rc = target_xcopy_parse_target_descriptors(se_cmd, xop, &p[16], tdll, &ret); in target_parse_xcopy_cmd()
852 if (xop->src_dev->dev_attrib.block_size != in target_parse_xcopy_cmd()
853 xop->dst_dev->dev_attrib.block_size) { in target_parse_xcopy_cmd()
856 xop->src_dev->dev_attrib.block_size, in target_parse_xcopy_cmd()
857 xop->dst_dev->dev_attrib.block_size); in target_parse_xcopy_cmd()
858 xcopy_pt_undepend_remotedev(xop); in target_parse_xcopy_cmd()
877 struct xcopy_op *xop; in target_do_xcopy() local
901 xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); in target_do_xcopy()
902 if (!xop) in target_do_xcopy()
904 xop->xop_se_cmd = se_cmd; in target_do_xcopy()
905 INIT_WORK(&xop->xop_work, target_xcopy_do_work); in target_do_xcopy()
906 if (WARN_ON_ONCE(!queue_work(xcopy_wq, &xop->xop_work))) in target_do_xcopy()
911 kfree(xop); in target_do_xcopy()