>From a643bfb01c4edbb2e686dd2500a564c93d402bba Mon Sep 17 00:00:00 2001 From: Rakesh Ranjan Date: Mon, 16 Nov 2009 19:07:40 +0530 Subject: [PATCH 1/2] Required changes for libiscsi to support dhcp based provisioning for offload capable cards. These changes adds ISCSI_UEVENT_REQ_IPCONF message to invoke dhcp handler. Signed-off-by: Rakesh Ranjan --- drivers/scsi/scsi_transport_iscsi.c | 25 +++++++++++++++++++++++++ include/scsi/iscsi_if.h | 4 ++++ include/scsi/libiscsi.h | 20 ++++++++++++++++++++ include/scsi/scsi_transport_iscsi.h | 1 + 4 files changed, 50 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index ad897df..4897a3f 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1508,6 +1508,28 @@ iscsi_set_path(struct iscsi_transport *transport, struct iscsi_uevent *ev) } static int +iscsi_req_ipconf(struct iscsi_transport *transport, struct iscsi_uevent *ev) +{ + struct Scsi_Host *shost; + int err; + + if (!transport->req_ipconf) + return -ENOSYS; + + shost = scsi_host_lookup(ev->u.req_ipconf.host_no); + if (!shost) { + printk(KERN_ERR "ipconf req could not find host no %u\n", + ev->u.req_ipconf.host_no); + return -ENODEV; + } + + err = transport->req_ipconf(shost); + + scsi_host_put(shost); + return err; +} + +static int iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) { int err = 0; @@ -1627,6 +1649,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) case ISCSI_UEVENT_PATH_UPDATE: err = iscsi_set_path(transport, ev); break; + case ISCSI_UEVENT_REQ_IPCONF: + err = iscsi_req_ipconf(transport, ev); + break; default: err = -ENOSYS; break; diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index d67dda2..135f229 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h @@ -59,6 +59,7 @@ enum iscsi_uevent_e { ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19, ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20, + ISCSI_UEVENT_REQ_IPCONF = UEVENT_BASE + 21, /* up events */ ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, @@ -172,6 +173,9 @@ struct iscsi_uevent { struct msg_set_path { uint32_t host_no; } set_path; + struct mag_req_ipconf { + uint32_t host_no; + } req_ipconf; } u; union { /* messages k -> u */ diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index a72edd4..a9af95e 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -330,6 +330,18 @@ struct iscsi_host { char workq_name[20]; }; +/* libiscsi ipconfig */ +struct dhcp_info { + __be32 ltime; + __be32 serverid; + __be32 ipaddr; + __be32 netmask; + __be32 dnsaddr; + __be32 gipaddr; + __u8 *mac_addr; +}; + + /* * scsi host template */ @@ -427,6 +439,14 @@ extern void iscsi_pool_free(struct iscsi_pool *); extern int iscsi_pool_init(struct iscsi_pool *, int, void ***, int); /* + * libiscsi ipconfig helpers + */ +extern int libiscsi_do_ipconf(struct net_device *ndev, + struct dhcp_info *dinfo); +extern int libiscsi_ipconfig_recv(struct net_device *ndev, + struct sk_buff *skb); + +/* * inline functions to deal with padding. */ static inline unsigned int diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 349c7f3..3e5fd96 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -134,6 +134,7 @@ struct iscsi_transport { int (*tgt_dscvr) (struct Scsi_Host *shost, enum iscsi_tgt_dscvr type, uint32_t enable, struct sockaddr *dst_addr); int (*set_path) (struct Scsi_Host *shost, struct iscsi_path *params); + int (*req_ipconf) (struct Scsi_Host *shost); }; /* -- 1.6.0.6