aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2017-02-17 05:22:58 +0000
committerAlexander Motin <mav@FreeBSD.org>2017-02-17 05:22:58 +0000
commit7a465c285fb94b892496ed14ac331f45944f420c (patch)
treedcd22df66e2478dddc399d05eef8a5ddd2b6e4b3
parentafa39f7a32c9b2d6003b06fda5c4fc21ab199747 (diff)
downloadsrc-7a465c285fb94b892496ed14ac331f45944f420c.tar.gz
src-7a465c285fb94b892496ed14ac331f45944f420c.zip
Change the way MaxCmdSN is used.
Before this change MaxCmdSN was reported as CmdSN + delta, that made it limit number of requests in transmission from the initiator to target, that was pretty useless. After this change MaxCmdSN limits number of requests queued to CTL, i.e. maximal queue depth for the initiator. The default limit is 256 outstanding requests per initiator at a time. This code uses existing cs_outstanding_ctl_pdus counter to track queue depth. It's semantics doen't perfectly match, but close enough to not add another counter. Just don't set the maxtags below 2. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=313854
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 0992fdb1352c..c91d52d65962 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -95,10 +95,9 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, ping_timeout, CTLFLAG_RWTUN,
static int login_timeout = 60;
SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, login_timeout, CTLFLAG_RWTUN,
&login_timeout, 60, "Time to wait for ctld(8) to finish Login Phase, in seconds");
-static int maxcmdsn_delta = 256;
-SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxcmdsn_delta, CTLFLAG_RWTUN,
- &maxcmdsn_delta, 256, "Number of commands the initiator can send "
- "without confirmation");
+static int maxtags = 256;
+SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxtags, CTLFLAG_RWTUN,
+ &maxtags, 0, "Max number of requests queued by initiator");
#define CFISCSI_DEBUG(X, ...) \
do { \
@@ -244,7 +243,7 @@ cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request)
* outside of this range.
*/
if (ISCSI_SNLT(cmdsn, cs->cs_cmdsn) ||
- ISCSI_SNGT(cmdsn, cs->cs_cmdsn + maxcmdsn_delta)) {
+ ISCSI_SNGT(cmdsn, cs->cs_cmdsn - 1 + maxtags)) {
CFISCSI_SESSION_UNLOCK(cs);
CFISCSI_SESSION_WARN(cs, "received PDU with CmdSN %u, "
"while expected %u", cmdsn, cs->cs_cmdsn);
@@ -399,7 +398,8 @@ cfiscsi_pdu_prepare(struct icl_pdu *response)
(bhssr->bhssr_flags & BHSDI_FLAGS_S))
bhssr->bhssr_statsn = htonl(cs->cs_statsn);
bhssr->bhssr_expcmdsn = htonl(cs->cs_cmdsn);
- bhssr->bhssr_maxcmdsn = htonl(cs->cs_cmdsn + maxcmdsn_delta);
+ bhssr->bhssr_maxcmdsn = htonl(cs->cs_cmdsn - 1 +
+ imax(0, maxtags - cs->cs_outstanding_ctl_pdus));
if (advance_statsn)
cs->cs_statsn++;