aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2012-09-30 00:47:16 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-10-02 16:17:30 -0400
commite004cb25927ad7a67c109ac13e1d2e5e378430dd (patch)
tree230c12934d68535a6725ab70617a5c7296cda258 /drivers/target
parentb32f4c7ed85c5cee2a21a55c9f59ebc9d57a2463 (diff)
iscsi-target: Add base MaxXmitDataSegmentLength code
This patch introduces a new per connection MaxXmitDataSegmentLength parameter value used to represent the outgoing MaxRecvDataSegmentLength that is actually sent over the wire during iSCSI login response back to the initiator side. It also adds a new MaxXmitDataSegmentLength configfs attribute to represent this value within the existing TPG parameter group under /sys/kernel/config/target/iscsi/$TARGETNAME/$TPGT/param/ Cc: Mike Christie <michaelc@cs.wisc.edu> Cc: Andy Grover <agrover@redhat.com> Cc: Hannes Reinecke <hare@suse.de> Cc: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target_configfs.c4
-rw-r--r--drivers/target/iscsi/iscsi_target_core.h1
-rw-r--r--drivers/target/iscsi/iscsi_target_parameters.c21
-rw-r--r--drivers/target/iscsi/iscsi_target_parameters.h5
4 files changed, 31 insertions, 0 deletions
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index f86833fcf33c..f491f969ab95 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1034,6 +1034,9 @@ TPG_PARAM_ATTR(ImmediateData, S_IRUGO | S_IWUSR);
1034DEF_TPG_PARAM(MaxRecvDataSegmentLength); 1034DEF_TPG_PARAM(MaxRecvDataSegmentLength);
1035TPG_PARAM_ATTR(MaxRecvDataSegmentLength, S_IRUGO | S_IWUSR); 1035TPG_PARAM_ATTR(MaxRecvDataSegmentLength, S_IRUGO | S_IWUSR);
1036 1036
1037DEF_TPG_PARAM(MaxXmitDataSegmentLength);
1038TPG_PARAM_ATTR(MaxXmitDataSegmentLength, S_IRUGO | S_IWUSR);
1039
1037DEF_TPG_PARAM(MaxBurstLength); 1040DEF_TPG_PARAM(MaxBurstLength);
1038TPG_PARAM_ATTR(MaxBurstLength, S_IRUGO | S_IWUSR); 1041TPG_PARAM_ATTR(MaxBurstLength, S_IRUGO | S_IWUSR);
1039 1042
@@ -1079,6 +1082,7 @@ static struct configfs_attribute *lio_target_tpg_param_attrs[] = {
1079 &iscsi_tpg_param_InitialR2T.attr, 1082 &iscsi_tpg_param_InitialR2T.attr,
1080 &iscsi_tpg_param_ImmediateData.attr, 1083 &iscsi_tpg_param_ImmediateData.attr,
1081 &iscsi_tpg_param_MaxRecvDataSegmentLength.attr, 1084 &iscsi_tpg_param_MaxRecvDataSegmentLength.attr,
1085 &iscsi_tpg_param_MaxXmitDataSegmentLength.attr,
1082 &iscsi_tpg_param_MaxBurstLength.attr, 1086 &iscsi_tpg_param_MaxBurstLength.attr,
1083 &iscsi_tpg_param_FirstBurstLength.attr, 1087 &iscsi_tpg_param_FirstBurstLength.attr,
1084 &iscsi_tpg_param_DefaultTime2Wait.attr, 1088 &iscsi_tpg_param_DefaultTime2Wait.attr,
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
index 8a908b28d8b2..b26611aa5ff3 100644
--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -239,6 +239,7 @@ struct iscsi_conn_ops {
239 u8 HeaderDigest; /* [0,1] == [None,CRC32C] */ 239 u8 HeaderDigest; /* [0,1] == [None,CRC32C] */
240 u8 DataDigest; /* [0,1] == [None,CRC32C] */ 240 u8 DataDigest; /* [0,1] == [None,CRC32C] */
241 u32 MaxRecvDataSegmentLength; /* [512..2**24-1] */ 241 u32 MaxRecvDataSegmentLength; /* [512..2**24-1] */
242 u32 MaxXmitDataSegmentLength; /* [512..2**24-1] */
242 u8 OFMarker; /* [0,1] == [No,Yes] */ 243 u8 OFMarker; /* [0,1] == [No,Yes] */
243 u8 IFMarker; /* [0,1] == [No,Yes] */ 244 u8 IFMarker; /* [0,1] == [No,Yes] */
244 u32 OFMarkInt; /* [1..65535] */ 245 u32 OFMarkInt; /* [1..65535] */
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
index 0c4760fabfc0..40864ee70302 100644
--- a/drivers/target/iscsi/iscsi_target_parameters.c
+++ b/drivers/target/iscsi/iscsi_target_parameters.c
@@ -334,6 +334,13 @@ int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr)
334 if (!param) 334 if (!param)
335 goto out; 335 goto out;
336 336
337 param = iscsi_set_default_param(pl, MAXXMITDATASEGMENTLENGTH,
338 INITIAL_MAXXMITDATASEGMENTLENGTH,
339 PHASE_OPERATIONAL, SCOPE_CONNECTION_ONLY, SENDER_BOTH,
340 TYPERANGE_512_TO_16777215, USE_ALL);
341 if (!param)
342 goto out;
343
337 param = iscsi_set_default_param(pl, MAXRECVDATASEGMENTLENGTH, 344 param = iscsi_set_default_param(pl, MAXRECVDATASEGMENTLENGTH,
338 INITIAL_MAXRECVDATASEGMENTLENGTH, 345 INITIAL_MAXRECVDATASEGMENTLENGTH,
339 PHASE_OPERATIONAL, SCOPE_CONNECTION_ONLY, SENDER_BOTH, 346 PHASE_OPERATIONAL, SCOPE_CONNECTION_ONLY, SENDER_BOTH,
@@ -467,6 +474,8 @@ int iscsi_set_keys_to_negotiate(
467 SET_PSTATE_NEGOTIATE(param); 474 SET_PSTATE_NEGOTIATE(param);
468 } else if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) { 475 } else if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) {
469 SET_PSTATE_NEGOTIATE(param); 476 SET_PSTATE_NEGOTIATE(param);
477 } else if (!strcmp(param->name, MAXXMITDATASEGMENTLENGTH)) {
478 continue;
470 } else if (!strcmp(param->name, MAXBURSTLENGTH)) { 479 } else if (!strcmp(param->name, MAXBURSTLENGTH)) {
471 SET_PSTATE_NEGOTIATE(param); 480 SET_PSTATE_NEGOTIATE(param);
472 } else if (!strcmp(param->name, FIRSTBURSTLENGTH)) { 481 } else if (!strcmp(param->name, FIRSTBURSTLENGTH)) {
@@ -1720,6 +1729,18 @@ void iscsi_set_connection_parameters(
1720 pr_debug("---------------------------------------------------" 1729 pr_debug("---------------------------------------------------"
1721 "---------------\n"); 1730 "---------------\n");
1722 list_for_each_entry(param, &param_list->param_list, p_list) { 1731 list_for_each_entry(param, &param_list->param_list, p_list) {
1732 /*
1733 * Special case to set MAXXMITDATASEGMENTLENGTH from the
1734 * target requested MaxRecvDataSegmentLength, even though
1735 * this key is not sent over the wire.
1736 */
1737 if (!strcmp(param->name, MAXXMITDATASEGMENTLENGTH)) {
1738 ops->MaxXmitDataSegmentLength =
1739 simple_strtoul(param->value, &tmpptr, 0);
1740 pr_debug("MaxXmitDataSegmentLength: %s\n",
1741 param->value);
1742 }
1743
1723 if (!IS_PSTATE_ACCEPTOR(param) && !IS_PSTATE_PROPOSER(param)) 1744 if (!IS_PSTATE_ACCEPTOR(param) && !IS_PSTATE_PROPOSER(param))
1724 continue; 1745 continue;
1725 if (!strcmp(param->name, AUTHMETHOD)) { 1746 if (!strcmp(param->name, AUTHMETHOD)) {
diff --git a/drivers/target/iscsi/iscsi_target_parameters.h b/drivers/target/iscsi/iscsi_target_parameters.h
index 6a37fd6f1285..77a28b589d56 100644
--- a/drivers/target/iscsi/iscsi_target_parameters.h
+++ b/drivers/target/iscsi/iscsi_target_parameters.h
@@ -70,6 +70,7 @@ extern void iscsi_set_session_parameters(struct iscsi_sess_ops *,
70#define INITIALR2T "InitialR2T" 70#define INITIALR2T "InitialR2T"
71#define IMMEDIATEDATA "ImmediateData" 71#define IMMEDIATEDATA "ImmediateData"
72#define MAXRECVDATASEGMENTLENGTH "MaxRecvDataSegmentLength" 72#define MAXRECVDATASEGMENTLENGTH "MaxRecvDataSegmentLength"
73#define MAXXMITDATASEGMENTLENGTH "MaxXmitDataSegmentLength"
73#define MAXBURSTLENGTH "MaxBurstLength" 74#define MAXBURSTLENGTH "MaxBurstLength"
74#define FIRSTBURSTLENGTH "FirstBurstLength" 75#define FIRSTBURSTLENGTH "FirstBurstLength"
75#define DEFAULTTIME2WAIT "DefaultTime2Wait" 76#define DEFAULTTIME2WAIT "DefaultTime2Wait"
@@ -113,6 +114,10 @@ extern void iscsi_set_session_parameters(struct iscsi_sess_ops *,
113#define INITIAL_INITIALR2T YES 114#define INITIAL_INITIALR2T YES
114#define INITIAL_IMMEDIATEDATA YES 115#define INITIAL_IMMEDIATEDATA YES
115#define INITIAL_MAXRECVDATASEGMENTLENGTH "8192" 116#define INITIAL_MAXRECVDATASEGMENTLENGTH "8192"
117/*
118 * Match outgoing MXDSL default to incoming Open-iSCSI default
119 */
120#define INITIAL_MAXXMITDATASEGMENTLENGTH "262144"
116#define INITIAL_MAXBURSTLENGTH "262144" 121#define INITIAL_MAXBURSTLENGTH "262144"
117#define INITIAL_FIRSTBURSTLENGTH "65536" 122#define INITIAL_FIRSTBURSTLENGTH "65536"
118#define INITIAL_DEFAULTTIME2WAIT "2" 123#define INITIAL_DEFAULTTIME2WAIT "2"