2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/include/iscsi_err.h open-iscsi-2.0-872-rc4-bnx2i.build/include/iscsi_err.h
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/include/iscsi_err.h 2011-08-14 16:49:44.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/include/iscsi_err.h 2011-08-14 16:56:54.000000000 -0500
|
2011-02-01 04:58:53 +00:00
|
|
|
@@ -58,6 +58,8 @@ enum {
|
|
|
|
ISCSI_ERR_ISNS_QUERY = 25,
|
|
|
|
/* iSNS registration/deregistration failed */
|
|
|
|
ISCSI_ERR_ISNS_REG_FAILED = 26,
|
|
|
|
+ /* Operation failed, but retrying layer may succeed */
|
|
|
|
+ ISCSI_ERR_AGAIN = 27,
|
|
|
|
|
|
|
|
/* Always last. Indicates end of error code space */
|
|
|
|
ISCSI_MAX_ERR_VAL,
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/Makefile open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/Makefile
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/libiscsi/Makefile 2011-08-14 16:55:23.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/libiscsi/Makefile 2011-08-14 16:56:54.000000000 -0500
|
2011-02-01 04:58:53 +00:00
|
|
|
@@ -13,7 +13,7 @@ TESTS += tests/test_set_auth tests/test_
|
|
|
|
|
|
|
|
COMMON_SRCS = sysdeps.o
|
|
|
|
# sources shared between iscsid, iscsiadm and iscsistart
|
2011-08-15 04:43:53 +00:00
|
|
|
-ISCSI_LIB_SRCS = netlink.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o dcb_app.o io.o auth.o discovery.o login.o log.o md5.o sha1.o iface.o idbm.o sysfs.o iscsi_sysfs.o iscsi_net_util.o iscsid_req.o
|
|
|
|
+ISCSI_LIB_SRCS = netlink.o uip_mgmt_ipc.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o dcb_app.o io.o auth.o discovery.o login.o log.o md5.o sha1.o iface.o idbm.o sysfs.o iscsi_sysfs.o iscsi_net_util.o iscsid_req.o
|
2011-02-01 04:58:53 +00:00
|
|
|
FW_PARAM_SRCS = fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_sysfs.o
|
2010-03-24 14:29:26 +00:00
|
|
|
|
2011-02-01 04:58:53 +00:00
|
|
|
# sources shared with the userspace utils, note we build these separately
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.c
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator.c 2011-08-14 16:49:44.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.c 2011-08-14 16:56:54.000000000 -0500
|
2010-01-15 11:53:18 +00:00
|
|
|
@@ -45,6 +45,7 @@
|
|
|
|
#include "iscsi_sysfs.h"
|
|
|
|
#include "iscsi_settings.h"
|
|
|
|
#include "iface.h"
|
|
|
|
+#include "host.h"
|
|
|
|
#include "sysdeps.h"
|
2011-02-01 04:58:53 +00:00
|
|
|
#include "iscsi_err.h"
|
|
|
|
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -557,6 +558,48 @@ static int iscsi_conn_connect(struct isc
|
2011-02-01 04:58:53 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void iscsi_uio_poll_login_timedout(void *data)
|
|
|
|
+{
|
|
|
|
+ struct queue_task *qtask = data;
|
|
|
|
+ struct iscsi_conn *conn = qtask->conn;
|
|
|
|
+ iscsi_session_t *session = conn->session;
|
|
|
|
+
|
|
|
|
+ log_debug(3, "timeout waiting for UIO ...\n");
|
|
|
|
+ mgmt_ipc_write_rsp(qtask, ISCSI_ERR_TRANS_TIMEOUT);
|
|
|
|
+ conn_delete_timers(conn);
|
|
|
|
+ __session_destroy(session);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int iscsi_sched_uio_poll(queue_task_t *qtask)
|
|
|
|
+{
|
|
|
|
+ struct iscsi_conn *conn = qtask->conn;
|
|
|
|
+ struct iscsi_session *session = conn->session;
|
|
|
|
+ struct iscsi_transport *t = session->t;
|
|
|
|
+ struct iscsi_ev_context *ev_context;
|
|
|
|
+
|
|
|
|
+ if (!t->template->set_net_config)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ ev_context = iscsi_ev_context_get(conn, 0);
|
|
|
|
+ if (!ev_context) {
|
|
|
|
+ /* while reopening the recv pool should be full */
|
|
|
|
+ log_error("BUG: __session_conn_reopen could "
|
|
|
|
+ "not get conn context for recv.");
|
|
|
|
+ return ENOMEM;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ev_context->data = qtask;
|
2011-08-15 04:43:53 +00:00
|
|
|
+ conn->state = ISCSI_CONN_STATE_XPT_WAIT;
|
2011-02-01 04:58:53 +00:00
|
|
|
+
|
|
|
|
+ iscsi_sched_ev_context(ev_context, conn, 0, EV_UIO_POLL);
|
|
|
|
+
|
|
|
|
+ log_debug(3, "Setting login UIO poll timer %p timeout %d",
|
|
|
|
+ &conn->login_timer, conn->login_timeout);
|
|
|
|
+ actor_timer(&conn->login_timer, conn->login_timeout * 1000,
|
|
|
|
+ iscsi_uio_poll_login_timedout, qtask);
|
|
|
|
+ return EAGAIN;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static void
|
|
|
|
__session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop,
|
|
|
|
int redirected)
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -598,6 +641,11 @@ __session_conn_reopen(iscsi_conn_t *conn
|
2011-02-01 04:58:53 +00:00
|
|
|
if (!redirected)
|
|
|
|
session->reopen_cnt++;
|
|
|
|
|
|
|
|
+ /* uIP will needs to be re-triggered on the connection re-open */
|
|
|
|
+ if (iscsi_set_net_config(conn->session->t, conn->session,
|
|
|
|
+ &conn->session->nrec.iface) != 0)
|
|
|
|
+ goto queue_reopen;
|
|
|
|
+
|
|
|
|
if (iscsi_conn_connect(conn, qtask)) {
|
|
|
|
delay = ISCSI_CONN_ERR_REOPEN_DELAY;
|
|
|
|
goto queue_reopen;
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -1659,6 +1707,53 @@ failed_login:
|
|
|
|
|
2011-02-01 04:58:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+static void session_conn_uio_poll(void *data)
|
|
|
|
+{
|
|
|
|
+ struct iscsi_ev_context *ev_context = data;
|
|
|
|
+ iscsi_conn_t *conn = ev_context->conn;
|
|
|
|
+ struct iscsi_session *session = conn->session;
|
|
|
|
+ queue_task_t *qtask = ev_context->data;
|
|
|
|
+ int rc;
|
|
|
|
+
|
|
|
|
+ log_debug(4, "retrying uio poll");
|
|
|
|
+ rc = iscsi_set_net_config(session->t, session,
|
|
|
|
+ &conn->session->nrec.iface);
|
|
|
|
+ if (rc != 0) {
|
|
|
|
+ if (rc == ISCSI_ERR_AGAIN) {
|
|
|
|
+ ev_context->data = qtask;
|
|
|
|
+ iscsi_sched_ev_context(ev_context, conn, 2,
|
|
|
|
+ EV_UIO_POLL);
|
|
|
|
+ return;
|
|
|
|
+ } else {
|
|
|
|
+ log_error("session_conn_uio_poll() "
|
|
|
|
+ "connection failure [0x%x]", rc);
|
|
|
|
+ actor_delete(&conn->login_timer);
|
|
|
|
+ iscsi_login_eh(conn, qtask, ISCSI_ERR_INTERNAL);
|
|
|
|
+ iscsi_ev_context_put(ev_context);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ iscsi_ev_context_put(ev_context);
|
|
|
|
+ actor_delete(&conn->login_timer);
|
|
|
|
+ log_debug(4, "UIO ready trying connect");
|
|
|
|
+
|
|
|
|
+ /* uIP is ready try to connect */
|
|
|
|
+ if (gettimeofday(&conn->initial_connect_time, NULL))
|
|
|
|
+ log_error("Could not get initial connect time. If "
|
|
|
|
+ "login errors iscsid may give up the initial "
|
|
|
|
+ "login early. You should manually login.");
|
|
|
|
+
|
2011-08-15 04:43:53 +00:00
|
|
|
+ conn->state = ISCSI_CONN_STATE_XPT_WAIT;
|
2011-02-01 04:58:53 +00:00
|
|
|
+ if (iscsi_conn_connect(conn, qtask)) {
|
|
|
|
+ int delay = ISCSI_CONN_ERR_REOPEN_DELAY;
|
|
|
|
+
|
|
|
|
+ log_debug(4, "Waiting %u seconds before trying to reconnect.\n",
|
|
|
|
+ delay);
|
|
|
|
+ queue_delayed_reopen(qtask, delay);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
|
|
|
|
struct iscsi_conn *conn, unsigned long tmo,
|
|
|
|
int event)
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -1700,6 +1795,11 @@ static int iscsi_sched_ev_context(struct
|
2011-02-01 04:58:53 +00:00
|
|
|
ev_context);
|
|
|
|
actor_schedule(&ev_context->actor);
|
|
|
|
break;
|
|
|
|
+ case EV_UIO_POLL:
|
|
|
|
+ actor_new(&ev_context->actor, session_conn_uio_poll,
|
|
|
|
+ ev_context);
|
|
|
|
+ actor_schedule(&ev_context->actor);
|
|
|
|
+ break;
|
|
|
|
case EV_CONN_LOGOUT_TIMER:
|
|
|
|
actor_timer(&ev_context->actor, tmo * 1000,
|
|
|
|
iscsi_logout_timedout, ev_context);
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -1833,7 +1933,17 @@ session_login_task(node_rec_t *rec, queu
|
2011-02-01 04:58:53 +00:00
|
|
|
conn = &session->conn[0];
|
|
|
|
qtask->conn = conn;
|
2010-01-15 11:53:18 +00:00
|
|
|
|
2011-02-01 04:58:53 +00:00
|
|
|
- if (iscsi_host_set_net_params(&rec->iface, session)) {
|
|
|
|
+ rc = iscsi_host_set_net_params(&rec->iface, session);
|
|
|
|
+ if (rc == ISCSI_ERR_AGAIN) {
|
|
|
|
+ iscsi_sched_uio_poll(qtask);
|
|
|
|
+ /*
|
|
|
|
+ * Cannot block iscsid, so caller is going to internally
|
|
|
|
+ * retry the operation.
|
|
|
|
+ */
|
|
|
|
+ qtask->rsp.command = MGMT_IPC_SESSION_LOGIN;
|
|
|
|
+ qtask->rsp.err = ISCSI_SUCCESS;
|
|
|
|
+ return ISCSI_SUCCESS;
|
|
|
|
+ } else if (rc) {
|
|
|
|
__session_destroy(session);
|
|
|
|
return ISCSI_ERR_LOGIN;
|
|
|
|
}
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -1990,6 +2100,7 @@ iscsi_host_send_targets(queue_task_t *qt
|
2011-02-01 04:58:53 +00:00
|
|
|
struct sockaddr_storage *ss)
|
|
|
|
{
|
|
|
|
struct iscsi_transport *t;
|
|
|
|
+ int rc;
|
|
|
|
|
|
|
|
t = iscsi_sysfs_get_transport_by_hba(host_no);
|
|
|
|
if (!t) {
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator_common.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator_common.c
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator_common.c 2011-08-14 16:49:44.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator_common.c 2011-08-14 16:56:54.000000000 -0500
|
|
|
|
@@ -561,6 +561,36 @@ TODO handle this
|
2010-01-15 11:53:18 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-02-01 04:58:53 +00:00
|
|
|
+int iscsi_set_net_config(struct iscsi_transport *t, iscsi_session_t *session,
|
|
|
|
+ struct iface_rec *iface)
|
2010-01-15 11:53:18 +00:00
|
|
|
+{
|
|
|
|
+ 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;
|
|
|
|
+}
|
|
|
|
+
|
2011-02-01 04:58:53 +00:00
|
|
|
int iscsi_host_set_net_params(struct iface_rec *iface,
|
|
|
|
struct iscsi_session *session)
|
|
|
|
{
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -582,6 +612,10 @@ int iscsi_host_set_net_params(struct ifa
|
2010-01-15 11:53:18 +00:00
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
2011-02-01 04:58:53 +00:00
|
|
|
+ rc = iscsi_set_net_config(t, session, iface);
|
2010-01-15 11:53:18 +00:00
|
|
|
+ if (rc != 0)
|
|
|
|
+ return rc;
|
|
|
|
+
|
2011-02-01 04:58:53 +00:00
|
|
|
rc = host_set_param(t, session->hostno,
|
|
|
|
ISCSI_HOST_PARAM_IPADDRESS,
|
|
|
|
iface->ipaddress, ISCSI_STRING);
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.h
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/initiator.h 2011-08-14 16:49:44.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/initiator.h 2011-08-14 16:58:14.000000000 -0500
|
|
|
|
@@ -83,6 +83,7 @@ typedef enum iscsi_event_e {
|
2011-02-01 04:58:53 +00:00
|
|
|
EV_CONN_LOGOUT_TIMER,
|
|
|
|
EV_CONN_STOP,
|
2011-08-15 04:43:53 +00:00
|
|
|
EV_CONN_LOGIN,
|
2011-02-01 04:58:53 +00:00
|
|
|
+ EV_UIO_POLL,
|
|
|
|
} iscsi_event_e;
|
|
|
|
|
|
|
|
struct queue_task;
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -353,5 +354,8 @@ extern void iscsi_copy_operational_param
|
2011-02-01 04:58:53 +00:00
|
|
|
extern int iscsi_setup_authentication(struct iscsi_session *session,
|
|
|
|
struct iscsi_auth_config *auth_cfg);
|
|
|
|
extern int iscsi_setup_portal(struct iscsi_conn *conn, char *address, int port);
|
|
|
|
+extern int iscsi_set_net_config(struct iscsi_transport *t,
|
|
|
|
+ iscsi_session_t *session,
|
|
|
|
+ struct iface_rec *iface);
|
|
|
|
|
|
|
|
#endif /* INITIATOR_H */
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsid_req.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsid_req.c
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsid_req.c 2011-08-14 16:49:44.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsid_req.c 2011-08-14 16:56:54.000000000 -0500
|
2010-03-24 14:29:26 +00:00
|
|
|
@@ -22,6 +22,7 @@
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
+#include <fcntl.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
2011-02-01 04:58:53 +00:00
|
|
|
@@ -32,6 +33,7 @@
|
2010-03-24 14:29:26 +00:00
|
|
|
#include "iscsi_util.h"
|
|
|
|
#include "config.h"
|
2011-02-01 04:58:53 +00:00
|
|
|
#include "iscsi_err.h"
|
2010-03-24 14:29:26 +00:00
|
|
|
+#include "uip_mgmt_ipc.h"
|
|
|
|
|
|
|
|
static void iscsid_startup(void)
|
|
|
|
{
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -54,7 +56,7 @@ static void iscsid_startup(void)
|
2010-03-24 14:29:26 +00:00
|
|
|
|
|
|
|
#define MAXSLEEP 128
|
|
|
|
|
2011-02-01 04:58:53 +00:00
|
|
|
-static int iscsid_connect(int *fd, int start_iscsid)
|
|
|
|
+static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid)
|
2010-03-24 14:29:26 +00:00
|
|
|
{
|
|
|
|
int nsec;
|
|
|
|
struct sockaddr_un addr;
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -67,8 +69,8 @@ static int iscsid_connect(int *fd, int s
|
2010-03-24 14:29:26 +00:00
|
|
|
|
|
|
|
memset(&addr, 0, sizeof(addr));
|
|
|
|
addr.sun_family = AF_LOCAL;
|
|
|
|
- memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE,
|
|
|
|
- strlen(ISCSIADM_NAMESPACE));
|
|
|
|
+ memcpy((char *) &addr.sun_path + 1, unix_sock_name,
|
|
|
|
+ strlen(unix_sock_name));
|
|
|
|
/*
|
|
|
|
* Trying to connect with exponential backoff
|
|
|
|
*/
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -96,6 +98,11 @@ static int iscsid_connect(int *fd, int s
|
2011-02-01 04:58:53 +00:00
|
|
|
return ISCSI_ERR_ISCSID_NOTCONN;
|
2010-03-24 14:29:26 +00:00
|
|
|
}
|
|
|
|
|
2011-02-01 04:58:53 +00:00
|
|
|
+static int iscsid_connect(int *fd, int start_iscsid)
|
2010-03-24 14:29:26 +00:00
|
|
|
+{
|
2011-02-01 04:58:53 +00:00
|
|
|
+ return ipc_connect(fd, ISCSIADM_NAMESPACE, start_iscsid);
|
2010-03-24 14:29:26 +00:00
|
|
|
+}
|
|
|
|
+
|
2011-02-01 04:58:53 +00:00
|
|
|
int iscsid_request(int *fd, iscsiadm_req_t *req, int start_iscsid)
|
2010-03-24 14:29:26 +00:00
|
|
|
{
|
|
|
|
int err;
|
2011-08-15 04:43:53 +00:00
|
|
|
@@ -192,3 +199,81 @@ int iscsid_req_by_sid(iscsiadm_cmd_e cmd
|
2011-02-01 04:58:53 +00:00
|
|
|
return err;
|
2010-03-24 14:29:26 +00:00
|
|
|
return iscsid_req_wait(cmd, fd);
|
|
|
|
}
|
2011-02-01 04:58:53 +00:00
|
|
|
+
|
|
|
|
+static int uip_connect(int *fd)
|
2010-03-24 14:29:26 +00:00
|
|
|
+{
|
|
|
|
+ return ipc_connect(fd, ISCSID_UIP_NAMESPACE, 0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int uip_broadcast(void *buf, size_t buf_len)
|
|
|
|
+{
|
|
|
|
+ int err;
|
|
|
|
+ int fd;
|
|
|
|
+ iscsid_uip_rsp_t rsp;
|
|
|
|
+ int flags;
|
|
|
|
+ int count;
|
|
|
|
+
|
|
|
|
+ err = uip_connect(&fd);
|
|
|
|
+ if (err) {
|
|
|
|
+ log_warning("uIP daemon is not up");
|
|
|
|
+ return err;
|
|
|
|
+ }
|
|
|
|
+
|
2011-02-01 04:58:53 +00:00
|
|
|
+ log_debug(3, "connected to uIP daemon");
|
|
|
|
+
|
2010-03-24 14:29:26 +00:00
|
|
|
+ /* Send the data to uIP */
|
|
|
|
+ if ((err = write(fd, buf, buf_len)) != buf_len) {
|
|
|
|
+ log_error("got write error (%d/%d), daemon died?",
|
2011-02-01 04:58:53 +00:00
|
|
|
+ err, errno);
|
2010-03-24 14:29:26 +00:00
|
|
|
+ close(fd);
|
2011-02-01 04:58:53 +00:00
|
|
|
+ return ISCSI_ERR_ISCSID_COMM_ERR;
|
2010-03-24 14:29:26 +00:00
|
|
|
+ }
|
|
|
|
+
|
2011-02-01 04:58:53 +00:00
|
|
|
+ log_debug(3, "send iface config to uIP daemon");
|
|
|
|
+
|
2010-03-24 14:29:26 +00:00
|
|
|
+ /* Set the socket to a non-blocking read, this way if there are
|
|
|
|
+ * problems waiting for uIP, iscsid can bailout early */
|
|
|
|
+ flags = fcntl(fd, F_GETFL, 0);
|
|
|
|
+ if (flags == -1)
|
2011-02-01 04:58:53 +00:00
|
|
|
+ flags = 0;
|
2010-03-24 14:29:26 +00:00
|
|
|
+ err = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
|
|
|
+ if(err != 0) {
|
|
|
|
+ log_error("could not set uip broadcast to non-blocking: %d",
|
|
|
|
+ errno);
|
|
|
|
+ close(fd);
|
2011-02-01 04:58:53 +00:00
|
|
|
+ return ISCSI_ERR;
|
2010-03-24 14:29:26 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+#define MAX_UIP_BROADCAST_READ_TRIES 3
|
|
|
|
+ for(count = 0; count < MAX_UIP_BROADCAST_READ_TRIES; count++) {
|
|
|
|
+ /* Wait for the response */
|
|
|
|
+ err = read(fd, &rsp, sizeof(rsp));
|
|
|
|
+ if (err == sizeof(rsp)) {
|
2011-02-01 04:58:53 +00:00
|
|
|
+ log_debug(3, "Broadcasted to uIP with length: %ld "
|
|
|
|
+ "cmd: 0x%x rsp: 0x%x\n", buf_len,
|
|
|
|
+ rsp.command, rsp.err);
|
|
|
|
+ err = 0;
|
2010-03-24 14:29:26 +00:00
|
|
|
+ break;
|
|
|
|
+ } else if((err == -1) && (errno == EAGAIN)) {
|
|
|
|
+ usleep(250000);
|
|
|
|
+ continue;
|
|
|
|
+ } else {
|
|
|
|
+ log_error("Could not read response (%d/%d), daemon died?",
|
|
|
|
+ err, errno);
|
2011-02-01 04:58:53 +00:00
|
|
|
+ err = ISCSI_ERR;
|
2010-03-24 14:29:26 +00:00
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2011-02-01 04:58:53 +00:00
|
|
|
+ if (count == MAX_UIP_BROADCAST_READ_TRIES) {
|
|
|
|
+ log_error("Could not broadcast to uIP after %d tries",
|
|
|
|
+ count);
|
|
|
|
+ err = ISCSI_ERR_AGAIN;
|
|
|
|
+ } else if (rsp.err != ISCISD_UIP_MGMT_IPC_DEVICE_UP) {
|
|
|
|
+ log_debug(3, "Device is not ready\n");
|
|
|
|
+ err = ISCSI_ERR_AGAIN;
|
|
|
|
+ }
|
2010-03-24 14:29:26 +00:00
|
|
|
+
|
|
|
|
+ close(fd);
|
2011-02-01 04:58:53 +00:00
|
|
|
+ return err;
|
2010-03-24 14:29:26 +00:00
|
|
|
+}
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsid_req.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsid_req.h
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsid_req.h 2011-08-14 16:49:44.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsid_req.h 2011-08-14 16:56:54.000000000 -0500
|
2011-02-01 04:58:53 +00:00
|
|
|
@@ -33,4 +33,6 @@ extern int iscsid_req_by_rec(int cmd, st
|
2010-03-24 14:29:26 +00:00
|
|
|
extern int iscsid_req_by_sid_async(int cmd, int sid, int *fd);
|
|
|
|
extern int iscsid_req_by_sid(int cmd, int sid);
|
2010-01-15 11:53:18 +00:00
|
|
|
|
2010-03-24 14:29:26 +00:00
|
|
|
+extern int uip_broadcast(void *buf, size_t buf_len);
|
|
|
|
+
|
|
|
|
#endif
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsi_err.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsi_err.c
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/iscsi_err.c 2011-08-14 16:49:44.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/iscsi_err.c 2011-08-14 16:56:54.000000000 -0500
|
2011-02-01 04:58:53 +00:00
|
|
|
@@ -49,6 +49,7 @@ static char *iscsi_err_msgs[] = {
|
|
|
|
/* 24 */ "iSCSI login failed due to authorization failure",
|
|
|
|
/* 25 */ "iSNS query failed",
|
|
|
|
/* 26 */ "iSNS registration failed",
|
|
|
|
+ /* 27 */ "Retryable failure",
|
|
|
|
};
|
|
|
|
|
|
|
|
char *iscsi_err_to_str(int err)
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/Makefile open-iscsi-2.0-872-rc4-bnx2i.build/usr/Makefile
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/Makefile 2011-08-14 16:55:23.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/Makefile 2011-08-14 16:58:57.000000000 -0500
|
|
|
|
@@ -42,7 +42,8 @@ SYSDEPS_SRCS = $(wildcard ../utils/sysde
|
2011-02-01 04:58:53 +00:00
|
|
|
ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o iscsi_timer.o login.o log.o md5.o \
|
|
|
|
sha1.o iface.o idbm.o sysfs.o host.o session_info.o iscsi_sysfs.o \
|
|
|
|
iscsi_net_util.o iscsid_req.o transport.o cxgbi.o be2iscsi.o \
|
2011-08-15 04:43:53 +00:00
|
|
|
- initiator_common.o iscsi_err.o $(IPC_OBJ) $(SYSDEPS_SRCS) $(DCB_OBJ)
|
|
|
|
+ initiator_common.o iscsi_err.o uip_mgmt_ipc.o \
|
|
|
|
+ $(IPC_OBJ) $(SYSDEPS_SRCS) $(DCB_OBJ)
|
2011-02-01 04:58:53 +00:00
|
|
|
# core initiator files
|
|
|
|
INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o
|
|
|
|
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/transport.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/transport.c
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/transport.c 2011-08-14 16:49:44.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/transport.c 2011-08-14 16:56:54.000000000 -0500
|
2010-01-15 11:53:18 +00:00
|
|
|
@@ -25,6 +25,7 @@
|
|
|
|
#include "log.h"
|
2010-03-24 14:29:26 +00:00
|
|
|
#include "iscsi_util.h"
|
2010-01-15 11:53:18 +00:00
|
|
|
#include "iscsi_sysfs.h"
|
|
|
|
+#include "uip_mgmt_ipc.h"
|
2011-02-01 04:58:53 +00:00
|
|
|
#include "cxgbi.h"
|
2010-01-15 11:53:18 +00:00
|
|
|
#include "be2iscsi.h"
|
|
|
|
|
2011-02-01 04:58:53 +00:00
|
|
|
@@ -67,6 +68,7 @@ struct iscsi_transport_template bnx2i =
|
2010-01-15 11:53:18 +00:00
|
|
|
.ep_connect = ktransport_ep_connect,
|
|
|
|
.ep_poll = ktransport_ep_poll,
|
|
|
|
.ep_disconnect = ktransport_ep_disconnect,
|
|
|
|
+ .set_net_config = uip_broadcast_params,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct iscsi_transport_template be2iscsi = {
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/transport.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/transport.h
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/transport.h 2011-08-14 16:49:34.000000000 -0500
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/transport.h 2011-08-14 16:56:54.000000000 -0500
|
2010-01-15 11:53:18 +00:00
|
|
|
@@ -35,6 +35,9 @@ struct iscsi_transport_template {
|
|
|
|
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
|
|
|
|
void (*ep_disconnect) (struct iscsi_conn *conn);
|
|
|
|
void (*create_conn) (struct iscsi_conn *conn);
|
|
|
|
+ int (*set_net_config) (struct iscsi_transport *t,
|
|
|
|
+ struct iface_rec *iface,
|
|
|
|
+ struct iscsi_session *session);
|
|
|
|
};
|
|
|
|
|
|
|
|
/* represents data path provider */
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/uip_mgmt_ipc.c open-iscsi-2.0-872-rc4-bnx2i.build/usr/uip_mgmt_ipc.c
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/uip_mgmt_ipc.c 1969-12-31 18:00:00.000000000 -0600
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/uip_mgmt_ipc.c 2011-08-14 16:56:54.000000000 -0500
|
2010-01-15 11:53:18 +00:00
|
|
|
@@ -0,0 +1,41 @@
|
|
|
|
+/*
|
|
|
|
+ * uIP iSCSI Daemon/Admin Management IPC
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
|
|
+ * it under the terms of the GNU General Public License as published
|
|
|
|
+ * by the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ * (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * This program is distributed in the hope that it will be useful, but
|
|
|
|
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
+ * General Public License for more details.
|
|
|
|
+ *
|
|
|
|
+ * See the file COPYING included with this distribution for more details.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <string.h>
|
|
|
|
+
|
|
|
|
+#include "log.h"
|
|
|
|
+#include "uip_mgmt_ipc.h"
|
2010-03-24 14:29:26 +00:00
|
|
|
+#include "iscsid_req.h"
|
2010-01-15 11:53:18 +00:00
|
|
|
+
|
|
|
|
+int uip_broadcast_params(struct iscsi_transport *t,
|
|
|
|
+ struct iface_rec *iface,
|
|
|
|
+ struct iscsi_session *session)
|
|
|
|
+{
|
|
|
|
+ struct iscsid_uip_broadcast broadcast;
|
|
|
|
+
|
|
|
|
+ log_debug(3, "broadcasting to uip\n");
|
|
|
|
+
|
|
|
|
+ memset(&broadcast, 0, sizeof(broadcast));
|
|
|
|
+
|
|
|
|
+ broadcast.header.command = ISCSID_UIP_IPC_GET_IFACE;
|
|
|
|
+ broadcast.header.payload_len = sizeof(*iface);
|
|
|
|
+
|
|
|
|
+ memcpy(&broadcast.u.iface_rec, iface, sizeof(*iface));
|
|
|
|
+
|
|
|
|
+ return uip_broadcast(&broadcast,
|
|
|
|
+ sizeof(iscsid_uip_broadcast_header_t) +
|
|
|
|
+ sizeof(*iface));
|
|
|
|
+}
|
2011-08-15 04:43:53 +00:00
|
|
|
diff -Naurp open-iscsi-2.0-872-rc4-bnx2i.base/usr/uip_mgmt_ipc.h open-iscsi-2.0-872-rc4-bnx2i.build/usr/uip_mgmt_ipc.h
|
|
|
|
--- open-iscsi-2.0-872-rc4-bnx2i.base/usr/uip_mgmt_ipc.h 1969-12-31 18:00:00.000000000 -0600
|
|
|
|
+++ open-iscsi-2.0-872-rc4-bnx2i.build/usr/uip_mgmt_ipc.h 2011-08-14 16:56:54.000000000 -0500
|
2011-02-01 04:58:53 +00:00
|
|
|
@@ -0,0 +1,73 @@
|
2010-01-15 11:53:18 +00:00
|
|
|
+/*
|
|
|
|
+ * uIP iSCSI Daemon/Admin Management IPC
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
|
|
+ * it under the terms of the GNU General Public License as published
|
|
|
|
+ * by the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ * (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * This program is distributed in the hope that it will be useful, but
|
|
|
|
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
+ * General Public License for more details.
|
|
|
|
+ *
|
|
|
|
+ * See the file COPYING included with this distribution for more details.
|
|
|
|
+ */
|
|
|
|
+#ifndef UIP_MGMT_IPC_H
|
|
|
|
+#define UIP_MGMT_IPC_H
|
|
|
|
+
|
|
|
|
+#include "types.h"
|
|
|
|
+#include "iscsi_if.h"
|
|
|
|
+#include "config.h"
|
|
|
|
+#include "mgmt_ipc.h"
|
|
|
|
+
|
|
|
|
+#include "initiator.h"
|
|
|
|
+#include "transport.h"
|
|
|
|
+
|
|
|
|
+#define ISCSID_UIP_NAMESPACE "ISCSID_UIP_ABSTRACT_NAMESPACE"
|
|
|
|
+
|
|
|
|
+typedef enum iscsid_uip_cmd {
|
|
|
|
+ ISCSID_UIP_IPC_UNKNOWN = 0,
|
|
|
|
+ ISCSID_UIP_IPC_GET_IFACE = 1,
|
|
|
|
+
|
|
|
|
+ __ISCSID_UIP_IPC_MAX_COMMAND
|
|
|
|
+} iscsid_uip_cmd_e;
|
|
|
|
+
|
|
|
|
+typedef struct iscsid_uip_broadcast_header {
|
|
|
|
+ iscsid_uip_cmd_e command;
|
|
|
|
+ uint32_t payload_len;
|
|
|
|
+} iscsid_uip_broadcast_header_t;
|
|
|
|
+
|
|
|
|
+/* IPC Request */
|
|
|
|
+typedef struct iscsid_uip_broadcast {
|
|
|
|
+ struct iscsid_uip_broadcast_header header;
|
|
|
|
+
|
|
|
|
+ union {
|
|
|
|
+ /* messages */
|
|
|
|
+ struct ipc_broadcast_iface_rec {
|
|
|
|
+ struct iface_rec rec;
|
|
|
|
+ } iface_rec;
|
|
|
|
+ } u;
|
|
|
|
+} iscsid_uip_broadcast_t;
|
|
|
|
+
|
|
|
|
+typedef enum iscsid_uip_mgmt_ipc_err {
|
|
|
|
+ ISCSID_UIP_MGMT_IPC_OK = 0,
|
|
|
|
+ ISCISD_UIP_MGMT_IPC_ERR = 1,
|
|
|
|
+ ISCISD_UIP_MGMT_IPC_ERR_NOT_FOUND = 2,
|
|
|
|
+ ISCISD_UIP_MGMT_IPC_ERR_NOMEM = 3,
|
2011-02-01 04:58:53 +00:00
|
|
|
+ ISCISD_UIP_MGMT_IPC_DEVICE_UP = 4,
|
|
|
|
+ ISCISD_UIP_MGMT_IPC_DEVICE_INITIALIZING = 5,
|
2010-01-15 11:53:18 +00:00
|
|
|
+} iscsid_uip_mgmt_ipc_err_e;
|
|
|
|
+
|
|
|
|
+/* IPC Response */
|
|
|
|
+typedef struct iscsid_uip_mgmt_rsp {
|
|
|
|
+ iscsid_uip_cmd_e command;
|
|
|
|
+ iscsid_uip_mgmt_ipc_err_e err;
|
|
|
|
+} iscsid_uip_rsp_t;
|
|
|
|
+
|
|
|
|
+extern int uip_broadcast_params(struct iscsi_transport *t,
|
|
|
|
+ struct iface_rec *iface,
|
|
|
|
+ struct iscsi_session *session);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#endif /* UIP_MGMT_IPC_H */
|