From owner-svn-src-stable-11@freebsd.org Fri Mar 3 06:06:28 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8D66CF40FE; Fri, 3 Mar 2017 06:06:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0D401DAC; Fri, 3 Mar 2017 06:06:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2366Rlh006265; Fri, 3 Mar 2017 06:06:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2366Rkm006263; Fri, 3 Mar 2017 06:06:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703030606.v2366Rkm006263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 3 Mar 2017 06:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r314584 - in stable/11: share/man/man4 sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2017 06:06:28 -0000 Author: mav Date: Fri Mar 3 06:06:27 2017 New Revision: 314584 URL: https://svnweb.freebsd.org/changeset/base/314584 Log: MFC r313854, r313963: 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. Modified: stable/11/share/man/man4/ctl.4 stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/ctl.4 ============================================================================== --- stable/11/share/man/man4/ctl.4 Fri Mar 3 06:04:42 2017 (r314583) +++ stable/11/share/man/man4/ctl.4 Fri Mar 3 06:06:27 2017 (r314584) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 27, 2015 +.Dd January 19, 2017 .Dt CTL 4 .Os .Sh NAME @@ -158,10 +158,9 @@ Verbosity level for log messages from th Set to 0 to disable logging or 1 to warn about potential problems. Larger values enable debugging output. Defaults to 1. -.It Va kern.cam.ctl.iscsi.maxcmdsn_delta -The number of outstanding commands to advertise to the iSCSI initiator. -Technically, it is the difference between ExpCmdSN and MaxCmdSN fields -in the iSCSI PDU. +.It Va kern.cam.ctl.iscsi.maxtags +The number of outstanding commands to advertise to each iSCSI initiator. +Current implementation is not very accurate, so do not set this below 2. Defaults to 256. .It Va kern.cam.ctl.iscsi.ping_timeout The number of seconds to wait for the iSCSI initiator to respond to a NOP-In Modified: stable/11/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Fri Mar 3 06:04:42 2017 (r314583) +++ stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Fri Mar 3 06:06:27 2017 (r314584) @@ -95,10 +95,9 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO 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 ic * 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 *resp (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++;