]>
Commit | Line | Data |
---|---|---|
c66ac9db NB |
1 | #ifndef TARGET_CORE_ALUA_H |
2 | #define TARGET_CORE_ALUA_H | |
3 | ||
4 | /* | |
5 | * INQUIRY response data, TPGS Field | |
6 | * | |
7 | * from spc4r17 section 6.4.2 Table 135 | |
8 | */ | |
9 | #define TPGS_NO_ALUA 0x00 | |
125d0119 HR |
10 | #define TPGS_IMPLICIT_ALUA 0x10 |
11 | #define TPGS_EXPLICIT_ALUA 0x20 | |
c66ac9db NB |
12 | |
13 | /* | |
14 | * ASYMMETRIC ACCESS STATE field | |
15 | * | |
16 | * from spc4r17 section 6.27 Table 245 | |
17 | */ | |
73f3bf51 | 18 | #define ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED 0x0 |
c66ac9db NB |
19 | #define ALUA_ACCESS_STATE_ACTIVE_NON_OPTIMIZED 0x1 |
20 | #define ALUA_ACCESS_STATE_STANDBY 0x2 | |
21 | #define ALUA_ACCESS_STATE_UNAVAILABLE 0x3 | |
22 | #define ALUA_ACCESS_STATE_OFFLINE 0xe | |
23 | #define ALUA_ACCESS_STATE_TRANSITION 0xf | |
24 | ||
c0dc941e HR |
25 | /* |
26 | * from spc4r36j section 6.37 Table 306 | |
27 | */ | |
28 | #define ALUA_T_SUP 0x80 | |
29 | #define ALUA_O_SUP 0x40 | |
30 | #define ALUA_LBD_SUP 0x10 | |
31 | #define ALUA_U_SUP 0x08 | |
32 | #define ALUA_S_SUP 0x04 | |
33 | #define ALUA_AN_SUP 0x02 | |
34 | #define ALUA_AO_SUP 0x01 | |
35 | ||
c66ac9db NB |
36 | /* |
37 | * REPORT_TARGET_PORT_GROUP STATUS CODE | |
38 | * | |
39 | * from spc4r17 section 6.27 Table 246 | |
40 | */ | |
41 | #define ALUA_STATUS_NONE 0x00 | |
125d0119 HR |
42 | #define ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG 0x01 |
43 | #define ALUA_STATUS_ALTERED_BY_IMPLICIT_ALUA 0x02 | |
c66ac9db NB |
44 | |
45 | /* | |
46 | * From spc4r17, Table D.1: ASC and ASCQ Assignement | |
47 | */ | |
48 | #define ASCQ_04H_ALUA_STATE_TRANSITION 0x0a | |
49 | #define ASCQ_04H_ALUA_TG_PT_STANDBY 0x0b | |
50 | #define ASCQ_04H_ALUA_TG_PT_UNAVAILABLE 0x0c | |
51 | #define ASCQ_04H_ALUA_OFFLINE 0x12 | |
52 | ||
53 | /* | |
54 | * Used as the default for Active/NonOptimized delay (in milliseconds) | |
55 | * This can also be changed via configfs on a per target port group basis.. | |
56 | */ | |
57 | #define ALUA_DEFAULT_NONOP_DELAY_MSECS 100 | |
58 | #define ALUA_MAX_NONOP_DELAY_MSECS 10000 /* 10 seconds */ | |
59 | /* | |
125d0119 | 60 | * Used for implicit and explicit ALUA transitional delay, that is disabled |
c66ac9db NB |
61 | * by default, and is intended to be used for debugging client side ALUA code. |
62 | */ | |
63 | #define ALUA_DEFAULT_TRANS_DELAY_MSECS 0 | |
64 | #define ALUA_MAX_TRANS_DELAY_MSECS 30000 /* 30 seconds */ | |
5b9a4d72 | 65 | /* |
125d0119 | 66 | * Used for the recommended application client implicit transition timeout |
5b9a4d72 NB |
67 | * in seconds, returned by the REPORT_TARGET_PORT_GROUPS w/ extended header. |
68 | */ | |
125d0119 HR |
69 | #define ALUA_DEFAULT_IMPLICIT_TRANS_SECS 0 |
70 | #define ALUA_MAX_IMPLICIT_TRANS_SECS 255 | |
c66ac9db NB |
71 | /* |
72 | * Used by core_alua_update_tpg_primary_metadata() and | |
73 | * core_alua_update_tpg_secondary_metadata() | |
74 | */ | |
75 | #define ALUA_METADATA_PATH_LEN 512 | |
76 | /* | |
77 | * Used by core_alua_update_tpg_secondary_metadata() | |
78 | */ | |
79 | #define ALUA_SECONDARY_METADATA_WWN_LEN 256 | |
80 | ||
81 | extern struct kmem_cache *t10_alua_lu_gp_cache; | |
82 | extern struct kmem_cache *t10_alua_lu_gp_mem_cache; | |
83 | extern struct kmem_cache *t10_alua_tg_pt_gp_cache; | |
84 | extern struct kmem_cache *t10_alua_tg_pt_gp_mem_cache; | |
85 | ||
de103c93 CH |
86 | extern sense_reason_t target_emulate_report_target_port_groups(struct se_cmd *); |
87 | extern sense_reason_t target_emulate_set_target_port_groups(struct se_cmd *); | |
c66ac9db NB |
88 | extern int core_alua_check_nonop_delay(struct se_cmd *); |
89 | extern int core_alua_do_port_transition(struct t10_alua_tg_pt_gp *, | |
90 | struct se_device *, struct se_port *, | |
91 | struct se_node_acl *, int, int); | |
92 | extern char *core_alua_dump_status(int); | |
93 | extern struct t10_alua_lu_gp *core_alua_allocate_lu_gp(const char *, int); | |
94 | extern int core_alua_set_lu_gp_id(struct t10_alua_lu_gp *, u16); | |
95 | extern void core_alua_free_lu_gp(struct t10_alua_lu_gp *); | |
96 | extern void core_alua_free_lu_gp_mem(struct se_device *); | |
97 | extern struct t10_alua_lu_gp *core_alua_get_lu_gp_by_name(const char *); | |
98 | extern void core_alua_put_lu_gp_from_name(struct t10_alua_lu_gp *); | |
99 | extern void __core_alua_attach_lu_gp_mem(struct t10_alua_lu_gp_member *, | |
100 | struct t10_alua_lu_gp *); | |
101 | extern void __core_alua_drop_lu_gp_mem(struct t10_alua_lu_gp_member *, | |
102 | struct t10_alua_lu_gp *); | |
103 | extern void core_alua_drop_lu_gp_dev(struct se_device *); | |
104 | extern struct t10_alua_tg_pt_gp *core_alua_allocate_tg_pt_gp( | |
0fd97ccf | 105 | struct se_device *, const char *, int); |
c66ac9db NB |
106 | extern int core_alua_set_tg_pt_gp_id(struct t10_alua_tg_pt_gp *, u16); |
107 | extern struct t10_alua_tg_pt_gp_member *core_alua_allocate_tg_pt_gp_mem( | |
108 | struct se_port *); | |
109 | extern void core_alua_free_tg_pt_gp(struct t10_alua_tg_pt_gp *); | |
110 | extern void core_alua_free_tg_pt_gp_mem(struct se_port *); | |
111 | extern void __core_alua_attach_tg_pt_gp_mem(struct t10_alua_tg_pt_gp_member *, | |
112 | struct t10_alua_tg_pt_gp *); | |
113 | extern ssize_t core_alua_show_tg_pt_gp_info(struct se_port *, char *); | |
114 | extern ssize_t core_alua_store_tg_pt_gp_info(struct se_port *, const char *, | |
115 | size_t); | |
116 | extern ssize_t core_alua_show_access_type(struct t10_alua_tg_pt_gp *, char *); | |
117 | extern ssize_t core_alua_store_access_type(struct t10_alua_tg_pt_gp *, | |
118 | const char *, size_t); | |
119 | extern ssize_t core_alua_show_nonop_delay_msecs(struct t10_alua_tg_pt_gp *, | |
120 | char *); | |
121 | extern ssize_t core_alua_store_nonop_delay_msecs(struct t10_alua_tg_pt_gp *, | |
122 | const char *, size_t); | |
123 | extern ssize_t core_alua_show_trans_delay_msecs(struct t10_alua_tg_pt_gp *, | |
124 | char *); | |
125 | extern ssize_t core_alua_store_trans_delay_msecs(struct t10_alua_tg_pt_gp *, | |
126 | const char *, size_t); | |
125d0119 | 127 | extern ssize_t core_alua_show_implicit_trans_secs(struct t10_alua_tg_pt_gp *, |
5b9a4d72 | 128 | char *); |
125d0119 | 129 | extern ssize_t core_alua_store_implicit_trans_secs(struct t10_alua_tg_pt_gp *, |
5b9a4d72 | 130 | const char *, size_t); |
c66ac9db NB |
131 | extern ssize_t core_alua_show_preferred_bit(struct t10_alua_tg_pt_gp *, |
132 | char *); | |
133 | extern ssize_t core_alua_store_preferred_bit(struct t10_alua_tg_pt_gp *, | |
134 | const char *, size_t); | |
135 | extern ssize_t core_alua_show_offline_bit(struct se_lun *, char *); | |
136 | extern ssize_t core_alua_store_offline_bit(struct se_lun *, const char *, | |
137 | size_t); | |
138 | extern ssize_t core_alua_show_secondary_status(struct se_lun *, char *); | |
139 | extern ssize_t core_alua_store_secondary_status(struct se_lun *, | |
140 | const char *, size_t); | |
141 | extern ssize_t core_alua_show_secondary_write_metadata(struct se_lun *, | |
142 | char *); | |
143 | extern ssize_t core_alua_store_secondary_write_metadata(struct se_lun *, | |
144 | const char *, size_t); | |
0fd97ccf | 145 | extern int core_setup_alua(struct se_device *); |
de103c93 | 146 | extern sense_reason_t target_alua_state_check(struct se_cmd *cmd); |
c66ac9db NB |
147 | |
148 | #endif /* TARGET_CORE_ALUA_H */ |