From owner-svn-src-head@freebsd.org Sat Jul 4 03:28:14 2020 Return-Path: Delivered-To: svn-src-head@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 00E09360614; Sat, 4 Jul 2020 03:28:14 +0000 (UTC) (envelope-from rmacklem@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zHNF6DfJz45r0; Sat, 4 Jul 2020 03:28:13 +0000 (UTC) (envelope-from rmacklem@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B929A1638B; Sat, 4 Jul 2020 03:28:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0643SDlO015991; Sat, 4 Jul 2020 03:28:13 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0643SD5O015990; Sat, 4 Jul 2020 03:28:13 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202007040328.0643SD5O015990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 4 Jul 2020 03:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362917 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 362917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 04 Jul 2020 03:28:14 -0000 Author: rmacklem Date: Sat Jul 4 03:28:13 2020 New Revision: 362917 URL: https://svnweb.freebsd.org/changeset/base/362917 Log: Add support for ext_pgs mbufs to nfscl_reqstart() and nfsm_set(). This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Modified: head/sys/fs/nfs/nfs_commonsubs.c Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Sat Jul 4 03:27:51 2020 (r362916) +++ head/sys/fs/nfs/nfs_commonsubs.c Sat Jul 4 03:28:13 2020 (r362917) @@ -359,13 +359,19 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum, /* * Get the first mbuf for the request. */ - if (nfs_bigrequest[procnum]) - NFSMCLGET(mb, M_WAITOK); - else - NFSMGET(mb); - mb->m_len = 0; - nd->nd_mreq = nd->nd_mb = mb; - nd->nd_bpos = mtod(mb, char *); + if ((nd->nd_flag & ND_EXTPG) != 0) { + mb = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); + nd->nd_mreq = nd->nd_mb = mb; + nfsm_set(nd, 0); + } else { + if (nfs_bigrequest[procnum]) + NFSMCLGET(mb, M_WAITOK); + else + NFSMGET(mb); + mb->m_len = 0; + nd->nd_mreq = nd->nd_mb = mb; + nd->nd_bpos = mtod(mb, char *); + } /* * And fill the first file handle into the request. @@ -4804,7 +4810,38 @@ void nfsm_set(struct nfsrv_descript *nd, u_int offs) { struct mbuf *m; + int rlen; m = nd->nd_mb; - nd->nd_bpos = mtod(m, char *) + offs; + if ((m->m_flags & M_EXTPG) != 0) { + nd->nd_bextpg = 0; + while (offs > 0) { + if (nd->nd_bextpg == 0) + rlen = m_epg_pagelen(m, 0, m->m_epg_1st_off); + else + rlen = m_epg_pagelen(m, nd->nd_bextpg, 0); + if (offs <= rlen) + break; + offs -= rlen; + nd->nd_bextpg++; + if (nd->nd_bextpg == m->m_epg_npgs) { + printf("nfsm_set: build offs " + "out of range\n"); + nd->nd_bextpg--; + break; + } + } + nd->nd_bpos = (char *)(void *) + PHYS_TO_DMAP(m->m_epg_pa[nd->nd_bextpg]); + if (nd->nd_bextpg == 0) + nd->nd_bpos += m->m_epg_1st_off; + if (offs > 0) { + nd->nd_bpos += offs; + nd->nd_bextpgsiz = rlen - offs; + } else if (nd->nd_bextpg == 0) + nd->nd_bextpgsiz = PAGE_SIZE - m->m_epg_1st_off; + else + nd->nd_bextpgsiz = PAGE_SIZE; + } else + nd->nd_bpos = mtod(m, char *) + offs; }