The changes in "retry login for ISCSI_ERR_HOST_NOT_FOUND" caused
sessions using the iscsi_tcp transport bound to a network iface to fail
to connect due to the host lookup failing (iscsi_tcp hosts are
dynamically allocated per-session).

This marks transports that use a host fixed to a hardware offload device
with "bind_ep_required" and only requires a host lookup before starting
the connection if this flag is set.

Signed-off-by: Chris Leech <cle...@redhat.com>
---
 usr/initiator.c | 30 ++++++++++++++++--------------
 usr/transport.c |  6 ++++++
 usr/transport.h |  1 +
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/usr/initiator.c b/usr/initiator.c
index b4b8957..9d02f47 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -398,20 +398,22 @@ __session_create(node_rec_t *rec, struct iscsi_transport 
*t, int *rc)
 
        iscsi_session_init_params(session);
 
-       hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, rc);
-       if (!*rc) {
-               /*
-                * if the netdev or mac was set, then we are going to want
-                * to want to bind the all the conns/eps to a specific host
-                * if offload is used.
-                */
-               session->conn[0].bind_ep = 1;
-               session->hostno = hostno;
-       } else if (*rc == ISCSI_ERR_HOST_NOT_FOUND) {
-               goto free_session;      
-       } else {
-                *rc = 0;
-       }
+        if (t->template->bind_ep_required) {
+                hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, rc);
+                if (!*rc) {
+                        /*
+                         * if the netdev or mac was set, then we are going to 
want
+                         * to want to bind the all the conns/eps to a specific 
host
+                         * if offload is used.
+                         */
+                        session->conn[0].bind_ep = 1;
+                        session->hostno = hostno;
+                } else if (*rc == ISCSI_ERR_HOST_NOT_FOUND) {
+                        goto free_session;     
+                } else {
+                         *rc = 0;
+                }
+        }
 
        list_add_tail(&session->list, &t->sessions);
        return session;
diff --git a/usr/transport.c b/usr/transport.c
index 630f163..e778a6e 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -59,6 +59,7 @@ struct iscsi_transport_template iscsi_iser = {
 struct iscsi_transport_template cxgb3i = {
        .name           = "cxgb3i",
        .set_host_ip    = SET_HOST_IP_OPT,
+        .bind_ep_required = 1,
        .ep_connect     = ktransport_ep_connect,
        .ep_poll        = ktransport_ep_poll,
        .ep_disconnect  = ktransport_ep_disconnect,
@@ -68,6 +69,7 @@ struct iscsi_transport_template cxgb3i = {
 struct iscsi_transport_template cxgb4i = {
        .name           = "cxgb4i",
        .set_host_ip    = SET_HOST_IP_NOT_REQ,
+        .bind_ep_required = 1,
        .ep_connect     = ktransport_ep_connect,
        .ep_poll        = ktransport_ep_poll,
        .ep_disconnect  = ktransport_ep_disconnect,
@@ -78,6 +80,7 @@ struct iscsi_transport_template bnx2i = {
        .name           = "bnx2i",
        .set_host_ip    = SET_HOST_IP_REQ,
        .use_boot_info  = 1,
+        .bind_ep_required = 1,
        .ep_connect     = ktransport_ep_connect,
        .ep_poll        = ktransport_ep_poll,
        .ep_disconnect  = ktransport_ep_disconnect,
@@ -86,6 +89,7 @@ struct iscsi_transport_template bnx2i = {
 
 struct iscsi_transport_template be2iscsi = {
        .name           = "be2iscsi",
+        .bind_ep_required = 1,
        .create_conn    = be2iscsi_create_conn,
        .ep_connect     = ktransport_ep_connect,
        .ep_poll        = ktransport_ep_poll,
@@ -95,6 +99,7 @@ struct iscsi_transport_template be2iscsi = {
 struct iscsi_transport_template qla4xxx = {
        .name           = "qla4xxx",
        .set_host_ip    = SET_HOST_IP_NOT_REQ,
+        .bind_ep_required = 1,
        .ep_connect     = ktransport_ep_connect,
        .ep_poll        = ktransport_ep_poll,
        .ep_disconnect  = ktransport_ep_disconnect,
@@ -102,6 +107,7 @@ struct iscsi_transport_template qla4xxx = {
 
 struct iscsi_transport_template ocs = {
        .name           = "ocs",
+        .bind_ep_required = 1,
        .ep_connect     = ktransport_ep_connect,
        .ep_poll        = ktransport_ep_poll,
        .ep_disconnect  = ktransport_ep_disconnect,
diff --git a/usr/transport.h b/usr/transport.h
index 73041fa..831403b 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -38,6 +38,7 @@ struct iscsi_transport_template {
         */
        uint8_t set_host_ip;
        uint8_t use_boot_info;
+        uint8_t bind_ep_required;
        int (*ep_connect) (struct iscsi_conn *conn, int non_blocking);
        int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
        void (*ep_disconnect) (struct iscsi_conn *conn);
-- 
2.1.0

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to