diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/scsi/libiscsi.h | 19 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 27 |
2 files changed, 31 insertions, 15 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 71eda24114e9..278011fb3c2f 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -135,6 +135,14 @@ static inline void* iscsi_next_hdr(struct iscsi_cmd_task *ctask) | |||
135 | return (void*)ctask->hdr + ctask->hdr_len; | 135 | return (void*)ctask->hdr + ctask->hdr_len; |
136 | } | 136 | } |
137 | 137 | ||
138 | /* Connection's states */ | ||
139 | enum { | ||
140 | ISCSI_CONN_INITIAL_STAGE, | ||
141 | ISCSI_CONN_STARTED, | ||
142 | ISCSI_CONN_STOPPED, | ||
143 | ISCSI_CONN_CLEANUP_WAIT, | ||
144 | }; | ||
145 | |||
138 | struct iscsi_conn { | 146 | struct iscsi_conn { |
139 | struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ | 147 | struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ |
140 | void *dd_data; /* iscsi_transport data */ | 148 | void *dd_data; /* iscsi_transport data */ |
@@ -227,6 +235,17 @@ struct iscsi_pool { | |||
227 | int max; /* Max number of elements */ | 235 | int max; /* Max number of elements */ |
228 | }; | 236 | }; |
229 | 237 | ||
238 | /* Session's states */ | ||
239 | enum { | ||
240 | ISCSI_STATE_FREE = 1, | ||
241 | ISCSI_STATE_LOGGED_IN, | ||
242 | ISCSI_STATE_FAILED, | ||
243 | ISCSI_STATE_TERMINATE, | ||
244 | ISCSI_STATE_IN_RECOVERY, | ||
245 | ISCSI_STATE_RECOVERY_FAILED, | ||
246 | ISCSI_STATE_LOGGING_OUT, | ||
247 | }; | ||
248 | |||
230 | struct iscsi_session { | 249 | struct iscsi_session { |
231 | /* | 250 | /* |
232 | * Syncs up the scsi eh thread with the iscsi eh thread when sending | 251 | * Syncs up the scsi eh thread with the iscsi eh thread when sending |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 404f11d331d6..0e869d9a3856 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -149,13 +149,6 @@ extern void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error); | |||
149 | extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | 149 | extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, |
150 | char *data, uint32_t data_size); | 150 | char *data, uint32_t data_size); |
151 | 151 | ||
152 | |||
153 | /* Connection's states */ | ||
154 | #define ISCSI_CONN_INITIAL_STAGE 0 | ||
155 | #define ISCSI_CONN_STARTED 1 | ||
156 | #define ISCSI_CONN_STOPPED 2 | ||
157 | #define ISCSI_CONN_CLEANUP_WAIT 3 | ||
158 | |||
159 | struct iscsi_cls_conn { | 152 | struct iscsi_cls_conn { |
160 | struct list_head conn_list; /* item in connlist */ | 153 | struct list_head conn_list; /* item in connlist */ |
161 | void *dd_data; /* LLD private data */ | 154 | void *dd_data; /* LLD private data */ |
@@ -169,19 +162,21 @@ struct iscsi_cls_conn { | |||
169 | #define iscsi_dev_to_conn(_dev) \ | 162 | #define iscsi_dev_to_conn(_dev) \ |
170 | container_of(_dev, struct iscsi_cls_conn, dev) | 163 | container_of(_dev, struct iscsi_cls_conn, dev) |
171 | 164 | ||
172 | /* Session's states */ | 165 | #define iscsi_conn_to_session(_conn) \ |
173 | #define ISCSI_STATE_FREE 1 | 166 | iscsi_dev_to_session(_conn->dev.parent) |
174 | #define ISCSI_STATE_LOGGED_IN 2 | 167 | |
175 | #define ISCSI_STATE_FAILED 3 | 168 | /* iscsi class session state */ |
176 | #define ISCSI_STATE_TERMINATE 4 | 169 | enum { |
177 | #define ISCSI_STATE_IN_RECOVERY 5 | 170 | ISCSI_SESSION_LOGGED_IN, |
178 | #define ISCSI_STATE_RECOVERY_FAILED 6 | 171 | ISCSI_SESSION_FAILED, |
179 | #define ISCSI_STATE_LOGGING_OUT 7 | 172 | ISCSI_SESSION_FREE, |
173 | }; | ||
180 | 174 | ||
181 | struct iscsi_cls_session { | 175 | struct iscsi_cls_session { |
182 | struct list_head sess_list; /* item in session_list */ | 176 | struct list_head sess_list; /* item in session_list */ |
183 | struct list_head host_list; | 177 | struct list_head host_list; |
184 | struct iscsi_transport *transport; | 178 | struct iscsi_transport *transport; |
179 | spinlock_t lock; | ||
185 | 180 | ||
186 | /* recovery fields */ | 181 | /* recovery fields */ |
187 | int recovery_tmo; | 182 | int recovery_tmo; |
@@ -190,6 +185,7 @@ struct iscsi_cls_session { | |||
190 | 185 | ||
191 | int target_id; | 186 | int target_id; |
192 | 187 | ||
188 | int state; | ||
193 | int sid; /* session id */ | 189 | int sid; /* session id */ |
194 | void *dd_data; /* LLD private data */ | 190 | void *dd_data; /* LLD private data */ |
195 | struct device dev; /* sysfs transport/container device */ | 191 | struct device dev; /* sysfs transport/container device */ |
@@ -214,6 +210,7 @@ struct iscsi_host { | |||
214 | /* | 210 | /* |
215 | * session and connection functions that can be used by HW iSCSI LLDs | 211 | * session and connection functions that can be used by HW iSCSI LLDs |
216 | */ | 212 | */ |
213 | extern int iscsi_session_chkready(struct iscsi_cls_session *session); | ||
217 | extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost, | 214 | extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost, |
218 | struct iscsi_transport *transport); | 215 | struct iscsi_transport *transport); |
219 | extern int iscsi_add_session(struct iscsi_cls_session *session, | 216 | extern int iscsi_add_session(struct iscsi_cls_session *session, |