Skip to content

Commit aa1e93a

Browse files
Mike ChristieJames Bottomley
authored andcommitted
[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>
1 parent 1819dc8 commit aa1e93a

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

drivers/scsi/qla4xxx/ql4_os.c

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ static int qla4xxx_conn_get_param(struct iscsi_cls_conn *conn,
6060
enum iscsi_param param, char *buf);
6161
static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess,
6262
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);
6365
static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag);
6466
static int qla4xxx_conn_start(struct iscsi_cls_conn *conn);
6567
static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session);
@@ -99,16 +101,16 @@ static struct scsi_host_template qla4xxx_driver_template = {
99101
static struct iscsi_transport qla4xxx_iscsi_transport = {
100102
.owner = THIS_MODULE,
101103
.name = DRIVER_NAME,
102-
.param_mask = ISCSI_CONN_PORT |
103-
ISCSI_CONN_ADDRESS |
104-
ISCSI_TARGET_NAME |
105-
ISCSI_TPGT,
104+
.param_mask = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS |
105+
ISCSI_TARGET_NAME | ISCSI_TPGT,
106+
.host_param_mask = ISCSI_HOST_HWADDRESS,
106107
.sessiondata_size = sizeof(struct ddb_entry),
107108
.host_template = &qla4xxx_driver_template,
108109

109110
.tgt_dscvr = qla4xxx_tgt_dscvr,
110111
.get_conn_param = qla4xxx_conn_get_param,
111112
.get_session_param = qla4xxx_sess_get_param,
113+
.get_host_param = qla4xxx_host_get_param,
112114
.start_conn = qla4xxx_conn_start,
113115
.stop_conn = qla4xxx_conn_stop,
114116
.session_recovery_timedout = qla4xxx_recovery_timedout,
@@ -165,6 +167,35 @@ static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag)
165167
printk(KERN_ERR "iscsi: invalid stop flag %d\n", flag);
166168
}
167169

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+
168199
static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess,
169200
enum iscsi_param param, char *buf)
170201
{

0 commit comments

Comments
 (0)