Blob Blame Raw
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/be2iscsi.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/be2iscsi.c
--- open-iscsi-2.0-872-rc1-bnx2i/usr/be2iscsi.c	2010-04-16 14:15:44.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/be2iscsi.c	2010-04-16 14:17:00.000000000 -0500
@@ -18,6 +18,9 @@
 
 void be2iscsi_create_conn(struct iscsi_conn *conn)
 {
+	struct iscsi_session *session = conn->session;
+	conn_rec_t *conn_rec = &session->nrec.conn[conn->id];
+
 	if (conn->max_recv_dlength > 65536)
 		conn->max_recv_dlength = 65536;
 
@@ -30,5 +33,9 @@ void be2iscsi_create_conn(struct iscsi_c
 	if (conn->max_xmit_dlength > 65536)
 		conn->max_xmit_dlength = 65536;
 
+	if (!conn_rec->iscsi.MaxXmitDataSegmentLength ||
+	    conn_rec->iscsi.MaxXmitDataSegmentLength > 65536)
+		conn_rec->iscsi.MaxXmitDataSegmentLength = 65536;
+
 	conn->session->erl = 0;
 }
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.c
--- open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.c	2010-04-16 14:16:30.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.c	2010-04-16 14:16:41.000000000 -0500
@@ -369,9 +369,10 @@ iscsi_copy_operational_params(iscsi_conn
 	/* zero indicates to use the target's value */
 	conn->max_xmit_dlength =
 			__padding(conn_rec->iscsi.MaxXmitDataSegmentLength);
-	if (conn->max_xmit_dlength != 0 &&
-	    (conn->max_xmit_dlength < ISCSI_MIN_MAX_RECV_SEG_LEN ||
-	     conn->max_xmit_dlength > ISCSI_MAX_MAX_RECV_SEG_LEN)) {
+	if (conn->max_xmit_dlength == 0)
+		conn->max_xmit_dlength = ISCSI_DEF_MAX_RECV_SEG_LEN;
+	if (conn->max_xmit_dlength < ISCSI_MIN_MAX_RECV_SEG_LEN ||
+	    conn->max_xmit_dlength > ISCSI_MAX_MAX_RECV_SEG_LEN) {
 		log_error("Invalid iscsi.MaxXmitDataSegmentLength. Must be "
 			 "within %u and %u. Setting to %u\n",
 			  ISCSI_MIN_MAX_RECV_SEG_LEN,
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/login.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/login.c
--- open-iscsi-2.0-872-rc1-bnx2i/usr/login.c	2010-04-16 14:16:30.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/login.c	2010-04-16 14:16:41.000000000 -0500
@@ -390,9 +390,14 @@ get_op_params_text_keys(iscsi_session_t 
 		if (session->type == ISCSI_SESSION_TYPE_DISCOVERY ||
 		    !session->t->template->rdma) {
 			int tgt_max_xmit;
+			conn_rec_t *conn_rec = &session->nrec.conn[cid];
 
 			tgt_max_xmit = strtoul(value, NULL, 0);
-			if (conn->max_xmit_dlength == 0 ||
+			/*
+			 * if the rec value is zero it means to use
+			 * what the target gave us.
+			 */
+			if (!conn_rec->iscsi.MaxXmitDataSegmentLength ||
 			    tgt_max_xmit < conn->max_xmit_dlength)
 				conn->max_xmit_dlength = tgt_max_xmit;
 		}