diff options
Diffstat (limited to 'include/scsi/libiscsi.h')
-rw-r--r-- | include/scsi/libiscsi.h | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index ea0816d4904d..3f631b08a1ab 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -48,9 +48,8 @@ struct iscsi_nopin; | |||
48 | #define debug_scsi(fmt...) | 48 | #define debug_scsi(fmt...) |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #define ISCSI_XMIT_CMDS_MAX 128 /* must be power of 2 */ | 51 | #define ISCSI_DEF_XMIT_CMDS_MAX 128 /* must be power of 2 */ |
52 | #define ISCSI_MGMT_CMDS_MAX 32 /* must be power of 2 */ | 52 | #define ISCSI_MGMT_CMDS_MAX 16 /* must be power of 2 */ |
53 | #define ISCSI_CONN_MAX 1 | ||
54 | 53 | ||
55 | #define ISCSI_MGMT_ITT_OFFSET 0xa00 | 54 | #define ISCSI_MGMT_ITT_OFFSET 0xa00 |
56 | 55 | ||
@@ -73,6 +72,8 @@ struct iscsi_nopin; | |||
73 | #define ISCSI_AGE_SHIFT 28 | 72 | #define ISCSI_AGE_SHIFT 28 |
74 | #define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT) | 73 | #define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT) |
75 | 74 | ||
75 | #define ISCSI_ADDRESS_BUF_LEN 64 | ||
76 | |||
76 | struct iscsi_mgmt_task { | 77 | struct iscsi_mgmt_task { |
77 | /* | 78 | /* |
78 | * Becuae LLDs allocate their hdr differently, this is a pointer to | 79 | * Becuae LLDs allocate their hdr differently, this is a pointer to |
@@ -80,7 +81,7 @@ struct iscsi_mgmt_task { | |||
80 | */ | 81 | */ |
81 | struct iscsi_hdr *hdr; | 82 | struct iscsi_hdr *hdr; |
82 | char *data; /* mgmt payload */ | 83 | char *data; /* mgmt payload */ |
83 | int data_count; /* counts data to be sent */ | 84 | unsigned data_count; /* counts data to be sent */ |
84 | uint32_t itt; /* this ITT */ | 85 | uint32_t itt; /* this ITT */ |
85 | void *dd_data; /* driver/transport data */ | 86 | void *dd_data; /* driver/transport data */ |
86 | struct list_head running; | 87 | struct list_head running; |
@@ -90,6 +91,7 @@ enum { | |||
90 | ISCSI_TASK_COMPLETED, | 91 | ISCSI_TASK_COMPLETED, |
91 | ISCSI_TASK_PENDING, | 92 | ISCSI_TASK_PENDING, |
92 | ISCSI_TASK_RUNNING, | 93 | ISCSI_TASK_RUNNING, |
94 | ISCSI_TASK_ABORTING, | ||
93 | }; | 95 | }; |
94 | 96 | ||
95 | struct iscsi_cmd_task { | 97 | struct iscsi_cmd_task { |
@@ -99,16 +101,14 @@ struct iscsi_cmd_task { | |||
99 | */ | 101 | */ |
100 | struct iscsi_cmd *hdr; | 102 | struct iscsi_cmd *hdr; |
101 | int itt; /* this ITT */ | 103 | int itt; /* this ITT */ |
102 | int datasn; /* DataSN */ | ||
103 | 104 | ||
104 | uint32_t unsol_datasn; | 105 | uint32_t unsol_datasn; |
105 | int imm_count; /* imm-data (bytes) */ | 106 | unsigned imm_count; /* imm-data (bytes) */ |
106 | int unsol_count; /* unsolicited (bytes)*/ | 107 | unsigned unsol_count; /* unsolicited (bytes)*/ |
107 | /* offset in unsolicited stream (bytes); */ | 108 | /* offset in unsolicited stream (bytes); */ |
108 | int unsol_offset; | 109 | unsigned unsol_offset; |
109 | int data_count; /* remaining Data-Out */ | 110 | unsigned data_count; /* remaining Data-Out */ |
110 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ | 111 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ |
111 | int total_length; | ||
112 | struct iscsi_conn *conn; /* used connection */ | 112 | struct iscsi_conn *conn; /* used connection */ |
113 | struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */ | 113 | struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */ |
114 | 114 | ||
@@ -152,18 +152,11 @@ struct iscsi_conn { | |||
152 | struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ | 152 | struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ |
153 | 153 | ||
154 | /* xmit */ | 154 | /* xmit */ |
155 | struct kfifo *immqueue; /* immediate xmit queue */ | ||
156 | struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */ | 155 | struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */ |
157 | struct list_head mgmt_run_list; /* list of control tasks */ | 156 | struct list_head mgmt_run_list; /* list of control tasks */ |
158 | struct list_head xmitqueue; /* data-path cmd queue */ | 157 | struct list_head xmitqueue; /* data-path cmd queue */ |
159 | struct list_head run_list; /* list of cmds in progress */ | 158 | struct list_head run_list; /* list of cmds in progress */ |
160 | struct work_struct xmitwork; /* per-conn. xmit workqueue */ | 159 | struct work_struct xmitwork; /* per-conn. xmit workqueue */ |
161 | /* | ||
162 | * serializes connection xmit, access to kfifos: | ||
163 | * xmitqueue, immqueue, mgmtqueue | ||
164 | */ | ||
165 | struct mutex xmitmutex; | ||
166 | |||
167 | unsigned long suspend_tx; /* suspend Tx */ | 160 | unsigned long suspend_tx; /* suspend Tx */ |
168 | unsigned long suspend_rx; /* suspend Rx */ | 161 | unsigned long suspend_rx; /* suspend Rx */ |
169 | 162 | ||
@@ -174,8 +167,8 @@ struct iscsi_conn { | |||
174 | int tmabort_state; /* see TMABORT_INITIAL, etc.*/ | 167 | int tmabort_state; /* see TMABORT_INITIAL, etc.*/ |
175 | 168 | ||
176 | /* negotiated params */ | 169 | /* negotiated params */ |
177 | int max_recv_dlength; /* initiator_max_recv_dsl*/ | 170 | unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ |
178 | int max_xmit_dlength; /* target_max_recv_dsl */ | 171 | unsigned max_xmit_dlength; /* target_max_recv_dsl */ |
179 | int hdrdgst_en; | 172 | int hdrdgst_en; |
180 | int datadgst_en; | 173 | int datadgst_en; |
181 | int ifmarker_en; | 174 | int ifmarker_en; |
@@ -183,6 +176,12 @@ struct iscsi_conn { | |||
183 | /* values userspace uses to id a conn */ | 176 | /* values userspace uses to id a conn */ |
184 | int persistent_port; | 177 | int persistent_port; |
185 | char *persistent_address; | 178 | char *persistent_address; |
179 | /* remote portal currently connected to */ | ||
180 | int portal_port; | ||
181 | char portal_address[ISCSI_ADDRESS_BUF_LEN]; | ||
182 | /* local address */ | ||
183 | int local_port; | ||
184 | char local_address[ISCSI_ADDRESS_BUF_LEN]; | ||
186 | 185 | ||
187 | /* MIB-statistics */ | 186 | /* MIB-statistics */ |
188 | uint64_t txdata_octets; | 187 | uint64_t txdata_octets; |
@@ -213,18 +212,25 @@ struct iscsi_session { | |||
213 | 212 | ||
214 | /* configuration */ | 213 | /* configuration */ |
215 | int initial_r2t_en; | 214 | int initial_r2t_en; |
216 | int max_r2t; | 215 | unsigned max_r2t; |
217 | int imm_data_en; | 216 | int imm_data_en; |
218 | int first_burst; | 217 | unsigned first_burst; |
219 | int max_burst; | 218 | unsigned max_burst; |
220 | int time2wait; | 219 | int time2wait; |
221 | int time2retain; | 220 | int time2retain; |
222 | int pdu_inorder_en; | 221 | int pdu_inorder_en; |
223 | int dataseq_inorder_en; | 222 | int dataseq_inorder_en; |
224 | int erl; | 223 | int erl; |
225 | int tpgt; | 224 | int tpgt; |
225 | char *username; | ||
226 | char *username_in; | ||
227 | char *password; | ||
228 | char *password_in; | ||
226 | char *targetname; | 229 | char *targetname; |
227 | 230 | char *initiatorname; | |
231 | /* hw address or netdev iscsi connection is bound to */ | ||
232 | char *hwaddress; | ||
233 | char *netdev; | ||
228 | /* control data */ | 234 | /* control data */ |
229 | struct iscsi_transport *tt; | 235 | struct iscsi_transport *tt; |
230 | struct Scsi_Host *host; | 236 | struct Scsi_Host *host; |
@@ -255,12 +261,22 @@ extern int iscsi_eh_host_reset(struct scsi_cmnd *sc); | |||
255 | extern int iscsi_queuecommand(struct scsi_cmnd *sc, | 261 | extern int iscsi_queuecommand(struct scsi_cmnd *sc, |
256 | void (*done)(struct scsi_cmnd *)); | 262 | void (*done)(struct scsi_cmnd *)); |
257 | 263 | ||
264 | |||
265 | /* | ||
266 | * iSCSI host helpers. | ||
267 | */ | ||
268 | extern int iscsi_host_set_param(struct Scsi_Host *shost, | ||
269 | enum iscsi_host_param param, char *buf, | ||
270 | int buflen); | ||
271 | extern int iscsi_host_get_param(struct Scsi_Host *shost, | ||
272 | enum iscsi_host_param param, char *buf); | ||
273 | |||
258 | /* | 274 | /* |
259 | * session management | 275 | * session management |
260 | */ | 276 | */ |
261 | extern struct iscsi_cls_session * | 277 | extern struct iscsi_cls_session * |
262 | iscsi_session_setup(struct iscsi_transport *, struct scsi_transport_template *, | 278 | iscsi_session_setup(struct iscsi_transport *, struct scsi_transport_template *, |
263 | int, int, uint32_t, uint32_t *); | 279 | uint16_t, uint16_t, int, int, uint32_t, uint32_t *); |
264 | extern void iscsi_session_teardown(struct iscsi_cls_session *); | 280 | extern void iscsi_session_teardown(struct iscsi_cls_session *); |
265 | extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *); | 281 | extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *); |
266 | extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); | 282 | extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); |
@@ -289,8 +305,7 @@ extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | |||
289 | /* | 305 | /* |
290 | * pdu and task processing | 306 | * pdu and task processing |
291 | */ | 307 | */ |
292 | extern int iscsi_check_assign_cmdsn(struct iscsi_session *, | 308 | extern void iscsi_update_cmdsn(struct iscsi_session *, struct iscsi_nopin *); |
293 | struct iscsi_nopin *); | ||
294 | extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *, | 309 | extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *, |
295 | struct iscsi_data *hdr); | 310 | struct iscsi_data *hdr); |
296 | extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, | 311 | extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, |