aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libiscsi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/libiscsi.h')
-rw-r--r--include/scsi/libiscsi.h40
1 files changed, 35 insertions, 5 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index cbf7e58bd6f9..401192e56e50 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -60,6 +60,7 @@ struct iscsi_nopin;
60#define TMABORT_SUCCESS 0x1 60#define TMABORT_SUCCESS 0x1
61#define TMABORT_FAILED 0x2 61#define TMABORT_FAILED 0x2
62#define TMABORT_TIMEDOUT 0x3 62#define TMABORT_TIMEDOUT 0x3
63#define TMABORT_NOT_FOUND 0x4
63 64
64/* Connection suspend "bit" */ 65/* Connection suspend "bit" */
65#define ISCSI_SUSPEND_BIT 1 66#define ISCSI_SUSPEND_BIT 1
@@ -83,6 +84,12 @@ struct iscsi_mgmt_task {
83 struct list_head running; 84 struct list_head running;
84}; 85};
85 86
87enum {
88 ISCSI_TASK_COMPLETED,
89 ISCSI_TASK_PENDING,
90 ISCSI_TASK_RUNNING,
91};
92
86struct iscsi_cmd_task { 93struct iscsi_cmd_task {
87 /* 94 /*
88 * Becuae LLDs allocate their hdr differently, this is a pointer to 95 * Becuae LLDs allocate their hdr differently, this is a pointer to
@@ -95,12 +102,17 @@ struct iscsi_cmd_task {
95 uint32_t unsol_datasn; 102 uint32_t unsol_datasn;
96 int imm_count; /* imm-data (bytes) */ 103 int imm_count; /* imm-data (bytes) */
97 int unsol_count; /* unsolicited (bytes)*/ 104 int unsol_count; /* unsolicited (bytes)*/
105 /* offset in unsolicited stream (bytes); */
106 int unsol_offset;
98 int data_count; /* remaining Data-Out */ 107 int data_count; /* remaining Data-Out */
99 struct scsi_cmnd *sc; /* associated SCSI cmd*/ 108 struct scsi_cmnd *sc; /* associated SCSI cmd*/
100 int total_length; 109 int total_length;
101 struct iscsi_conn *conn; /* used connection */ 110 struct iscsi_conn *conn; /* used connection */
102 struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */ 111 struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */
103 112
113 /* state set/tested under session->lock */
114 int state;
115 atomic_t refcount;
104 struct list_head running; /* running cmd list */ 116 struct list_head running; /* running cmd list */
105 void *dd_data; /* driver/transport data */ 117 void *dd_data; /* driver/transport data */
106}; 118};
@@ -126,6 +138,14 @@ struct iscsi_conn {
126 int id; /* CID */ 138 int id; /* CID */
127 struct list_head item; /* maintains list of conns */ 139 struct list_head item; /* maintains list of conns */
128 int c_stage; /* connection state */ 140 int c_stage; /* connection state */
141 /*
142 * Preallocated buffer for pdus that have data but do not
143 * originate from scsi-ml. We never have two pdus using the
144 * buffer at the same time. It is only allocated to
145 * the default max recv size because the pdus we support
146 * should always fit in this buffer
147 */
148 char *data;
129 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */ 149 struct iscsi_mgmt_task *login_mtask; /* mtask used for login/text */
130 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */ 150 struct iscsi_mgmt_task *mtask; /* xmit mtask in progress */
131 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ 151 struct iscsi_cmd_task *ctask; /* xmit ctask in progress */
@@ -134,7 +154,7 @@ struct iscsi_conn {
134 struct kfifo *immqueue; /* immediate xmit queue */ 154 struct kfifo *immqueue; /* immediate xmit queue */
135 struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */ 155 struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */
136 struct list_head mgmt_run_list; /* list of control tasks */ 156 struct list_head mgmt_run_list; /* list of control tasks */
137 struct kfifo *xmitqueue; /* data-path cmd queue */ 157 struct list_head xmitqueue; /* data-path cmd queue */
138 struct list_head run_list; /* list of cmds in progress */ 158 struct list_head run_list; /* list of cmds in progress */
139 struct work_struct xmitwork; /* per-conn. xmit workqueue */ 159 struct work_struct xmitwork; /* per-conn. xmit workqueue */
140 /* 160 /*
@@ -157,6 +177,11 @@ struct iscsi_conn {
157 int max_xmit_dlength; /* target_max_recv_dsl */ 177 int max_xmit_dlength; /* target_max_recv_dsl */
158 int hdrdgst_en; 178 int hdrdgst_en;
159 int datadgst_en; 179 int datadgst_en;
180 int ifmarker_en;
181 int ofmarker_en;
182 /* values userspace uses to id a conn */
183 int persistent_port;
184 char *persistent_address;
160 185
161 /* MIB-statistics */ 186 /* MIB-statistics */
162 uint64_t txdata_octets; 187 uint64_t txdata_octets;
@@ -196,8 +221,8 @@ struct iscsi_session {
196 int pdu_inorder_en; 221 int pdu_inorder_en;
197 int dataseq_inorder_en; 222 int dataseq_inorder_en;
198 int erl; 223 int erl;
199 int ifmarker_en; 224 int tpgt;
200 int ofmarker_en; 225 char *targetname;
201 226
202 /* control data */ 227 /* control data */
203 struct iscsi_transport *tt; 228 struct iscsi_transport *tt;
@@ -240,6 +265,10 @@ iscsi_session_setup(struct iscsi_transport *, struct scsi_transport_template *,
240extern void iscsi_session_teardown(struct iscsi_cls_session *); 265extern void iscsi_session_teardown(struct iscsi_cls_session *);
241extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *); 266extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *);
242extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); 267extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *);
268extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
269 enum iscsi_param param, char *buf, int buflen);
270extern int iscsi_session_get_param(struct iscsi_cls_session *cls_session,
271 enum iscsi_param param, char *buf);
243 272
244#define session_to_cls(_sess) \ 273#define session_to_cls(_sess) \
245 hostdata_session(_sess->host->hostdata) 274 hostdata_session(_sess->host->hostdata)
@@ -255,6 +284,8 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
255extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, 284extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
256 int); 285 int);
257extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); 286extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
287extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
288 enum iscsi_param param, char *buf);
258 289
259/* 290/*
260 * pdu and task processing 291 * pdu and task processing
@@ -262,8 +293,7 @@ extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
262extern int iscsi_check_assign_cmdsn(struct iscsi_session *, 293extern int iscsi_check_assign_cmdsn(struct iscsi_session *,
263 struct iscsi_nopin *); 294 struct iscsi_nopin *);
264extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *, 295extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *,
265 struct iscsi_data *hdr, 296 struct iscsi_data *hdr);
266 int transport_data_cnt);
267extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, 297extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *,
268 char *, uint32_t); 298 char *, uint32_t);
269extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, 299extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,