diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2006-04-06 22:13:36 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-04-14 15:03:41 -0400 |
commit | fd7255f51a13ea915099c7e488001dfbbeb05104 (patch) | |
tree | 964624f68f000848dae1a9f4c396502849707826 /include | |
parent | b5c7a12dc29ae0990d9e867749bdd717a3160325 (diff) |
[SCSI] iscsi: add sysfs attrs for uspace sync up
For iscsi boot when going from initramfs to the real root we
need to stop the userpsace iscsi daemon. To later restart it
iscsid needs to be able to rebuild itself and part of that
process is matching a session running the kernel with the
iscsid representation. To do this the attached patch
adds several required iscsi values. If the LLD does not provide
them becuase, login is done in userspace, then the transport
class and userspace set ths up for the LLD.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/scsi/iscsi_if.h | 64 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 24 |
2 files changed, 68 insertions, 20 deletions
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 933a91b1474e..2c3a89b64e71 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -86,7 +86,7 @@ struct iscsi_uevent { | |||
86 | uint32_t sid; | 86 | uint32_t sid; |
87 | uint32_t cid; | 87 | uint32_t cid; |
88 | uint32_t param; /* enum iscsi_param */ | 88 | uint32_t param; /* enum iscsi_param */ |
89 | uint32_t value; | 89 | uint32_t len; |
90 | } set_param; | 90 | } set_param; |
91 | struct msg_start_conn { | 91 | struct msg_start_conn { |
92 | uint32_t sid; | 92 | uint32_t sid; |
@@ -155,22 +155,54 @@ enum iscsi_err { | |||
155 | * iSCSI Parameters (RFC3720) | 155 | * iSCSI Parameters (RFC3720) |
156 | */ | 156 | */ |
157 | enum iscsi_param { | 157 | enum iscsi_param { |
158 | ISCSI_PARAM_MAX_RECV_DLENGTH = 0, | 158 | /* passed in using netlink set param */ |
159 | ISCSI_PARAM_MAX_XMIT_DLENGTH = 1, | 159 | ISCSI_PARAM_MAX_RECV_DLENGTH, |
160 | ISCSI_PARAM_HDRDGST_EN = 2, | 160 | ISCSI_PARAM_MAX_XMIT_DLENGTH, |
161 | ISCSI_PARAM_DATADGST_EN = 3, | 161 | ISCSI_PARAM_HDRDGST_EN, |
162 | ISCSI_PARAM_INITIAL_R2T_EN = 4, | 162 | ISCSI_PARAM_DATADGST_EN, |
163 | ISCSI_PARAM_MAX_R2T = 5, | 163 | ISCSI_PARAM_INITIAL_R2T_EN, |
164 | ISCSI_PARAM_IMM_DATA_EN = 6, | 164 | ISCSI_PARAM_MAX_R2T, |
165 | ISCSI_PARAM_FIRST_BURST = 7, | 165 | ISCSI_PARAM_IMM_DATA_EN, |
166 | ISCSI_PARAM_MAX_BURST = 8, | 166 | ISCSI_PARAM_FIRST_BURST, |
167 | ISCSI_PARAM_PDU_INORDER_EN = 9, | 167 | ISCSI_PARAM_MAX_BURST, |
168 | ISCSI_PARAM_DATASEQ_INORDER_EN = 10, | 168 | ISCSI_PARAM_PDU_INORDER_EN, |
169 | ISCSI_PARAM_ERL = 11, | 169 | ISCSI_PARAM_DATASEQ_INORDER_EN, |
170 | ISCSI_PARAM_IFMARKER_EN = 12, | 170 | ISCSI_PARAM_ERL, |
171 | ISCSI_PARAM_OFMARKER_EN = 13, | 171 | ISCSI_PARAM_IFMARKER_EN, |
172 | ISCSI_PARAM_OFMARKER_EN, | ||
173 | ISCSI_PARAM_TARGET_NAME, | ||
174 | ISCSI_PARAM_TPGT, | ||
175 | ISCSI_PARAM_PERSISTENT_ADDRESS, | ||
176 | ISCSI_PARAM_PERSISTENT_PORT, | ||
177 | |||
178 | /* pased in through bind conn using transport_fd */ | ||
179 | ISCSI_PARAM_CONN_PORT, | ||
180 | ISCSI_PARAM_CONN_ADDRESS, | ||
181 | |||
182 | /* must always be last */ | ||
183 | ISCSI_PARAM_MAX, | ||
172 | }; | 184 | }; |
173 | #define ISCSI_PARAM_MAX 14 | 185 | |
186 | #define ISCSI_MAX_RECV_DLENGTH (1 << ISCSI_PARAM_MAX_RECV_DLENGTH) | ||
187 | #define ISCSI_MAX_XMIT_DLENGTH (1 << ISCSI_PARAM_MAX_XMIT_DLENGTH) | ||
188 | #define ISCSI_HDRDGST_EN (1 << ISCSI_PARAM_HDRDGST_EN) | ||
189 | #define ISCSI_DATADGST_EN (1 << ISCSI_PARAM_DATADGST_EN) | ||
190 | #define ISCSI_INITIAL_R2T_EN (1 << ISCSI_PARAM_INITIAL_R2T_EN) | ||
191 | #define ISCSI_MAX_R2T (1 << ISCSI_PARAM_MAX_R2T) | ||
192 | #define ISCSI_IMM_DATA_EN (1 << ISCSI_PARAM_IMM_DATA_EN) | ||
193 | #define ISCSI_FIRST_BURST (1 << ISCSI_PARAM_FIRST_BURST) | ||
194 | #define ISCSI_MAX_BURST (1 << ISCSI_PARAM_MAX_BURST) | ||
195 | #define ISCSI_PDU_INORDER_EN (1 << ISCSI_PARAM_PDU_INORDER_EN) | ||
196 | #define ISCSI_DATASEQ_INORDER_EN (1 << ISCSI_PARAM_DATASEQ_INORDER_EN) | ||
197 | #define ISCSI_ERL (1 << ISCSI_PARAM_ERL) | ||
198 | #define ISCSI_IFMARKER_EN (1 << ISCSI_PARAM_IFMARKER_EN) | ||
199 | #define ISCSI_OFMARKER_EN (1 << ISCSI_PARAM_OFMARKER_EN) | ||
200 | #define ISCSI_TARGET_NAME (1 << ISCSI_PARAM_TARGET_NAME) | ||
201 | #define ISCSI_TPGT (1 << ISCSI_PARAM_TPGT) | ||
202 | #define ISCSI_PERSISTENT_ADDRESS (1 << ISCSI_PARAM_PERSISTENT_ADDRESS) | ||
203 | #define ISCSI_PERSISTENT_PORT (1 << ISCSI_PARAM_PERSISTENT_PORT) | ||
204 | #define ISCSI_CONN_PORT (1 << ISCSI_PARAM_CONN_PORT) | ||
205 | #define ISCSI_CONN_ADDRESS (1 << ISCSI_PARAM_CONN_ADDRESS) | ||
174 | 206 | ||
175 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) | 207 | #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) |
176 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) | 208 | #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 631463cd4892..4b200645c84b 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -53,11 +53,11 @@ struct iscsi_transport { | |||
53 | struct module *owner; | 53 | struct module *owner; |
54 | char *name; | 54 | char *name; |
55 | unsigned int caps; | 55 | unsigned int caps; |
56 | /* LLD sets this to indicate what values it can export to sysfs */ | ||
57 | unsigned int param_mask; | ||
56 | struct scsi_host_template *host_template; | 58 | struct scsi_host_template *host_template; |
57 | /* LLD session/scsi_host data size */ | 59 | /* LLD session/scsi_host data size */ |
58 | int hostdata_size; | 60 | int hostdata_size; |
59 | /* LLD iscsi_host data size */ | ||
60 | int ihostdata_size; | ||
61 | /* LLD connection data size */ | 61 | /* LLD connection data size */ |
62 | int conndata_size; | 62 | int conndata_size; |
63 | /* LLD session data size */ | 63 | /* LLD session data size */ |
@@ -79,10 +79,13 @@ struct iscsi_transport { | |||
79 | int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, | 79 | int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, |
80 | uint32_t value); | 80 | uint32_t value); |
81 | int (*get_conn_param) (struct iscsi_cls_conn *conn, | 81 | int (*get_conn_param) (struct iscsi_cls_conn *conn, |
82 | enum iscsi_param param, | 82 | enum iscsi_param param, uint32_t *value); |
83 | uint32_t *value); | ||
84 | int (*get_session_param) (struct iscsi_cls_session *session, | 83 | int (*get_session_param) (struct iscsi_cls_session *session, |
85 | enum iscsi_param param, uint32_t *value); | 84 | enum iscsi_param param, uint32_t *value); |
85 | int (*get_conn_str_param) (struct iscsi_cls_conn *conn, | ||
86 | enum iscsi_param param, char *buf); | ||
87 | int (*get_session_str_param) (struct iscsi_cls_session *session, | ||
88 | enum iscsi_param param, char *buf); | ||
86 | int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | 89 | int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, |
87 | char *data, uint32_t data_size); | 90 | char *data, uint32_t data_size); |
88 | void (*get_stats) (struct iscsi_cls_conn *conn, | 91 | void (*get_stats) (struct iscsi_cls_conn *conn, |
@@ -107,6 +110,14 @@ struct iscsi_cls_conn { | |||
107 | void *dd_data; /* LLD private data */ | 110 | void *dd_data; /* LLD private data */ |
108 | struct iscsi_transport *transport; | 111 | struct iscsi_transport *transport; |
109 | uint32_t cid; /* connection id */ | 112 | uint32_t cid; /* connection id */ |
113 | |||
114 | /* portal/group values we got during discovery */ | ||
115 | char *persistent_address; | ||
116 | int persistent_port; | ||
117 | /* portal/group values we are currently using */ | ||
118 | char *address; | ||
119 | int port; | ||
120 | |||
110 | int active; /* must be accessed with the connlock */ | 121 | int active; /* must be accessed with the connlock */ |
111 | struct device dev; /* sysfs transport/container device */ | 122 | struct device dev; /* sysfs transport/container device */ |
112 | struct mempool_zone *z_error; | 123 | struct mempool_zone *z_error; |
@@ -120,6 +131,11 @@ struct iscsi_cls_conn { | |||
120 | struct iscsi_cls_session { | 131 | struct iscsi_cls_session { |
121 | struct list_head sess_list; /* item in session_list */ | 132 | struct list_head sess_list; /* item in session_list */ |
122 | struct iscsi_transport *transport; | 133 | struct iscsi_transport *transport; |
134 | |||
135 | /* iSCSI values used as unique id by userspace. */ | ||
136 | char *targetname; | ||
137 | int tpgt; | ||
138 | |||
123 | int sid; /* session id */ | 139 | int sid; /* session id */ |
124 | void *dd_data; /* LLD private data */ | 140 | void *dd_data; /* LLD private data */ |
125 | struct device dev; /* sysfs transport/container device */ | 141 | struct device dev; /* sysfs transport/container device */ |