diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2013-05-28 02:18:08 -0500 |
---|---|---|
committer | Mike Christie <michaelc@cs.wisc.edu> | 2013-05-28 02:18:08 -0500 |
commit | d571cdfc0b3c539310f43dc11d54d9308299efdc (patch) | |
tree | dd05f1eae52f0815daa41c28219e6555dfc28754 /usr/initiator_common.c | |
parent | a7afdf46c3193eb102cc6ec2a3b61e8d36794437 (diff) | |
download | open-iscsi-d571cdfc0b3c539310f43dc11d54d9308299efdc.tar.gz |
ISCSID: Added socket communication hooks for uip
From Eddie Wai:
This patch adds the communication path between iscsid->iscsiuio.
It utilizes the set_net_config func ptr in the iscsi_transport_template
to initiate the callbacks.
Two new files are introduced: uip_mgmt_ipc.h and uip_mgmt_ipc.c
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Diffstat (limited to 'usr/initiator_common.c')
-rw-r--r-- | usr/initiator_common.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/usr/initiator_common.c b/usr/initiator_common.c index ef6820c..eb72795 100644 --- a/usr/initiator_common.c +++ b/usr/initiator_common.c @@ -562,6 +562,36 @@ TODO handle this return 0; } +int iscsi_set_net_config(struct iscsi_transport *t, iscsi_session_t *session, + struct iface_rec *iface) +{ + if (t->template->set_net_config) { + /* uip needs the netdev name */ + struct host_info hinfo; + int hostno, rc; + + /* this assumes that the netdev or hw address is going to be + set */ + hostno = iscsi_sysfs_get_host_no_from_hwinfo(iface, &rc); + if (rc) { + log_debug(4, "Couldn't get host no.\n"); + return rc; + } + + /* uip needs the netdev name */ + if (!strlen(iface->netdev)) { + memset(&hinfo, 0, sizeof(hinfo)); + hinfo.host_no = hostno; + iscsi_sysfs_get_hostinfo_by_host_no(&hinfo); + strcpy(iface->netdev, hinfo.iface.netdev); + } + + return t->template->set_net_config(t, iface, session); + } + + return 0; +} + int iscsi_host_set_net_params(struct iface_rec *iface, struct iscsi_session *session) { @@ -600,6 +630,10 @@ int iscsi_host_set_net_params(struct iface_rec *iface, log_warning("Could not brining up netdev %s. Try running " "'ifup %s' first if login fails.", netdev, netdev); + rc = iscsi_set_net_config(t, session, iface); + if (rc != 0) + return rc; + rc = host_set_param(t, session->hostno, ISCSI_HOST_PARAM_IPADDRESS, iface->ipaddress, ISCSI_STRING); |