From owner-dev-commits-src-branches@freebsd.org Wed Jul 14 20:48:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32EF5656141; Wed, 14 Jul 2021 20:48:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQ8jv0zwMz4Ssd; Wed, 14 Jul 2021 20:48:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A2F71C7C7; Wed, 14 Jul 2021 20:48:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16EKmola074238; Wed, 14 Jul 2021 20:48:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16EKmol3074237; Wed, 14 Jul 2021 20:48:50 GMT (envelope-from git) Date: Wed, 14 Jul 2021 20:48:50 GMT Message-Id: <202107142048.16EKmol3074237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: cd2e5ae71bb1 - stable/13 - nfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cd2e5ae71bb1f283fba1d6dfd7aa63708ff1529f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 20:48:51 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=cd2e5ae71bb1f283fba1d6dfd7aa63708ff1529f commit cd2e5ae71bb1f283fba1d6dfd7aa63708ff1529f Author: Rick Macklem AuthorDate: 2021-06-30 22:15:41 +0000 Commit: Rick Macklem CommitDate: 2021-07-14 20:45:41 +0000 nfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message When the setting of kern.ipc.maxsockbuf is less than what is desired for I/O based on vfs.maxbcachebuf and vfs.nfs.bufpackets, a console message of "Consider increasing kern.ipc.maxsockbuf". is printed. This patch modifies the message to provide a suggested value for kern.ipc.maxsockbuf. Note that the setting is only needed when the NFS rsize/wsize is set to vfs.maxbcachebuf. While here, make nfs_bufpackets global, so that it can be used by a future patch that adds a sysctl to set the NFS server's maximum I/O size. Also, remove "sizeof(u_int32_t)" from the maximum packet length, since NFS_MAXXDR is already an "overestimate" of the actual length. (cherry picked from commit c5f4772c66d2eb31b84a84a89c8a284043f03452) --- sys/fs/nfs/nfs_commonkrpc.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 04ef04955ce0..63ff02331a0e 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -101,8 +101,8 @@ extern int nfscl_debuglevel; extern int nfsrv_lease; SVCPOOL *nfscbd_pool; +int nfs_bufpackets = 4; static int nfsrv_gsscallbackson = 0; -static int nfs_bufpackets = 4; static int nfs_reconnects; static int nfs3_jukebox_delay = 10; static int nfs_skip_wcc_data_onerr = 1; @@ -180,6 +180,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, struct thread *td = curthread; SVCXPRT *xprt; struct timeval timo; + uint64_t tval; /* * We need to establish the socket using the credentials of @@ -238,8 +239,21 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, do { if (error != 0 && pktscale > 2) { if (nmp != NULL && nrp->nr_sotype == SOCK_STREAM && - pktscale == pktscalesav) - printf("Consider increasing kern.ipc.maxsockbuf\n"); + pktscale == pktscalesav) { + /* + * Suggest vfs.nfs.bufpackets * maximum RPC message, + * adjusted for the sb_max->sb_max_adj conversion of + * MCLBYTES / (MSIZE + MCLBYTES) as the minimum setting + * for kern.ipc.maxsockbuf. + */ + tval = (NFS_MAXBSIZE + NFS_MAXXDR) * nfs_bufpackets; + tval *= MSIZE + MCLBYTES; + tval += MCLBYTES - 1; /* Round up divide by MCLBYTES. */ + tval /= MCLBYTES; + printf("Consider increasing kern.ipc.maxsockbuf to a " + "minimum of %ju to support %ubyte NFS I/O\n", + (uintmax_t)tval, NFS_MAXBSIZE); + } pktscale--; } if (nrp->nr_sotype == SOCK_DGRAM) { @@ -255,10 +269,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, if (nrp->nr_sotype != SOCK_STREAM) panic("nfscon sotype"); if (nmp != NULL) { - sndreserve = (NFS_MAXBSIZE + NFS_MAXXDR + - sizeof (u_int32_t)) * pktscale; - rcvreserve = (NFS_MAXBSIZE + NFS_MAXXDR + - sizeof (u_int32_t)) * pktscale; + sndreserve = (NFS_MAXBSIZE + NFS_MAXXDR) * + pktscale; + rcvreserve = (NFS_MAXBSIZE + NFS_MAXXDR) * + pktscale; } else { sndreserve = rcvreserve = 1024 * pktscale; }