[Stgt-devel] [PATCH 14/18] iser transport mxdsl
Pete Wyckoff
pw
Tue Sep 4 22:11:03 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 | 17 +++++++++++------
usr/iscsi/iscsid.h | 1 +
3 files changed, 14 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 bf613f4..f72073b 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -478,6 +478,11 @@ static void login_finish(struct iscsi_connection *conn)
/* use spec default if he did not mention MRDSL */
conn->session_param[ISCSI_PARAM_MAX_XMIT_DLENGTH].val =
session_keys[ISCSI_PARAM_MAX_XMIT_DLENGTH].def;
+
+ /* 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.
*/
@@ -920,7 +925,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;
@@ -933,9 +937,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 */
@@ -946,7 +951,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);
@@ -965,7 +970,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));
@@ -977,7 +982,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 8ef141a..99b8448 100644
--- a/usr/iscsi/iscsid.h
+++ b/usr/iscsi/iscsid.h
@@ -142,6 +142,7 @@ struct iscsi_connection {
int tid;
struct param session_param[ISCSI_PARAM_MAX];
int mxdsl_negotiated;
+ int data_inout_max_size;
char *initiator;
uint8_t isid[6];
--
1.5.2.5
More information about the stgt
mailing list