aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_os.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2007-05-30 13:57:09 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-01 12:15:36 -0400
commitaa1e93a2fe0392588220d491454e7752d0fdb251 (patch)
tree080514986b008c283a6f5d9f7eec8f2292205035 /drivers/scsi/qla4xxx/ql4_os.c
parent1819dc8143eff2a5850af274bcf8bcbc3e73ec76 (diff)
[SCSI] qla4xxx: export mac as hw address
Export mac as hw address. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Cc: David C Somayajulu <david.somayajulu@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_os.c')
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c39
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);
61static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess, 61static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess,
62 enum iscsi_param param, char *buf); 62 enum iscsi_param param, char *buf);
63static int qla4xxx_host_get_param(struct Scsi_Host *shost,
64 enum iscsi_host_param param, char *buf);
63static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag); 65static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag);
64static int qla4xxx_conn_start(struct iscsi_cls_conn *conn); 66static int qla4xxx_conn_start(struct iscsi_cls_conn *conn);
65static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session); 67static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session);
@@ -99,16 +101,16 @@ static struct scsi_host_template qla4xxx_driver_template = {
99static struct iscsi_transport qla4xxx_iscsi_transport = { 101static 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
170static 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
182static 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
168static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess, 199static 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{