From owner-dev-commits-src-all@freebsd.org Wed Jun 30 22:19:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A47F26515E9; Wed, 30 Jun 2021 22:19:30 +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 4GFbNy3x4yz4YqL; Wed, 30 Jun 2021 22:19:30 +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 6B16D14D45; Wed, 30 Jun 2021 22:19:30 +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 15UMJU2o080957; Wed, 30 Jun 2021 22:19:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15UMJU5j080956; Wed, 30 Jun 2021 22:19:30 GMT (envelope-from git) Date: Wed, 30 Jun 2021 22:19:30 GMT Message-Id: <202106302219.15UMJU5j080956@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: c5f4772c66d2 - main - 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/main X-Git-Reftype: branch X-Git-Commit: c5f4772c66d2eb31b84a84a89c8a284043f03452 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2021 22:19:30 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c5f4772c66d2eb31b84a84a89c8a284043f03452 commit c5f4772c66d2eb31b84a84a89c8a284043f03452 Author: Rick Macklem AuthorDate: 2021-06-30 22:15:41 +0000 Commit: Rick Macklem CommitDate: 2021-06-30 22:15: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. MFC after: 2 weeks --- 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; }