target_core_xcopy.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #include <target/target_core_base.h>
  3. #define XCOPY_HDR_LEN 16
  4. #define XCOPY_TARGET_DESC_LEN 32
  5. #define XCOPY_SEGMENT_DESC_LEN 28
  6. #define XCOPY_NAA_IEEE_REGEX_LEN 16
  7. #define XCOPY_MAX_SECTORS 4096
  8. /*
  9. * SPC4r37 6.4.6.1
  10. * Table 150 — CSCD descriptor ID values
  11. */
  12. #define XCOPY_CSCD_DESC_ID_LIST_OFF_MAX 0x07FF
  13. enum xcopy_origin_list {
  14. XCOL_SOURCE_RECV_OP = 0x01,
  15. XCOL_DEST_RECV_OP = 0x02,
  16. };
  17. struct xcopy_op {
  18. int op_origin;
  19. struct se_cmd *xop_se_cmd;
  20. struct se_device *src_dev;
  21. unsigned char src_tid_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
  22. struct se_device *dst_dev;
  23. unsigned char dst_tid_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
  24. unsigned char local_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
  25. struct percpu_ref *remote_lun_ref;
  26. sector_t src_lba;
  27. sector_t dst_lba;
  28. unsigned short stdi;
  29. unsigned short dtdi;
  30. unsigned short nolb;
  31. u32 xop_data_bytes;
  32. u32 xop_data_nents;
  33. struct scatterlist *xop_data_sg;
  34. struct work_struct xop_work;
  35. };
  36. /*
  37. * Receive Copy Results Sevice Actions
  38. */
  39. #define RCR_SA_COPY_STATUS 0x00
  40. #define RCR_SA_RECEIVE_DATA 0x01
  41. #define RCR_SA_OPERATING_PARAMETERS 0x03
  42. #define RCR_SA_FAILED_SEGMENT_DETAILS 0x04
  43. /*
  44. * Receive Copy Results defs for Operating Parameters
  45. */
  46. #define RCR_OP_MAX_TARGET_DESC_COUNT 0x2
  47. #define RCR_OP_MAX_SG_DESC_COUNT 0x1
  48. #define RCR_OP_MAX_DESC_LIST_LEN 1024
  49. #define RCR_OP_MAX_SEGMENT_LEN 268435456 /* 256 MB */
  50. #define RCR_OP_TOTAL_CONCURR_COPIES 0x1 /* Must be <= 16384 */
  51. #define RCR_OP_MAX_CONCURR_COPIES 0x1 /* Must be <= 255 */
  52. #define RCR_OP_DATA_SEG_GRAN_LOG2 9 /* 512 bytes in log 2 */
  53. #define RCR_OP_INLINE_DATA_GRAN_LOG2 9 /* 512 bytes in log 2 */
  54. #define RCR_OP_HELD_DATA_GRAN_LOG2 9 /* 512 bytes in log 2 */
  55. extern int target_xcopy_setup_pt(void);
  56. extern void target_xcopy_release_pt(void);
  57. extern sense_reason_t target_do_xcopy(struct se_cmd *);
  58. extern sense_reason_t target_do_receive_copy_results(struct se_cmd *);