Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #include <target/target_core_base.h>
0003 
0004 #define XCOPY_HDR_LEN           16
0005 #define XCOPY_TARGET_DESC_LEN       32
0006 #define XCOPY_SEGMENT_DESC_LEN      28
0007 #define XCOPY_NAA_IEEE_REGEX_LEN    16
0008 #define XCOPY_MAX_SECTORS       4096
0009 
0010 /*
0011  * SPC4r37 6.4.6.1
0012  * Table 150 — CSCD descriptor ID values
0013  */
0014 #define XCOPY_CSCD_DESC_ID_LIST_OFF_MAX 0x07FF
0015 
0016 enum xcopy_origin_list {
0017     XCOL_SOURCE_RECV_OP = 0x01,
0018     XCOL_DEST_RECV_OP = 0x02,
0019 };
0020 
0021 struct xcopy_op {
0022     int op_origin;
0023 
0024     struct se_cmd *xop_se_cmd;
0025     struct se_device *src_dev;
0026     unsigned char src_tid_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
0027     struct se_device *dst_dev;
0028     unsigned char dst_tid_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
0029     unsigned char local_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
0030     struct percpu_ref *remote_lun_ref;
0031 
0032     sector_t src_lba;
0033     sector_t dst_lba;
0034     unsigned short stdi;
0035     unsigned short dtdi;
0036     unsigned short nolb;
0037 
0038     u32 xop_data_bytes;
0039     u32 xop_data_nents;
0040     struct scatterlist *xop_data_sg;
0041     struct work_struct xop_work;
0042 };
0043 
0044 /*
0045  * Receive Copy Results Sevice Actions
0046  */
0047 #define RCR_SA_COPY_STATUS      0x00
0048 #define RCR_SA_RECEIVE_DATA     0x01
0049 #define RCR_SA_OPERATING_PARAMETERS 0x03
0050 #define RCR_SA_FAILED_SEGMENT_DETAILS   0x04
0051 
0052 /*
0053  * Receive Copy Results defs for Operating Parameters
0054  */
0055 #define RCR_OP_MAX_TARGET_DESC_COUNT    0x2
0056 #define RCR_OP_MAX_SG_DESC_COUNT    0x1
0057 #define RCR_OP_MAX_DESC_LIST_LEN    1024
0058 #define RCR_OP_MAX_SEGMENT_LEN      268435456 /* 256 MB */
0059 #define RCR_OP_TOTAL_CONCURR_COPIES 0x1 /* Must be <= 16384 */
0060 #define RCR_OP_MAX_CONCURR_COPIES   0x1 /* Must be <= 255 */
0061 #define RCR_OP_DATA_SEG_GRAN_LOG2   9 /* 512 bytes in log 2 */
0062 #define RCR_OP_INLINE_DATA_GRAN_LOG2    9 /* 512 bytes in log 2 */
0063 #define RCR_OP_HELD_DATA_GRAN_LOG2  9 /* 512 bytes in log 2 */
0064 
0065 extern int target_xcopy_setup_pt(void);
0066 extern void target_xcopy_release_pt(void);
0067 extern sense_reason_t target_do_xcopy(struct se_cmd *);
0068 extern sense_reason_t target_do_receive_copy_results(struct se_cmd *);