mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
[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 <[email protected]> Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
parent
84ac86ca8c
commit
6eabafbe66
4 changed files with 161 additions and 33 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue