aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_transport_iscsi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/scsi_transport_iscsi.h')
-rw-r--r--include/scsi/scsi_transport_iscsi.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index b684426a5900..39e833260bd0 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -34,6 +34,7 @@ struct iscsi_cls_conn;
34struct iscsi_conn; 34struct iscsi_conn;
35struct iscsi_cmd_task; 35struct iscsi_cmd_task;
36struct iscsi_mgmt_task; 36struct iscsi_mgmt_task;
37struct sockaddr;
37 38
38/** 39/**
39 * struct iscsi_transport - iSCSI Transport template 40 * struct iscsi_transport - iSCSI Transport template
@@ -46,13 +47,16 @@ struct iscsi_mgmt_task;
46 * @bind_conn: associate this connection with existing iSCSI session 47 * @bind_conn: associate this connection with existing iSCSI session
47 * and specified transport descriptor 48 * and specified transport descriptor
48 * @destroy_conn: destroy inactive iSCSI connection 49 * @destroy_conn: destroy inactive iSCSI connection
49 * @set_param: set iSCSI Data-Path operational parameter 50 * @set_param: set iSCSI parameter. Return 0 on success, -ENODATA
51 * when param is not supported, and a -Exx value on other
52 * error.
53 * @get_param get iSCSI parameter. Must return number of bytes
54 * copied to buffer on success, -ENODATA when param
55 * is not supported, and a -Exx value on other error
50 * @start_conn: set connection to be operational 56 * @start_conn: set connection to be operational
51 * @stop_conn: suspend/recover/terminate connection 57 * @stop_conn: suspend/recover/terminate connection
52 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text. 58 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.
53 * @session_recovery_timedout: notify LLD a block during recovery timed out 59 * @session_recovery_timedout: notify LLD a block during recovery timed out
54 * @suspend_conn_recv: susepend the recv side of the connection
55 * @termincate_conn: destroy socket connection. Called with mutex lock.
56 * @init_cmd_task: Initialize a iscsi_cmd_task and any internal structs. 60 * @init_cmd_task: Initialize a iscsi_cmd_task and any internal structs.
57 * Called from queuecommand with session lock held. 61 * Called from queuecommand with session lock held.
58 * @init_mgmt_task: Initialize a iscsi_mgmt_task and any internal structs. 62 * @init_mgmt_task: Initialize a iscsi_mgmt_task and any internal structs.
@@ -97,21 +101,15 @@ struct iscsi_transport {
97 void (*stop_conn) (struct iscsi_cls_conn *conn, int flag); 101 void (*stop_conn) (struct iscsi_cls_conn *conn, int flag);
98 void (*destroy_conn) (struct iscsi_cls_conn *conn); 102 void (*destroy_conn) (struct iscsi_cls_conn *conn);
99 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, 103 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param,
100 uint32_t value); 104 char *buf, int buflen);
101 int (*get_conn_param) (struct iscsi_cls_conn *conn, 105 int (*get_conn_param) (struct iscsi_cls_conn *conn,
102 enum iscsi_param param, uint32_t *value); 106 enum iscsi_param param, char *buf);
103 int (*get_session_param) (struct iscsi_cls_session *session, 107 int (*get_session_param) (struct iscsi_cls_session *session,
104 enum iscsi_param param, uint32_t *value); 108 enum iscsi_param param, char *buf);
105 int (*get_conn_str_param) (struct iscsi_cls_conn *conn,
106 enum iscsi_param param, char *buf);
107 int (*get_session_str_param) (struct iscsi_cls_session *session,
108 enum iscsi_param param, char *buf);
109 int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 109 int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
110 char *data, uint32_t data_size); 110 char *data, uint32_t data_size);
111 void (*get_stats) (struct iscsi_cls_conn *conn, 111 void (*get_stats) (struct iscsi_cls_conn *conn,
112 struct iscsi_stats *stats); 112 struct iscsi_stats *stats);
113 void (*suspend_conn_recv) (struct iscsi_conn *conn);
114 void (*terminate_conn) (struct iscsi_conn *conn);
115 void (*init_cmd_task) (struct iscsi_cmd_task *ctask); 113 void (*init_cmd_task) (struct iscsi_cmd_task *ctask);
116 void (*init_mgmt_task) (struct iscsi_conn *conn, 114 void (*init_mgmt_task) (struct iscsi_conn *conn,
117 struct iscsi_mgmt_task *mtask, 115 struct iscsi_mgmt_task *mtask,
@@ -127,6 +125,8 @@ struct iscsi_transport {
127 uint64_t *ep_handle); 125 uint64_t *ep_handle);
128 int (*ep_poll) (uint64_t ep_handle, int timeout_ms); 126 int (*ep_poll) (uint64_t ep_handle, int timeout_ms);
129 void (*ep_disconnect) (uint64_t ep_handle); 127 void (*ep_disconnect) (uint64_t ep_handle);
128 int (*tgt_dscvr) (enum iscsi_tgt_dscvr type, uint32_t host_no,
129 uint32_t enable, struct sockaddr *dst_addr);
130}; 130};
131 131
132/* 132/*
@@ -155,13 +155,6 @@ struct iscsi_cls_conn {
155 struct iscsi_transport *transport; 155 struct iscsi_transport *transport;
156 uint32_t cid; /* connection id */ 156 uint32_t cid; /* connection id */
157 157
158 /* portal/group values we got during discovery */
159 char *persistent_address;
160 int persistent_port;
161 /* portal/group values we are currently using */
162 char *address;
163 int port;
164
165 int active; /* must be accessed with the connlock */ 158 int active; /* must be accessed with the connlock */
166 struct device dev; /* sysfs transport/container device */ 159 struct device dev; /* sysfs transport/container device */
167 struct mempool_zone *z_error; 160 struct mempool_zone *z_error;
@@ -185,16 +178,11 @@ struct iscsi_cls_session {
185 struct list_head host_list; 178 struct list_head host_list;
186 struct iscsi_transport *transport; 179 struct iscsi_transport *transport;
187 180
188 /* iSCSI values used as unique id by userspace. */
189 char *targetname;
190 int tpgt;
191
192 /* recovery fields */ 181 /* recovery fields */
193 int recovery_tmo; 182 int recovery_tmo;
194 struct work_struct recovery_work; 183 struct work_struct recovery_work;
195 184
196 int target_id; 185 int target_id;
197 int channel;
198 186
199 int sid; /* session id */ 187 int sid; /* session id */
200 void *dd_data; /* LLD private data */ 188 void *dd_data; /* LLD private data */
@@ -207,8 +195,10 @@ struct iscsi_cls_session {
207#define iscsi_session_to_shost(_session) \ 195#define iscsi_session_to_shost(_session) \
208 dev_to_shost(_session->dev.parent) 196 dev_to_shost(_session->dev.parent)
209 197
198#define starget_to_session(_stgt) \
199 iscsi_dev_to_session(_stgt->dev.parent)
200
210struct iscsi_host { 201struct iscsi_host {
211 int next_target_id;
212 struct list_head sessions; 202 struct list_head sessions;
213 struct mutex mutex; 203 struct mutex mutex;
214}; 204};
@@ -216,8 +206,17 @@ struct iscsi_host {
216/* 206/*
217 * session and connection functions that can be used by HW iSCSI LLDs 207 * session and connection functions that can be used by HW iSCSI LLDs
218 */ 208 */
209extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost,
210 struct iscsi_transport *transport);
211extern int iscsi_add_session(struct iscsi_cls_session *session,
212 unsigned int target_id);
213extern int iscsi_if_create_session_done(struct iscsi_cls_conn *conn);
214extern int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn);
219extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, 215extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
220 struct iscsi_transport *t, int channel); 216 struct iscsi_transport *t,
217 unsigned int target_id);
218extern void iscsi_remove_session(struct iscsi_cls_session *session);
219extern void iscsi_free_session(struct iscsi_cls_session *session);
221extern int iscsi_destroy_session(struct iscsi_cls_session *session); 220extern int iscsi_destroy_session(struct iscsi_cls_session *session);
222extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess, 221extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
223 uint32_t cid); 222 uint32_t cid);
@@ -225,4 +224,5 @@ extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);
225extern void iscsi_unblock_session(struct iscsi_cls_session *session); 224extern void iscsi_unblock_session(struct iscsi_cls_session *session);
226extern void iscsi_block_session(struct iscsi_cls_session *session); 225extern void iscsi_block_session(struct iscsi_cls_session *session);
227 226
227
228#endif 228#endif