From owner-svn-src-head@FreeBSD.ORG Wed Apr 2 23:11:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5FB08B1C; Wed, 2 Apr 2014 23:11:58 +0000 (UTC) Received: from mail-we0-x236.google.com (mail-we0-x236.google.com [IPv6:2a00:1450:400c:c03::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D3FE95B; Wed, 2 Apr 2014 23:11:57 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id p61so984206wes.13 for ; Wed, 02 Apr 2014 16:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=SS/iYsBzKJZH7vy237F7kG1q31XOI5gzUwBzKM32pi8=; b=W4o7JDJs41OMYAGxIjL/pwcobYPIV0QR0mgCO8auAyxmIjD2Kt1PXKg/mrf+k84B/C RfIefUm8Q3SRBuQwT+2qzUlPAQ05J7xGTt2EOOFDM/t03mX8r4kgtOhSzPs/sFTGYH6z LHIs8vhODgw7FBX1J/vQpC6adyzm7YUsVucq1INjcN9eUBxWQ9ZZJVeOyL/0eC2zK81i 03ajdZqjrd+C6WhJ9zGjjhhtzAlCoCt3MYiy8XwF5b8iK/FNCNoCS2brjmpTVXvirz5G GGacwSPVavnyWArtV+lwy7ffPziCw65efSzrDYPqtb9kuhYBVZK68ekc70fgarY+x4c4 D7Fw== X-Received: by 10.180.12.233 with SMTP id b9mr31796580wic.8.1396480315853; Wed, 02 Apr 2014 16:11:55 -0700 (PDT) Received: from strashydlo.home (adbf227.neoplus.adsl.tpnet.pl. [79.184.5.227]) by mx.google.com with ESMTPSA id u1sm7722490eex.31.2014.04.02.16.11.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Apr 2014 16:11:55 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Subject: Re: svn commit: r264025 - head/sys/dev/iscsi Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-2 From: =?iso-8859-2?Q?Edward_Tomasz_Napiera=B3a?= In-Reply-To: <1396445055.81853.233.camel@revolution.hippie.lan> Date: Thu, 3 Apr 2014 01:11:54 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201404012203.s31M34Gr007384@svn.freebsd.org> <1396445055.81853.233.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Apr 2014 23:11:58 -0000 Wiadomo=B6=E6 napisana przez Ian Lepore w dniu 2 kwi 2014, o godz. = 15:24: > On Tue, 2014-04-01 at 22:03 +0000, Edward Tomasz Napierala wrote: >> Author: trasz >> Date: Tue Apr 1 22:03:03 2014 >> New Revision: 264025 >> URL: http://svnweb.freebsd.org/changeset/base/264025 >>=20 >> Log: >> Get rid of the "autoscaling", instead just set socket buffer sizes >> in the usual way. The only thing the old code did was making things >> less predictable. >>=20 >> Sponsored by: The FreeBSD Foundation >>=20 >> Modified: >> head/sys/dev/iscsi/icl.c >>=20 >> Modified: head/sys/dev/iscsi/icl.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/dev/iscsi/icl.c Tue Apr 1 21:54:20 2014 = (r264024) >> +++ head/sys/dev/iscsi/icl.c Tue Apr 1 22:03:03 2014 = (r264025) >> @@ -68,6 +68,14 @@ TUNABLE_INT("kern.icl.partial_receive_le >> SYSCTL_INT(_kern_icl, OID_AUTO, partial_receive_len, CTLFLAG_RW, >> &partial_receive_len, 1 * 1024, "Minimum read size for partially = received " >> "data segment"); >> +static int sendspace =3D 1048576; >> +TUNABLE_INT("kern.icl.sendspace", &sendspace); >> +SYSCTL_INT(_kern_icl, OID_AUTO, sendspace, CTLFLAG_RW, >> + &sendspace, 1048576, "Default send socket buffer size"); >> +static int recvspace =3D 1048576; >> +TUNABLE_INT("kern.icl.recvspace", &recvspace); >> +SYSCTL_INT(_kern_icl, OID_AUTO, recvspace, CTLFLAG_RW, >> + &recvspace, 1048576, "Default receive socket buffer size"); >>=20 >> static uma_zone_t icl_conn_zone; >> static uma_zone_t icl_pdu_zone; >> @@ -1008,7 +1016,7 @@ icl_conn_free(struct icl_conn *ic) >> static int >> icl_conn_start(struct icl_conn *ic) >> { >> - size_t bufsize; >> + size_t minspace; >> struct sockopt opt; >> int error, one =3D 1; >>=20 >> @@ -1029,18 +1037,28 @@ icl_conn_start(struct icl_conn *ic) >> ICL_CONN_UNLOCK(ic); >>=20 >> /* >> - * Use max available sockbuf size for sending. Do it manually >> - * instead of sbreserve(9) to work around resource limits. >> + * For sendspace, this is required because the current code = cannot >> + * send a PDU in pieces; thus, the minimum buffer size is equal >> + * to the maximum PDU size. "+4" is to account for possible = padding. >> * >> - * XXX: This kind of sucks. On one hand, we don't currently = support >> - * sending a part of data segment; we always do it in one = piece, >> - * so we have to make sure it can fit in the socket buffer. >> - * Once I've implemented partial send, we'll get rid of = this >> - * and use autoscaling. >> + * What we should actually do here is to use autoscaling, but = set >> + * some minimal buffer size to "minspace". I don't know a way = to do >> + * that, though. >> */ >> - bufsize =3D (sizeof(struct iscsi_bhs) + >> - ic->ic_max_data_segment_length) * 8; >> - error =3D soreserve(ic->ic_socket, bufsize, bufsize); >> + minspace =3D sizeof(struct iscsi_bhs) + = ic->ic_max_data_segment_length + >> + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE + 4; >> + if (sendspace < minspace) { >> + ICL_WARN("kern.icl.sendspace too low; must be at least = %jd", >> + minspace); >> + sendspace =3D minspace; >> + } >> + if (recvspace < minspace) { >> + ICL_WARN("kern.icl.recvspace too low; must be at least = %jd", >> + minspace); >> + recvspace =3D minspace; >> + } >> + >=20 > The %jd on these is causing build failures on 32-bit arches due to > size_t being only 32 bits. Right. Should be fixed now, sorry for breakage.