summaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-01-31 13:36:43 -0600
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-07 18:02:34 -0600
commit6eabafbe6616266e8de61980a7dac5ecc1ba1113 (patch)
treef5533027fac576acf4db08210ea5815db3a15e50 /include/scsi
parent84ac86ca8c6787f9efff28bc04b1b65fe0a5c310 (diff)
downloadop-kernel-dev-6eabafbe6616266e8de61980a7dac5ecc1ba1113.zip
op-kernel-dev-6eabafbe6616266e8de61980a7dac5ecc1ba1113.tar.gz
[SCSI] iscsi class, libiscsi: add iscsi sysfs session state file
This adds a iscsi session state file which exports the session state for both software and hardware iscsi. It also hooks libiscsi in. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libiscsi.h19
-rw-r--r--include/scsi/scsi_transport_iscsi.h27
2 files changed, 31 insertions, 15 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 71eda241..278011f 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)
return (void*)ctask->hdr + ctask->hdr_len;
}
+/* Connection's states */
+enum {
+ ISCSI_CONN_INITIAL_STAGE,
+ ISCSI_CONN_STARTED,
+ ISCSI_CONN_STOPPED,
+ ISCSI_CONN_CLEANUP_WAIT,
+};
+
struct iscsi_conn {
struct iscsi_cls_conn *cls_conn; /* ptr to class connection */
void *dd_data; /* iscsi_transport data */
@@ -227,6 +235,17 @@ struct iscsi_pool {
int max; /* Max number of elements */
};
+/* Session's states */
+enum {
+ ISCSI_STATE_FREE = 1,
+ ISCSI_STATE_LOGGED_IN,
+ ISCSI_STATE_FAILED,
+ ISCSI_STATE_TERMINATE,
+ ISCSI_STATE_IN_RECOVERY,
+ ISCSI_STATE_RECOVERY_FAILED,
+ ISCSI_STATE_LOGGING_OUT,
+};
+
struct iscsi_session {
/*
* 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 404f11d..0e869d9 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);
extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
char *data, uint32_t data_size);
-
-/* Connection's states */
-#define ISCSI_CONN_INITIAL_STAGE 0
-#define ISCSI_CONN_STARTED 1
-#define ISCSI_CONN_STOPPED 2
-#define ISCSI_CONN_CLEANUP_WAIT 3
-
struct iscsi_cls_conn {
struct list_head conn_list; /* item in connlist */
void *dd_data; /* LLD private data */
@@ -169,19 +162,21 @@ struct iscsi_cls_conn {
#define iscsi_dev_to_conn(_dev) \
container_of(_dev, struct iscsi_cls_conn, dev)
-/* Session's states */
-#define ISCSI_STATE_FREE 1
-#define ISCSI_STATE_LOGGED_IN 2
-#define ISCSI_STATE_FAILED 3
-#define ISCSI_STATE_TERMINATE 4
-#define ISCSI_STATE_IN_RECOVERY 5
-#define ISCSI_STATE_RECOVERY_FAILED 6
-#define ISCSI_STATE_LOGGING_OUT 7
+#define iscsi_conn_to_session(_conn) \
+ iscsi_dev_to_session(_conn->dev.parent)
+
+/* iscsi class session state */
+enum {
+ ISCSI_SESSION_LOGGED_IN,
+ ISCSI_SESSION_FAILED,
+ ISCSI_SESSION_FREE,
+};
struct iscsi_cls_session {
struct list_head sess_list; /* item in session_list */
struct list_head host_list;
struct iscsi_transport *transport;
+ spinlock_t lock;
/* recovery fields */
int recovery_tmo;
@@ -190,6 +185,7 @@ struct iscsi_cls_session {
int target_id;
+ int state;
int sid; /* session id */
void *dd_data; /* LLD private data */
struct device dev; /* sysfs transport/container device */
@@ -214,6 +210,7 @@ struct iscsi_host {
/*
* session and connection functions that can be used by HW iSCSI LLDs
*/
+extern int iscsi_session_chkready(struct iscsi_cls_session *session);
extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost,
struct iscsi_transport *transport);
extern int iscsi_add_session(struct iscsi_cls_session *session,
OpenPOWER on IntegriCloud