Skip to content

Commit 1d9bf13

Browse files
Mike ChristieJames Bottomley
authored andcommitted
[SCSI] iscsi class: add iscsi host set param event
The iscsi class uses the set_param event to set session and connection params. This patch adds a set_host_param so we can set host level values. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent 2174a04 commit 1d9bf13

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,30 @@ iscsi_tgt_dscvr(struct iscsi_transport *transport,
967967
return err;
968968
}
969969

970+
static int
971+
iscsi_set_host_param(struct iscsi_transport *transport,
972+
struct iscsi_uevent *ev)
973+
{
974+
char *data = (char*)ev + sizeof(*ev);
975+
struct Scsi_Host *shost;
976+
int err;
977+
978+
if (!transport->set_host_param)
979+
return -ENOSYS;
980+
981+
shost = scsi_host_lookup(ev->u.set_host_param.host_no);
982+
if (IS_ERR(shost)) {
983+
printk(KERN_ERR "set_host_param could not find host no %u\n",
984+
ev->u.set_host_param.host_no);
985+
return -ENODEV;
986+
}
987+
988+
err = transport->set_host_param(shost, ev->u.set_host_param.param,
989+
data, ev->u.set_host_param.len);
990+
scsi_host_put(shost);
991+
return err;
992+
}
993+
970994
static int
971995
iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
972996
{
@@ -1058,8 +1082,11 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
10581082
case ISCSI_UEVENT_TGT_DSCVR:
10591083
err = iscsi_tgt_dscvr(transport, ev);
10601084
break;
1085+
case ISCSI_UEVENT_SET_HOST_PARAM:
1086+
err = iscsi_set_host_param(transport, ev);
1087+
break;
10611088
default:
1062-
err = -EINVAL;
1089+
err = -ENOSYS;
10631090
break;
10641091
}
10651092

include/scsi/iscsi_if.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ enum iscsi_uevent_e {
4848
ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT = UEVENT_BASE + 14,
4949

5050
ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
51+
ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
5152

5253
/* up events */
5354
ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -136,6 +137,11 @@ struct iscsi_uevent {
136137
*/
137138
uint32_t enable;
138139
} tgt_dscvr;
140+
struct msg_set_host_param {
141+
uint32_t host_no;
142+
uint32_t param; /* enum iscsi_host_param */
143+
uint32_t len;
144+
} set_host_param;
139145
} u;
140146
union {
141147
/* messages k -> u */

include/scsi/scsi_transport_iscsi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ struct iscsi_transport {
108108
enum iscsi_param param, char *buf);
109109
int (*get_host_param) (struct Scsi_Host *shost,
110110
enum iscsi_host_param param, char *buf);
111+
int (*set_host_param) (struct Scsi_Host *shost,
112+
enum iscsi_host_param param, char *buf,
113+
int buflen);
111114
int (*send_pdu) (struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
112115
char *data, uint32_t data_size);
113116
void (*get_stats) (struct iscsi_cls_conn *conn,

0 commit comments

Comments
 (0)