diff options
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index e09fc4241970..01308e7ef2ae 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -60,6 +60,8 @@ static int qla4xxx_conn_get_param(struct iscsi_cls_conn *conn, | |||
60 | enum iscsi_param param, char *buf); | 60 | enum iscsi_param param, char *buf); |
61 | static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess, | 61 | static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess, |
62 | enum iscsi_param param, char *buf); | 62 | enum iscsi_param param, char *buf); |
63 | static int qla4xxx_host_get_param(struct Scsi_Host *shost, | ||
64 | enum iscsi_host_param param, char *buf); | ||
63 | static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag); | 65 | static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag); |
64 | static int qla4xxx_conn_start(struct iscsi_cls_conn *conn); | 66 | static int qla4xxx_conn_start(struct iscsi_cls_conn *conn); |
65 | static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session); | 67 | static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session); |
@@ -99,16 +101,16 @@ static struct scsi_host_template qla4xxx_driver_template = { | |||
99 | static struct iscsi_transport qla4xxx_iscsi_transport = { | 101 | static struct iscsi_transport qla4xxx_iscsi_transport = { |
100 | .owner = THIS_MODULE, | 102 | .owner = THIS_MODULE, |
101 | .name = DRIVER_NAME, | 103 | .name = DRIVER_NAME, |
102 | .param_mask = ISCSI_CONN_PORT | | 104 | .param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS | |
103 | ISCSI_CONN_ADDRESS | | 105 | ISCSI_TARGET_NAME | ISCSI_TPGT, |
104 | ISCSI_TARGET_NAME | | 106 | .host_param_mask = ISCSI_HOST_HWADDRESS, |
105 | ISCSI_TPGT, | ||
106 | .sessiondata_size = sizeof(struct ddb_entry), | 107 | .sessiondata_size = sizeof(struct ddb_entry), |
107 | .host_template = &qla4xxx_driver_template, | 108 | .host_template = &qla4xxx_driver_template, |
108 | 109 | ||
109 | .tgt_dscvr = qla4xxx_tgt_dscvr, | 110 | .tgt_dscvr = qla4xxx_tgt_dscvr, |
110 | .get_conn_param = qla4xxx_conn_get_param, | 111 | .get_conn_param = qla4xxx_conn_get_param, |
111 | .get_session_param = qla4xxx_sess_get_param, | 112 | .get_session_param = qla4xxx_sess_get_param, |
113 | .get_host_param = qla4xxx_host_get_param, | ||
112 | .start_conn = qla4xxx_conn_start, | 114 | .start_conn = qla4xxx_conn_start, |
113 | .stop_conn = qla4xxx_conn_stop, | 115 | .stop_conn = qla4xxx_conn_stop, |
114 | .session_recovery_timedout = qla4xxx_recovery_timedout, | 116 | .session_recovery_timedout = qla4xxx_recovery_timedout, |
@@ -165,6 +167,35 @@ static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag) | |||
165 | printk(KERN_ERR "iscsi: invalid stop flag %d\n", flag); | 167 | printk(KERN_ERR "iscsi: invalid stop flag %d\n", flag); |
166 | } | 168 | } |
167 | 169 | ||
170 | static ssize_t format_addr(char *buf, const unsigned char *addr, int len) | ||
171 | { | ||
172 | int i; | ||
173 | char *cp = buf; | ||
174 | |||
175 | for (i = 0; i < len; i++) | ||
176 | cp += sprintf(cp, "%02x%c", addr[i], | ||
177 | i == (len - 1) ? '\n' : ':'); | ||
178 | return cp - buf; | ||
179 | } | ||
180 | |||
181 | |||
182 | static int qla4xxx_host_get_param(struct Scsi_Host *shost, | ||
183 | enum iscsi_host_param param, char *buf) | ||
184 | { | ||
185 | struct scsi_qla_host *ha = to_qla_host(shost); | ||
186 | int len; | ||
187 | |||
188 | switch (param) { | ||
189 | case ISCSI_HOST_PARAM_HWADDRESS: | ||
190 | len = format_addr(buf, ha->my_mac, MAC_ADDR_LEN); | ||
191 | break; | ||
192 | default: | ||
193 | return -ENOSYS; | ||
194 | } | ||
195 | |||
196 | return len; | ||
197 | } | ||
198 | |||
168 | static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess, | 199 | static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess, |
169 | enum iscsi_param param, char *buf) | 200 | enum iscsi_param param, char *buf) |
170 | { | 201 | { |