target_core_alua.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef TARGET_CORE_ALUA_H
  2. #define TARGET_CORE_ALUA_H
  3. /*
  4. * INQUIRY response data, TPGS Field
  5. *
  6. * from spc4r17 section 6.4.2 Table 135
  7. */
  8. #define TPGS_NO_ALUA 0x00
  9. #define TPGS_IMPLICT_ALUA 0x10
  10. #define TPGS_EXPLICT_ALUA 0x20
  11. /*
  12. * ASYMMETRIC ACCESS STATE field
  13. *
  14. * from spc4r17 section 6.27 Table 245
  15. */
  16. #define ALUA_ACCESS_STATE_ACTIVE_OPTMIZED 0x0
  17. #define ALUA_ACCESS_STATE_ACTIVE_NON_OPTIMIZED 0x1
  18. #define ALUA_ACCESS_STATE_STANDBY 0x2
  19. #define ALUA_ACCESS_STATE_UNAVAILABLE 0x3
  20. #define ALUA_ACCESS_STATE_OFFLINE 0xe
  21. #define ALUA_ACCESS_STATE_TRANSITION 0xf
  22. /*
  23. * REPORT_TARGET_PORT_GROUP STATUS CODE
  24. *
  25. * from spc4r17 section 6.27 Table 246
  26. */
  27. #define ALUA_STATUS_NONE 0x00
  28. #define ALUA_STATUS_ALTERED_BY_EXPLICT_STPG 0x01
  29. #define ALUA_STATUS_ALTERED_BY_IMPLICT_ALUA 0x02
  30. /*
  31. * From spc4r17, Table D.1: ASC and ASCQ Assignement
  32. */
  33. #define ASCQ_04H_ALUA_STATE_TRANSITION 0x0a
  34. #define ASCQ_04H_ALUA_TG_PT_STANDBY 0x0b
  35. #define ASCQ_04H_ALUA_TG_PT_UNAVAILABLE 0x0c
  36. #define ASCQ_04H_ALUA_OFFLINE 0x12
  37. /*
  38. * Used as the default for Active/NonOptimized delay (in milliseconds)
  39. * This can also be changed via configfs on a per target port group basis..
  40. */
  41. #define ALUA_DEFAULT_NONOP_DELAY_MSECS 100
  42. #define ALUA_MAX_NONOP_DELAY_MSECS 10000 /* 10 seconds */
  43. /*
  44. * Used for implict and explict ALUA transitional delay, that is disabled
  45. * by default, and is intended to be used for debugging client side ALUA code.
  46. */
  47. #define ALUA_DEFAULT_TRANS_DELAY_MSECS 0
  48. #define ALUA_MAX_TRANS_DELAY_MSECS 30000 /* 30 seconds */
  49. /*
  50. * Used by core_alua_update_tpg_primary_metadata() and
  51. * core_alua_update_tpg_secondary_metadata()
  52. */
  53. #define ALUA_METADATA_PATH_LEN 512
  54. /*
  55. * Used by core_alua_update_tpg_secondary_metadata()
  56. */
  57. #define ALUA_SECONDARY_METADATA_WWN_LEN 256
  58. extern struct kmem_cache *t10_alua_lu_gp_cache;
  59. extern struct kmem_cache *t10_alua_lu_gp_mem_cache;
  60. extern struct kmem_cache *t10_alua_tg_pt_gp_cache;
  61. extern struct kmem_cache *t10_alua_tg_pt_gp_mem_cache;
  62. extern int target_emulate_report_target_port_groups(struct se_task *);
  63. extern int target_emulate_set_target_port_groups(struct se_task *);
  64. extern int core_alua_check_nonop_delay(struct se_cmd *);
  65. extern int core_alua_do_port_transition(struct t10_alua_tg_pt_gp *,
  66. struct se_device *, struct se_port *,
  67. struct se_node_acl *, int, int);
  68. extern char *core_alua_dump_status(int);
  69. extern struct t10_alua_lu_gp *core_alua_allocate_lu_gp(const char *, int);
  70. extern int core_alua_set_lu_gp_id(struct t10_alua_lu_gp *, u16);
  71. extern void core_alua_free_lu_gp(struct t10_alua_lu_gp *);
  72. extern void core_alua_free_lu_gp_mem(struct se_device *);
  73. extern struct t10_alua_lu_gp *core_alua_get_lu_gp_by_name(const char *);
  74. extern void core_alua_put_lu_gp_from_name(struct t10_alua_lu_gp *);
  75. extern void __core_alua_attach_lu_gp_mem(struct t10_alua_lu_gp_member *,
  76. struct t10_alua_lu_gp *);
  77. extern void __core_alua_drop_lu_gp_mem(struct t10_alua_lu_gp_member *,
  78. struct t10_alua_lu_gp *);
  79. extern void core_alua_drop_lu_gp_dev(struct se_device *);
  80. extern struct t10_alua_tg_pt_gp *core_alua_allocate_tg_pt_gp(
  81. struct se_subsystem_dev *, const char *, int);
  82. extern int core_alua_set_tg_pt_gp_id(struct t10_alua_tg_pt_gp *, u16);
  83. extern struct t10_alua_tg_pt_gp_member *core_alua_allocate_tg_pt_gp_mem(
  84. struct se_port *);
  85. extern void core_alua_free_tg_pt_gp(struct t10_alua_tg_pt_gp *);
  86. extern void core_alua_free_tg_pt_gp_mem(struct se_port *);
  87. extern void __core_alua_attach_tg_pt_gp_mem(struct t10_alua_tg_pt_gp_member *,
  88. struct t10_alua_tg_pt_gp *);
  89. extern ssize_t core_alua_show_tg_pt_gp_info(struct se_port *, char *);
  90. extern ssize_t core_alua_store_tg_pt_gp_info(struct se_port *, const char *,
  91. size_t);
  92. extern ssize_t core_alua_show_access_type(struct t10_alua_tg_pt_gp *, char *);
  93. extern ssize_t core_alua_store_access_type(struct t10_alua_tg_pt_gp *,
  94. const char *, size_t);
  95. extern ssize_t core_alua_show_nonop_delay_msecs(struct t10_alua_tg_pt_gp *,
  96. char *);
  97. extern ssize_t core_alua_store_nonop_delay_msecs(struct t10_alua_tg_pt_gp *,
  98. const char *, size_t);
  99. extern ssize_t core_alua_show_trans_delay_msecs(struct t10_alua_tg_pt_gp *,
  100. char *);
  101. extern ssize_t core_alua_store_trans_delay_msecs(struct t10_alua_tg_pt_gp *,
  102. const char *, size_t);
  103. extern ssize_t core_alua_show_preferred_bit(struct t10_alua_tg_pt_gp *,
  104. char *);
  105. extern ssize_t core_alua_store_preferred_bit(struct t10_alua_tg_pt_gp *,
  106. const char *, size_t);
  107. extern ssize_t core_alua_show_offline_bit(struct se_lun *, char *);
  108. extern ssize_t core_alua_store_offline_bit(struct se_lun *, const char *,
  109. size_t);
  110. extern ssize_t core_alua_show_secondary_status(struct se_lun *, char *);
  111. extern ssize_t core_alua_store_secondary_status(struct se_lun *,
  112. const char *, size_t);
  113. extern ssize_t core_alua_show_secondary_write_metadata(struct se_lun *,
  114. char *);
  115. extern ssize_t core_alua_store_secondary_write_metadata(struct se_lun *,
  116. const char *, size_t);
  117. extern int core_setup_alua(struct se_device *, int);
  118. #endif /* TARGET_CORE_ALUA_H */