diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2006-06-28 13:00:23 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-29 11:07:14 -0400 |
commit | a54a52caad4bd6166cb7fa64e4e93031fa2fda5d (patch) | |
tree | 728672fae35fd344619129e78213043dabacf099 /include/scsi | |
parent | 01cb225dad8da2e717356fab03240e2f4a8d01bf (diff) |
[SCSI] iscsi: fixup set/get param functions
Reduce duplication in the software iscsi_transport modules by
adding a libiscsi function to handle the common grunt work.
This also has the drivers return specifc -EXXX values for different
errors so userspace can finally handle them in a sane way.
Also just pass the sysfs buffers to the drivers so HW iscsi can
get/set its string values, like targetname, and initiatorname.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/libiscsi.h | 15 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 29 |
2 files changed, 23 insertions, 21 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index cbf7e58bd6f9..ba2760802ded 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -157,6 +157,11 @@ struct iscsi_conn { | |||
157 | int max_xmit_dlength; /* target_max_recv_dsl */ | 157 | int max_xmit_dlength; /* target_max_recv_dsl */ |
158 | int hdrdgst_en; | 158 | int hdrdgst_en; |
159 | int datadgst_en; | 159 | int datadgst_en; |
160 | int ifmarker_en; | ||
161 | int ofmarker_en; | ||
162 | /* values userspace uses to id a conn */ | ||
163 | int persistent_port; | ||
164 | char *persistent_address; | ||
160 | 165 | ||
161 | /* MIB-statistics */ | 166 | /* MIB-statistics */ |
162 | uint64_t txdata_octets; | 167 | uint64_t txdata_octets; |
@@ -196,8 +201,8 @@ struct iscsi_session { | |||
196 | int pdu_inorder_en; | 201 | int pdu_inorder_en; |
197 | int dataseq_inorder_en; | 202 | int dataseq_inorder_en; |
198 | int erl; | 203 | int erl; |
199 | int ifmarker_en; | 204 | int tpgt; |
200 | int ofmarker_en; | 205 | char *targetname; |
201 | 206 | ||
202 | /* control data */ | 207 | /* control data */ |
203 | struct iscsi_transport *tt; | 208 | struct iscsi_transport *tt; |
@@ -240,6 +245,10 @@ iscsi_session_setup(struct iscsi_transport *, struct scsi_transport_template *, | |||
240 | extern void iscsi_session_teardown(struct iscsi_cls_session *); | 245 | extern void iscsi_session_teardown(struct iscsi_cls_session *); |
241 | extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *); | 246 | extern struct iscsi_session *class_to_transport_session(struct iscsi_cls_session *); |
242 | extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); | 247 | extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); |
248 | extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn, | ||
249 | enum iscsi_param param, char *buf, int buflen); | ||
250 | extern int iscsi_session_get_param(struct iscsi_cls_session *cls_session, | ||
251 | enum iscsi_param param, char *buf); | ||
243 | 252 | ||
244 | #define session_to_cls(_sess) \ | 253 | #define session_to_cls(_sess) \ |
245 | hostdata_session(_sess->host->hostdata) | 254 | hostdata_session(_sess->host->hostdata) |
@@ -255,6 +264,8 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int); | |||
255 | extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, | 264 | extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, |
256 | int); | 265 | int); |
257 | extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); | 266 | extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); |
267 | extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | ||
268 | enum iscsi_param param, char *buf); | ||
258 | 269 | ||
259 | /* | 270 | /* |
260 | * pdu and task processing | 271 | * pdu and task processing |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index b95151aec602..05397058a9b8 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -34,6 +34,7 @@ struct iscsi_cls_conn; | |||
34 | struct iscsi_conn; | 34 | struct iscsi_conn; |
35 | struct iscsi_cmd_task; | 35 | struct iscsi_cmd_task; |
36 | struct iscsi_mgmt_task; | 36 | struct iscsi_mgmt_task; |
37 | struct sockaddr; | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | * struct iscsi_transport - iSCSI Transport template | 40 | * struct iscsi_transport - iSCSI Transport template |
@@ -46,7 +47,12 @@ 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. |
@@ -97,15 +103,11 @@ struct iscsi_transport { | |||
97 | void (*stop_conn) (struct iscsi_cls_conn *conn, int flag); | 103 | void (*stop_conn) (struct iscsi_cls_conn *conn, int flag); |
98 | void (*destroy_conn) (struct iscsi_cls_conn *conn); | 104 | void (*destroy_conn) (struct iscsi_cls_conn *conn); |
99 | int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, | 105 | int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, |
100 | uint32_t value); | 106 | char *buf, int buflen); |
101 | int (*get_conn_param) (struct iscsi_cls_conn *conn, | 107 | int (*get_conn_param) (struct iscsi_cls_conn *conn, |
102 | enum iscsi_param param, uint32_t *value); | 108 | enum iscsi_param param, char *buf); |
103 | int (*get_session_param) (struct iscsi_cls_session *session, | 109 | int (*get_session_param) (struct iscsi_cls_session *session, |
104 | enum iscsi_param param, uint32_t *value); | 110 | 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, | 111 | int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, |
110 | char *data, uint32_t data_size); | 112 | char *data, uint32_t data_size); |
111 | void (*get_stats) (struct iscsi_cls_conn *conn, | 113 | void (*get_stats) (struct iscsi_cls_conn *conn, |
@@ -157,13 +159,6 @@ struct iscsi_cls_conn { | |||
157 | struct iscsi_transport *transport; | 159 | struct iscsi_transport *transport; |
158 | uint32_t cid; /* connection id */ | 160 | uint32_t cid; /* connection id */ |
159 | 161 | ||
160 | /* portal/group values we got during discovery */ | ||
161 | char *persistent_address; | ||
162 | int persistent_port; | ||
163 | /* portal/group values we are currently using */ | ||
164 | char *address; | ||
165 | int port; | ||
166 | |||
167 | int active; /* must be accessed with the connlock */ | 162 | int active; /* must be accessed with the connlock */ |
168 | struct device dev; /* sysfs transport/container device */ | 163 | struct device dev; /* sysfs transport/container device */ |
169 | struct mempool_zone *z_error; | 164 | struct mempool_zone *z_error; |
@@ -187,10 +182,6 @@ struct iscsi_cls_session { | |||
187 | struct list_head host_list; | 182 | struct list_head host_list; |
188 | struct iscsi_transport *transport; | 183 | struct iscsi_transport *transport; |
189 | 184 | ||
190 | /* iSCSI values used as unique id by userspace. */ | ||
191 | char *targetname; | ||
192 | int tpgt; | ||
193 | |||
194 | /* recovery fields */ | 185 | /* recovery fields */ |
195 | int recovery_tmo; | 186 | int recovery_tmo; |
196 | struct work_struct recovery_work; | 187 | struct work_struct recovery_work; |