Lines Matching refs:xop

34 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop);
115 static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op *xop, in target_xcopy_parse_tiddesc_e4() argument
161 if (cscd_index != xop->stdi && cscd_index != xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
167 if (cscd_index == xop->stdi) { in target_xcopy_parse_tiddesc_e4()
168 memcpy(&xop->src_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
172 if (!memcmp(&xop->local_dev_wwn[0], &xop->src_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
174 xop->op_origin = XCOL_SOURCE_RECV_OP; in target_xcopy_parse_tiddesc_e4()
175 xop->src_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
177 " received xop\n", xop->src_dev); in target_xcopy_parse_tiddesc_e4()
181 if (cscd_index == xop->dtdi) { in target_xcopy_parse_tiddesc_e4()
182 memcpy(&xop->dst_tid_wwn[0], &desc[8], XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_tiddesc_e4()
189 if (!memcmp(&xop->local_dev_wwn[0], &xop->dst_tid_wwn[0], in target_xcopy_parse_tiddesc_e4()
191 xop->op_origin = XCOL_DEST_RECV_OP; in target_xcopy_parse_tiddesc_e4()
192 xop->dst_dev = se_cmd->se_dev; in target_xcopy_parse_tiddesc_e4()
194 " received xop\n", xop->dst_dev); in target_xcopy_parse_tiddesc_e4()
202 struct xcopy_op *xop, unsigned char *p, in target_xcopy_parse_target_descriptors() argument
230 memset(&xop->local_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); in target_xcopy_parse_target_descriptors()
231 spc_gen_naa_6h_vendor_specific(local_dev, &xop->local_dev_wwn[0]); in target_xcopy_parse_target_descriptors()
241 rc = target_xcopy_parse_tiddesc_e4(se_cmd, xop, in target_xcopy_parse_target_descriptors()
257 switch (xop->op_origin) { in target_xcopy_parse_target_descriptors()
260 xop->dst_tid_wwn, in target_xcopy_parse_target_descriptors()
261 &xop->dst_dev, in target_xcopy_parse_target_descriptors()
262 &xop->remote_lun_ref); in target_xcopy_parse_target_descriptors()
266 xop->src_tid_wwn, in target_xcopy_parse_target_descriptors()
267 &xop->src_dev, in target_xcopy_parse_target_descriptors()
268 &xop->remote_lun_ref); in target_xcopy_parse_target_descriptors()
272 "stdi: %hu dtdi: %hu\n", xop->stdi, xop->dtdi); in target_xcopy_parse_target_descriptors()
288 xop->src_dev, &xop->src_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
290 xop->dst_dev, &xop->dst_tid_wwn[0]); in target_xcopy_parse_target_descriptors()
298 static int target_xcopy_parse_segdesc_02(struct xcopy_op *xop, unsigned char *p) in target_xcopy_parse_segdesc_02() argument
311 xop->stdi = get_unaligned_be16(&desc[4]); in target_xcopy_parse_segdesc_02()
312 xop->dtdi = get_unaligned_be16(&desc[6]); in target_xcopy_parse_segdesc_02()
314 if (xop->stdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX || in target_xcopy_parse_segdesc_02()
315 xop->dtdi > XCOPY_CSCD_DESC_ID_LIST_OFF_MAX) { in target_xcopy_parse_segdesc_02()
317 XCOPY_CSCD_DESC_ID_LIST_OFF_MAX, xop->stdi, xop->dtdi); in target_xcopy_parse_segdesc_02()
322 desc_len, xop->stdi, xop->dtdi, dc); in target_xcopy_parse_segdesc_02()
324 xop->nolb = get_unaligned_be16(&desc[10]); in target_xcopy_parse_segdesc_02()
325 xop->src_lba = get_unaligned_be64(&desc[12]); in target_xcopy_parse_segdesc_02()
326 xop->dst_lba = get_unaligned_be64(&desc[20]); in target_xcopy_parse_segdesc_02()
328 xop->nolb, (unsigned long long)xop->src_lba, in target_xcopy_parse_segdesc_02()
329 (unsigned long long)xop->dst_lba); in target_xcopy_parse_segdesc_02()
334 static int target_xcopy_parse_segment_descriptors(struct xcopy_op *xop, in target_xcopy_parse_segment_descriptors() argument
364 rc = target_xcopy_parse_segdesc_02(xop, desc); in target_xcopy_parse_segment_descriptors()
405 static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) in xcopy_pt_undepend_remotedev() argument
407 if (xop->op_origin == XCOL_SOURCE_RECV_OP) in xcopy_pt_undepend_remotedev()
408 pr_debug("putting dst lun_ref for %p\n", xop->dst_dev); in xcopy_pt_undepend_remotedev()
410 pr_debug("putting src lun_ref for %p\n", xop->src_dev); in xcopy_pt_undepend_remotedev()
412 percpu_ref_put(xop->remote_lun_ref); in xcopy_pt_undepend_remotedev()
523 struct xcopy_op *xop, in target_xcopy_setup_pt_cmd() argument
538 cmd->se_lun = xop->xop_se_cmd->se_lun; in target_xcopy_setup_pt_cmd()
539 cmd->se_dev = xop->xop_se_cmd->se_dev; in target_xcopy_setup_pt_cmd()
550 if (transport_generic_map_mem_to_cmd(cmd, xop->xop_data_sg, in target_xcopy_setup_pt_cmd()
551 xop->xop_data_nents, NULL, 0)) in target_xcopy_setup_pt_cmd()
582 struct xcopy_op *xop, in target_xcopy_read_source() argument
592 bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); in target_xcopy_read_source()
607 rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, src_dev, &cdb[0], in target_xcopy_read_source()
615 " memory\n", xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_read_source()
627 struct xcopy_op *xop, in target_xcopy_write_destination() argument
637 bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); in target_xcopy_write_destination()
652 rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, dst_dev, &cdb[0], in target_xcopy_write_destination()
669 struct xcopy_op *xop = container_of(work, struct xcopy_op, xop_work); in target_xcopy_do_work() local
670 struct se_cmd *ec_cmd = xop->xop_se_cmd; in target_xcopy_do_work()
678 sense_rc = target_parse_xcopy_cmd(xop); in target_xcopy_do_work()
682 if (WARN_ON_ONCE(!xop->src_dev) || WARN_ON_ONCE(!xop->dst_dev)) { in target_xcopy_do_work()
687 src_dev = xop->src_dev; in target_xcopy_do_work()
688 dst_dev = xop->dst_dev; in target_xcopy_do_work()
689 src_lba = xop->src_lba; in target_xcopy_do_work()
690 dst_lba = xop->dst_lba; in target_xcopy_do_work()
691 nolb = xop->nolb; in target_xcopy_do_work()
712 if (cur_bytes != xop->xop_data_bytes) { in target_xcopy_do_work()
717 target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_do_work()
718 rc = target_alloc_sgl(&xop->xop_data_sg, in target_xcopy_do_work()
719 &xop->xop_data_nents, in target_xcopy_do_work()
724 xop->xop_data_bytes = cur_bytes; in target_xcopy_do_work()
730 rc = target_xcopy_read_source(ec_cmd, xop, src_dev, src_lba, cur_nolb); in target_xcopy_do_work()
741 rc = target_xcopy_write_destination(ec_cmd, xop, dst_dev, in target_xcopy_do_work()
754 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
755 target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_do_work()
756 kfree(xop); in target_xcopy_do_work()
774 xcopy_pt_undepend_remotedev(xop); in target_xcopy_do_work()
775 target_free_sgl(xop->xop_data_sg, xop->xop_data_nents); in target_xcopy_do_work()
778 kfree(xop); in target_xcopy_do_work()
788 static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop) in target_parse_xcopy_cmd() argument
790 struct se_cmd *se_cmd = xop->xop_se_cmd; in target_parse_xcopy_cmd()
842 rc = target_xcopy_parse_segment_descriptors(xop, seg_desc, sdll, &ret); in target_parse_xcopy_cmd()
849 rc = target_xcopy_parse_target_descriptors(se_cmd, xop, &p[16], tdll, &ret); in target_parse_xcopy_cmd()
853 if (xop->src_dev->dev_attrib.block_size != in target_parse_xcopy_cmd()
854 xop->dst_dev->dev_attrib.block_size) { in target_parse_xcopy_cmd()
857 xop->src_dev->dev_attrib.block_size, in target_parse_xcopy_cmd()
858 xop->dst_dev->dev_attrib.block_size); in target_parse_xcopy_cmd()
859 xcopy_pt_undepend_remotedev(xop); in target_parse_xcopy_cmd()
878 struct xcopy_op *xop; in target_do_xcopy() local
902 xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); in target_do_xcopy()
903 if (!xop) in target_do_xcopy()
905 xop->xop_se_cmd = se_cmd; in target_do_xcopy()
906 INIT_WORK(&xop->xop_work, target_xcopy_do_work); in target_do_xcopy()
907 if (WARN_ON_ONCE(!queue_work(xcopy_wq, &xop->xop_work))) in target_do_xcopy()
912 kfree(xop); in target_do_xcopy()