[stgt] [PATCH 4/4] iser, new implementation

Alexander Nezhinsky alexandern at Voltaire.COM
Wed Oct 13 15:32:12 CEST 2010


Signed-off-by: Alexander Nezhinsky <alexandern at voltaire.com>
---
 usr/Makefile       |    6 +++---
 usr/iscsi/iscsid.c |   10 +++++++++-
 usr/iscsi/iscsid.h |    6 ++++++
 usr/list.h         |    3 +++
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/usr/Makefile b/usr/Makefile
index 322ecfb..484d3f2 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -15,9 +15,9 @@ TGTD_OBJS += $(addprefix iscsi/, conn.o param.o session.o \
 		isns.o)
 TGTD_OBJS += bs_rdwr.o bs_aio.o
 
-ifneq ($(ISCSI_RDMA),)
-CFLAGS += -DISCSI_RDMA
-TGTD_OBJS += iscsi/iscsi_rdma.o
+ifneq ($(ISER),)
+CFLAGS += -DISER
+TGTD_OBJS += iscsi/iser.o iscsi/iser_text.o
 LIBS += -libverbs -lrdmacm
 endif
 
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 3a79d93..dfed360 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -488,6 +488,14 @@ static void login_start(struct iscsi_connection *conn)
 			conn->state = STATE_EXIT;
 			return;
 		}
+		if (target->rdma) {
+			eprintf("Target %s is RDMA, but conn cid:%d from %s is TCP\n",
+				target_name, conn->cid, conn->initiator);
+			rsp->status_class = ISCSI_STATUS_CLS_INITIATOR_ERR;
+			rsp->status_detail = ISCSI_LOGIN_STATUS_TGT_NOT_FOUND;
+			conn->state = STATE_EXIT;
+			return;
+		}
 
 		conn->tid = target->tid;
 
@@ -2285,7 +2293,7 @@ out:
 	return ret;
 }
 
-static int iscsi_transportid(int tid, uint64_t itn_id, char *buf, int size)
+int iscsi_transportid(int tid, uint64_t itn_id, char *buf, int size)
 {
 	struct iscsi_session *session;
 	char *p;
diff --git a/usr/iscsi/iscsid.h b/usr/iscsi/iscsid.h
index 2a7a3f8..be585bb 100644
--- a/usr/iscsi/iscsid.h
+++ b/usr/iscsi/iscsid.h
@@ -214,6 +214,9 @@ struct iscsi_connection {
 #define STATE_CLOSE		10
 #define STATE_EXIT		11
 #define STATE_SCSI		12
+#define STATE_INIT		13
+#define STATE_START		14
+#define STATE_READY		15
 
 #define AUTH_STATE_START	0
 #define AUTH_STATE_CHALLENGE	1
@@ -254,6 +257,8 @@ struct iscsi_target {
 	} redirect_info;
 
 	struct list_head isns_list;
+
+	int rdma;
 };
 
 enum task_flags {
@@ -296,6 +301,7 @@ extern void conn_read_pdu(struct iscsi_connection *conn);
 extern int iscsi_tx_handler(struct iscsi_connection *conn);
 extern void iscsi_rx_handler(struct iscsi_connection *conn);
 extern int iscsi_scsi_cmd_execute(struct iscsi_task *task);
+extern int iscsi_transportid(int tid, uint64_t itn_id, char *buf, int size);
 
 /* iscsid.c iscsi_task */
 extern void iscsi_free_task(struct iscsi_task *task);
diff --git a/usr/list.h b/usr/list.h
index f66ff36..2f80a56 100644
--- a/usr/list.h
+++ b/usr/list.h
@@ -43,6 +43,9 @@ static inline int list_empty(const struct list_head *head)
 #define list_for_each(pos, head) \
 	for (pos = (head)->next; pos != (head); pos = pos->next)
 
+#define list_for_each_prev(pos, head) \
+	for (pos = (head)->prev; pos != (head); pos = pos->prev)
+
 #define list_for_each_entry(pos, head, member)				\
 	for (pos = list_entry((head)->next, typeof(*pos), member);	\
 	     &pos->member != (head);				 	\
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list