[Stgt-devel] [PATCH 14/20] iser transport mxdsl

Pete Wyckoff pw
Tue Oct 16 17:21:23 CEST 2007


The RDMA transport chooses the size for data-in and data-out
transfers, as these operations are not visible to the initiator.
MaxXmitDataSegmentLength applies only to control-type PDUs, not
to RDMA data transfers.  Add a per-connection parameter to hold
the data transfer size chosen by the transport, with the proper
default for TCP.

Signed-off-by: Pete Wyckoff <pw at osc.edu>
---
 usr/iscsi/conn.c   |    2 ++
 usr/iscsi/iscsid.c |   16 ++++++++++------
 usr/iscsi/iscsid.h |    1 +
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/usr/iscsi/conn.c b/usr/iscsi/conn.c
index 9b0c3b9..b1d3937 100644
--- a/usr/iscsi/conn.c
+++ b/usr/iscsi/conn.c
@@ -65,6 +65,8 @@ struct iscsi_connection *conn_alloc(unsigned int trans_len)
 	conn->refcount = 1;
 	conn->state = STATE_FREE;
 	param_set_defaults(conn->session_param, session_keys);
+	conn->data_inout_max_size =
+		conn->session_param[ISCSI_PARAM_MAX_XMIT_DLENGTH].val;
 
 	INIT_LIST_HEAD(&conn->clist);
 	INIT_LIST_HEAD(&conn->tx_clist);
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 0d7ad43..8b7b48e 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -474,6 +474,10 @@ static void login_finish(struct iscsi_connection *conn)
 
 	switch (conn->session_type) {
 	case SESSION_NORMAL:
+		/* update based on negotiations (but conn_init can override) */
+		conn->data_inout_max_size =
+			conn->session_param[ISCSI_PARAM_MAX_XMIT_DLENGTH].val;
+
 		/*
 		 * Allocate transport resources for this connection.
 		 */
@@ -916,7 +920,6 @@ static int iscsi_data_rsp_build(struct iscsi_task *task)
 	struct iscsi_connection *conn = task->conn;
 	struct iscsi_data_rsp *rsp = (struct iscsi_data_rsp *) &conn->rsp.bhs;
 	int datalen;
-	int max_burst = conn->session_param[ISCSI_PARAM_MAX_XMIT_DLENGTH].val;
 
 	memset(rsp, 0, sizeof(*rsp));
 	rsp->opcode = ISCSI_OP_SCSI_DATA_IN;
@@ -929,9 +932,10 @@ static int iscsi_data_rsp_build(struct iscsi_task *task)
 	datalen = min_t(uint32_t, task->read_len, task->len);
 	datalen -= task->offset;
 
-	dprintf("%d %d %d %d %x\n", datalen, task->read_len, task->len, max_burst, rsp->itt);
+	dprintf("%d %d %d %d %x\n", datalen, task->read_len, task->len,
+		conn->data_inout_max_size, rsp->itt);
 
-	if (datalen <= max_burst) {
+	if (datalen <= conn->data_inout_max_size) {
 		rsp->flags = ISCSI_FLAG_CMD_FINAL;
 
 		/* collapse status into final packet if successful */
@@ -942,7 +946,7 @@ static int iscsi_data_rsp_build(struct iscsi_task *task)
 			calc_residual((struct iscsi_cmd_rsp *) rsp, task);
 		}
 	} else
-		datalen = max_burst;
+		datalen = conn->data_inout_max_size;
 
 	rsp->exp_cmdsn = cpu_to_be32(conn->session->exp_cmd_sn);
 	rsp->max_cmdsn = cpu_to_be32(conn->session->exp_cmd_sn + MAX_QUEUE_CMD);
@@ -961,7 +965,7 @@ static int iscsi_r2t_build(struct iscsi_task *task)
 {
 	struct iscsi_connection *conn = task->conn;
 	struct iscsi_r2t_rsp *rsp = (struct iscsi_r2t_rsp *) &conn->rsp.bhs;
-	int length, max_burst = conn->session_param[ISCSI_PARAM_MAX_XMIT_DLENGTH].val;
+	int length;
 
 	memset(rsp, 0, sizeof(*rsp));
 
@@ -973,7 +977,7 @@ static int iscsi_r2t_build(struct iscsi_task *task)
 	rsp->r2tsn = cpu_to_be32(task->exp_r2tsn++);
 	rsp->data_offset = cpu_to_be32(task->offset);
 	rsp->ttt = (unsigned long) task;
-	length = min(task->r2t_count, max_burst);
+	length = min(task->r2t_count, conn->data_inout_max_size);
 	rsp->data_length = cpu_to_be32(length);
 
 	return 0;
diff --git a/usr/iscsi/iscsid.h b/usr/iscsi/iscsid.h
index 915c47d..c1fab67 100644
--- a/usr/iscsi/iscsid.h
+++ b/usr/iscsi/iscsid.h
@@ -141,6 +141,7 @@ struct iscsi_connection {
 
 	int tid;
 	struct param session_param[ISCSI_PARAM_MAX];
+	int data_inout_max_size;
 
 	char *initiator;
 	uint8_t isid[6];
-- 
1.5.3.4




More information about the stgt mailing list